Bug #19403 » rtehtmlarea_bugfix_9464_trunk.patch
typo3/sysext/rtehtmlarea/htmlarea/htmlarea-gecko.js (copie de travail) | ||
---|---|---|
* handle DOM mutations when moving back to the bookmark.
|
||
*/
|
||
HTMLArea.prototype.getBookmark = function (range) {
|
||
// For performance, includeNodes=true if intended to SelectBookmark.
|
||
// Create the bookmark info (random IDs).
|
||
var bookmark = {
|
||
startId : (new Date()).valueOf() + Math.floor(Math.random()*1000) + 'S',
|
||
... | ... | |
var endSpan = this.getBookmarkNode(bookmark, false);
|
||
var range = this._createRange();
|
||
range.setStartBefore(startSpan);
|
||
// If the previous sibling is a text node, let the anchor have it as parent
|
||
if (startSpan.previousSibling && startSpan.previousSibling.nodeType == 3) {
|
||
range.setStart(startSpan.previousSibling, startSpan.previousSibling.data.length);
|
||
} else {
|
||
range.setStartBefore(startSpan);
|
||
}
|
||
HTMLArea.removeFromParent(startSpan);
|
||
// If collapsed, the end span will not be available.
|
||
// If the bookmarked range was collapsed, the end span will not be available
|
||
if (endSpan) {
|
||
range.setEndBefore(endSpan);
|
||
// If the next sibling is a text node, let the anchor have it as parent
|
||
if (endSpan.nextSibling && endSpan.nextSibling.nodeType == 3) {
|
||
range.setEnd(endSpan.nextSibling, 0);
|
||
} else {
|
||
range.setEndBefore(endSpan);
|
||
}
|
||
HTMLArea.removeFromParent(endSpan);
|
||
} else {
|
||
range.collapse(true);
|
typo3/sysext/rtehtmlarea/htmlarea/plugins/UndoRedo/undo-redo.js (copie de travail) | ||
---|---|---|
if (this.editor.getMode() == "wysiwyg" && this.editor.isEditable()) {
|
||
var selection = this.editor._getSelection();
|
||
if ((HTMLArea.is_gecko && !HTMLArea.is_opera) || (HTMLArea.is_ie && selection.type.toLowerCase() != "control")) {
|
||
try { // catch error in FF when the selection contains no usable range
|
||
// catch error in FF when the selection contains no usable range
|
||
try {
|
||
bookmark = this.editor.getBookmark(this.editor._createRange(selection));
|
||
} catch (e) {
|
||
bookmark = null;
|
||
}
|
||
}
|
||
// Get the bookmarked html text and remove the bookmark
|
||
if (bookmark) {
|
||
bookmarkedText = this.editor.getInnerHTML();
|
||
var range = this.editor.moveToBookmark(bookmark);
|
||
// Restore Firefox selection
|
||
if (HTMLArea.is_gecko && !HTMLArea.is_opera && !HTMLArea.is_safari) {
|
||
this.editor.emptySelection(selection);
|
||
this.editor.addRangeToSelection(selection, range);
|
||
}
|
||
}
|
||
}
|
||
// Get the bookmarked html text and remove the bookmark
|
||
if (bookmark) {
|
||
bookmarkedText = this.editor.getInnerHTML();
|
||
this.editor.moveToBookmark(bookmark);
|
||
}
|
||
return {
|
||
text : this.editor.getInnerHTML(),
|
||
bookmark : bookmark,
|