Skip to content

Commit

Permalink
change: only prevent dom update while composing
Browse files Browse the repository at this point in the history
  • Loading branch information
farthinker committed Dec 9, 2019
1 parent bd70aa5 commit 7d92120
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions src/view/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,6 @@ export default class Renderer {
* removed as long as the selection is in the text node which needed it at first.
*/
render() {
if ( this.isComposing ) {
return;
}

let inlineFillerPosition;

// Refresh mappings.
Expand All @@ -201,17 +197,21 @@ export default class Renderer {
this.markedChildren.add( inlineFillerPosition.parent );
}

for ( const element of this.markedAttributes ) {
this._updateAttrs( element );
if ( !this.isComposing ) {
for ( const element of this.markedAttributes ) {
this._updateAttrs( element );
}
}

for ( const element of this.markedChildren ) {
this._updateChildren( element, { inlineFillerPosition } );
}

for ( const node of this.markedTexts ) {
if ( !this.markedChildren.has( node.parent ) && this.domConverter.mapViewToDom( node.parent ) ) {
this._updateText( node, { inlineFillerPosition } );
if ( !this.isComposing ) {
for ( const node of this.markedTexts ) {
if ( !this.markedChildren.has( node.parent ) && this.domConverter.mapViewToDom( node.parent ) ) {
this._updateText( node, { inlineFillerPosition } );
}
}
}

Expand All @@ -237,7 +237,7 @@ export default class Renderer {
this._inlineFiller = null;
}

if ( !this.isCodeEditing ) {
if ( !this.isCodeEditing && !this.isComposing ) {
this._updateSelection();
this._updateFocus();
}
Expand Down Expand Up @@ -559,12 +559,16 @@ export default class Renderer {

for ( const action of diff ) {
if ( action === 'insert' ) {
insertAt( domElement, i, expectedDomChildren[ i ] );
if ( !this.isComposing ) {
insertAt( domElement, i, expectedDomChildren[ i ] );
}
i++;
} else if ( action === 'delete' ) {
if ( actualDomChildren[ i ] && !nodesInserted.has( actualDomChildren[ i ] ) ) {
nodesToUnbind.add( actualDomChildren[ i ] );
remove( actualDomChildren[ i ] );
if ( !this.isComposing ) {
remove( actualDomChildren[ i ] );
}
}
} else { // 'equal'
// Force updating text nodes inside elements which did not change and do not need to be re-rendered (#1125).
Expand Down

0 comments on commit 7d92120

Please sign in to comment.