From 90725a31def4fa9879f296af6c4ef7953da507e6 Mon Sep 17 00:00:00 2001 From: Dariusz Szut Date: Wed, 14 Jun 2023 15:25:49 +0200 Subject: [PATCH] Revert "IBX-5870: Fixed link editing" This reverts commit 714bd6b1d77cc0eed10b7d50b72f0a4a60100e0c. --- .../public/js/CKEditor/link/link-ui.js | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/bundle/Resources/public/js/CKEditor/link/link-ui.js b/src/bundle/Resources/public/js/CKEditor/link/link-ui.js index a3d3e11f..c5b7ddbe 100644 --- a/src/bundle/Resources/public/js/CKEditor/link/link-ui.js +++ b/src/bundle/Resources/public/js/CKEditor/link/link-ui.js @@ -17,30 +17,15 @@ class IbexaLinkUI extends Plugin { this.showForm = this.showForm.bind(this); this.addLink = this.addLink.bind(this); - this.getLinkRange = this.getLinkRange.bind(this); this.isNew = false; } - getLinkRange() { - return findAttributeRange( - this.editor.model.document.selection.getFirstPosition(), - 'ibexaLinkHref', - this.editor.model.document.selection.getAttribute('ibexaLinkHref'), - this.editor.model, - ); - } - createFormView() { const formView = new IbexaLinkFormView({ locale: this.editor.locale, editor: this.editor }); this.listenTo(formView, 'save-link', () => { const { url, title, target } = this.formView.getValues(); - const range = this.getLinkRange(); - - this.editor.model.change((writer) => { - writer.setSelection(range); - }); this.isNew = false; @@ -64,7 +49,12 @@ class IbexaLinkUI extends Plugin { removeLink() { const modelElement = this.editor.model.document.selection.getSelectedElement(); - const range = this.getLinkRange(); + const range = findAttributeRange( + this.editor.model.document.selection.getFirstPosition(), + 'ibexaLinkHref', + this.editor.model.document.selection.getAttribute('ibexaLinkHref'), + this.editor.model, + ); if (modelElement) { if (this.editor.model.schema.checkAttribute(modelElement, 'ibexaLinkHref')) {