-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Scope blot definitions to Quill instance instead of globally #1101
Comments
Why doesn't the |
This woks, partially - i cant define two formats with same name that does not override each other. E.x. i use default image format, then for some pages/editors i want to change images view, that requires image blot markup changes, so it's new blot. But already created content has this
and i cant define new blot |
I see. Yes a current limitation is blot names need to be globally unique. |
We're running into this same problem with many editors on the page, each with their own plugins. We may try to do a PR on this to add local instance formatters alongside global formatters. |
@artaommahe Here is PR we hope will address this issue. Interested to gather some perspective on its usability. slab/parchment#41 Update |
@jhchen @artaommahe Here is a working branch of Parchment matched with Quill branched off of version 2.0. I still have 44 tests failing. Could we start a conversation about merging this with branch 2.0? Any insight is much appreciated as I continue to refactor the last few tests. Parchment - https://github.com/zdizzle6717/parchment/tree/feature/scope-registry-to-quill-instance |
Down to 23 failing tests, but I'm really struggling to understand how getBounds() and the code format work. |
What is your approach / design this time? What other designs did you consider that you decided against in favor of this? |
This time the approach follows the initial recommendation. Rather than having a singleton registry at the modular level, this branch adds a class called EditorRegistry that can be instantiated along with each instance of Quill. Quill's constructor gets a third argument that defaults to a new instance of EditorRegistry. We gain the ability to mitigate different formats/blots/attributors among each editor. One example of this could be having an editor with a custom video blot and a secondary editor that restricts the use of that same custom video. The user can no longer copy/paste or load content which includes custom formats/blots/attributors unless both editors explicitly use the same EditorRegistry instance. We first considered cataloguing a different Registry for each editor and setting the active registry on focus. There were too many changes occurring in the background that happened even before focus or that occurred when an editor was inactive. Having the option to share one EditorRegistry among all editors or differentiate a new EditorRegistry per editor allows for more customization without overcomplicating the usability or creating redundant overhead. |
What are the proposed API changes and function signature changes/additions? |
With the proposed changes, Parchment and Quill are affected in the following ways. Parchment
Quill
...currently there are issues with the tests for |
Implementation and trying to pass tests is premature at this stage. To me this is still in the design vetting stage.
|
|
1 - I think what will happen with the current proposal is Quill will be initialized with no formats/blots registered 3 - This does not answer my question about why it is necessary to change the |
My mistake...I had pasted the wrong link to the Quill branch, so I updated the comment above. Here it is again for reference. 1 - On lines 35 and 38 of 3 - I made a mistake here. It looks like the find function is exported separately from the registry, so I will revert that change in both repositories. |
There is some use-cases with SPA when editor is used in several places that requires different formats usage. E.x. at one place i want to disable default images format and enable custom one, and vice versa at another.
Currently all formats registered globally for each quill instance, that forces to use uglyhacks like this
This way i forced to change current page quill instance formats set and also i dont know how to disable any format without replacing with dummy one. Also i cannot use two different instances at one page at the same time with different formatting - they will use one global set.
Removing format button from toolbar/elsewhere or registering new formats with other names does not solve this issue cause this formats will work with copy-pasted or added via setContents/dangerouslyPasteHTML content.
The text was updated successfully, but these errors were encountered: