mirror of
https://github.com/wagtail/wagtail.git
synced 2024-12-01 11:41:20 +01:00
Unlink previously existing links when turning a selection into a link
This commit is contained in:
parent
09fccb2624
commit
2992782c99
@ -77,9 +77,18 @@
|
||||
linkHasExistingContent = true;
|
||||
} else if (!lastSelection.collapsed) {
|
||||
// Turning a selection into a link
|
||||
|
||||
a = document.createElement('a');
|
||||
lastSelection.surroundContents(a);
|
||||
// TODO: unlink all existing links in the selection
|
||||
|
||||
// unlink all previously existing links in the selection,
|
||||
// now nested within 'a'
|
||||
$('a[href]', a).each(function() {
|
||||
var parent = this.parentNode;
|
||||
while (this.firstChild) parent.insertBefore(this.firstChild, this);
|
||||
parent.removeChild(this);
|
||||
});
|
||||
|
||||
linkHasExistingContent = true;
|
||||
} else {
|
||||
// Inserting a new link at the cursor position
|
||||
|
Loading…
Reference in New Issue
Block a user