Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUGFIX: Change update interval on CKEditor #3751

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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<br>Bun Buz'}).exists).ok('The TextAreaEditor mirrors the expected value')
});

Expand Down
13 changes: 8 additions & 5 deletions packages/neos-ui-ckeditor5-bindings/src/ckEditorApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,14 @@ export const createEditor = store => async options => {
.create(propertyDomNode, ckEditorConfig)
.then(editor => {
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) => {
Expand All @@ -71,7 +74,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'/)) {
Expand Down
Loading