mirror of
https://github.com/facebook/lexical.git
synced 2025-08-06 16:39:33 +08:00
25 lines
654 B
JavaScript
25 lines
654 B
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @flow strict-local
|
|
*/
|
|
|
|
import type {ViewModel, OutlineEditor, View} from 'outline';
|
|
|
|
export const viewModelsWithoutHistory: Set<ViewModel> = new Set();
|
|
|
|
export function updateWithoutHistory(
|
|
editor: OutlineEditor,
|
|
updateFn: (view: View) => void,
|
|
): boolean {
|
|
const res = editor.update(updateFn);
|
|
const pendingViewModel = editor._pendingViewModel;
|
|
if (pendingViewModel !== null) {
|
|
viewModelsWithoutHistory.add(pendingViewModel);
|
|
}
|
|
return res;
|
|
}
|