mirror of
https://github.com/moodle/moodle.git
synced 2025-04-20 07:56:06 +02:00
Merge branch 'MDL-71047-master' of https://github.com/NashTechOpenUniversity/moodle
This commit is contained in:
commit
1aa1276a84
@ -1485,17 +1485,9 @@ EditorClean.prototype = {
|
||||
// Scrub the paste content.
|
||||
content = this._cleanPasteHTML(content);
|
||||
|
||||
// Save the current selection.
|
||||
// Using saveSelection as it produces a more consistent experience.
|
||||
var selection = window.rangy.saveSelection();
|
||||
|
||||
// Insert the content.
|
||||
this.insertContentAtFocusPoint(content);
|
||||
|
||||
// Restore the selection, and collapse to end.
|
||||
window.rangy.restoreSelection(selection);
|
||||
window.rangy.getSelection().collapseToEnd();
|
||||
|
||||
// Update the text area.
|
||||
this.updateOriginal();
|
||||
return false;
|
||||
@ -2826,7 +2818,12 @@ EditorSelection.prototype = {
|
||||
}
|
||||
if (range) {
|
||||
range.deleteContents();
|
||||
range.insertNode(node.getDOMNode());
|
||||
range.collapse(false);
|
||||
var currentnode = node.getDOMNode(),
|
||||
last = currentnode.lastChild || currentnode;
|
||||
range.insertNode(currentnode);
|
||||
range.collapseAfter(last);
|
||||
selection.setSingleRange(range);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -1474,17 +1474,9 @@ EditorClean.prototype = {
|
||||
// Scrub the paste content.
|
||||
content = this._cleanPasteHTML(content);
|
||||
|
||||
// Save the current selection.
|
||||
// Using saveSelection as it produces a more consistent experience.
|
||||
var selection = window.rangy.saveSelection();
|
||||
|
||||
// Insert the content.
|
||||
this.insertContentAtFocusPoint(content);
|
||||
|
||||
// Restore the selection, and collapse to end.
|
||||
window.rangy.restoreSelection(selection);
|
||||
window.rangy.getSelection().collapseToEnd();
|
||||
|
||||
// Update the text area.
|
||||
this.updateOriginal();
|
||||
return false;
|
||||
@ -2801,7 +2793,12 @@ EditorSelection.prototype = {
|
||||
}
|
||||
if (range) {
|
||||
range.deleteContents();
|
||||
range.insertNode(node.getDOMNode());
|
||||
range.collapse(false);
|
||||
var currentnode = node.getDOMNode(),
|
||||
last = currentnode.lastChild || currentnode;
|
||||
range.insertNode(currentnode);
|
||||
range.collapseAfter(last);
|
||||
selection.setSingleRange(range);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
8
lib/editor/atto/yui/src/editor/js/clean.js
vendored
8
lib/editor/atto/yui/src/editor/js/clean.js
vendored
@ -190,17 +190,9 @@ EditorClean.prototype = {
|
||||
// Scrub the paste content.
|
||||
content = this._cleanPasteHTML(content);
|
||||
|
||||
// Save the current selection.
|
||||
// Using saveSelection as it produces a more consistent experience.
|
||||
var selection = window.rangy.saveSelection();
|
||||
|
||||
// Insert the content.
|
||||
this.insertContentAtFocusPoint(content);
|
||||
|
||||
// Restore the selection, and collapse to end.
|
||||
window.rangy.restoreSelection(selection);
|
||||
window.rangy.getSelection().collapseToEnd();
|
||||
|
||||
// Update the text area.
|
||||
this.updateOriginal();
|
||||
return false;
|
||||
|
@ -409,7 +409,12 @@ EditorSelection.prototype = {
|
||||
}
|
||||
if (range) {
|
||||
range.deleteContents();
|
||||
range.insertNode(node.getDOMNode());
|
||||
range.collapse(false);
|
||||
var currentnode = node.getDOMNode(),
|
||||
last = currentnode.lastChild || currentnode;
|
||||
range.insertNode(currentnode);
|
||||
range.collapseAfter(last);
|
||||
selection.setSingleRange(range);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user