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
Expose quill parser format and blot classes #9860
Conversation
@bleistivt I support this, but probably in a more limited way. I don't think we want to open up wholesale replacing all formats, because it will result in fragile implementations as we add additional ones. I'd prefer to some implementation like the following: public function replaceFormat(string $newFormatClass, string $existingFormatClass) {
// Ensure the new format is subclass the old one. Otherwise throw an error.
// Replace our existing class definition and only that one if it exists.
}
public function removeFormat(string $existingFormatClass) {
// Replace our existing format class if it exists.
} I don't like the wholesale replacement access, because at some point in the near future we might have different sets of formats for different parts of the site, or for different permission levels. |
Codecov Report
@@ Coverage Diff @@
## master #9860 +/- ##
============================================
- Coverage 51.53% 51.52% -0.01%
Complexity 7907 7907
============================================
Files 357 357
Lines 43383 43391 +8
============================================
Hits 22357 22357
- Misses 21026 21034 +8
Continue to review full report at Codecov.
|
I implemented your suggestion for both format and blot classes. Is a subclass check really necessary? The class would have to be instantiated for this as far as I understand: |
@bleistivt From the PHP manual
There is a lot of specific logic in the blots that checks if things are a certain blot type. If you don't do the subclass check, then these would need to be identified and updated to go find the class instance that is registered here, instead of just using them directly. |
Thanks, I must've missed that. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
A use case for this recently came up here: https://open.vanillaforums.com/discussion/comment/262655#Comment_262655 |
I hit a roadblock, trying to modify a quill format like this:
This only lets me add a format to the end of the chain, which will then be wrapped in the old format I am actually trying to overwrite.
(I currently have to use reflection to do this instead.)
For real extensibility (e.g. setting the precedence as well), formatClasses and blotClasses would have to be exposed.