N°5298 - Upgrade CKEditor to version 5 (#647)

This commit is contained in:
Benjamin Dalsass
2024-05-24 16:13:20 +02:00
committed by GitHub
parent 094a9ed82f
commit 9bf0addc9c
105 changed files with 1820 additions and 949 deletions

View File

@@ -0,0 +1,28 @@
import { Plugin } from '@ckeditor/ckeditor5-core';
import {ClassicEditor} from "@ckeditor/ckeditor5-editor-classic";
export default class UpdateInputOnChange extends Plugin {
static get pluginName() {
return 'UpdateInputOnChange';
}
init() {
// retrieve editor instance
const oEditor:ClassicEditor = this.editor as ClassicEditor;
if(oEditor.sourceElement !== undefined) {
const oInputElement = oEditor.sourceElement as HTMLInputElement;
// update input when data change
oEditor.model.document.on('change:data', (event) => {
oInputElement.value = oEditor.getData();
const oEvent = new Event('change');
oInputElement.dispatchEvent(oEvent);
});
}
}
}