mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 07:13:08 -05:00
Added option to persist splits in inline nodes when fetching range from bookmark.
This commit is contained in:
parent
83a1b4c520
commit
d16de00a23
2 changed files with 14 additions and 10 deletions
|
@ -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,10 +2007,12 @@ proto._getRangeAndRemoveBookmark = function ( range ) {
|
|||
detach( start );
|
||||
detach( end );
|
||||
|
||||
// Merge any text nodes we split
|
||||
mergeInlines( startContainer, _range );
|
||||
if ( startContainer !== endContainer ) {
|
||||
mergeInlines( endContainer, _range );
|
||||
if ( !persistSplits ) {
|
||||
// Merge any text nodes we split
|
||||
mergeInlines( startContainer, _range );
|
||||
if ( startContainer !== endContainer ) {
|
||||
mergeInlines( endContainer, _range );
|
||||
}
|
||||
}
|
||||
|
||||
if ( !range ) {
|
||||
|
|
|
@ -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,10 +549,12 @@ proto._getRangeAndRemoveBookmark = function ( range ) {
|
|||
detach( start );
|
||||
detach( end );
|
||||
|
||||
// Merge any text nodes we split
|
||||
mergeInlines( startContainer, _range );
|
||||
if ( startContainer !== endContainer ) {
|
||||
mergeInlines( endContainer, _range );
|
||||
if ( !persistSplits ) {
|
||||
// Merge any text nodes we split
|
||||
mergeInlines( startContainer, _range );
|
||||
if ( startContainer !== endContainer ) {
|
||||
mergeInlines( endContainer, _range );
|
||||
}
|
||||
}
|
||||
|
||||
if ( !range ) {
|
||||
|
|
Loading…
Reference in a new issue