From 4bf2ae617b04f473392160cefc3ed74037b54715 Mon Sep 17 00:00:00 2001 From: Christian Pansch Date: Thu, 14 Mar 2024 12:54:06 +0100 Subject: [PATCH 1/3] increase onChange debounce time and trigger onChange on FocusLos --- .../neos-ui-ckeditor5-bindings/src/ckEditorApi.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/neos-ui-ckeditor5-bindings/src/ckEditorApi.js b/packages/neos-ui-ckeditor5-bindings/src/ckEditorApi.js index fa7f56352a..d9099e0d86 100644 --- a/packages/neos-ui-ckeditor5-bindings/src/ckEditorApi.js +++ b/packages/neos-ui-ckeditor5-bindings/src/ckEditorApi.js @@ -57,12 +57,16 @@ export const createEditor = store => async options => { return NeosEditor .create(propertyDomNode, ckEditorConfig) .then(editor => { + console.log('editor.ui', editor.ui); editor.ui.focusTracker.on('change:isFocused', event => { - if (event.source.isFocused) { - currentEditor = editor; - editorConfig.setCurrentlyEditedPropertyName(propertyName); - handleUserInteractionCallback(); + if (!event.source.isFocused) { + onChange(cleanupContentBeforeCommit(editor.getData())) + return } + + currentEditor = editor; + editorConfig.setCurrentlyEditedPropertyName(propertyName); + handleUserInteractionCallback(); }); editor.keystrokes.set('Ctrl+K', (_, cancel) => { @@ -71,7 +75,7 @@ export const createEditor = store => async options => { }); editor.model.document.on('change', () => handleUserInteractionCallback()); - editor.model.document.on('change:data', debounce(() => onChange(cleanupContentBeforeCommit(editor.getData())), 500, {maxWait: 5000})); + editor.model.document.on('change:data', debounce(() => onChange(cleanupContentBeforeCommit(editor.getData())), 1500, {maxWait: 5000})); return editor; }).catch(e => { if (e instanceof TypeError && e.message.match(/Class constructor .* cannot be invoked without 'new'/)) { From b961e03bd835a658d4de7c0af689194e268ed632 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anke=20H=C3=A4slich?= Date: Wed, 10 Apr 2024 19:24:11 +0200 Subject: [PATCH 2/3] Update packages/neos-ui-ckeditor5-bindings/src/ckEditorApi.js Co-authored-by: Wilhelm Behncke <2522299+grebaldi@users.noreply.github.com> --- packages/neos-ui-ckeditor5-bindings/src/ckEditorApi.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/neos-ui-ckeditor5-bindings/src/ckEditorApi.js b/packages/neos-ui-ckeditor5-bindings/src/ckEditorApi.js index d9099e0d86..979a2ab5f5 100644 --- a/packages/neos-ui-ckeditor5-bindings/src/ckEditorApi.js +++ b/packages/neos-ui-ckeditor5-bindings/src/ckEditorApi.js @@ -57,7 +57,6 @@ export const createEditor = store => async options => { return NeosEditor .create(propertyDomNode, ckEditorConfig) .then(editor => { - console.log('editor.ui', editor.ui); editor.ui.focusTracker.on('change:isFocused', event => { if (!event.source.isFocused) { onChange(cleanupContentBeforeCommit(editor.getData())) From 5356f070965ac56a604327f65ee6a1862f42360b Mon Sep 17 00:00:00 2001 From: Wilhelm Behncke Date: Mon, 8 Jul 2024 13:24:33 +0200 Subject: [PATCH 3/3] TASK: Increase wait times for text changes in E2E tests --- .../Fixtures/1Dimension/createNewNodes.e2e.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Tests/IntegrationTests/Fixtures/1Dimension/createNewNodes.e2e.js b/Tests/IntegrationTests/Fixtures/1Dimension/createNewNodes.e2e.js index 1adc77dccb..12b0cedb89 100644 --- a/Tests/IntegrationTests/Fixtures/1Dimension/createNewNodes.e2e.js +++ b/Tests/IntegrationTests/Fixtures/1Dimension/createNewNodes.e2e.js @@ -177,21 +177,21 @@ test('Can create content node from inside InlineUI', async t => { subSection('Inline validation'); // We have to wait for ajax requests to be triggered, since they are debounced for 0.5s - await t.wait(600); + await t.wait(1600); await changeRequestLogger.clear(); await t .expect(Selector('.test-headline h1').exists).ok('Validation tooltip appeared') .click('.test-headline h1') .pressKey('ctrl+a delete') .switchToMainWindow() - .wait(600) + .wait(1600) .expect(ReactSelector('InlineValidationTooltips').exists).ok('Validation tooltip appeared'); await t .expect(changeRequestLogger.count(() => true)).eql(0, 'No requests were fired with invalid state'); await t .switchToIframe(contentIframeSelector) .typeText(Selector('.test-headline h1'), 'Some text') - .wait(600); + .wait(1600); await t.expect(changeRequestLogger.count(() => true)).eql(1, 'Request fired when field became valid'); subSection('Create a link to node'); @@ -228,7 +228,7 @@ test('Inline CKEditor mode `paragraph: false` works as expected', async t => { .expect(Selector('.neos-contentcollection').withText('Foo Bar').exists).ok('Inserted text exists'); await t.switchToMainWindow(); - await t.wait(500); // we debounce the change + await t.wait(1500); // we debounce the change await t.expect(ReactSelector('Inspector TextAreaEditor').withProps({ value: 'Foo Bar
Bun Buz'}).exists).ok('The TextAreaEditor mirrors the expected value') });