Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarification on insert(), delete(), retain() #44

Closed
jsamr opened this issue May 31, 2019 · 2 comments
Closed

Clarification on insert(), delete(), retain() #44

jsamr opened this issue May 31, 2019 · 2 comments

Comments

@jsamr
Copy link

jsamr commented May 31, 2019

I don't understand this extract from the official Quilljs website:

use the chainable insert(), delete(), and retain() methods to create new Deltas.

source: quilljs.com/docs/delta

Returns this for chainability.

source: github.com/quilljs/delta#insert

If this is returned, it's not a new instance. Hence, why the doc refers to new Deltas ?

@jhchen
Copy link
Member

jhchen commented Jun 1, 2019

The full text is

It is not recommended to construct Deltas by hand—rather use the chainable insert(), delete(), and retain() methods to create new Deltas.

The first part is important as it sets the context that the user is wanting to mold the Delta content to their desire, and to do that with these functions. It is not saying that the functions each individually literally return a new Delta instance.

@jhchen jhchen closed this as completed Jun 1, 2019
@jhchen jhchen changed the title The documentation is confusing Clarification on insert(), delete(), retain() Jun 1, 2019
@jsamr
Copy link
Author

jsamr commented Jun 1, 2019

@jhchen I did thought after reading this line these methods returned new instances in an immutable, stateless way, and I still believe it is somehow confusing. But anyway, great library, thanks for the job :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants