Bug #19403 » rtehtmlarea_bugfix_9464_typo3_4-2.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/htmlarea.js (copie de travail) | ||
---|---|---|
HTMLArea.prototype.buildUndoSnapshot = function () {
|
||
var text, bookmark = null, bookmarkedText = null;
|
||
// Insert a bookmark
|
||
if (this.getMode() === "wysiwyg" && this.isEditable()) {
|
||
// Insert a bookmark
|
||
if (this.getMode() == "wysiwyg" && this.isEditable()) {
|
||
var selection = this._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.getBookmark(this._createRange(selection));
|
||
} catch (e) {
|
||
bookmark = null;
|
||
}
|
||
}
|
||
// Get the bookmarked html text and remove the bookmark
|
||
if (bookmark) {
|
||
bookmarkedText = this.getInnerHTML();
|
||
var range = this.moveToBookmark(bookmark);
|
||
// Restore Firefox selection
|
||
if (HTMLArea.is_gecko && !HTMLArea.is_opera && !HTMLArea.is_safari) {
|
||
this.emptySelection(selection);
|
||
this.addRangeToSelection(selection, range);
|
||
}
|
||
}
|
||
}
|
||
// Get the bookmarked html text and remove the bookmark
|
||
if (bookmark) {
|
||
bookmarkedText = this.getInnerHTML();
|
||
this.moveToBookmark(bookmark);
|
||
}
|
||
// Get the html text
|
||
var text = this.getInnerHTML();
|
||
return {
|
- « Previous
- 1
- 2
- Next »