From f88d3220b527e4f0904dd37a96d8adbf632e1c19 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 9 Nov 2024 18:09:05 +0200 Subject: [PATCH] client: Repair attribute editor --- .../attribute_widgets/attribute_editor.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/public/app/widgets/attribute_widgets/attribute_editor.js b/src/public/app/widgets/attribute_widgets/attribute_editor.js index 5d33f57d7..e21afc073 100644 --- a/src/public/app/widgets/attribute_widgets/attribute_editor.js +++ b/src/public/app/widgets/attribute_widgets/attribute_editor.js @@ -341,6 +341,22 @@ export default class AttributeEditorWidget extends NoteContextAwareWidget { } async initEditor() { + await libraryLoader.requireLibrary(libraryLoader.CKEDITOR); + + this.$widget.show(); + + this.$editor.on("click", e => this.handleEditorClick(e)); + + this.textEditor = await CKEditor.BalloonEditor.create(this.$editor[0], editorConfig); + this.textEditor.model.document.on('change:data', () => this.dataChanged()); + this.textEditor.editing.view.document.on('enter', (event, data) => { + // disable entering new line - see https://github.com/ckeditor/ckeditor5/issues/9422 + data.preventDefault(); + event.stop(); + }, {priority: 'high'}); + + // disable spellcheck for attribute editor + this.textEditor.editing.view.change(writer => writer.setAttribute('spellcheck', 'false', this.textEditor.editing.view.document.getRoot())); } dataChanged() {