Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Remove fake selection container only if selection is not fake anymore.
Browse files Browse the repository at this point in the history
  • Loading branch information
jodator committed Feb 26, 2019
1 parent a63ca69 commit d4939a1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/view/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,9 @@ export default class Renderer {
let inlineFillerPosition;

// Remove unneeded fake selection container from the DOM so it will not affect the DOM nodes diffing.
// It will be re-added if needed when rendering the selection.
this._removeFakeSelection();
if ( !this.selection.isFake && isInDom( this._fakeSelectionContainer ) ) {
this._removeFakeSelection();
}

// Refresh mappings.
for ( const element of this.markedChildren ) {
Expand Down Expand Up @@ -957,3 +958,7 @@ function fixGeckoSelectionAfterBr( focus, domSelection ) {
domSelection.addRange( domSelection.getRangeAt( 0 ) );
}
}

function isInDom( fakeSelectionContainer ) {
return fakeSelectionContainer && fakeSelectionContainer.parentElement;
}

0 comments on commit d4939a1

Please sign in to comment.