Skip to content

Commit

Permalink
More fixes #3
Browse files Browse the repository at this point in the history
  • Loading branch information
trueadm authored and acywatson committed Apr 9, 2022
1 parent 58bf5fe commit 6e8bcd5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 5 additions & 1 deletion packages/outline/src/OutlineEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ export class OutlineEditor {
this._keyToDOMMap.delete('root');
} else {
this._keyToDOMMap.set('root', editorElement);
updateViewModel(this._viewModel, this);
const pendingViewModel = this._pendingViewModel
if (pendingViewModel !== null) {
this._pendingViewModel = null;
updateViewModel(pendingViewModel, this);
}
}
}
getElementByKey(key: NodeKey): HTMLElement {
Expand Down
8 changes: 5 additions & 3 deletions packages/outline/src/OutlineView.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,13 @@ export function updateViewModel(
viewModel: ViewModel,
editor: OutlineEditor,
): void {
if (editor._editorElement === null) {
this._pendingViewModel = viewModel;
return;
}
const previousActiveViewModel = activeViewModel;
activeViewModel = viewModel;
if (editor._editorElement !== null) {
reconcileViewModel(viewModel, editor);
}
reconcileViewModel(viewModel, editor);
activeViewModel = previousActiveViewModel;
if (viewModel.selection === null) {
viewModel.selection = editor._viewModel.selection;
Expand Down

0 comments on commit 6e8bcd5

Please sign in to comment.