N°5298 - Upgrade CKEditor to version 5

- adjust plugin update-input-on-change to prevent emitting event when data has no change
This commit is contained in:
Benjamin Dalsass
2024-05-28 16:07:00 +02:00
parent 22882e35b4
commit e750ad8755
3 changed files with 9 additions and 3 deletions

View File

@@ -17,7 +17,13 @@ export default class UpdateInputOnChange extends Plugin {
// update input when data change
oEditor.model.document.on('change:data', (event) => {
oInputElement.value = oEditor.getData();
// only when input and textarea are different
if(oInputElement.value !== oEditor.getData()) {
oInputElement.value = oEditor.getData();
const oEvent = new Event('change');
oInputElement.dispatchEvent(oEvent);
}
});
}