Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
createEditor: function() {
if (this.editorInitialized) {
return;
}
this.currentConfig = this.config || this.defaultConfig;
this.setContent(true);
// Bind editor events.
this.registerEvents();
this.initListeners();
this._editor = new FroalaEditor(this.$el, this.currentConfig)
this.editorInitialized = true;
},
this.element = this.el;
if (this.props.model) {
this.element.innerHTML = this.props.model;
}
this.setContent(true);
// Default initialized.
this.registerEvent('initialized', this.config.events && this.config.events.initialized);
// Check if events are set.
if (!this.config.events) this.config.events = {};
this.config.events.initialized = () => this.initListeners();
this.editor = new FroalaEditor(this.element, this.config);
// Call init events.
if (this._initEvents) {
for (let i = 0; i < this._initEvents.length; i++) {
this._initEvents[i].call(this.editor);
}
}
}
if (!this._opts.events) this._opts.events = {}
// Register initialized event.
this.registerEvent('initialized', this._opts.events && this._opts.events.initialized);
const existingInitCallback = this._opts.events.initialized;
// Default initialized event.
if (!this._opts.events.initialized || !this._opts.events.initialized.overridden) {
this._opts.events.initialized = () => {
this.initListeners();
existingInitCallback && existingInitCallback.call(this._editor, this);
};
this._opts.events.initialized.overridden = true;
}
// Initialize the Froala Editor.
this._editor = new FroalaEditor(
this._element,
this._opts
);
});
}
@action createEditor(element, [options]) {
new FroalaEditor(element, options);
}