MCPcopy
hub / github.com/udecode/plate / createPlateStore

Function createPlateStore

packages/core/src/react/stores/plate/createPlateStore.ts:22–90  ·  view source on GitHub ↗
({
  id,
  composing = false,
  containerRef = { current: null },
  decorate = null,
  editor,
  isMounted = false,
  primary = true,
  readOnly = null,
  renderChunk = null,
  renderElement = null,
  renderLeaf = null,
  renderText = null,
  scrollRef = { current: null },
  versionDecorate = 1,
  versionEditor = 1,
  versionSelection = 1,
  versionValue = 1,
  onChange = null,
  onNodeChange = null,
  onSelectionChange = null,
  onTextChange = null,
  onValueChange = null,
  ...state
}: Partial<PlateStoreState<E>> = {})

Source from the content-addressed store, hash-verified

20export const GLOBAL_PLATE_SCOPE = Symbol('global-plate');
21
22export const createPlateStore = <E extends PlateEditor = PlateEditor>({
23 id,
24 composing = false,
25 containerRef = { current: null },
26 decorate = null,
27 editor,
28 isMounted = false,
29 primary = true,
30 readOnly = null,
31 renderChunk = null,
32 renderElement = null,
33 renderLeaf = null,
34 renderText = null,
35 scrollRef = { current: null },
36 versionDecorate = 1,
37 versionEditor = 1,
38 versionSelection = 1,
39 versionValue = 1,
40 onChange = null,
41 onNodeChange = null,
42 onSelectionChange = null,
43 onTextChange = null,
44 onValueChange = null,
45 ...state
46}: Partial<PlateStoreState<E>> = {}) =>
47 createAtomStore(
48 {
49 composing,
50 containerRef,
51 decorate,
52 editor,
53 isMounted,
54 primary,
55 readOnly,
56 renderChunk,
57 renderElement,
58 renderLeaf,
59 renderText,
60 scrollRef,
61 versionDecorate,
62 versionEditor,
63 versionSelection,
64 versionValue,
65 onChange,
66 onNodeChange,
67 onSelectionChange,
68 onTextChange,
69 onValueChange,
70 ...state,
71 } as PlateStoreState<E>,
72 {
73 name: 'plate',
74 suppressWarnings: true,
75 extend: (atoms) => ({
76 trackedEditor: atom((get) => ({
77 editor: get(atoms.editor),
78 version: get(atoms.versionEditor),
79 })),

Callers 1

Calls 1

getFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…