Open leevigraham opened 1 year ago
Hi @leevigraham, I'm working on solving the same overall feature: Opening a CMS-provided modal to the normal Link plugin. While I understand your overall question, "What's the proper way to insert a link from a modal", I'm not sure why this is flagged as a bug. You mention that removing this line solves the problem:
Removing
this.linkUI._hideUI();
from_openModal(args)
resolves the issue.
But since that line is in custom code (and on top of that calling a private method) this does seem like it would be a bug.
I'd still like to know the same question, I have an issue where CKEditor is loosing focus when the modal opens, and the balloon closes, causing the whole link not to be saved.
I think you will need to add the dom element to the editor.ui.focusTracker
. @oleq, probably you have a better understanding here. The focus tracking article may be of help here.
I think you will need to add the dom element to the editor.ui.focusTracker. @oleq, probably you have a better understanding here. The focus tracking article may be of help here.
I think this is not the case here.
LinkUI#_hideUI()
calls editor.editing.view.focus()
internally. If the editor is not focused, this will move the selection to the beginning of the editing root. You can call editor.editing.view.focus()
from the console in any blurred editor instance to see how it works.
Why do you want to call LinkUI#_hideUI()
in the first place when the modal gets open?
But since that line is in custom code (and on top of that calling a private method) this does seem like it would be a bug.
Yes, this is a private method for a reason: it was not meant to be used by integrators; it was created to satisfy the needs of the default link UI.
There has been no activity on this issue for the past year. We've marked it as stale and will close it in 30 days. We understand it may still be relevant, so if you're interested in the solution, leave a comment or reaction under this issue.
π Provide detailed reproduction steps (if any)
I'm trying to add custom buttons to the Link Balloon which opens a CMS modal. When closing the modal and adding the link the link is created in the wrong position.
What I want to ultimately know is⦠what is the correct way to launch a third party modal, take it's selection, populate the link balloon, and submit the link balloon form.
Here's the pseudo code:
ButtonView
and append to LlinkUI.formView`https://user-images.githubusercontent.com/25124/216180273-42044ee7-fd93-491c-af05-9708fd95ee5d.mov
Plugin code:
Removing
this.linkUI._hideUI();
from_openModal(args)
resolves the issue.https://user-images.githubusercontent.com/25124/216181113-661aa551-71a4-4eb0-ae9d-6c1c4e52c187.mov
βοΈ Expected result
Link should be added to selected text.
β Actual result
Link is added to the start of the block
Related tickets:
https://github.com/ckeditor/ckeditor5/issues/4836
π Other details