UNPKG

laif-ds

Version:

Design System di Laif con componenti React basati su principi di Atomic Design

17 lines (16 loc) 773 B
"use client"; import { useLexicalComposerContext as u } from "./LexicalComposerContext.prod.js"; import { HISTORY_MERGE_TAG as f } from "../../lexical/Lexical.prod.js"; import { useLayoutEffect as m, useEffect as g } from "react"; const c = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? m : g; function w({ ignoreHistoryMergeTagChange: o = !0, ignoreSelectionChange: n = !1, onChange: e }) { const [t] = u(); return c((() => { if (e) return t.registerUpdateListener((({ editorState: r, dirtyElements: s, dirtyLeaves: a, prevEditorState: d, tags: i }) => { n && s.size === 0 && a.size === 0 || o && i.has(f) || d.isEmpty() || e(r, t, i); })); }), [t, o, n, e]), null; } export { w as OnChangePlugin };