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

Commit

Permalink
Slightly improved wording and clarified that it's all about selection…
Browse files Browse the repository at this point in the history
… position.
  • Loading branch information
Reinmar committed Sep 13, 2019
1 parent 8485421 commit 291d41b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/view/domconverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@ export default class DomConverter {
}

/**
* Binds given DOM element that represents fake selection to {@link module:engine/view/documentselection~DocumentSelection
* document selection}. Document selection copy is stored and can be retrieved by
* Binds given DOM element that represents fake selection to a **position** of a
* {@link module:engine/view/documentselection~DocumentSelection document selection}.
* Document selection copy is stored and can be retrieved by
* {@link module:engine/view/domconverter~DomConverter#fakeSelectionToView} method.
*
* @param {HTMLElement} domElement
Expand Down
12 changes: 7 additions & 5 deletions src/view/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -698,10 +698,14 @@ export default class Renderer {
*/
_updateFakeSelection( domRoot ) {
const domDocument = domRoot.ownerDocument;
// Create fake selection container if one does not exist.
const container = this._fakeSelectionContainer = this._fakeSelectionContainer || createFakeSelectionContainer( domDocument );

// Bind fake selection container with current selection.
if ( !this._fakeSelectionContainer ) {
this._fakeSelectionContainer = createFakeSelectionContainer( domDocument );
}

const container = this._fakeSelectionContainer;

// Bind fake selection container with the current selection *position*.
this.domConverter.bindFakeSelection( container, this.selection );

if ( !this._fakeSelectionNeedsUpdate( domRoot ) ) {
Expand All @@ -712,10 +716,8 @@ export default class Renderer {
domRoot.appendChild( container );
}

// Update contents.
container.textContent = this.selection.fakeSelectionLabel || '\u00A0';

// Update selection.
const domSelection = domDocument.getSelection();
const domRange = domDocument.createRange();

Expand Down

0 comments on commit 291d41b

Please sign in to comment.