UNPKG

@portabletext/editor

Version:

Portable Text Editor made in React

15 lines (11 loc) 385 B
import type {Editor} from 'slate' export const PATCHING: WeakMap<Editor, boolean | undefined> = new WeakMap() export function withoutPatching(editor: Editor, fn: () => void): void { const prev = isPatching(editor) PATCHING.set(editor, false) fn() PATCHING.set(editor, prev) } export function isPatching(editor: Editor): boolean | undefined { return PATCHING.get(editor) }