@lofcz/platejs-core 52.3.4 → 53.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- import { Gt as getEditorPlugin$1, Kt as createSlatePlugin, Pt as BaseParagraphPlugin, Z as DOMPlugin, dt as getPluginNodeProps, f as isEditOnly, n as withSlate, s as SlateExtensionPlugin, tt as ChunkingPlugin, ut as getSlateClass, zt as getPluginByType } from "../withSlate-1B0SfAWG.js";
1
+ import { Ht as BaseParagraphPlugin, at as DOMPlugin, cn as createSlatePlugin, lt as ChunkingPlugin, n as withSlate, p as isEditOnly, s as SlateExtensionPlugin, sn as getEditorPlugin$1, tn as getPluginByType, vt as getSlateClass, y as NavigationFeedbackPlugin$1, yt as getPluginNodeProps } from "../withSlate-DsAgt7dN.js";
2
2
  import { t as Hotkeys } from "../hotkeys-DI1HPO2Q.js";
3
- import { A as pipeInjectNodeProps, C as createStaticEditor, k as pipeDecorate, s as PlateStatic } from "../static-CVN6JhaR.js";
3
+ import { A as pipeInjectNodeProps, C as createStaticEditor, k as pipeDecorate, s as PlateStatic } from "../static-HrbPXDQ1.js";
4
4
  import { PathApi, createEditor } from "@platejs/slate";
5
5
  import { isDefined } from "@udecode/utils";
6
6
  import { DefaultPlaceholder, Editable, Slate, useComposing, useFocused, useReadOnly, useSelected, useSlateStatic, withReact } from "slate-react";
@@ -269,6 +269,44 @@ const useFocusedLast = (id) => {
269
269
  return (id ?? useEditorId()) === useEventEditorValue("last");
270
270
  };
271
271
 
272
+ //#endregion
273
+ //#region src/react/plugins/navigation-feedback/useNavigationHighlight.ts
274
+ const useNavigationHighlight = (target) => {
275
+ const targetRef = React.useRef(target);
276
+ targetRef.current = target;
277
+ return useEditorSelector((editor) => {
278
+ const activeTarget = editor.api.navigation.activeTarget();
279
+ if (!activeTarget) return null;
280
+ const currentTarget = targetRef.current;
281
+ if (!currentTarget) return null;
282
+ const resolvedPath = Array.isArray(currentTarget) ? currentTarget : editor.api.findPath(currentTarget);
283
+ if (!resolvedPath) return null;
284
+ if (!PathApi.equals(activeTarget.path, resolvedPath)) return null;
285
+ return activeTarget;
286
+ }, [target]);
287
+ };
288
+
289
+ //#endregion
290
+ //#region src/react/plugins/navigation-feedback/NavigationFeedbackPlugin.ts
291
+ const NavigationFeedbackPlugin = toTPlatePlugin(NavigationFeedbackPlugin$1, { inject: {
292
+ isElement: true,
293
+ nodeProps: { transformProps: ({ element, props, text }) => {
294
+ const activeTarget = useNavigationHighlight(element ?? text);
295
+ if (!activeTarget) return props;
296
+ return {
297
+ ...props,
298
+ "data-nav-cycle": String(activeTarget.cycle),
299
+ "data-nav-highlight": activeTarget.variant,
300
+ "data-nav-pulse": String(activeTarget.pulse),
301
+ "data-nav-target": "true",
302
+ style: {
303
+ ...props.style ?? {},
304
+ "--plate-nav-feedback-duration": `${activeTarget.duration}ms`
305
+ }
306
+ };
307
+ } }
308
+ } });
309
+
272
310
  //#endregion
273
311
  //#region src/react/plugins/paragraph/ParagraphPlugin.tsx
274
312
  const ParagraphPlugin = toPlatePlugin(BaseParagraphPlugin, ({ editor, type }) => ({ shortcuts: { toggleParagraph: {
@@ -301,10 +339,14 @@ const ReactPlugin = toPlatePlugin(DOMPlugin, {
301
339
 
302
340
  //#endregion
303
341
  //#region src/react/editor/getPlateCorePlugins.ts
304
- const getPlateCorePlugins = () => [
342
+ const getPlateCorePlugins = ({ navigationFeedback } = {}) => [
305
343
  SlateReactExtensionPlugin,
306
344
  ReactPlugin,
307
345
  EventEditorPlugin,
346
+ NavigationFeedbackPlugin.configure({
347
+ enabled: navigationFeedback !== false,
348
+ options: typeof navigationFeedback === "boolean" ? void 0 : navigationFeedback
349
+ }),
308
350
  ParagraphPlugin
309
351
  ];
310
352
 
@@ -321,11 +363,12 @@ const getPlateCorePlugins = () => [
321
363
  * @see {@link withSlate} for the non-React version of editor enhancement.
322
364
  */
323
365
  const withPlate = (e, options = {}) => {
324
- const { optionsStoreFactory, plugins = [], ...rest } = options;
366
+ const { navigationFeedback, optionsStoreFactory, plugins = [], ...rest } = options;
325
367
  return withSlate(e, {
368
+ navigationFeedback,
326
369
  ...rest,
327
370
  optionsStoreFactory: optionsStoreFactory ?? createZustandStore,
328
- plugins: [...getPlateCorePlugins(), ...plugins]
371
+ plugins: [...getPlateCorePlugins({ navigationFeedback }), ...plugins]
329
372
  });
330
373
  };
331
374
  /**
@@ -2578,5 +2621,4 @@ const withHOC = (HOC, Component, hocProps, hocRef) => React.forwardRef((props, c
2578
2621
  });
2579
2622
 
2580
2623
  //#endregion
2581
- export { BLUR_EDITOR_EVENT, BelowRootNodes, ContentVisibilityChunk, DOM_HANDLERS, DefaultPlaceholder, Editable, EditorHotkeysEffect, EditorMethodsEffect, EditorRefEffect, EditorRefPluginEffect, ElementProvider, EventEditorPlugin, EventEditorStore, FOCUS_EDITOR_EVENT, GLOBAL_PLATE_SCOPE, PLATE_SCOPE, ParagraphPlugin, Plate, PlateContainer, PlateContent, PlateController, PlateControllerEffect, PlateElement, PlateLeaf, PlateSlate, PlateStoreProvider, PlateTest, PlateText, PlateView, ReactPlugin, SCOPE_ELEMENT, Slate, SlateReactExtensionPlugin, atom, convertDomEventToSyntheticEvent, createAtomStore, createPlateEditor, createPlateFallbackEditor, createPlatePlugin, createPlateStore, createTPlatePlugin, createZustandStore, elementStore, getEditorPlugin, getEventPlateId, getPlateCorePlugins, getPlugin, getRenderNodeProps, isEventHandled, omitPluginContext, pipeHandler, pipeOnChange, pipeRenderElement, pipeRenderLeaf, pipeRenderText, plateControllerStore, plateStore, pluginRenderElement, pluginRenderLeaf, pluginRenderText, toPlatePlugin, toTPlatePlugin, useComposing, useEditableProps, useEditorComposing, useEditorContainerRef, useEditorId, useEditorMounted, useEditorPlugin, useEditorPluginOption, useEditorPluginOptions, useEditorReadOnly, useEditorRef, useEditorScrollRef, useEditorSelection, useEditorSelector, useEditorState, useEditorValue, useEditorVersion, useElement, useElementSelector, useElementStore, useEventEditorValue, useEventPlateId, useFocusEditorEvents, useFocused, useFocusedLast, useIncrementVersion, useNodeAttributes, useNodePath, usePath, usePlateControllerExists, usePlateControllerLocalStore, usePlateControllerStore, usePlateEditor, usePlateLocalStore, usePlateSet, usePlateState, usePlateStore, usePlateValue, usePlateViewEditor, usePluginOption, usePluginOptions, useReadOnly, useRedecorate, useScrollRef, useSelected, useSelectionVersion, useSlateProps, useSlateStatic, useStoreAtomState, useStoreAtomValue, useStoreSelect, useStoreSetAtom, useStoreState, useStoreValue, useTracked, useTrackedStore, useValueVersion, withHOC, withPlate, withPlateReact, withReact };
2582
- //# sourceMappingURL=index.js.map
2624
+ export { BLUR_EDITOR_EVENT, BelowRootNodes, ContentVisibilityChunk, DOM_HANDLERS, DefaultPlaceholder, Editable, EditorHotkeysEffect, EditorMethodsEffect, EditorRefEffect, EditorRefPluginEffect, ElementProvider, EventEditorPlugin, EventEditorStore, FOCUS_EDITOR_EVENT, GLOBAL_PLATE_SCOPE, NavigationFeedbackPlugin, PLATE_SCOPE, ParagraphPlugin, Plate, PlateContainer, PlateContent, PlateController, PlateControllerEffect, PlateElement, PlateLeaf, PlateSlate, PlateStoreProvider, PlateTest, PlateText, PlateView, ReactPlugin, SCOPE_ELEMENT, Slate, SlateReactExtensionPlugin, atom, convertDomEventToSyntheticEvent, createAtomStore, createPlateEditor, createPlateFallbackEditor, createPlatePlugin, createPlateStore, createTPlatePlugin, createZustandStore, elementStore, getEditorPlugin, getEventPlateId, getPlateCorePlugins, getPlugin, getRenderNodeProps, isEventHandled, omitPluginContext, pipeHandler, pipeOnChange, pipeRenderElement, pipeRenderLeaf, pipeRenderText, plateControllerStore, plateStore, pluginRenderElement, pluginRenderLeaf, pluginRenderText, toPlatePlugin, toTPlatePlugin, useComposing, useEditableProps, useEditorComposing, useEditorContainerRef, useEditorId, useEditorMounted, useEditorPlugin, useEditorPluginOption, useEditorPluginOptions, useEditorReadOnly, useEditorRef, useEditorScrollRef, useEditorSelection, useEditorSelector, useEditorState, useEditorValue, useEditorVersion, useElement, useElementSelector, useElementStore, useEventEditorValue, useEventPlateId, useFocusEditorEvents, useFocused, useFocusedLast, useIncrementVersion, useNavigationHighlight, useNodeAttributes, useNodePath, usePath, usePlateControllerExists, usePlateControllerLocalStore, usePlateControllerStore, usePlateEditor, usePlateLocalStore, usePlateSet, usePlateState, usePlateStore, usePlateValue, usePlateViewEditor, usePluginOption, usePluginOptions, useReadOnly, useRedecorate, useScrollRef, useSelected, useSelectionVersion, useSlateProps, useSlateStatic, useStoreAtomState, useStoreAtomValue, useStoreSelect, useStoreSetAtom, useStoreState, useStoreValue, useTracked, useTrackedStore, useValueVersion, withHOC, withPlate, withPlateReact, withReact };
@@ -1,2 +1,2 @@
1
- import { Aa as PlateStatic, Ba as pluginRenderElementStatic, Bi as getSelectedDomFragment, Ca as SlateRenderLeafProps, Da as serializeHtml, Ea as SerializeHtmlOptions, Fa as SlateRenderLeaf, Fi as stripSlateDataAttributes, Gi as createStaticString, Hi as getRenderNodeStaticProps, Ia as pipeRenderLeafStatic, Ii as stripHtmlClassNames, Ki as getStaticPlugins, La as pluginRenderLeafStatic, Li as pipeDecorate, Ma as SlateRenderText, Na as pipeRenderTextStatic, Oa as ElementStatic, Pa as pluginRenderTextStatic, Ra as pipeRenderElementStatic, Ri as isSelectOutside, Sa as SlateRenderElementProps, Ta as SlateRenderTextProps, Ui as getNodeDataAttributes, Vi as getSelectedDomBlocks, Wi as getPluginDataAttributes, _a as StyledSlateElementProps, ba as useNodeAttributes, ca as getEditorDOMFromHtmlString, da as SlateHTMLProps, fa as SlateLeaf, ga as SlateTextProps, ha as SlateText, ja as PlateStaticProps, ka as LeafStatic, la as SlateElement, ma as SlateNodeProps, pa as SlateLeafProps, qi as ViewPlugin, sa as createStaticEditor, ua as SlateElementProps, va as StyledSlateLeafProps, wa as SlateRenderNodeProps, xa as BoxStaticProps, ya as StyledSlateTextProps, za as SlateRenderElement, zi as getSelectedDomNode } from "../index-NTp--CEF";
1
+ import { $a as SlateHTMLProps, Ba as getSelectedDomNode, Co as SlateRenderLeaf, Do as SlateRenderElement, Eo as pipeRenderElementStatic, Ga as getPluginDataAttributes, Ha as getSelectedDomBlocks, Ia as stripSlateDataAttributes, Ja as ViewPlugin, Ka as createStaticString, La as stripHtmlClassNames, Oo as pluginRenderElementStatic, Qa as SlateElementProps, Ra as pipeDecorate, So as pluginRenderTextStatic, To as pluginRenderLeafStatic, Ua as getRenderNodeStaticProps, Va as getSelectedDomFragment, Wa as getNodeDataAttributes, Xa as getEditorDOMFromHtmlString, Ya as createStaticEditor, Za as SlateElement, _o as LeafStatic, ao as StyledSlateElementProps, bo as SlateRenderText, co as useNodeAttributes, do as SlateRenderLeafProps, eo as SlateLeaf, fo as SlateRenderNodeProps, go as ElementStatic, ho as serializeHtml, io as SlateTextProps, lo as BoxStaticProps, mo as SerializeHtmlOptions, no as SlateNodeProps, oo as StyledSlateLeafProps, po as SlateRenderTextProps, qa as getStaticPlugins, ro as SlateText, so as StyledSlateTextProps, to as SlateLeafProps, uo as SlateRenderElementProps, vo as PlateStatic, wo as pipeRenderLeafStatic, xo as pipeRenderTextStatic, yo as PlateStaticProps, za as isSelectOutside } from "../index-C-LKDYK-";
2
2
  export { BoxStaticProps, ElementStatic, LeafStatic, PlateStatic, PlateStaticProps, SerializeHtmlOptions, SlateElement, SlateElementProps, SlateHTMLProps, SlateLeaf, SlateLeafProps, SlateNodeProps, SlateRenderElement, SlateRenderElementProps, SlateRenderLeaf, SlateRenderLeafProps, SlateRenderNodeProps, SlateRenderText, SlateRenderTextProps, SlateText, SlateTextProps, StyledSlateElementProps, StyledSlateLeafProps, StyledSlateTextProps, ViewPlugin, createStaticEditor, createStaticString, getEditorDOMFromHtmlString, getNodeDataAttributes, getPluginDataAttributes, getRenderNodeStaticProps, getSelectedDomBlocks, getSelectedDomFragment, getSelectedDomNode, getStaticPlugins, isSelectOutside, pipeDecorate, pipeRenderElementStatic, pipeRenderLeafStatic, pipeRenderTextStatic, pluginRenderElementStatic, pluginRenderLeafStatic, pluginRenderTextStatic, serializeHtml, stripHtmlClassNames, stripSlateDataAttributes, useNodeAttributes };
@@ -1,4 +1,4 @@
1
- import "../withSlate-1B0SfAWG.js";
2
- import { C as createStaticEditor, D as getSelectedDomNode, E as isSelectOutside, O as getSelectedDomFragment, S as useNodeAttributes, T as ViewPlugin, _ as getPluginDataAttributes, a as ElementStatic, b as SlateLeaf, c as pipeRenderTextStatic, d as pluginRenderElementStatic, f as stripSlateDataAttributes, g as getNodeDataAttributes, h as getRenderNodeStaticProps, i as pluginRenderLeafStatic, k as pipeDecorate, l as pluginRenderTextStatic, m as getSelectedDomBlocks, n as serializeHtml, o as LeafStatic, p as stripHtmlClassNames, r as pipeRenderLeafStatic, s as PlateStatic, t as getEditorDOMFromHtmlString, u as pipeRenderElementStatic, v as createStaticString, w as getStaticPlugins, x as SlateText, y as SlateElement } from "../static-CVN6JhaR.js";
1
+ import "../withSlate-DsAgt7dN.js";
2
+ import { C as createStaticEditor, D as getSelectedDomNode, E as isSelectOutside, O as getSelectedDomFragment, S as useNodeAttributes, T as ViewPlugin, _ as getPluginDataAttributes, a as ElementStatic, b as SlateLeaf, c as pipeRenderTextStatic, d as pluginRenderElementStatic, f as stripSlateDataAttributes, g as getNodeDataAttributes, h as getRenderNodeStaticProps, i as pluginRenderLeafStatic, k as pipeDecorate, l as pluginRenderTextStatic, m as getSelectedDomBlocks, n as serializeHtml, o as LeafStatic, p as stripHtmlClassNames, r as pipeRenderLeafStatic, s as PlateStatic, t as getEditorDOMFromHtmlString, u as pipeRenderElementStatic, v as createStaticString, w as getStaticPlugins, x as SlateText, y as SlateElement } from "../static-HrbPXDQ1.js";
3
3
 
4
4
  export { ElementStatic, LeafStatic, PlateStatic, SlateElement, SlateLeaf, SlateText, ViewPlugin, createStaticEditor, createStaticString, getEditorDOMFromHtmlString, getNodeDataAttributes, getPluginDataAttributes, getRenderNodeStaticProps, getSelectedDomBlocks, getSelectedDomFragment, getSelectedDomNode, getStaticPlugins, isSelectOutside, pipeDecorate, pipeRenderElementStatic, pipeRenderLeafStatic, pipeRenderTextStatic, pluginRenderElementStatic, pluginRenderLeafStatic, pluginRenderTextStatic, serializeHtml, stripHtmlClassNames, stripSlateDataAttributes, useNodeAttributes };
@@ -1,4 +1,4 @@
1
- import { Gt as getEditorPlugin, Z as DOMPlugin, dt as getPluginNodeProps, f as isEditOnly, ht as getInjectMatch, n as withSlate, pt as keyToDataAttribute, ut as getSlateClass, zt as getPluginByType } from "./withSlate-1B0SfAWG.js";
1
+ import { Ct as getInjectMatch, at as DOMPlugin, n as withSlate, p as isEditOnly, sn as getEditorPlugin, tn as getPluginByType, vt as getSlateClass, xt as keyToDataAttribute, yt as getPluginNodeProps } from "./withSlate-DsAgt7dN.js";
2
2
  import { ElementApi, NodeApi, RangeApi, TextApi, createEditor, isElementDecorationsEqual, isTextDecorationsEqual } from "@platejs/slate";
3
3
  import { isDefined } from "@udecode/utils";
4
4
  import React from "react";
@@ -20,7 +20,7 @@ const pluginInjectNodeProps = (editor, plugin, nodeProps, getElementPath) => {
20
20
  if (!node) return;
21
21
  if (!injectNodeProps) return;
22
22
  const { classNames, defaultNodeValue, nodeKey = editor.getType(key), query, styleKey = nodeKey, transformClassName, transformNodeValue, transformProps, transformStyle, validNodeValues } = injectNodeProps;
23
- if (!getInjectMatch(editor, plugin)(node, getElementPath(node))) return;
23
+ if (!getInjectMatch(editor, plugin)(node, !!(plugin.inject.excludeBelowPlugins || plugin.inject.maxLevel) ? getElementPath(node) : void 0)) return;
24
24
  const queryResult = query?.({
25
25
  ...injectNodeProps,
26
26
  ...getEditorPlugin(editor, plugin),
@@ -288,7 +288,7 @@ const getPluginDataAttributes = (editor, plugin, node) => {
288
288
 
289
289
  //#endregion
290
290
  //#region src/static/utils/getRenderNodeStaticProps.ts
291
- const getRenderNodeStaticProps = ({ attributes: nodeAttributes, editor, node, plugin, props }) => {
291
+ const getRenderNodeStaticProps = ({ attributes: nodeAttributes, editor, node, path, plugin, props }) => {
292
292
  let newProps = {
293
293
  ...props,
294
294
  ...plugin ? getEditorPlugin(editor, plugin) : {
@@ -311,7 +311,7 @@ const getRenderNodeStaticProps = ({ attributes: nodeAttributes, editor, node, pl
311
311
  className: clsx$1(getSlateClass(plugin?.node.type), className) || void 0
312
312
  }
313
313
  };
314
- newProps = pipeInjectNodeProps(editor, newProps, (node$1) => editor.api.findPath(node$1));
314
+ newProps = pipeInjectNodeProps(editor, newProps, path ? () => path : (node$1) => editor.api.findPath(node$1));
315
315
  if (newProps.style && Object.keys(newProps.style).length === 0) newProps.style = void 0;
316
316
  return newProps;
317
317
  };
@@ -363,6 +363,7 @@ const pluginRenderElementStatic = (editor, plugin) => function render(nodeProps)
363
363
  },
364
364
  editor,
365
365
  node: element,
366
+ path: nodeProps.path,
366
367
  plugin,
367
368
  props: nodeProps
368
369
  });
@@ -409,6 +410,7 @@ const pipeRenderElementStatic = (editor, { renderElement: renderElementProp } =
409
410
  if (renderElementProp) return renderElementProp(props);
410
411
  const ctxProps = getRenderNodeStaticProps({
411
412
  editor,
413
+ path: props.path,
412
414
  props: { ...props }
413
415
  });
414
416
  return /* @__PURE__ */ React.createElement(SlateElement, ctxProps, props.children, editor.meta.pluginCache.render.belowRootNodes.map((key) => {
@@ -431,6 +433,7 @@ const pluginRenderTextStatic = (editor, plugin) => function render(nodeProps) {
431
433
  attributes: { ...text.attributes },
432
434
  editor,
433
435
  node: text,
436
+ path: nodeProps.path,
434
437
  plugin,
435
438
  props: nodeProps
436
439
  });
@@ -475,6 +478,7 @@ const pipeRenderTextStatic = (editor, { renderText: renderTextProp } = {}) => {
475
478
  });
476
479
  const ctxProps = getRenderNodeStaticProps({
477
480
  editor,
481
+ path: props.path,
478
482
  props: {
479
483
  attributes,
480
484
  ...props
@@ -497,7 +501,7 @@ const pipeRenderTextStatic = (editor, { renderText: renderTextProp } = {}) => {
497
501
  function BaseElementStatic({ decorate, decorations, editor, element = {
498
502
  children: [],
499
503
  type: ""
500
- } }) {
504
+ }, path }) {
501
505
  const renderElement = pipeRenderElementStatic(editor);
502
506
  const attributes = {
503
507
  "data-slate-node": "element",
@@ -506,7 +510,8 @@ function BaseElementStatic({ decorate, decorations, editor, element = {
506
510
  let children = /* @__PURE__ */ React.createElement(Children, {
507
511
  decorate,
508
512
  decorations,
509
- editor
513
+ editor,
514
+ parentPath: path
510
515
  }, element.children);
511
516
  if (editor.api.isVoid(element)) {
512
517
  attributes["data-slate-void"] = true;
@@ -521,18 +526,20 @@ function BaseElementStatic({ decorate, decorations, editor, element = {
521
526
  }, /* @__PURE__ */ React.createElement(Children, {
522
527
  decorate,
523
528
  decorations,
524
- editor
529
+ editor,
530
+ parentPath: path
525
531
  }, element.children));
526
532
  }
527
533
  if (editor.api.isInline(element)) attributes["data-slate-inline"] = true;
528
534
  return /* @__PURE__ */ React.createElement(React.Fragment, null, renderElement?.({
529
535
  attributes,
530
536
  children,
531
- element
537
+ element,
538
+ path
532
539
  }));
533
540
  }
534
541
  const ElementStatic = React.memo(BaseElementStatic, (prev, next) => (prev.element === next.element || prev.element._memo !== void 0 && prev.element._memo === next.element._memo) && isElementDecorationsEqual(prev.decorations, next.decorations));
535
- function BaseLeafStatic({ decorations, editor, text = { text: "" } }) {
542
+ function BaseLeafStatic({ decorations, editor, path, text = { text: "" } }) {
536
543
  const renderLeaf = pipeRenderLeafStatic(editor);
537
544
  const renderText = pipeRenderTextStatic(editor);
538
545
  const leafElements = TextApi.decorations(text, decorations).map(({ leaf, position }, index) => {
@@ -541,6 +548,7 @@ function BaseLeafStatic({ decorations, editor, text = { text: "" } }) {
541
548
  children: /* @__PURE__ */ React.createElement("span", { "data-slate-string": true }, leaf.text === "" ? "" : leaf.text),
542
549
  leaf,
543
550
  leafPosition: position,
551
+ path,
544
552
  text: leaf
545
553
  });
546
554
  return /* @__PURE__ */ React.createElement(React.Fragment, { key: index }, leafElement);
@@ -551,6 +559,7 @@ function BaseLeafStatic({ decorations, editor, text = { text: "" } }) {
551
559
  ref: null
552
560
  },
553
561
  children: leafElements,
562
+ path,
554
563
  text
555
564
  });
556
565
  }
@@ -558,12 +567,12 @@ const LeafStatic = React.memo(BaseLeafStatic, (prev, next) => {
558
567
  return TextApi.equals(next.text, prev.text) && isTextDecorationsEqual(next.decorations, prev.decorations);
559
568
  });
560
569
  const defaultDecorate = () => [];
561
- function Children({ children = [], decorate = defaultDecorate, decorations = [], editor }) {
570
+ function Children({ children = [], decorate = defaultDecorate, decorations = [], editor, parentPath = [] }) {
562
571
  return /* @__PURE__ */ React.createElement(React.Fragment, null, children.map((child, i) => {
563
- const p = editor.api.findPath(child);
572
+ const p = [...parentPath, i];
564
573
  let ds = [];
565
- if (p) {
566
- const range = editor.api.range(p);
574
+ const range = editor.api.range(p);
575
+ if (range) {
567
576
  ds = decorate([child, p]);
568
577
  for (const dec of decorations) {
569
578
  const d = RangeApi.intersection(dec, range);
@@ -575,11 +584,13 @@ function Children({ children = [], decorate = defaultDecorate, decorations = [],
575
584
  decorate,
576
585
  decorations: ds,
577
586
  editor,
578
- element: child
587
+ element: child,
588
+ path: p
579
589
  }) : /* @__PURE__ */ React.createElement(LeafStatic, {
580
590
  key: i,
581
591
  decorations: ds,
582
592
  editor,
593
+ path: p,
583
594
  text: child
584
595
  });
585
596
  }));
@@ -627,6 +638,7 @@ const pluginRenderLeafStatic = (editor, plugin) => function render(props) {
627
638
  attributes: { ...leaf.attributes },
628
639
  editor,
629
640
  node: leaf,
641
+ path: props.path,
630
642
  plugin,
631
643
  props
632
644
  });
@@ -671,6 +683,7 @@ const pipeRenderLeafStatic = (editor, { renderLeaf: renderLeafProp } = {}) => {
671
683
  });
672
684
  const ctxProps = getRenderNodeStaticProps({
673
685
  editor,
686
+ path: props.path,
674
687
  props: {
675
688
  attributes,
676
689
  ...props
@@ -724,5 +737,4 @@ const getEditorDOMFromHtmlString = (html) => {
724
737
  };
725
738
 
726
739
  //#endregion
727
- export { pipeInjectNodeProps as A, createStaticEditor as C, getSelectedDomNode as D, isSelectOutside as E, getSelectedDomFragment as O, useNodeAttributes as S, ViewPlugin as T, getPluginDataAttributes as _, ElementStatic as a, SlateLeaf as b, pipeRenderTextStatic as c, pluginRenderElementStatic as d, stripSlateDataAttributes as f, getNodeDataAttributes as g, getRenderNodeStaticProps as h, pluginRenderLeafStatic as i, pipeDecorate as k, pluginRenderTextStatic as l, getSelectedDomBlocks as m, serializeHtml as n, LeafStatic as o, stripHtmlClassNames as p, pipeRenderLeafStatic as r, PlateStatic as s, getEditorDOMFromHtmlString as t, pipeRenderElementStatic as u, createStaticString as v, getStaticPlugins as w, SlateText as x, SlateElement as y };
728
- //# sourceMappingURL=static-CVN6JhaR.js.map
740
+ export { pipeInjectNodeProps as A, createStaticEditor as C, getSelectedDomNode as D, isSelectOutside as E, getSelectedDomFragment as O, useNodeAttributes as S, ViewPlugin as T, getPluginDataAttributes as _, ElementStatic as a, SlateLeaf as b, pipeRenderTextStatic as c, pluginRenderElementStatic as d, stripSlateDataAttributes as f, getNodeDataAttributes as g, getRenderNodeStaticProps as h, pluginRenderLeafStatic as i, pipeDecorate as k, pluginRenderTextStatic as l, getSelectedDomBlocks as m, serializeHtml as n, LeafStatic as o, stripHtmlClassNames as p, pipeRenderLeafStatic as r, PlateStatic as s, getEditorDOMFromHtmlString as t, pipeRenderElementStatic as u, createStaticString as v, getStaticPlugins as w, SlateText as x, SlateElement as y };