0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 15:23:29 -05:00

Added option to persist splits in inline nodes when fetching range from bookmark.

This commit is contained in:
Gert K. Sønderby 2015-06-15 16:00:30 +02:00 committed by Neil Jenkins
parent 83a1b4c520
commit d16de00a23
2 changed files with 14 additions and 10 deletions

View file

@ -1983,7 +1983,7 @@ proto._saveRangeToBookmark = function ( range ) {
range.setEndBefore( endNode );
};
proto._getRangeAndRemoveBookmark = function ( range ) {
proto._getRangeAndRemoveBookmark = function ( range, persistSplits ) {
var doc = this._doc,
start = doc.getElementById( startSelectionId ),
end = doc.getElementById( endSelectionId );
@ -2007,11 +2007,13 @@ proto._getRangeAndRemoveBookmark = function ( range ) {
detach( start );
detach( end );
if ( !persistSplits ) {
// Merge any text nodes we split
mergeInlines( startContainer, _range );
if ( startContainer !== endContainer ) {
mergeInlines( endContainer, _range );
}
}
if ( !range ) {
range = doc.createRange();

View file

@ -525,7 +525,7 @@ proto._saveRangeToBookmark = function ( range ) {
range.setEndBefore( endNode );
};
proto._getRangeAndRemoveBookmark = function ( range ) {
proto._getRangeAndRemoveBookmark = function ( range, persistSplits ) {
var doc = this._doc,
start = doc.getElementById( startSelectionId ),
end = doc.getElementById( endSelectionId );
@ -549,11 +549,13 @@ proto._getRangeAndRemoveBookmark = function ( range ) {
detach( start );
detach( end );
if ( !persistSplits ) {
// Merge any text nodes we split
mergeInlines( startContainer, _range );
if ( startContainer !== endContainer ) {
mergeInlines( endContainer, _range );
}
}
if ( !range ) {
range = doc.createRange();