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

Fix plugins initialization problems #686

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/lib/SCEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,14 +407,22 @@ export default function SCEditor(original, userOptions) {
isRequired = original.required;
original.required = false;

// Plugins should be initiated before the formatters since plugin
// may add/change the handlers and format init should create cache
// with those changes
initPlugins();

// Plugins might change the commands, should re-build it
base.commands = utils
.extend(true, {}, (userOptions.commands || defaultCommands));

var FormatCtor = SCEditor.formats[options.format];
format = FormatCtor ? new FormatCtor() : {};
if ('init' in format) {
format.init.call(base);
}

// create the editor
initPlugins();
initEmoticons();
initToolBar();
initEditor();
Expand Down