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

Typing in the CKEditor 5 is ridiculously slow #3584

Closed
escix opened this issue Jul 6, 2024 · 8 comments · Fixed by #3790
Closed

Typing in the CKEditor 5 is ridiculously slow #3584

escix opened this issue Jul 6, 2024 · 8 comments · Fixed by #3790
Assignees

Comments

@escix
Copy link

escix commented Jul 6, 2024

Hi Team,
When I reply to email tickets, it takes long time for the typing to display on the screen. Like 10 to 20 seconds.
Which makes it hard to know if there's any spelling mistakes while typing.

@svenoe
Copy link
Contributor

svenoe commented Jul 8, 2024

Hi escix,

this can happen for really long emails, and to our understanding especially if there are a lot of nested citations. "Normal" sized emails should not have this problem, though (I tested one with 15000 characters right now again, to be able to give a number, which, on my pc didn't have any issues). CK5 is a topic still in various places in any case, unfortunately we had to make the change, because CK4 is not updated anymore. CK5 was completely rewritten and has some drawbacks, which we are not totally happy with, ourselves.

Currently for this specific issue I can only say, that we are aware, and that it has a relatively high priority, but that we do not know of an "easy fix".

Best regards, Sven

@escix
Copy link
Author

escix commented Jul 8, 2024

Hi escix,

this can happen for really long emails, and to our understanding especially if there are a lot of nested citations. "Normal" sized emails should not have this problem, though (I tested one with 15000 characters right now again, to be able to give a number, which, on my pc didn't have any issues). CK5 is a topic still in various places in any case, unfortunately we had to make the change, because CK4 is not updated anymore. CK5 was completely rewritten and has some drawbacks, which we are not totally happy with, ourselves.

Currently for this specific issue I can only say, that we are aware, and that it has a relatively high priority, but that we do not know of an "easy fix".

Best regards, Sven

Hi Sven,
Thanks for the quick response.
I recall when replying only a limited lines from original email was included.
Not sure where this setting was, but I may have to revisit this to limit the number of lines from the original email in the reply.

bschmalhofer added a commit that referenced this issue Jul 13, 2024
internally, indicate boolean attributes by setting it to
$Types::Serialised::true.

Require the Perl distribution Types::Serialiser. This is no new
requirement and JSON::XS already required that module.
bschmalhofer added a commit that referenced this issue Jul 13, 2024
bschmalhofer added a commit that referenced this issue Jul 13, 2024
internally, indicate boolean attributes by setting it to
$Types::Serialised::true.

Require the Perl distribution Types::Serialiser. This is no new
requirement and JSON::XS already required that module.
bschmalhofer added a commit that referenced this issue Jul 13, 2024
@bschmalhofer
Copy link
Contributor

The referenced commits actually belong to #3583 . Sorry for messing up.

@wornet-aer
Copy link
Contributor

Unfortunately we also suffer from this issue. There was now lag or slow typing with the older CKEditor 4, but version 5 seems ridiciously slow even with small emails. We use an embedded logo for our corporate signature, but this wasn't changed since the migration to OTOBO 11.x.

I have already tried to further limit the lines of the original quoted request, but we didn't notice a big difference yet.

@escix
Copy link
Author

escix commented Aug 23, 2024

I commented out this section and it solved the issue. But not sure if there is any other issue pop up due to this.

File: var/httpd/htdocs/js/Core.UI.RichTextEditor.js

`

              //Block pasting images for ToolbarWithoutImage
            editor.editing.view.document.on( 'clipboardInput', ( evt, data ) => {
                const dataTransfer = data.dataTransfer;

                if ( dataTransfer._files.length > 0 ) {
                    const imageName = dataTransfer._files[0].name;

                    if ( /\.(jpe?g|png|gif|bmp)$/i.test(imageName) && BlockPasteImg ) {
                        evt.stop();
                        return;
                    }
                }
            });
            Core.App.Publish('Event.UI.RichTextEditor.InstanceCreated', [editor]);

            // workaround for ckeditor not using data filter correctly on prefilled content
            if (editor.ElementId == 'RichText') {
                editor.setData(editor.sourceElement.innerText);
            }
           // -- > Commented below section to speed up CKEditor

            // Update validation error tooltip while content is added to the editor
           // editor.model.document.on('change:data', () => {
           //     if (editor.getData() != "") {
           //         $("#" + editor.ElementId).val(editor.getData());
           //     }
            //
            //    window.clearTimeout(TimeOutRTEOnChange);
            //    TimeOutRTEOnChange = window.setTimeout(function () {
            //        Core.Form.Validate.ValidateElement($EditorArea);
            //        Core.App.Publish('Event.UI.RichTextEditor.ChangeValidationComplete', [editor]);
            //    }, 250);
            //});
           // <-- Commented above section to speed up CKEditor

           editor.ui.focusTracker.on('change:isFocused', (evt, name, isFocused) => {
               if (!isFocused) {
                    $("#" + $EditorArea.attr('id')).val(editor.getData());

                    Core.Form.Validate.ValidateElement($EditorArea);
                    Core.Form.ErrorTooltips.RemoveRTETooltip($EditorArea);
                }
             });
        })
        .catch(error => {
            console.error(error);
        });

    // mark the editor textarea as linked with an RTE instance to avoid multiple instances
    $EditorArea.addClass('HasCKEInstance');

`

@chzauleck chzauleck self-assigned this Aug 26, 2024
chzauleck added a commit that referenced this issue Aug 26, 2024
the data copying seems to cause a huge chunk of the lag, so i moved this into the timeout. i also increased timeout to half a second as that should be sufficient.
@chzauleck
Copy link
Contributor

that was a great find, thank you. i adapted the code you commented out and the fix should arrive soonish.

@wornet-aer
Copy link
Contributor

Just a quick feedback: we are using the quick-fix suggested by @escix since last friday and it's working quite well. No more lags or slow-typing. 👍

@Patt92
Copy link

Patt92 commented Aug 29, 2024

works for us as well, thank you

chzauleck added a commit that referenced this issue Sep 2, 2024
the data copying seems to cause a huge chunk of the lag, so i moved this into the timeout. i also increased timeout to half a second as that should be sufficient.
chzauleck added a commit that referenced this issue Sep 4, 2024
the data copying seems to cause a huge chunk of the lag, so i moved this into the timeout. i also increased timeout to half a second as that should be sufficient.
chzauleck added a commit that referenced this issue Sep 9, 2024
the data copying seems to cause a huge chunk of the lag, so i moved this into the timeout. i also increased timeout to half a second as that should be sufficient.
chzauleck added a commit that referenced this issue Sep 12, 2024
the data copying seems to cause a huge chunk of the lag, so i moved this into the timeout. i also increased timeout to half a second as that should be sufficient.
chzauleck added a commit that referenced this issue Sep 16, 2024
the data copying seems to cause a huge chunk of the lag, so i moved this into the timeout. i also increased timeout to half a second as that should be sufficient.
chzauleck added a commit that referenced this issue Sep 17, 2024
the data copying seems to cause a huge chunk of the lag, so i moved this into the timeout. i also increased timeout to half a second as that should be sufficient.
chzauleck added a commit that referenced this issue Sep 20, 2024
the data copying seems to cause a huge chunk of the lag, so i moved this into the timeout. i also increased timeout to half a second as that should be sufficient.
@chzauleck chzauleck linked a pull request Sep 20, 2024 that will close this issue
svenoe pushed a commit that referenced this issue Sep 26, 2024
the data copying seems to cause a huge chunk of the lag, so i moved this into the timeout. i also increased timeout to half a second as that should be sufficient.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants