@portabletext/editor 1.44.13 → 1.44.14

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.
package/lib/index.d.cts CHANGED
@@ -7,12 +7,12 @@ import type {
7
7
  BlockStyleDefinition,
8
8
  KeyedSegment,
9
9
  ObjectSchemaType,
10
+ Path,
10
11
  PortableTextListBlock,
11
12
  PortableTextObject,
12
13
  TypedObject,
13
14
  } from '@sanity/types'
14
15
  import {
15
- Path,
16
16
  PortableTextBlock,
17
17
  PortableTextChild,
18
18
  PortableTextSpan,
package/lib/index.d.ts CHANGED
@@ -7,12 +7,12 @@ import type {
7
7
  BlockStyleDefinition,
8
8
  KeyedSegment,
9
9
  ObjectSchemaType,
10
+ Path,
10
11
  PortableTextListBlock,
11
12
  PortableTextObject,
12
13
  TypedObject,
13
14
  } from '@sanity/types'
14
15
  import {
15
- Path,
16
16
  PortableTextBlock,
17
17
  PortableTextChild,
18
18
  PortableTextSpan,
package/lib/index.js CHANGED
@@ -1,9 +1,11 @@
1
- import { getNodeBlock, getFirstBlock, getLastBlock, slateRangeToSelection, toSlateRange, debugWithName, EditorActorContext, fromSlateValue, KEY_TO_VALUE_ELEMENT, usePortableTextEditor, PortableTextEditor, moveRangeByOperation, isEqualToEmptyEditor, getEditorSnapshot, useEditor } from "./_chunks-es/editor-provider.js";
1
+ import { c } from "react-compiler-runtime";
2
+ import { useEffect, useContext, useRef, useState, useMemo, startTransition, useCallback, forwardRef, useImperativeHandle } from "react";
3
+ import { useEffectEvent } from "use-effect-event";
4
+ import { useEditor, getNodeBlock, getFirstBlock, getLastBlock, slateRangeToSelection, toSlateRange, debugWithName, EditorActorContext, fromSlateValue, KEY_TO_VALUE_ELEMENT, usePortableTextEditor, PortableTextEditor, moveRangeByOperation, isEqualToEmptyEditor, getEditorSnapshot } from "./_chunks-es/editor-provider.js";
2
5
  import { EditorProvider, defineSchema, defaultKeyGenerator, useEditorSelector, usePortableTextEditorSelection } from "./_chunks-es/editor-provider.js";
3
6
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
4
7
  import { useSelector, useActorRef } from "@xstate/react";
5
8
  import noop from "lodash/noop.js";
6
- import { useContext, useRef, useState, useEffect, useMemo, startTransition, useCallback, forwardRef, useImperativeHandle } from "react";
7
9
  import { Editor, Range, Element as Element$2, Text, Path, Transforms } from "slate";
8
10
  import { useSlateStatic, useSelected, ReactEditor, useSlate, Editable } from "slate-react";
9
11
  import { isSelectionCollapsed, getFocusTextBlock, getFocusSpan, getSelectedBlocks, isSelectionExpanded, getSelectionStartBlock, getSelectionEndBlock, isOverlappingSelection, getFocusBlock } from "./_chunks-es/selector.is-overlapping-selection.js";
@@ -15,10 +17,20 @@ import { parseBlocks } from "./_chunks-es/parse-blocks.js";
15
17
  import isEqual from "lodash/isEqual.js";
16
18
  import { isSelectingEntireBlocks } from "./_chunks-es/selector.is-selecting-entire-blocks.js";
17
19
  import { defineBehavior, isHotkey } from "./_chunks-es/behavior.core.js";
18
- import { c } from "react-compiler-runtime";
19
20
  import uniq from "lodash/uniq.js";
20
21
  import { setup, fromCallback, assign, assertEvent, and } from "xstate";
21
- import { useEffectEvent } from "use-effect-event";
22
+ function EditorEventListener(props) {
23
+ const $ = c(5), editor = useEditor(), on = useEffectEvent(props.on);
24
+ let t0;
25
+ $[0] !== editor || $[1] !== on ? (t0 = () => {
26
+ const subscription = editor.on("*", on);
27
+ return () => {
28
+ subscription.unsubscribe();
29
+ };
30
+ }, $[0] = editor, $[1] = on, $[2] = t0) : t0 = $[2];
31
+ let t1;
32
+ return $[3] !== editor ? (t1 = [editor], $[3] = editor, $[4] = t1) : t1 = $[4], useEffect(t0, t1), null;
33
+ }
22
34
  function getCompoundClientRect(nodes) {
23
35
  if (nodes.length === 0)
24
36
  return new DOMRect(0, 0, 0, 0);
@@ -1599,18 +1611,6 @@ const debug = debugWithName("component:Editable"), PLACEHOLDER_STYLE = {
1599
1611
  ) : null;
1600
1612
  });
1601
1613
  PortableTextEditable.displayName = "ForwardRef(PortableTextEditable)";
1602
- function EditorEventListener(props) {
1603
- const $ = c(5), editor = useEditor(), on = useEffectEvent(props.on);
1604
- let t0;
1605
- $[0] !== editor || $[1] !== on ? (t0 = () => {
1606
- const subscription = editor.on("*", on);
1607
- return () => {
1608
- subscription.unsubscribe();
1609
- };
1610
- }, $[0] = editor, $[1] = on, $[2] = t0) : t0 = $[2];
1611
- let t1;
1612
- return $[3] !== editor ? (t1 = [editor], $[3] = editor, $[4] = t1) : t1 = $[4], useEffect(t0, t1), null;
1613
- }
1614
1614
  export {
1615
1615
  EditorEventListener,
1616
1616
  EditorProvider,