Jemt / Fit.UI

Fit.UI is a JavaScript based UI framework built on Object Oriented principles
http://fitui.org
GNU Lesser General Public License v3.0
19 stars 7 forks source link

HTML Editor: Open image and link dialog on double click #131

Open FlowIT-JIT opened 3 years ago

FlowIT-JIT commented 3 years ago

This bug report is a result of the implementation of Image support in the HTML Editor - see #100

By default the base64image plugin opens the image dialog when double clicking an image.

image

Unfortunately this does not work properly with the current CKEditor implementation in Input.js since it relies on dialogs being opened using toolbar buttons, which in turn triggers the beforeCommandExec event.

image

When a dialog is opened using double click, without beforeCommandExec being triggered, it results in internal state not being set properly, and eventually results in an error when the dialog is being closed/hidden again:

image

If this error is not caught, it could lead to the web application crashing, and potentially leave the control and Fit.UI in an invalid state as some state is shared among multiple editor instances.

We need to move the dialog related logic from the beforeCommandExec event handler to a new dialogShow event handler.

All available events are listed on this page (see Events section): https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_editor.html

Double click support in the base64image plugin has been disabled, and needs to be enabled again when this bug has been resolved:

image

FlowIT-JIT commented 3 years ago

Labeled minor bug since the problem has been temporarily resolved simply by disabling double click support.

FlowIT-JIT commented 2 years ago

Opening link dialog by double click has also been disabled in commit https://github.com/Jemt/Fit.UI/commit/be01e26e068b86f1ea4cc1836f1e728073719ce9 since it triggered the same bug - related code is here: https://github.com/Jemt/Fit.UI/blob/f50ea81bf26225ee9b3b32044ef34ea6a55db655/Controls/Input/Input.js#L2755

Focus state is locked when the dialog is opened, but this happens through the beforeCommandExec event which does not execute when double clicking. To fix this we need to ensure that focus state is also locked when double clicking.