Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const createEditor = options => {
const {propertyDomNode, propertyName, editorOptions, globalRegistry, userPreferences, onChange} = options;
const ckEditorConfig = editorConfig.configRegistry.getCkeditorConfig({
editorOptions,
userPreferences,
globalRegistry,
propertyDomNode
});
DecoupledEditor
.create(propertyDomNode, ckEditorConfig)
.then(editor => {
editor.ui.focusTracker.on('change:isFocused', event => {
if (event.source.isFocused) {
currentEditor = editor;
editorConfig.setCurrentlyEditedPropertyName(propertyName);
}
});
// We attach all options for this editor to the editor DOM node, so it would be easier to access them from CKE plugins
editor.neos = options;
editor.model.document.on('change', () => handleUserInteractionCallback());
editor.model.document.on('change:data', debounce(() => onChange(cleanupContentBeforeCommit(editor.getData())), 500, {maxWait: 5000}));
}).catch(e => console.error(e));
};
constructor(settings) {
console.log("CKEditorImplementation");
super(settings);
// Initialize CKEditor 5 class
DecoupledEditor.create( this.domObject.firstElementChild, {
plugins: [
Alignment,
// Autosave,
Bold,
Essentials,
Font,
Heading,
Highlight,
// Image,
// ImageUpload,
Italic,
Link,
List,
Paragraph,
PasteFromOffice,
RemoveFormat,