-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Documentation obfuscates Quill.import
usage, making it unclear e.g. how to import non-default exports
#2938
Comments
natevw
added a commit
to natevw/quill
that referenced
this issue
Feb 20, 2020
Make it more clear that `Quill.import` is just the read to `Quill.register`'s write, and that the relationship between Quill source code and an object's "path" is simply a convention. I wrote this assuming that `Quill.imports` is internal API but since it was already mentioned elsewhere in the public docs it seemed fitting to share a similar tip here.
Please try v2.0.0-rc.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The API documentation for Quill.import is misleading (emphasis mine):
And the example has a comment that using
Quill.import
is…No other discussion is provided regarding exceptions to the "in general". So when I needed to get a non-default export that exists inside the "Quill source code directory structure" at
blots/block
I guessed I would have to do something like…and the
Quill.import
internals would have set things up so that all the other exports would be exposed as properties on theBlock as default
value it returns. ButBlockEmbed
gets an undefined value; apparently not much similarity to ESimport
as claimed.Elsewhere in the documentation, I found a more helpful note:
So the secret is that
Quill.import
actually has very little to do with filesystem paths and ES module syntax, and a whole lot more to do with what calls toQuill.register
are made internally. Behold, in quill/core.js I found:As it turns out, my code should actually be:
It would have saved me significant time if the API documentation for
Quill.import()
itself had confessed the connection withQuill.register()
and ability to see whatQuill.imports
exist, instead of conveying the impression that it was more like the real ES moduleimport
.Related: #2659
The text was updated successfully, but these errors were encountered: