@portabletext/editor 6.6.7 → 6.6.9
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/_chunks-dts/behavior.types.action.d.ts +21 -21
- package/lib/index.js +10 -3
- package/lib/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
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
|
-
import * as
|
|
3
|
+
import * as xstate72 from "xstate";
|
|
4
4
|
import { ActorRef, ActorRefFrom, EventObject, Snapshot } from "xstate";
|
|
5
5
|
import * as react4 from "react";
|
|
6
6
|
import React$1, { BaseSyntheticEvent, ClipboardEvent as ClipboardEvent$1, FocusEvent, JSX, PropsWithChildren, ReactElement, RefObject, TextareaHTMLAttributes } from "react";
|
|
@@ -1448,7 +1448,7 @@ type EditorActor = ActorRefFrom<typeof editorMachine>;
|
|
|
1448
1448
|
/**
|
|
1449
1449
|
* @internal
|
|
1450
1450
|
*/
|
|
1451
|
-
declare const editorMachine:
|
|
1451
|
+
declare const editorMachine: xstate72.StateMachine<{
|
|
1452
1452
|
behaviors: Set<BehaviorConfig>;
|
|
1453
1453
|
behaviorsSorted: boolean;
|
|
1454
1454
|
converters: Set<Converter>;
|
|
@@ -1509,52 +1509,52 @@ declare const editorMachine: xstate73.StateMachine<{
|
|
|
1509
1509
|
editor: PortableTextSlateEditor;
|
|
1510
1510
|
}, {}, never, {
|
|
1511
1511
|
type: "add behavior to context";
|
|
1512
|
-
params:
|
|
1512
|
+
params: xstate72.NonReducibleUnknown;
|
|
1513
1513
|
} | {
|
|
1514
1514
|
type: "remove behavior from context";
|
|
1515
|
-
params:
|
|
1515
|
+
params: xstate72.NonReducibleUnknown;
|
|
1516
1516
|
} | {
|
|
1517
1517
|
type: "add slate editor to context";
|
|
1518
|
-
params:
|
|
1518
|
+
params: xstate72.NonReducibleUnknown;
|
|
1519
1519
|
} | {
|
|
1520
1520
|
type: "emit patch event";
|
|
1521
|
-
params:
|
|
1521
|
+
params: xstate72.NonReducibleUnknown;
|
|
1522
1522
|
} | {
|
|
1523
1523
|
type: "emit mutation event";
|
|
1524
|
-
params:
|
|
1524
|
+
params: xstate72.NonReducibleUnknown;
|
|
1525
1525
|
} | {
|
|
1526
1526
|
type: "emit read only";
|
|
1527
|
-
params:
|
|
1527
|
+
params: xstate72.NonReducibleUnknown;
|
|
1528
1528
|
} | {
|
|
1529
1529
|
type: "emit editable";
|
|
1530
|
-
params:
|
|
1530
|
+
params: xstate72.NonReducibleUnknown;
|
|
1531
1531
|
} | {
|
|
1532
1532
|
type: "defer event";
|
|
1533
|
-
params:
|
|
1533
|
+
params: xstate72.NonReducibleUnknown;
|
|
1534
1534
|
} | {
|
|
1535
1535
|
type: "emit pending events";
|
|
1536
|
-
params:
|
|
1536
|
+
params: xstate72.NonReducibleUnknown;
|
|
1537
1537
|
} | {
|
|
1538
1538
|
type: "emit ready";
|
|
1539
|
-
params:
|
|
1539
|
+
params: xstate72.NonReducibleUnknown;
|
|
1540
1540
|
} | {
|
|
1541
1541
|
type: "clear pending events";
|
|
1542
|
-
params:
|
|
1542
|
+
params: xstate72.NonReducibleUnknown;
|
|
1543
1543
|
} | {
|
|
1544
1544
|
type: "discard conflicting pending patches";
|
|
1545
|
-
params:
|
|
1545
|
+
params: xstate72.NonReducibleUnknown;
|
|
1546
1546
|
} | {
|
|
1547
1547
|
type: "discard all pending events";
|
|
1548
|
-
params:
|
|
1548
|
+
params: xstate72.NonReducibleUnknown;
|
|
1549
1549
|
} | {
|
|
1550
1550
|
type: "defer incoming patches";
|
|
1551
|
-
params:
|
|
1551
|
+
params: xstate72.NonReducibleUnknown;
|
|
1552
1552
|
} | {
|
|
1553
1553
|
type: "emit pending incoming patches";
|
|
1554
|
-
params:
|
|
1554
|
+
params: xstate72.NonReducibleUnknown;
|
|
1555
1555
|
} | {
|
|
1556
1556
|
type: "clear pending incoming patches";
|
|
1557
|
-
params:
|
|
1557
|
+
params: xstate72.NonReducibleUnknown;
|
|
1558
1558
|
} | {
|
|
1559
1559
|
type: "handle blur";
|
|
1560
1560
|
params: unknown;
|
|
@@ -1566,7 +1566,7 @@ declare const editorMachine: xstate73.StateMachine<{
|
|
|
1566
1566
|
params: unknown;
|
|
1567
1567
|
} | {
|
|
1568
1568
|
type: "sort behaviors";
|
|
1569
|
-
params:
|
|
1569
|
+
params: xstate72.NonReducibleUnknown;
|
|
1570
1570
|
}, {
|
|
1571
1571
|
type: "slate is busy";
|
|
1572
1572
|
params: unknown;
|
|
@@ -1595,7 +1595,7 @@ declare const editorMachine: xstate73.StateMachine<{
|
|
|
1595
1595
|
readOnly?: boolean;
|
|
1596
1596
|
schema: EditorSchema;
|
|
1597
1597
|
initialValue?: Array<PortableTextBlock>;
|
|
1598
|
-
},
|
|
1598
|
+
}, xstate72.NonReducibleUnknown, InternalPatchEvent | MutationEvent | PatchesEvent | {
|
|
1599
1599
|
type: "blurred";
|
|
1600
1600
|
event: react4.FocusEvent<HTMLDivElement, Element>;
|
|
1601
1601
|
} | {
|
|
@@ -1626,7 +1626,7 @@ declare const editorMachine: xstate73.StateMachine<{
|
|
|
1626
1626
|
} | {
|
|
1627
1627
|
type: "value changed";
|
|
1628
1628
|
value: Array<PortableTextBlock> | undefined;
|
|
1629
|
-
},
|
|
1629
|
+
}, xstate72.MetaObject, {
|
|
1630
1630
|
id: "editor";
|
|
1631
1631
|
states: {
|
|
1632
1632
|
readonly 'edit mode': {
|
package/lib/index.js
CHANGED
|
@@ -1046,7 +1046,7 @@ typeof globalThis < "u" && globalThis.InputEvent && typeof globalThis.InputEvent
|
|
|
1046
1046
|
return current;
|
|
1047
1047
|
if (current.parentElement)
|
|
1048
1048
|
current = current.parentElement;
|
|
1049
|
-
else if (current.parentNode
|
|
1049
|
+
else if (isShadowRoot(current.parentNode))
|
|
1050
1050
|
current = current.parentNode.host;
|
|
1051
1051
|
else
|
|
1052
1052
|
return null;
|
|
@@ -1062,12 +1062,12 @@ typeof globalThis < "u" && globalThis.InputEvent && typeof globalThis.InputEvent
|
|
|
1062
1062
|
if (current === parent)
|
|
1063
1063
|
return !0;
|
|
1064
1064
|
if (current.parentNode)
|
|
1065
|
-
|
|
1065
|
+
isShadowRoot(current.parentNode) ? current = current.parentNode.host : current = current.parentNode;
|
|
1066
1066
|
else
|
|
1067
1067
|
return !1;
|
|
1068
1068
|
}
|
|
1069
1069
|
return !1;
|
|
1070
|
-
};
|
|
1070
|
+
}, isShadowRoot = (value) => isDOMNode(value) && value.nodeType === Node.DOCUMENT_FRAGMENT_NODE && "host" in value;
|
|
1071
1071
|
function getDomNodePath(domNode) {
|
|
1072
1072
|
let element = isDOMElement(domNode) ? domNode : domNode.parentElement;
|
|
1073
1073
|
if (element && !element.hasAttribute("data-pt-path") && (element = element.closest("[data-pt-path]")), !element)
|
|
@@ -17504,6 +17504,13 @@ const editorMachine = setup({
|
|
|
17504
17504
|
}) => event), assign({
|
|
17505
17505
|
lastEventWasFocused: !1
|
|
17506
17506
|
})]
|
|
17507
|
+
}, {
|
|
17508
|
+
// Without an unguarded fallback, a deduped `selection` event falls
|
|
17509
|
+
// through to the `'*'` wildcard below and gets emitted anyway,
|
|
17510
|
+
// defeating the dedupe above.
|
|
17511
|
+
actions: [assign({
|
|
17512
|
+
lastEventWasFocused: !1
|
|
17513
|
+
})]
|
|
17507
17514
|
}],
|
|
17508
17515
|
"*": {
|
|
17509
17516
|
actions: [emit(({
|