initialize plugins before the formatters #822
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Plugins should be initialized before the formatters since they may wish to add or change formatting handlers and since the bbcode format caches its handlers, such changes must be done first.
One possible caveat is that the public API
sceditor.command
won't work as intended in plugin init—#686 works around this by duplicating some codeThat workaround seems kinda ugly to me, and will probably cause some undesired conflicts when running multiple editor instances on the same page. I haven't tested that, though.
Come to think of it,
sceditor.formats.bbcode
may also exhibit the same behavior due to what looks like shared memory access. I have not tested this either.I see more of what could lead to surprising results: methods that get pointers to iframe related objects return null, range helper also is null, but those can easily be worked around by waiting for the ready signal.