Skip to content

Commit

Permalink
Revert "IBX-5870: Fixed link editing"
Browse files Browse the repository at this point in the history
This reverts commit 714bd6b.
  • Loading branch information
dew326 committed Jun 14, 2023
1 parent 714bd6b commit 90725a3
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions src/bundle/Resources/public/js/CKEditor/link/link-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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')) {
Expand Down

0 comments on commit 90725a3

Please sign in to comment.