RTE link
This commit is contained in:
@@ -1 +1 @@
|
|||||||
1.1.59
|
1.1.60
|
||||||
@@ -944,6 +944,12 @@
|
|||||||
hideLinkPanel();
|
hideLinkPanel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
restoreSelection();
|
||||||
|
const range = savedRange ? savedRange.cloneRange() : getSelectionRange();
|
||||||
|
if (!range || range.collapsed) {
|
||||||
|
hideLinkPanel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
const linkEl = findLinkAtSelection();
|
const linkEl = findLinkAtSelection();
|
||||||
if (linkEl && linkEl.setAttribute) {
|
if (linkEl && linkEl.setAttribute) {
|
||||||
@@ -952,23 +958,19 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch {}
|
} catch {}
|
||||||
const range = savedRange ? savedRange.cloneRange() : getSelectionRange();
|
exec('createLink', url);
|
||||||
if (!range || range.collapsed) {
|
const linkAfter = findLinkAtSelection();
|
||||||
hideLinkPanel();
|
if (!linkAfter) {
|
||||||
return;
|
try {
|
||||||
}
|
const docRef = content.ownerDocument || document;
|
||||||
try {
|
const anchor = docRef.createElement('a');
|
||||||
const docRef = content.ownerDocument || document;
|
anchor.setAttribute('href', url);
|
||||||
const anchor = docRef.createElement('a');
|
anchor.setAttribute('target', '_blank');
|
||||||
anchor.setAttribute('href', url);
|
anchor.setAttribute('rel', 'noopener');
|
||||||
anchor.setAttribute('target', '_blank');
|
const fragment = range.extractContents();
|
||||||
anchor.setAttribute('rel', 'noopener');
|
anchor.appendChild(fragment);
|
||||||
const fragment = range.extractContents();
|
range.insertNode(anchor);
|
||||||
anchor.appendChild(fragment);
|
} catch {}
|
||||||
range.insertNode(anchor);
|
|
||||||
} catch {
|
|
||||||
restoreSelection();
|
|
||||||
exec('createLink', url);
|
|
||||||
}
|
}
|
||||||
hideLinkPanel();
|
hideLinkPanel();
|
||||||
});
|
});
|
||||||
@@ -986,6 +988,13 @@
|
|||||||
} catch {}
|
} catch {}
|
||||||
restoreSelection();
|
restoreSelection();
|
||||||
exec('unlink');
|
exec('unlink');
|
||||||
|
const stillLinked = findLinkAtSelection();
|
||||||
|
if (stillLinked && stillLinked.parentNode) {
|
||||||
|
while (stillLinked.firstChild) {
|
||||||
|
stillLinked.parentNode.insertBefore(stillLinked.firstChild, stillLinked);
|
||||||
|
}
|
||||||
|
stillLinked.parentNode.removeChild(stillLinked);
|
||||||
|
}
|
||||||
hideLinkPanel();
|
hideLinkPanel();
|
||||||
});
|
});
|
||||||
linkCancel.addEventListener('click', hideLinkPanel);
|
linkCancel.addEventListener('click', hideLinkPanel);
|
||||||
|
|||||||
Reference in New Issue
Block a user