Enhancement
Critical
Major
Detail
Detail
The following JS errors appear in the log when long texts are saved:
Client-side message: Uncaught JavaScript exception (exception: 'TypeError: this.document.getWindow().$ is undefined', component: 'rootLayout#masterFrame', source: 'http://demo1:8080/demo/servlet/LayoutServlet/demo1-12b782d1c6070cbf', layout: 'masterFrame.layout.xml', session: node0poq7g3blxodz1vizmwwyzubkj0, UserAgent[Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:87.0) Gecko/20100101 Firefox/87.0])
Client-side message: Uncaught JavaScript exception (exception: 'TypeError: a is null', component: 'rootLayout#masterFrame', source: 'http://demo1:8080/demo/servlet/LayoutServlet/demo1-9d999c76a42ef4f0', layout: 'masterFrame.layout.xml', session: node0poq7g3blxodz1vizmwwyzubkj0, UserAgent[Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:87.0) Gecko/20100101 Firefox/87.0])
Seems to be from the CK editor:
Uncaught TypeError: a is null getClientRect http://demo1:8080/demo/script/ckeditor/ckeditor.js:1248 queryViewport http://demo1:8080/demo/script/ckeditor/ckeditor.js:1248 p http://demo1:8080/demo/script/ckeditor/ckeditor.js:1233 O http://demo1:8080/demo/script/ckeditor/ckeditor.js:1269 p http://demo1:8080/demo/script/ckeditor/ckeditor.js:10 fire http://demo1:8080/demo/script/ckeditor/ckeditor.js:12 fire http://demo1:8080/demo/script/ckeditor/ckeditor.js:13 m http://demo1:8080/demo/script/ckeditor/ckeditor.js:941 setTimeout http://demo1:8080/demo/script/ckeditor/ckeditor.js:30 setTimeout handler*setTimeout http://demo1:8080/demo/script/ckeditor/ckeditor.js:30 m http://demo1:8080/demo/script/ckeditor/ckeditor.js:941 setTimeout handler*setTimeout http://demo1:8080/demo/script/ckeditor/ckeditor.js:30 frameLoadedHandler http://demo1:8080/demo/script/ckeditor/ckeditor.js:946 addFunction http:/
The error messages occur because the application does not correctly recognize changes from the client as such and tries to save the new value to the editor again each time. The error messages most likely occur because the editor is still trying to set the "new" content while it itself has already been removed from the DOM.
Improvement
It is now checked in advance whether changes came from the client before the editor is unnecessarily updated again. To ensure a correct comparison, the current StructuredText is set for the FormField as soon as changes have been made in the editor.
Test
The test can be performed at http://docker:8007/CWS_25982. Edit a new page (especially a long page) and save it (similar to #25969). Test the whole thing several times, as the error does not always occur. No messages should appear in the log and no changes should be lost when saving. Additionally you should test if unnecessary update requests are sent to the client. To do this, open the Developer Tools and set a breakpoint in replaceContent in wysiwyg.js. If changes are made in the editor and saved or you click into another field, the replaceContent method must not be called.