mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-25 19:48:49 +02:00
- remove fired event UPDATE in plugin update-input-on-change effect: alert dialog on portal when adding image known impact: validation on portal not triggered on textarea modification
32 lines
970 B
TypeScript
32 lines
970 B
TypeScript
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) => {
|
|
|
|
// only when input and textarea are different
|
|
if(oInputElement.value !== oEditor.getData()) {
|
|
oInputElement.value = oEditor.getData();
|
|
// const oEvent = new Event('change');
|
|
// oInputElement.dispatchEvent(oEvent);
|
|
}
|
|
});
|
|
|
|
}
|
|
}
|
|
|
|
} |