@portabletext/editor 1.36.2 → 1.36.4
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/behavior.core.cjs.map +1 -1
- package/lib/_chunks-cjs/editor-provider.cjs +36 -36
- package/lib/_chunks-cjs/editor-provider.cjs.map +1 -1
- package/lib/_chunks-es/behavior.core.js.map +1 -1
- package/lib/_chunks-es/editor-provider.js +36 -36
- package/lib/_chunks-es/editor-provider.js.map +1 -1
- package/lib/behaviors/index.d.cts +5 -5
- package/lib/behaviors/index.d.ts +5 -5
- package/lib/index.d.cts +4 -4
- package/lib/index.d.ts +4 -4
- package/lib/plugins/index.d.cts +4 -4
- package/lib/plugins/index.d.ts +4 -4
- package/lib/selectors/index.d.cts +4 -4
- package/lib/selectors/index.d.ts +4 -4
- package/lib/utils/index.d.cts +4 -4
- package/lib/utils/index.d.ts +4 -4
- package/package.json +1 -1
- package/src/behavior-actions/behavior.actions.ts +10 -6
- package/src/behaviors/{behavior.foundational.ts → behavior.default.raise-soft-break.ts} +1 -3
- package/src/behaviors/behavior.default.ts +2 -0
- package/src/behaviors/behavior.types.ts +7 -10
- package/src/behaviors/index.ts +2 -2
- package/src/editor/editor-machine.ts +18 -22
- package/src/editor/plugins/createWithUndoRedo.ts +10 -13
- package/src/editor/with-applying-behavior-actions.ts +6 -9
|
@@ -19,23 +19,20 @@ export function isApplyingBehaviorActions(editor: Editor) {
|
|
|
19
19
|
|
|
20
20
|
////////
|
|
21
21
|
|
|
22
|
-
const
|
|
22
|
+
const CURRENT_BEHAVIOR_ACTION_SET: WeakMap<
|
|
23
23
|
Editor,
|
|
24
24
|
{actionSetId: string} | undefined
|
|
25
25
|
> = new WeakMap()
|
|
26
26
|
|
|
27
|
-
export function
|
|
28
|
-
editor
|
|
29
|
-
|
|
30
|
-
) {
|
|
31
|
-
const current = CURRENT_BEHAVIOR_ACTION_INTEND_SET.get(editor)
|
|
32
|
-
CURRENT_BEHAVIOR_ACTION_INTEND_SET.set(editor, {
|
|
27
|
+
export function withApplyingBehaviorActionSet(editor: Editor, fn: () => void) {
|
|
28
|
+
const current = CURRENT_BEHAVIOR_ACTION_SET.get(editor)
|
|
29
|
+
CURRENT_BEHAVIOR_ACTION_SET.set(editor, {
|
|
33
30
|
actionSetId: defaultKeyGenerator(),
|
|
34
31
|
})
|
|
35
32
|
withApplyingBehaviorActions(editor, fn)
|
|
36
|
-
|
|
33
|
+
CURRENT_BEHAVIOR_ACTION_SET.set(editor, current)
|
|
37
34
|
}
|
|
38
35
|
|
|
39
36
|
export function getCurrentBehaviorActionSetId(editor: Editor) {
|
|
40
|
-
return
|
|
37
|
+
return CURRENT_BEHAVIOR_ACTION_SET.get(editor)?.actionSetId
|
|
41
38
|
}
|