@portabletext/editor 6.5.0 → 6.5.2

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.
@@ -2,7 +2,7 @@ import * as _portabletext_schema6 from "@portabletext/schema";
2
2
  import { AnnotationDefinition, AnnotationSchemaType, AnnotationSchemaType as AnnotationSchemaType$1, BaseDefinition, BlockObjectDefinition, BlockObjectSchemaType, BlockObjectSchemaType as BlockObjectSchemaType$1, DecoratorDefinition, DecoratorSchemaType, DecoratorSchemaType as DecoratorSchemaType$1, FieldDefinition, InlineObjectDefinition, InlineObjectSchemaType, InlineObjectSchemaType as InlineObjectSchemaType$1, ListDefinition, ListSchemaType, ListSchemaType as ListSchemaType$1, PortableTextBlock, PortableTextBlock as PortableTextBlock$1, PortableTextChild, PortableTextChild as PortableTextChild$1, PortableTextObject, PortableTextObject as PortableTextObject$1, PortableTextSpan, PortableTextSpan as PortableTextSpan$1, PortableTextTextBlock, PortableTextTextBlock as PortableTextTextBlock$1, Schema, SchemaDefinition, SchemaDefinition as SchemaDefinition$1, StyleDefinition, StyleSchemaType, StyleSchemaType as StyleSchemaType$1, TypedObject, defineSchema } from "@portabletext/schema";
3
3
  import * as xstate73 from "xstate";
4
4
  import { ActorRef, ActorRefFrom, EventObject, Snapshot } from "xstate";
5
- import * as react4 from "react";
5
+ import * as react6 from "react";
6
6
  import React$1, { BaseSyntheticEvent, ClipboardEvent as ClipboardEvent$1, FocusEvent, JSX, PropsWithChildren, ReactElement, RefObject, TextareaHTMLAttributes } from "react";
7
7
  import { Patch, Patch as Patch$1 } from "@portabletext/patches";
8
8
  type MIMEType = `${string}/${string}`;
@@ -999,7 +999,7 @@ type PortableTextEditableProps = Omit<TextareaHTMLAttributes<HTMLDivElement>, 'o
999
999
  * ```
1000
1000
  * @group Components
1001
1001
  */
1002
- declare const PortableTextEditable: react4.ForwardRefExoticComponent<Omit<PortableTextEditableProps, "ref"> & react4.RefAttributes<Omit<HTMLDivElement, "as" | "onPaste" | "onBeforeInput">>>;
1002
+ declare const PortableTextEditable: react6.ForwardRefExoticComponent<Omit<PortableTextEditableProps, "ref"> & react6.RefAttributes<Omit<HTMLDivElement, "as" | "onPaste" | "onBeforeInput">>>;
1003
1003
  /** @beta */
1004
1004
  interface EditableAPIDeleteOptions {
1005
1005
  mode?: 'blocks' | 'children' | 'selected';
@@ -1635,7 +1635,7 @@ declare const editorMachine: xstate73.StateMachine<{
1635
1635
  initialValue?: Array<PortableTextBlock>;
1636
1636
  }, xstate73.NonReducibleUnknown, InternalPatchEvent | MutationEvent | PatchesEvent | {
1637
1637
  type: "blurred";
1638
- event: react4.FocusEvent<HTMLDivElement, Element>;
1638
+ event: react6.FocusEvent<HTMLDivElement, Element>;
1639
1639
  } | {
1640
1640
  type: "done loading";
1641
1641
  } | {
@@ -1647,7 +1647,7 @@ declare const editorMachine: xstate73.StateMachine<{
1647
1647
  data: unknown;
1648
1648
  } | {
1649
1649
  type: "focused";
1650
- event: react4.FocusEvent<HTMLDivElement, Element>;
1650
+ event: react6.FocusEvent<HTMLDivElement, Element>;
1651
1651
  } | {
1652
1652
  type: "invalid value";
1653
1653
  resolution: InvalidValueResolution | null;
package/lib/index.js CHANGED
@@ -4399,7 +4399,7 @@ const RestoreDOM = IS_ANDROID ? RestoreDOMComponent : ({
4399
4399
  }
4400
4400
  for (const op of deferredOperations.current)
4401
4401
  op();
4402
- deferredOperations.current = [], ReactEditor.isFocused(editor) || handleNativeHistoryEvents(editor, editorActor, event.nativeEvent);
4402
+ deferredOperations.current = [], !ReactEditor.isFocused(editor) && isDOMNode(event.target) && DOMEditor.hasEditableTarget(editor, event.target) && handleNativeHistoryEvents(editor, editorActor, event.nativeEvent);
4403
4403
  }
4404
4404
  }, [attributes.onInput, editor, editorActor]),
4405
4405
  onBlur: useCallback((event) => {
@@ -13218,6 +13218,10 @@ const addAnnotationOperationImplementation = ({
13218
13218
  const filteredProps = {};
13219
13219
  for (const key of Object.keys(operation.props))
13220
13220
  if (!(key === "_type" || key === "children")) {
13221
+ if (key === "_key") {
13222
+ filteredProps[key] = operation.props[key];
13223
+ continue;
13224
+ }
13221
13225
  if (key === "style") {
13222
13226
  context.schema.styles.some((style) => style.name === operation.props[key]) && (filteredProps[key] = operation.props[key]);
13223
13227
  continue;