mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
Merge branch 'MDL-77706-401' of https://github.com/andrewnicols/moodle into MOODLE_401_STABLE
This commit is contained in:
commit
a29ef48500
@ -317,8 +317,33 @@ Y.namespace('M.atto_link').Button = Y.Base.create('button', Y.M.editor_atto.Edit
|
||||
selectednode = host.insertContentAtFocusPoint(link.get('outerHTML'));
|
||||
host.setSelection(host.getSelectionFromNode(selectednode));
|
||||
} else {
|
||||
document.execCommand('unlink', false, null);
|
||||
document.execCommand('createLink', false, url);
|
||||
if (Y.UA.gecko > 0) {
|
||||
// For Firefox / Gecko we need to wrap the selection in a span so we can surround it with an anchor.
|
||||
// This relates to https://bugzilla.mozilla.org/show_bug.cgi?id=1906559.
|
||||
var originalSelection = document.getSelection();
|
||||
var wrapper = document.createElement('span');
|
||||
wrapper.setAttribute('data-wrapper', '');
|
||||
wrapper.style.display = 'inline';
|
||||
|
||||
var i;
|
||||
for (i = 0; i < originalSelection.rangeCount; i++) {
|
||||
originalSelection.getRangeAt(i).surroundContents(wrapper);
|
||||
}
|
||||
host.setSelection(host.getSelectionFromNode(Y.one(wrapper)));
|
||||
|
||||
document.execCommand('unlink', false, null);
|
||||
document.execCommand('createLink', false, url);
|
||||
|
||||
var anchorNode = wrapper.parentNode;
|
||||
wrapper.children.forEach(function(child) {
|
||||
anchorNode.appendChild(child);
|
||||
});
|
||||
wrapper.remove();
|
||||
|
||||
} else {
|
||||
document.execCommand('unlink', false, null);
|
||||
document.execCommand('createLink', false, url);
|
||||
}
|
||||
|
||||
// Now set the target.
|
||||
selectednode = host.getSelectionParentNode();
|
||||
|
File diff suppressed because one or more lines are too long
@ -317,8 +317,33 @@ Y.namespace('M.atto_link').Button = Y.Base.create('button', Y.M.editor_atto.Edit
|
||||
selectednode = host.insertContentAtFocusPoint(link.get('outerHTML'));
|
||||
host.setSelection(host.getSelectionFromNode(selectednode));
|
||||
} else {
|
||||
document.execCommand('unlink', false, null);
|
||||
document.execCommand('createLink', false, url);
|
||||
if (Y.UA.gecko > 0) {
|
||||
// For Firefox / Gecko we need to wrap the selection in a span so we can surround it with an anchor.
|
||||
// This relates to https://bugzilla.mozilla.org/show_bug.cgi?id=1906559.
|
||||
var originalSelection = document.getSelection();
|
||||
var wrapper = document.createElement('span');
|
||||
wrapper.setAttribute('data-wrapper', '');
|
||||
wrapper.style.display = 'inline';
|
||||
|
||||
var i;
|
||||
for (i = 0; i < originalSelection.rangeCount; i++) {
|
||||
originalSelection.getRangeAt(i).surroundContents(wrapper);
|
||||
}
|
||||
host.setSelection(host.getSelectionFromNode(Y.one(wrapper)));
|
||||
|
||||
document.execCommand('unlink', false, null);
|
||||
document.execCommand('createLink', false, url);
|
||||
|
||||
var anchorNode = wrapper.parentNode;
|
||||
wrapper.children.forEach(function(child) {
|
||||
anchorNode.appendChild(child);
|
||||
});
|
||||
wrapper.remove();
|
||||
|
||||
} else {
|
||||
document.execCommand('unlink', false, null);
|
||||
document.execCommand('createLink', false, url);
|
||||
}
|
||||
|
||||
// Now set the target.
|
||||
selectednode = host.getSelectionParentNode();
|
||||
|
@ -315,8 +315,33 @@ Y.namespace('M.atto_link').Button = Y.Base.create('button', Y.M.editor_atto.Edit
|
||||
selectednode = host.insertContentAtFocusPoint(link.get('outerHTML'));
|
||||
host.setSelection(host.getSelectionFromNode(selectednode));
|
||||
} else {
|
||||
document.execCommand('unlink', false, null);
|
||||
document.execCommand('createLink', false, url);
|
||||
if (Y.UA.gecko > 0) {
|
||||
// For Firefox / Gecko we need to wrap the selection in a span so we can surround it with an anchor.
|
||||
// This relates to https://bugzilla.mozilla.org/show_bug.cgi?id=1906559.
|
||||
var originalSelection = document.getSelection();
|
||||
var wrapper = document.createElement('span');
|
||||
wrapper.setAttribute('data-wrapper', '');
|
||||
wrapper.style.display = 'inline';
|
||||
|
||||
var i;
|
||||
for (i = 0; i < originalSelection.rangeCount; i++) {
|
||||
originalSelection.getRangeAt(i).surroundContents(wrapper);
|
||||
}
|
||||
host.setSelection(host.getSelectionFromNode(Y.one(wrapper)));
|
||||
|
||||
document.execCommand('unlink', false, null);
|
||||
document.execCommand('createLink', false, url);
|
||||
|
||||
var anchorNode = wrapper.parentNode;
|
||||
wrapper.children.forEach(function(child) {
|
||||
anchorNode.appendChild(child);
|
||||
});
|
||||
wrapper.remove();
|
||||
|
||||
} else {
|
||||
document.execCommand('unlink', false, null);
|
||||
document.execCommand('createLink', false, url);
|
||||
}
|
||||
|
||||
// Now set the target.
|
||||
selectednode = host.getSelectionParentNode();
|
||||
|
Loading…
x
Reference in New Issue
Block a user