@portabletext/editor 1.48.13 → 1.48.15
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-cjs/editor-provider.cjs +682 -609
- package/lib/_chunks-cjs/editor-provider.cjs.map +1 -1
- package/lib/_chunks-es/editor-provider.js +683 -610
- package/lib/_chunks-es/editor-provider.js.map +1 -1
- package/lib/behaviors/index.cjs.map +1 -1
- package/lib/behaviors/index.d.cts +226 -2772
- package/lib/behaviors/index.d.ts +226 -2772
- package/lib/behaviors/index.js.map +1 -1
- package/lib/index.cjs +22 -6
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +227 -2780
- package/lib/index.d.ts +227 -2780
- package/lib/index.js +23 -7
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.cjs +1 -7
- package/lib/plugins/index.cjs.map +1 -1
- package/lib/plugins/index.d.cts +226 -2785
- package/lib/plugins/index.d.ts +226 -2785
- package/lib/plugins/index.js +2 -8
- package/lib/plugins/index.js.map +1 -1
- package/lib/selectors/index.d.cts +225 -2771
- package/lib/selectors/index.d.ts +225 -2771
- package/lib/utils/index.d.cts +227 -2772
- package/lib/utils/index.d.ts +227 -2772
- package/package.json +1 -1
- package/src/behaviors/behavior.abstract.keyboard.ts +16 -0
- package/src/behaviors/{behavior.default.ts → behavior.abstract.ts} +3 -3
- package/src/behaviors/behavior.config.ts +7 -0
- package/src/behaviors/behavior.core.ts +6 -5
- package/src/behaviors/behavior.perform-event.ts +27 -51
- package/src/behaviors/behavior.types.action.ts +1 -11
- package/src/editor/PortableTextEditor.tsx +1 -1
- package/src/editor/components/Element.tsx +30 -4
- package/src/editor/create-editor.ts +17 -5
- package/src/editor/editor-machine.ts +23 -17
- package/src/editor/mutation-machine.ts +6 -6
- package/src/editor/plugins/create-with-event-listeners.ts +25 -25
- package/src/editor/plugins/createWithEditableAPI.ts +3 -3
- package/src/editor/plugins/createWithPatches.ts +13 -5
- package/src/editor/plugins/createWithPortableTextMarkModel.ts +5 -5
- package/src/editor/plugins/createWithUndoRedo.ts +8 -8
- package/src/editor/with-applying-behavior-operations.ts +18 -0
- package/src/editor/{with-applying-behavior-actions.ts → with-undo-step.ts} +1 -19
- package/src/index.ts +1 -1
- package/src/{behavior-actions/behavior.action.annotation.add.ts → operations/behavior.operation.annotation.add.ts} +7 -7
- package/src/{behavior-actions/behavior.action.annotation.remove.ts → operations/behavior.operation.annotation.remove.ts} +6 -6
- package/src/{behavior-actions/behavior.action.block.set.ts → operations/behavior.operation.block.set.ts} +14 -14
- package/src/{behavior-actions/behavior.action.block.unset.ts → operations/behavior.operation.block.unset.ts} +19 -17
- package/src/{behavior-actions/behavior.action.decorator.add.ts → operations/behavior.operation.decorator.add.ts} +10 -10
- package/src/operations/behavior.operation.delete.backward.ts +8 -0
- package/src/operations/behavior.operation.delete.block.ts +24 -0
- package/src/operations/behavior.operation.delete.forward.ts +8 -0
- package/src/{behavior-actions/behavior.action.delete.ts → operations/behavior.operation.delete.ts} +8 -8
- package/src/{behavior-actions/behavior.action.insert-inline-object.ts → operations/behavior.operation.insert-inline-object.ts} +11 -11
- package/src/{behavior-actions/behavior.action.insert-span.ts → operations/behavior.operation.insert-span.ts} +15 -15
- package/src/{behavior-actions/behavior.action.insert.block.ts → operations/behavior.operation.insert.block.ts} +8 -8
- package/src/operations/behavior.operation.insert.text.ts +17 -0
- package/src/operations/behavior.operation.move.backward.ts +12 -0
- package/src/operations/behavior.operation.move.block.ts +16 -0
- package/src/operations/behavior.operation.move.forward.ts +11 -0
- package/src/operations/behavior.operation.select.ts +15 -0
- package/src/operations/behavior.operations.ts +239 -0
- package/src/plugins/index.ts +0 -1
- package/src/priority/priority.core.ts +3 -0
- package/src/priority/priority.sort.test.ts +319 -0
- package/src/priority/priority.sort.ts +121 -0
- package/src/priority/priority.types.ts +24 -0
- package/src/behavior-actions/behavior.action.delete.backward.ts +0 -7
- package/src/behavior-actions/behavior.action.delete.block.ts +0 -24
- package/src/behavior-actions/behavior.action.delete.forward.ts +0 -7
- package/src/behavior-actions/behavior.action.insert.text.ts +0 -17
- package/src/behavior-actions/behavior.action.move.backward.ts +0 -12
- package/src/behavior-actions/behavior.action.move.block.ts +0 -16
- package/src/behavior-actions/behavior.action.move.forward.ts +0 -11
- package/src/behavior-actions/behavior.action.select.ts +0 -15
- package/src/behavior-actions/behavior.actions.ts +0 -219
- package/src/behaviors/behavior.default.raise-soft-break.ts +0 -14
- package/src/plugins/plugin.core.tsx +0 -9
package/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { c } from "react-compiler-runtime";
|
|
2
2
|
import { useEffect, useContext, useRef, useState, useMemo, startTransition, useCallback, forwardRef, useImperativeHandle } from "react";
|
|
3
3
|
import { useEffectEvent } from "use-effect-event";
|
|
4
|
-
import { useEditor, getNodeBlock, getFirstBlock, getLastBlock, slateRangeToSelection, toSlateRange, debugWithName, EditorActorContext, fromSlateValue, KEY_TO_VALUE_ELEMENT, usePortableTextEditor, PortableTextEditor, isHotkey, moveRangeByOperation, isEqualToEmptyEditor, getEditorSnapshot } from "./_chunks-es/editor-provider.js";
|
|
4
|
+
import { useEditor, getNodeBlock, getFirstBlock, getLastBlock, slateRangeToSelection, toSlateRange, debugWithName, EditorActorContext, createEditorPriority, corePriority, fromSlateValue, KEY_TO_VALUE_ELEMENT, usePortableTextEditor, PortableTextEditor, isHotkey, moveRangeByOperation, isEqualToEmptyEditor, getEditorSnapshot } from "./_chunks-es/editor-provider.js";
|
|
5
5
|
import { EditorProvider, defineSchema, defaultKeyGenerator, useEditorSelector, usePortableTextEditorSelection } from "./_chunks-es/editor-provider.js";
|
|
6
6
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
7
7
|
import { useSelector, useActorRef } from "@xstate/react";
|
|
@@ -436,14 +436,22 @@ const EMPTY_ANNOTATIONS = [], inlineBlockStyle = {
|
|
|
436
436
|
setDragPositionBlock(event_0.position.block);
|
|
437
437
|
}
|
|
438
438
|
}]]
|
|
439
|
-
})
|
|
439
|
+
}), priority = createEditorPriority({
|
|
440
|
+
reference: {
|
|
441
|
+
priority: corePriority,
|
|
442
|
+
importance: "lower"
|
|
443
|
+
}
|
|
444
|
+
}), behaviorConfig = {
|
|
445
|
+
behavior,
|
|
446
|
+
priority
|
|
447
|
+
};
|
|
440
448
|
return editorActor.send({
|
|
441
449
|
type: "add behavior",
|
|
442
|
-
|
|
450
|
+
behaviorConfig
|
|
443
451
|
}), () => {
|
|
444
452
|
editorActor.send({
|
|
445
453
|
type: "remove behavior",
|
|
446
|
-
|
|
454
|
+
behaviorConfig
|
|
447
455
|
});
|
|
448
456
|
};
|
|
449
457
|
}, [editorActor, element._key]), useEffect(() => {
|
|
@@ -460,14 +468,22 @@ const EMPTY_ANNOTATIONS = [], inlineBlockStyle = {
|
|
|
460
468
|
setDragPositionBlock(void 0);
|
|
461
469
|
}
|
|
462
470
|
}, forward(event_2)]]
|
|
463
|
-
})
|
|
471
|
+
}), priority_0 = createEditorPriority({
|
|
472
|
+
reference: {
|
|
473
|
+
priority: corePriority,
|
|
474
|
+
importance: "lower"
|
|
475
|
+
}
|
|
476
|
+
}), behaviorConfig_0 = {
|
|
477
|
+
behavior: behavior_0,
|
|
478
|
+
priority: priority_0
|
|
479
|
+
};
|
|
464
480
|
return editorActor.send({
|
|
465
481
|
type: "add behavior",
|
|
466
|
-
|
|
482
|
+
behaviorConfig: behaviorConfig_0
|
|
467
483
|
}), () => {
|
|
468
484
|
editorActor.send({
|
|
469
485
|
type: "remove behavior",
|
|
470
|
-
|
|
486
|
+
behaviorConfig: behaviorConfig_0
|
|
471
487
|
});
|
|
472
488
|
};
|
|
473
489
|
}, [editorActor]);
|