@portabletext/editor 1.24.0 → 1.26.0
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 +283 -64
- package/lib/_chunks-cjs/behavior.core.cjs.map +1 -1
- package/lib/_chunks-cjs/selector.get-text-before.cjs +8 -8
- package/lib/_chunks-cjs/selector.get-text-before.cjs.map +1 -1
- package/lib/_chunks-cjs/selector.is-at-the-start-of-block.cjs +412 -0
- package/lib/_chunks-cjs/selector.is-at-the-start-of-block.cjs.map +1 -0
- package/lib/_chunks-cjs/util.is-empty-text-block.cjs +2 -2
- package/lib/_chunks-cjs/util.is-empty-text-block.cjs.map +1 -1
- package/lib/_chunks-cjs/util.is-equal-selection-points.cjs +46 -0
- package/lib/_chunks-cjs/util.is-equal-selection-points.cjs.map +1 -0
- package/lib/_chunks-cjs/util.reverse-selection.cjs +0 -16
- package/lib/_chunks-cjs/util.reverse-selection.cjs.map +1 -1
- package/lib/_chunks-es/behavior.core.js +259 -40
- package/lib/_chunks-es/behavior.core.js.map +1 -1
- package/lib/_chunks-es/selector.get-text-before.js +2 -2
- package/lib/_chunks-es/selector.is-at-the-start-of-block.js +414 -0
- package/lib/_chunks-es/selector.is-at-the-start-of-block.js.map +1 -0
- package/lib/_chunks-es/util.is-empty-text-block.js +1 -1
- package/lib/_chunks-es/util.is-equal-selection-points.js +47 -0
- package/lib/_chunks-es/util.is-equal-selection-points.js.map +1 -0
- package/lib/_chunks-es/util.reverse-selection.js +0 -16
- package/lib/_chunks-es/util.reverse-selection.js.map +1 -1
- package/lib/behaviors/index.cjs +27 -27
- package/lib/behaviors/index.cjs.map +1 -1
- package/lib/behaviors/index.d.cts +2208 -171
- package/lib/behaviors/index.d.ts +2208 -171
- package/lib/behaviors/index.js +1 -1
- package/lib/index.cjs +306 -298
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +10499 -521
- package/lib/index.d.ts +10499 -521
- package/lib/index.js +302 -294
- package/lib/index.js.map +1 -1
- package/lib/selectors/index.cjs +26 -171
- package/lib/selectors/index.cjs.map +1 -1
- package/lib/selectors/index.d.cts +16 -0
- package/lib/selectors/index.d.ts +16 -0
- package/lib/selectors/index.js +5 -151
- package/lib/selectors/index.js.map +1 -1
- package/lib/utils/index.cjs +5 -3
- package/lib/utils/index.cjs.map +1 -1
- package/lib/utils/index.d.cts +19 -0
- package/lib/utils/index.d.ts +19 -0
- package/lib/utils/index.js +4 -2
- package/package.json +6 -6
- package/src/behavior-actions/behavior.action-utils.insert-block.ts +3 -3
- package/src/behavior-actions/behavior.action.block.set.ts +23 -0
- package/src/behavior-actions/behavior.action.block.unset.ts +21 -0
- package/src/behavior-actions/behavior.action.insert-break.ts +2 -69
- package/src/behavior-actions/behavior.action.insert.block.ts +29 -0
- package/src/behavior-actions/behavior.actions.ts +116 -96
- package/src/behaviors/behavior.core.annotations.ts +29 -0
- package/src/behaviors/behavior.core.block-objects.ts +13 -13
- package/src/behaviors/behavior.core.decorators.ts +19 -0
- package/src/behaviors/behavior.core.insert-break.ts +122 -0
- package/src/behaviors/behavior.core.lists.ts +57 -23
- package/src/behaviors/behavior.core.style.ts +19 -0
- package/src/behaviors/behavior.core.ts +18 -2
- package/src/behaviors/behavior.types.ts +103 -88
- package/src/converters/converter.json.ts +4 -4
- package/src/converters/converter.portable-text.deserialize.test.ts +1 -1
- package/src/converters/converter.portable-text.ts +4 -4
- package/src/converters/converter.text-html.deserialize.test.ts +1 -1
- package/src/converters/converter.text-html.serialize.test.ts +1 -1
- package/src/converters/converter.text-html.ts +4 -4
- package/src/converters/converter.text-plain.test.ts +1 -1
- package/src/converters/converter.text-plain.ts +3 -3
- package/src/converters/{converter.ts → converter.types.ts} +6 -0
- package/src/editor/create-editor.ts +50 -7
- package/src/editor/editor-machine.ts +46 -3
- package/src/editor/editor-snapshot.ts +1 -1
- package/src/editor/plugins/__tests__/withPortableTextMarkModel.test.tsx +2 -2
- package/src/editor/plugins/create-with-event-listeners.ts +41 -106
- package/src/selectors/index.ts +2 -0
- package/src/selectors/selector.is-at-the-end-of-block.ts +22 -0
- package/src/selectors/selector.is-at-the-start-of-block.ts +25 -0
- package/src/selectors/selector.is-selection-collapsed.ts +6 -2
- package/src/utils/index.ts +2 -0
- package/src/utils/util.get-block-end-point.ts +34 -0
- package/src/utils/util.is-equal-selection-points.ts +13 -0
- package/lib/_chunks-cjs/selector.is-selection-collapsed.cjs +0 -231
- package/lib/_chunks-cjs/selector.is-selection-collapsed.cjs.map +0 -1
- package/lib/_chunks-cjs/util.is-keyed-segment.cjs +0 -6
- package/lib/_chunks-cjs/util.is-keyed-segment.cjs.map +0 -1
- package/lib/_chunks-es/selector.is-selection-collapsed.js +0 -232
- package/lib/_chunks-es/selector.is-selection-collapsed.js.map +0 -1
- package/lib/_chunks-es/util.is-keyed-segment.js +0 -7
- package/lib/_chunks-es/util.is-keyed-segment.js.map +0 -1
- /package/src/converters/{converters.ts → converters.core.ts} +0 -0
package/lib/index.js
CHANGED
|
@@ -23,7 +23,7 @@ import { toHTML } from "@portabletext/to-html";
|
|
|
23
23
|
import get from "lodash/get.js";
|
|
24
24
|
import isUndefined from "lodash/isUndefined.js";
|
|
25
25
|
import omitBy from "lodash/omitBy.js";
|
|
26
|
-
import { createGuards } from "./_chunks-es/selector.is-
|
|
26
|
+
import { createGuards } from "./_chunks-es/selector.is-at-the-start-of-block.js";
|
|
27
27
|
import { blockOffsetToSpanSelectionPoint } from "./_chunks-es/util.is-empty-text-block.js";
|
|
28
28
|
import { coreBehaviors, isCustomBehaviorEvent, isHotkey } from "./_chunks-es/behavior.core.js";
|
|
29
29
|
import getRandomValues from "get-random-values-esm";
|
|
@@ -2523,6 +2523,7 @@ function _temp(s) {
|
|
|
2523
2523
|
}
|
|
2524
2524
|
Synchronizer.displayName = "Synchronizer";
|
|
2525
2525
|
const converterJson = {
|
|
2526
|
+
mimeType: "application/json",
|
|
2526
2527
|
serialize: ({
|
|
2527
2528
|
context,
|
|
2528
2529
|
event
|
|
@@ -2558,8 +2559,7 @@ const converterJson = {
|
|
|
2558
2559
|
mimeType: "application/json",
|
|
2559
2560
|
reason: "No application/x-portable-text Converter found"
|
|
2560
2561
|
};
|
|
2561
|
-
}
|
|
2562
|
-
mimeType: "application/json"
|
|
2562
|
+
}
|
|
2563
2563
|
};
|
|
2564
2564
|
function isTypedObject(object) {
|
|
2565
2565
|
return isRecord(object) && typeof object._type == "string";
|
|
@@ -2621,6 +2621,7 @@ function parseBlock({
|
|
|
2621
2621
|
return context.schema.lists.find((list) => list.value === block.listItem) || (delete parsedBlock.listItem, delete parsedBlock.level), parsedBlock;
|
|
2622
2622
|
}
|
|
2623
2623
|
const converterPortableText = {
|
|
2624
|
+
mimeType: "application/x-portable-text",
|
|
2624
2625
|
serialize: ({
|
|
2625
2626
|
context,
|
|
2626
2627
|
event
|
|
@@ -2670,9 +2671,9 @@ const converterPortableText = {
|
|
|
2670
2671
|
data: parsedBlocks,
|
|
2671
2672
|
mimeType: "application/x-portable-text"
|
|
2672
2673
|
};
|
|
2673
|
-
}
|
|
2674
|
-
mimeType: "application/x-portable-text"
|
|
2674
|
+
}
|
|
2675
2675
|
}, converterTextHtml = {
|
|
2676
|
+
mimeType: "text/html",
|
|
2676
2677
|
serialize: ({
|
|
2677
2678
|
context,
|
|
2678
2679
|
event
|
|
@@ -2717,8 +2718,7 @@ const converterPortableText = {
|
|
|
2717
2718
|
unstable_whitespaceOnPasteMode: context.schema.block.options.unstable_whitespaceOnPasteMode
|
|
2718
2719
|
}),
|
|
2719
2720
|
mimeType: "text/html"
|
|
2720
|
-
})
|
|
2721
|
-
mimeType: "text/html"
|
|
2721
|
+
})
|
|
2722
2722
|
}, converterTextPlain = {
|
|
2723
2723
|
mimeType: "text/plain",
|
|
2724
2724
|
serialize: ({
|
|
@@ -3003,123 +3003,57 @@ function createWithEventListeners(editorActor, subscriptions) {
|
|
|
3003
3003
|
subscriptions.push(() => {
|
|
3004
3004
|
const subscription = editorActor.on("*", (event) => {
|
|
3005
3005
|
switch (event.type) {
|
|
3006
|
-
case "
|
|
3007
|
-
editorActor.send({
|
|
3008
|
-
type: "behavior event",
|
|
3009
|
-
behaviorEvent: {
|
|
3010
|
-
type: "annotation.add",
|
|
3011
|
-
annotation: event.annotation
|
|
3012
|
-
},
|
|
3013
|
-
editor
|
|
3014
|
-
});
|
|
3015
|
-
break;
|
|
3016
|
-
}
|
|
3017
|
-
case "annotation.remove": {
|
|
3018
|
-
editorActor.send({
|
|
3019
|
-
type: "behavior event",
|
|
3020
|
-
behaviorEvent: {
|
|
3021
|
-
type: "annotation.remove",
|
|
3022
|
-
annotation: event.annotation
|
|
3023
|
-
},
|
|
3024
|
-
editor
|
|
3025
|
-
});
|
|
3026
|
-
break;
|
|
3027
|
-
}
|
|
3028
|
-
case "blur": {
|
|
3029
|
-
editorActor.send({
|
|
3030
|
-
type: "behavior event",
|
|
3031
|
-
behaviorEvent: {
|
|
3032
|
-
type: "blur"
|
|
3033
|
-
},
|
|
3034
|
-
editor
|
|
3035
|
-
});
|
|
3036
|
-
break;
|
|
3037
|
-
}
|
|
3038
|
-
case "custom.*": {
|
|
3006
|
+
case "custom.*":
|
|
3039
3007
|
editorActor.send({
|
|
3040
3008
|
type: "custom behavior event",
|
|
3041
3009
|
behaviorEvent: event.event,
|
|
3042
3010
|
editor
|
|
3043
3011
|
});
|
|
3044
3012
|
break;
|
|
3045
|
-
|
|
3046
|
-
case "
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
case "
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
case "
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
case "
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
type: "insert.inline object",
|
|
3084
|
-
inlineObject: event.inlineObject
|
|
3085
|
-
},
|
|
3086
|
-
editor
|
|
3087
|
-
});
|
|
3088
|
-
break;
|
|
3089
|
-
}
|
|
3090
|
-
case "list item.toggle": {
|
|
3013
|
+
case "annotation.add":
|
|
3014
|
+
case "annotation.remove":
|
|
3015
|
+
case "annotation.toggle":
|
|
3016
|
+
case "block.set":
|
|
3017
|
+
case "block.unset":
|
|
3018
|
+
case "blur":
|
|
3019
|
+
case "data transfer.set":
|
|
3020
|
+
case "decorator.add":
|
|
3021
|
+
case "decorator.remove":
|
|
3022
|
+
case "decorator.toggle":
|
|
3023
|
+
case "delete.backward":
|
|
3024
|
+
case "delete.block":
|
|
3025
|
+
case "delete.forward":
|
|
3026
|
+
case "delete.text":
|
|
3027
|
+
case "deserialization.failure":
|
|
3028
|
+
case "deserialization.success":
|
|
3029
|
+
case "focus":
|
|
3030
|
+
case "insert.block":
|
|
3031
|
+
case "insert.block object":
|
|
3032
|
+
case "insert.inline object":
|
|
3033
|
+
case "insert.span":
|
|
3034
|
+
case "insert.text block":
|
|
3035
|
+
case "list item.add":
|
|
3036
|
+
case "list item.remove":
|
|
3037
|
+
case "list item.toggle":
|
|
3038
|
+
case "move.block":
|
|
3039
|
+
case "move.block down":
|
|
3040
|
+
case "move.block up":
|
|
3041
|
+
case "select":
|
|
3042
|
+
case "select.next block":
|
|
3043
|
+
case "select.previous block":
|
|
3044
|
+
case "serialization.failure":
|
|
3045
|
+
case "serialization.success":
|
|
3046
|
+
case "style.add":
|
|
3047
|
+
case "style.remove":
|
|
3048
|
+
case "style.toggle":
|
|
3049
|
+
case "text block.set":
|
|
3050
|
+
case "text block.unset":
|
|
3091
3051
|
editorActor.send({
|
|
3092
3052
|
type: "behavior event",
|
|
3093
|
-
behaviorEvent:
|
|
3094
|
-
type: "list item.toggle",
|
|
3095
|
-
listItem: event.listItem
|
|
3096
|
-
},
|
|
3053
|
+
behaviorEvent: event,
|
|
3097
3054
|
editor
|
|
3098
3055
|
});
|
|
3099
3056
|
break;
|
|
3100
|
-
}
|
|
3101
|
-
case "select": {
|
|
3102
|
-
editorActor.send({
|
|
3103
|
-
type: "behavior event",
|
|
3104
|
-
behaviorEvent: {
|
|
3105
|
-
type: "select",
|
|
3106
|
-
selection: event.selection
|
|
3107
|
-
},
|
|
3108
|
-
editor
|
|
3109
|
-
});
|
|
3110
|
-
break;
|
|
3111
|
-
}
|
|
3112
|
-
case "style.toggle": {
|
|
3113
|
-
editorActor.send({
|
|
3114
|
-
type: "behavior event",
|
|
3115
|
-
behaviorEvent: {
|
|
3116
|
-
type: "style.toggle",
|
|
3117
|
-
style: event.style
|
|
3118
|
-
},
|
|
3119
|
-
editor
|
|
3120
|
-
});
|
|
3121
|
-
break;
|
|
3122
|
-
}
|
|
3123
3057
|
}
|
|
3124
3058
|
});
|
|
3125
3059
|
return () => {
|
|
@@ -5143,10 +5077,9 @@ function insertBlock({
|
|
|
5143
5077
|
});
|
|
5144
5078
|
} else placement === "before" ? Transforms.insertNodes(editor, block, {
|
|
5145
5079
|
at: focusBlockPath
|
|
5146
|
-
}) : Editor.insertNode(editor, block)
|
|
5147
|
-
focusBlock && isEqualToEmptyEditor([focusBlock], schema) && Transforms.removeNodes(editor, {
|
|
5080
|
+
}) : (Editor.insertNode(editor, block), focusBlock && isEqualToEmptyEditor([focusBlock], schema) && Transforms.removeNodes(editor, {
|
|
5148
5081
|
at: focusBlockPath
|
|
5149
|
-
});
|
|
5082
|
+
}));
|
|
5150
5083
|
} else {
|
|
5151
5084
|
const lastBlock = Array.from(Editor.nodes(editor, {
|
|
5152
5085
|
match: (n) => !Editor.isEditor(n),
|
|
@@ -5158,7 +5091,47 @@ function insertBlock({
|
|
|
5158
5091
|
});
|
|
5159
5092
|
}
|
|
5160
5093
|
}
|
|
5161
|
-
const
|
|
5094
|
+
const blockSetBehaviorActionImplementation = ({
|
|
5095
|
+
action
|
|
5096
|
+
}) => {
|
|
5097
|
+
const location = toSlateRange({
|
|
5098
|
+
anchor: {
|
|
5099
|
+
path: action.at,
|
|
5100
|
+
offset: 0
|
|
5101
|
+
},
|
|
5102
|
+
focus: {
|
|
5103
|
+
path: action.at,
|
|
5104
|
+
offset: 0
|
|
5105
|
+
}
|
|
5106
|
+
}, action.editor);
|
|
5107
|
+
if (!location)
|
|
5108
|
+
return;
|
|
5109
|
+
const {
|
|
5110
|
+
at,
|
|
5111
|
+
editor,
|
|
5112
|
+
type,
|
|
5113
|
+
...payload
|
|
5114
|
+
} = action;
|
|
5115
|
+
Transforms.setNodes(action.editor, payload, {
|
|
5116
|
+
at: location
|
|
5117
|
+
});
|
|
5118
|
+
}, blockUnsetBehaviorActionImplementation = ({
|
|
5119
|
+
action
|
|
5120
|
+
}) => {
|
|
5121
|
+
const location = toSlateRange({
|
|
5122
|
+
anchor: {
|
|
5123
|
+
path: action.at,
|
|
5124
|
+
offset: 0
|
|
5125
|
+
},
|
|
5126
|
+
focus: {
|
|
5127
|
+
path: action.at,
|
|
5128
|
+
offset: 0
|
|
5129
|
+
}
|
|
5130
|
+
}, action.editor);
|
|
5131
|
+
location && Transforms.unsetNodes(action.editor, action.props, {
|
|
5132
|
+
at: location
|
|
5133
|
+
});
|
|
5134
|
+
}, dataTransferSetActionImplementation = ({
|
|
5162
5135
|
action
|
|
5163
5136
|
}) => {
|
|
5164
5137
|
action.dataTransfer.setData(action.mimeType, action.data);
|
|
@@ -5215,96 +5188,54 @@ const dataTransferSetActionImplementation = ({
|
|
|
5215
5188
|
const keyGenerator = context.keyGenerator, schema = context.schema, editor = action.editor;
|
|
5216
5189
|
if (!editor.selection)
|
|
5217
5190
|
return;
|
|
5218
|
-
const
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
offset: 0
|
|
5231
|
-
});
|
|
5232
|
-
if (atTheEndOfBlock && Range.isCollapsed(editor.selection)) {
|
|
5233
|
-
Editor.insertNode(editor, editor.pteCreateTextBlock({
|
|
5234
|
-
decorators: [],
|
|
5235
|
-
listItem: focusBlock.listItem,
|
|
5236
|
-
level: focusBlock.level
|
|
5237
|
-
}));
|
|
5238
|
-
return;
|
|
5239
|
-
}
|
|
5240
|
-
if (atTheStartOfBlock && Range.isCollapsed(editor.selection)) {
|
|
5241
|
-
Editor.insertNode(editor, editor.pteCreateTextBlock({
|
|
5242
|
-
decorators: focusAnnotations.length === 0 ? focusDecorators : [],
|
|
5243
|
-
listItem: focusBlock.listItem,
|
|
5244
|
-
level: focusBlock.level
|
|
5245
|
-
}));
|
|
5246
|
-
const [nextBlockPath] = Path.next(focusBlockPath);
|
|
5247
|
-
Transforms.select(editor, {
|
|
5191
|
+
const anchorBlockPath = editor.selection.anchor.path.slice(0, 1), focusBlockPath = editor.selection.focus.path.slice(0, 1), focusBlock = Node.descendant(editor, focusBlockPath);
|
|
5192
|
+
if (editor.isTextBlock(focusBlock) && anchorBlockPath[0] === focusBlockPath[0]) {
|
|
5193
|
+
Editor.withoutNormalizing(editor, () => {
|
|
5194
|
+
if (!editor.selection)
|
|
5195
|
+
return;
|
|
5196
|
+
Transforms.splitNodes(editor, {
|
|
5197
|
+
at: editor.selection
|
|
5198
|
+
});
|
|
5199
|
+
const [nextNode, nextNodePath] = Editor.node(editor, Path.next(focusBlockPath), {
|
|
5200
|
+
depth: 1
|
|
5201
|
+
});
|
|
5202
|
+
if (Transforms.setSelection(editor, {
|
|
5248
5203
|
anchor: {
|
|
5249
|
-
path: [
|
|
5204
|
+
path: [...nextNodePath, 0],
|
|
5250
5205
|
offset: 0
|
|
5251
5206
|
},
|
|
5252
5207
|
focus: {
|
|
5253
|
-
path: [
|
|
5208
|
+
path: [...nextNodePath, 0],
|
|
5254
5209
|
offset: 0
|
|
5255
5210
|
}
|
|
5256
|
-
})
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
const [nextNode, nextNodePath] = Editor.node(editor, Path.next(focusBlockPath), {
|
|
5268
|
-
depth: 1
|
|
5269
|
-
});
|
|
5270
|
-
if (Transforms.setSelection(editor, {
|
|
5271
|
-
anchor: {
|
|
5272
|
-
path: [...nextNodePath, 0],
|
|
5273
|
-
offset: 0
|
|
5274
|
-
},
|
|
5275
|
-
focus: {
|
|
5276
|
-
path: [...nextNodePath, 0],
|
|
5277
|
-
offset: 0
|
|
5278
|
-
}
|
|
5279
|
-
}), editor.isTextBlock(nextNode) && nextNode.markDefs && nextNode.markDefs.length > 0) {
|
|
5280
|
-
const newMarkDefKeys = /* @__PURE__ */ new Map(), prevNodeSpans = Array.from(Node.children(editor, focusBlockPath)).map((entry) => entry[0]).filter((node) => editor.isTextSpan(node)), children = Node.children(editor, nextNodePath);
|
|
5281
|
-
for (const [child, childPath] of children) {
|
|
5282
|
-
if (!editor.isTextSpan(child))
|
|
5283
|
-
continue;
|
|
5284
|
-
const marks = child.marks ?? [];
|
|
5285
|
-
for (const mark of marks)
|
|
5286
|
-
schema.decorators.some((decorator) => decorator.value === mark) || prevNodeSpans.some((prevNodeSpan) => prevNodeSpan.marks?.includes(mark)) && !newMarkDefKeys.has(mark) && newMarkDefKeys.set(mark, keyGenerator());
|
|
5287
|
-
const newMarks = marks.map((mark) => newMarkDefKeys.get(mark) ?? mark);
|
|
5288
|
-
isEqual(marks, newMarks) || Transforms.setNodes(editor, {
|
|
5289
|
-
marks: newMarks
|
|
5290
|
-
}, {
|
|
5291
|
-
at: childPath
|
|
5292
|
-
});
|
|
5293
|
-
}
|
|
5294
|
-
const newMarkDefs = nextNode.markDefs.map((markDef) => ({
|
|
5295
|
-
...markDef,
|
|
5296
|
-
_key: newMarkDefKeys.get(markDef._key) ?? markDef._key
|
|
5297
|
-
}));
|
|
5298
|
-
isEqual(nextNode.markDefs, newMarkDefs) || Transforms.setNodes(editor, {
|
|
5299
|
-
markDefs: newMarkDefs
|
|
5211
|
+
}), editor.isTextBlock(nextNode) && nextNode.markDefs && nextNode.markDefs.length > 0) {
|
|
5212
|
+
const newMarkDefKeys = /* @__PURE__ */ new Map(), prevNodeSpans = Array.from(Node.children(editor, focusBlockPath)).map((entry) => entry[0]).filter((node) => editor.isTextSpan(node)), children = Node.children(editor, nextNodePath);
|
|
5213
|
+
for (const [child, childPath] of children) {
|
|
5214
|
+
if (!editor.isTextSpan(child))
|
|
5215
|
+
continue;
|
|
5216
|
+
const marks = child.marks ?? [];
|
|
5217
|
+
for (const mark of marks)
|
|
5218
|
+
schema.decorators.some((decorator) => decorator.value === mark) || prevNodeSpans.some((prevNodeSpan) => prevNodeSpan.marks?.includes(mark)) && !newMarkDefKeys.has(mark) && newMarkDefKeys.set(mark, keyGenerator());
|
|
5219
|
+
const newMarks = marks.map((mark) => newMarkDefKeys.get(mark) ?? mark);
|
|
5220
|
+
isEqual(marks, newMarks) || Transforms.setNodes(editor, {
|
|
5221
|
+
marks: newMarks
|
|
5300
5222
|
}, {
|
|
5301
|
-
at:
|
|
5302
|
-
match: (node) => editor.isTextBlock(node)
|
|
5223
|
+
at: childPath
|
|
5303
5224
|
});
|
|
5304
5225
|
}
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5226
|
+
const newMarkDefs = nextNode.markDefs.map((markDef) => ({
|
|
5227
|
+
...markDef,
|
|
5228
|
+
_key: newMarkDefKeys.get(markDef._key) ?? markDef._key
|
|
5229
|
+
}));
|
|
5230
|
+
isEqual(nextNode.markDefs, newMarkDefs) || Transforms.setNodes(editor, {
|
|
5231
|
+
markDefs: newMarkDefs
|
|
5232
|
+
}, {
|
|
5233
|
+
at: nextNodePath,
|
|
5234
|
+
match: (node) => editor.isTextBlock(node)
|
|
5235
|
+
});
|
|
5236
|
+
}
|
|
5237
|
+
}), editor.onChange();
|
|
5238
|
+
return;
|
|
5308
5239
|
}
|
|
5309
5240
|
Transforms.splitNodes(editor, {
|
|
5310
5241
|
always: !0
|
|
@@ -5385,6 +5316,27 @@ const dataTransferSetActionImplementation = ({
|
|
|
5385
5316
|
text: action.text,
|
|
5386
5317
|
marks: [...annotations?.map((annotation) => annotation._key) ?? [], ...action.decorators ?? []]
|
|
5387
5318
|
});
|
|
5319
|
+
}, insertBlockActionImplementation = ({
|
|
5320
|
+
context,
|
|
5321
|
+
action
|
|
5322
|
+
}) => {
|
|
5323
|
+
const parsedBlock = parseBlock({
|
|
5324
|
+
block: action.block,
|
|
5325
|
+
context
|
|
5326
|
+
});
|
|
5327
|
+
if (!parsedBlock)
|
|
5328
|
+
throw new Error(`Failed to parse block ${JSON.stringify(action.block)}`);
|
|
5329
|
+
const fragment = toSlateValue([parsedBlock], {
|
|
5330
|
+
schemaTypes: context.schema
|
|
5331
|
+
})[0];
|
|
5332
|
+
if (!fragment)
|
|
5333
|
+
throw new Error(`Failed to convert block to Slate fragment ${JSON.stringify(parsedBlock)}`);
|
|
5334
|
+
insertBlock({
|
|
5335
|
+
block: fragment,
|
|
5336
|
+
placement: action.placement,
|
|
5337
|
+
editor: action.editor,
|
|
5338
|
+
schema: context.schema
|
|
5339
|
+
});
|
|
5388
5340
|
}, textBlockSetActionImplementation = ({
|
|
5389
5341
|
action
|
|
5390
5342
|
}) => {
|
|
@@ -5431,6 +5383,8 @@ const dataTransferSetActionImplementation = ({
|
|
|
5431
5383
|
"annotation.add": addAnnotationActionImplementation,
|
|
5432
5384
|
"annotation.remove": removeAnnotationActionImplementation,
|
|
5433
5385
|
"annotation.toggle": toggleAnnotationActionImplementation,
|
|
5386
|
+
"block.set": blockSetBehaviorActionImplementation,
|
|
5387
|
+
"block.unset": blockUnsetBehaviorActionImplementation,
|
|
5434
5388
|
blur: ({
|
|
5435
5389
|
action
|
|
5436
5390
|
}) => {
|
|
@@ -5521,6 +5475,7 @@ const dataTransferSetActionImplementation = ({
|
|
|
5521
5475
|
}
|
|
5522
5476
|
});
|
|
5523
5477
|
},
|
|
5478
|
+
"insert.block": insertBlockActionImplementation,
|
|
5524
5479
|
"insert.blocks": insertBlocksActionImplementation,
|
|
5525
5480
|
"insert.block object": insertBlockObjectActionImplementation,
|
|
5526
5481
|
"insert.break": insertBreakActionImplementation,
|
|
@@ -5661,302 +5616,316 @@ function performAction({
|
|
|
5661
5616
|
action
|
|
5662
5617
|
}) {
|
|
5663
5618
|
switch (action.type) {
|
|
5664
|
-
case "
|
|
5665
|
-
|
|
5619
|
+
case "noop":
|
|
5620
|
+
break;
|
|
5621
|
+
case "effect": {
|
|
5622
|
+
behaviorActionImplementations.effect({
|
|
5666
5623
|
context,
|
|
5667
5624
|
action
|
|
5668
5625
|
});
|
|
5669
5626
|
break;
|
|
5670
5627
|
}
|
|
5671
|
-
|
|
5672
|
-
|
|
5628
|
+
default:
|
|
5629
|
+
performDefaultAction({
|
|
5630
|
+
context,
|
|
5631
|
+
action
|
|
5632
|
+
});
|
|
5633
|
+
}
|
|
5634
|
+
}
|
|
5635
|
+
function performDefaultAction({
|
|
5636
|
+
context,
|
|
5637
|
+
action
|
|
5638
|
+
}) {
|
|
5639
|
+
switch (action.type) {
|
|
5640
|
+
case "annotation.add": {
|
|
5641
|
+
behaviorActionImplementations["annotation.add"]({
|
|
5673
5642
|
context,
|
|
5674
5643
|
action
|
|
5675
5644
|
});
|
|
5676
5645
|
break;
|
|
5677
5646
|
}
|
|
5678
|
-
case "
|
|
5679
|
-
behaviorActionImplementations["
|
|
5647
|
+
case "annotation.remove": {
|
|
5648
|
+
behaviorActionImplementations["annotation.remove"]({
|
|
5680
5649
|
context,
|
|
5681
5650
|
action
|
|
5682
5651
|
});
|
|
5683
5652
|
break;
|
|
5684
5653
|
}
|
|
5685
|
-
case "
|
|
5686
|
-
behaviorActionImplementations["
|
|
5654
|
+
case "annotation.toggle": {
|
|
5655
|
+
behaviorActionImplementations["annotation.toggle"]({
|
|
5687
5656
|
context,
|
|
5688
5657
|
action
|
|
5689
5658
|
});
|
|
5690
5659
|
break;
|
|
5691
5660
|
}
|
|
5692
|
-
case "
|
|
5693
|
-
behaviorActionImplementations["
|
|
5661
|
+
case "block.set": {
|
|
5662
|
+
behaviorActionImplementations["block.set"]({
|
|
5694
5663
|
context,
|
|
5695
5664
|
action
|
|
5696
5665
|
});
|
|
5697
5666
|
break;
|
|
5698
5667
|
}
|
|
5699
|
-
case "
|
|
5700
|
-
behaviorActionImplementations["
|
|
5668
|
+
case "block.unset": {
|
|
5669
|
+
behaviorActionImplementations["block.unset"]({
|
|
5701
5670
|
context,
|
|
5702
5671
|
action
|
|
5703
5672
|
});
|
|
5704
5673
|
break;
|
|
5705
5674
|
}
|
|
5706
|
-
case "
|
|
5707
|
-
behaviorActionImplementations
|
|
5675
|
+
case "blur": {
|
|
5676
|
+
behaviorActionImplementations.blur({
|
|
5708
5677
|
context,
|
|
5709
5678
|
action
|
|
5710
5679
|
});
|
|
5711
5680
|
break;
|
|
5712
5681
|
}
|
|
5713
|
-
case "
|
|
5714
|
-
behaviorActionImplementations["
|
|
5682
|
+
case "data transfer.set": {
|
|
5683
|
+
behaviorActionImplementations["data transfer.set"]({
|
|
5715
5684
|
context,
|
|
5716
5685
|
action
|
|
5717
5686
|
});
|
|
5718
5687
|
break;
|
|
5719
5688
|
}
|
|
5720
|
-
case "
|
|
5721
|
-
behaviorActionImplementations["
|
|
5689
|
+
case "decorator.add": {
|
|
5690
|
+
behaviorActionImplementations["decorator.add"]({
|
|
5722
5691
|
context,
|
|
5723
5692
|
action
|
|
5724
5693
|
});
|
|
5725
5694
|
break;
|
|
5726
5695
|
}
|
|
5727
|
-
case "
|
|
5728
|
-
behaviorActionImplementations["
|
|
5696
|
+
case "decorator.remove": {
|
|
5697
|
+
behaviorActionImplementations["decorator.remove"]({
|
|
5729
5698
|
context,
|
|
5730
5699
|
action
|
|
5731
5700
|
});
|
|
5732
5701
|
break;
|
|
5733
5702
|
}
|
|
5734
|
-
case "
|
|
5735
|
-
behaviorActionImplementations["
|
|
5703
|
+
case "decorator.toggle": {
|
|
5704
|
+
behaviorActionImplementations["decorator.toggle"]({
|
|
5736
5705
|
context,
|
|
5737
5706
|
action
|
|
5738
5707
|
});
|
|
5739
5708
|
break;
|
|
5740
5709
|
}
|
|
5741
|
-
case "
|
|
5742
|
-
behaviorActionImplementations["
|
|
5710
|
+
case "delete.backward": {
|
|
5711
|
+
behaviorActionImplementations["delete.backward"]({
|
|
5743
5712
|
context,
|
|
5744
5713
|
action
|
|
5745
5714
|
});
|
|
5746
5715
|
break;
|
|
5747
5716
|
}
|
|
5748
|
-
case "
|
|
5717
|
+
case "delete.block": {
|
|
5718
|
+
behaviorActionImplementations["delete.block"]({
|
|
5719
|
+
context,
|
|
5720
|
+
action
|
|
5721
|
+
});
|
|
5749
5722
|
break;
|
|
5750
|
-
|
|
5751
|
-
|
|
5723
|
+
}
|
|
5724
|
+
case "delete.forward": {
|
|
5725
|
+
behaviorActionImplementations["delete.forward"]({
|
|
5752
5726
|
context,
|
|
5753
5727
|
action
|
|
5754
5728
|
});
|
|
5755
5729
|
break;
|
|
5756
5730
|
}
|
|
5757
|
-
case "
|
|
5758
|
-
behaviorActionImplementations.
|
|
5731
|
+
case "delete.text": {
|
|
5732
|
+
behaviorActionImplementations["delete.text"]({
|
|
5759
5733
|
context,
|
|
5760
5734
|
action
|
|
5761
5735
|
});
|
|
5762
5736
|
break;
|
|
5763
5737
|
}
|
|
5764
|
-
case "
|
|
5765
|
-
behaviorActionImplementations["
|
|
5738
|
+
case "deserialization.failure": {
|
|
5739
|
+
behaviorActionImplementations["deserialization.failure"]({
|
|
5766
5740
|
context,
|
|
5767
5741
|
action
|
|
5768
5742
|
});
|
|
5769
5743
|
break;
|
|
5770
5744
|
}
|
|
5771
|
-
case "
|
|
5772
|
-
behaviorActionImplementations["
|
|
5745
|
+
case "deserialization.success": {
|
|
5746
|
+
behaviorActionImplementations["deserialization.success"]({
|
|
5773
5747
|
context,
|
|
5774
5748
|
action
|
|
5775
5749
|
});
|
|
5776
5750
|
break;
|
|
5777
5751
|
}
|
|
5778
|
-
case "
|
|
5779
|
-
behaviorActionImplementations
|
|
5752
|
+
case "focus": {
|
|
5753
|
+
behaviorActionImplementations.focus({
|
|
5780
5754
|
context,
|
|
5781
5755
|
action
|
|
5782
5756
|
});
|
|
5783
5757
|
break;
|
|
5784
5758
|
}
|
|
5785
|
-
case "
|
|
5786
|
-
behaviorActionImplementations["
|
|
5759
|
+
case "insert.block": {
|
|
5760
|
+
behaviorActionImplementations["insert.block"]({
|
|
5787
5761
|
context,
|
|
5788
5762
|
action
|
|
5789
5763
|
});
|
|
5790
5764
|
break;
|
|
5791
5765
|
}
|
|
5792
|
-
case "
|
|
5793
|
-
behaviorActionImplementations["
|
|
5766
|
+
case "insert.blocks": {
|
|
5767
|
+
behaviorActionImplementations["insert.blocks"]({
|
|
5794
5768
|
context,
|
|
5795
5769
|
action
|
|
5796
5770
|
});
|
|
5797
5771
|
break;
|
|
5798
5772
|
}
|
|
5799
|
-
case "
|
|
5800
|
-
behaviorActionImplementations["
|
|
5773
|
+
case "insert.block object": {
|
|
5774
|
+
behaviorActionImplementations["insert.block object"]({
|
|
5801
5775
|
context,
|
|
5802
5776
|
action
|
|
5803
5777
|
});
|
|
5804
5778
|
break;
|
|
5805
5779
|
}
|
|
5806
|
-
|
|
5807
|
-
|
|
5780
|
+
case "insert.inline object": {
|
|
5781
|
+
behaviorActionImplementations["insert.inline object"]({
|
|
5808
5782
|
context,
|
|
5809
5783
|
action
|
|
5810
5784
|
});
|
|
5811
|
-
|
|
5812
|
-
}
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
action
|
|
5816
|
-
}) {
|
|
5817
|
-
switch (action.type) {
|
|
5818
|
-
case "annotation.add": {
|
|
5819
|
-
behaviorActionImplementations["annotation.add"]({
|
|
5785
|
+
break;
|
|
5786
|
+
}
|
|
5787
|
+
case "insert.break": {
|
|
5788
|
+
behaviorActionImplementations["insert.break"]({
|
|
5820
5789
|
context,
|
|
5821
5790
|
action
|
|
5822
5791
|
});
|
|
5823
5792
|
break;
|
|
5824
5793
|
}
|
|
5825
|
-
case "
|
|
5826
|
-
behaviorActionImplementations["
|
|
5794
|
+
case "insert.soft break": {
|
|
5795
|
+
behaviorActionImplementations["insert.soft break"]({
|
|
5827
5796
|
context,
|
|
5828
5797
|
action
|
|
5829
5798
|
});
|
|
5830
5799
|
break;
|
|
5831
5800
|
}
|
|
5832
|
-
case "
|
|
5833
|
-
behaviorActionImplementations.
|
|
5801
|
+
case "insert.span": {
|
|
5802
|
+
behaviorActionImplementations["insert.span"]({
|
|
5834
5803
|
context,
|
|
5835
5804
|
action
|
|
5836
5805
|
});
|
|
5837
5806
|
break;
|
|
5838
5807
|
}
|
|
5839
|
-
case "
|
|
5840
|
-
behaviorActionImplementations["
|
|
5808
|
+
case "insert.text": {
|
|
5809
|
+
behaviorActionImplementations["insert.text"]({
|
|
5841
5810
|
context,
|
|
5842
5811
|
action
|
|
5843
5812
|
});
|
|
5844
5813
|
break;
|
|
5845
5814
|
}
|
|
5846
|
-
case "
|
|
5847
|
-
behaviorActionImplementations["
|
|
5815
|
+
case "insert.text block": {
|
|
5816
|
+
behaviorActionImplementations["insert.text block"]({
|
|
5848
5817
|
context,
|
|
5849
5818
|
action
|
|
5850
5819
|
});
|
|
5851
5820
|
break;
|
|
5852
5821
|
}
|
|
5853
|
-
case "
|
|
5854
|
-
behaviorActionImplementations["
|
|
5822
|
+
case "list item.add": {
|
|
5823
|
+
behaviorActionImplementations["list item.add"]({
|
|
5855
5824
|
context,
|
|
5856
5825
|
action
|
|
5857
5826
|
});
|
|
5858
5827
|
break;
|
|
5859
5828
|
}
|
|
5860
|
-
case "
|
|
5861
|
-
behaviorActionImplementations["
|
|
5829
|
+
case "list item.remove": {
|
|
5830
|
+
behaviorActionImplementations["list item.remove"]({
|
|
5862
5831
|
context,
|
|
5863
5832
|
action
|
|
5864
5833
|
});
|
|
5865
5834
|
break;
|
|
5866
5835
|
}
|
|
5867
|
-
case "
|
|
5868
|
-
behaviorActionImplementations["
|
|
5836
|
+
case "list item.toggle": {
|
|
5837
|
+
behaviorActionImplementations["list item.toggle"]({
|
|
5869
5838
|
context,
|
|
5870
5839
|
action
|
|
5871
5840
|
});
|
|
5872
5841
|
break;
|
|
5873
5842
|
}
|
|
5874
|
-
case "
|
|
5875
|
-
behaviorActionImplementations["
|
|
5843
|
+
case "move.block": {
|
|
5844
|
+
behaviorActionImplementations["move.block"]({
|
|
5876
5845
|
context,
|
|
5877
5846
|
action
|
|
5878
5847
|
});
|
|
5879
5848
|
break;
|
|
5880
5849
|
}
|
|
5881
|
-
case "
|
|
5882
|
-
behaviorActionImplementations.
|
|
5850
|
+
case "move.block down": {
|
|
5851
|
+
behaviorActionImplementations["move.block down"]({
|
|
5883
5852
|
context,
|
|
5884
5853
|
action
|
|
5885
5854
|
});
|
|
5886
5855
|
break;
|
|
5887
5856
|
}
|
|
5888
|
-
case "
|
|
5889
|
-
behaviorActionImplementations["
|
|
5857
|
+
case "move.block up": {
|
|
5858
|
+
behaviorActionImplementations["move.block up"]({
|
|
5890
5859
|
context,
|
|
5891
5860
|
action
|
|
5892
5861
|
});
|
|
5893
5862
|
break;
|
|
5894
5863
|
}
|
|
5895
|
-
case "
|
|
5896
|
-
behaviorActionImplementations
|
|
5864
|
+
case "select": {
|
|
5865
|
+
behaviorActionImplementations.select({
|
|
5897
5866
|
context,
|
|
5898
5867
|
action
|
|
5899
5868
|
});
|
|
5900
5869
|
break;
|
|
5901
5870
|
}
|
|
5902
|
-
case "
|
|
5903
|
-
behaviorActionImplementations["
|
|
5871
|
+
case "select.previous block": {
|
|
5872
|
+
behaviorActionImplementations["select.previous block"]({
|
|
5904
5873
|
context,
|
|
5905
5874
|
action
|
|
5906
5875
|
});
|
|
5907
5876
|
break;
|
|
5908
5877
|
}
|
|
5909
|
-
case "
|
|
5910
|
-
behaviorActionImplementations["
|
|
5878
|
+
case "select.next block": {
|
|
5879
|
+
behaviorActionImplementations["select.next block"]({
|
|
5911
5880
|
context,
|
|
5912
5881
|
action
|
|
5913
5882
|
});
|
|
5914
5883
|
break;
|
|
5915
5884
|
}
|
|
5916
|
-
case "
|
|
5917
|
-
behaviorActionImplementations["
|
|
5885
|
+
case "serialization.failure": {
|
|
5886
|
+
behaviorActionImplementations["serialization.failure"]({
|
|
5918
5887
|
context,
|
|
5919
5888
|
action
|
|
5920
5889
|
});
|
|
5921
5890
|
break;
|
|
5922
5891
|
}
|
|
5923
|
-
case "
|
|
5924
|
-
behaviorActionImplementations["
|
|
5892
|
+
case "serialization.success": {
|
|
5893
|
+
behaviorActionImplementations["serialization.success"]({
|
|
5925
5894
|
context,
|
|
5926
5895
|
action
|
|
5927
5896
|
});
|
|
5928
5897
|
break;
|
|
5929
5898
|
}
|
|
5930
|
-
case "
|
|
5931
|
-
behaviorActionImplementations["
|
|
5899
|
+
case "style.add": {
|
|
5900
|
+
behaviorActionImplementations["style.add"]({
|
|
5932
5901
|
context,
|
|
5933
5902
|
action
|
|
5934
5903
|
});
|
|
5935
5904
|
break;
|
|
5936
5905
|
}
|
|
5937
|
-
case "
|
|
5938
|
-
behaviorActionImplementations.
|
|
5906
|
+
case "style.remove": {
|
|
5907
|
+
behaviorActionImplementations["style.remove"]({
|
|
5939
5908
|
context,
|
|
5940
5909
|
action
|
|
5941
5910
|
});
|
|
5942
5911
|
break;
|
|
5943
5912
|
}
|
|
5944
|
-
case "
|
|
5945
|
-
behaviorActionImplementations["
|
|
5913
|
+
case "style.toggle": {
|
|
5914
|
+
behaviorActionImplementations["style.toggle"]({
|
|
5946
5915
|
context,
|
|
5947
5916
|
action
|
|
5948
5917
|
});
|
|
5949
5918
|
break;
|
|
5950
5919
|
}
|
|
5951
|
-
case "
|
|
5952
|
-
behaviorActionImplementations["
|
|
5920
|
+
case "text block.set": {
|
|
5921
|
+
behaviorActionImplementations["text block.set"]({
|
|
5953
5922
|
context,
|
|
5954
5923
|
action
|
|
5955
5924
|
});
|
|
5956
5925
|
break;
|
|
5957
5926
|
}
|
|
5958
5927
|
default:
|
|
5959
|
-
behaviorActionImplementations["
|
|
5928
|
+
behaviorActionImplementations["text block.unset"]({
|
|
5960
5929
|
context,
|
|
5961
5930
|
action
|
|
5962
5931
|
});
|
|
@@ -6340,6 +6309,11 @@ const editorMachine = setup({
|
|
|
6340
6309
|
event
|
|
6341
6310
|
}) => event)
|
|
6342
6311
|
},
|
|
6312
|
+
"block.*": {
|
|
6313
|
+
actions: emit(({
|
|
6314
|
+
event
|
|
6315
|
+
}) => event)
|
|
6316
|
+
},
|
|
6343
6317
|
blur: {
|
|
6344
6318
|
actions: emit(({
|
|
6345
6319
|
event
|
|
@@ -6358,6 +6332,11 @@ const editorMachine = setup({
|
|
|
6358
6332
|
event
|
|
6359
6333
|
}) => event)
|
|
6360
6334
|
},
|
|
6335
|
+
"delete.*": {
|
|
6336
|
+
actions: emit(({
|
|
6337
|
+
event
|
|
6338
|
+
}) => event)
|
|
6339
|
+
},
|
|
6361
6340
|
focus: {
|
|
6362
6341
|
actions: emit(({
|
|
6363
6342
|
event
|
|
@@ -6373,15 +6352,30 @@ const editorMachine = setup({
|
|
|
6373
6352
|
event
|
|
6374
6353
|
}) => event)
|
|
6375
6354
|
},
|
|
6355
|
+
"move.*": {
|
|
6356
|
+
actions: emit(({
|
|
6357
|
+
event
|
|
6358
|
+
}) => event)
|
|
6359
|
+
},
|
|
6376
6360
|
select: {
|
|
6377
6361
|
actions: emit(({
|
|
6378
6362
|
event
|
|
6379
6363
|
}) => event)
|
|
6380
6364
|
},
|
|
6365
|
+
"select.*": {
|
|
6366
|
+
actions: emit(({
|
|
6367
|
+
event
|
|
6368
|
+
}) => event)
|
|
6369
|
+
},
|
|
6381
6370
|
"style.*": {
|
|
6382
6371
|
actions: emit(({
|
|
6383
6372
|
event
|
|
6384
6373
|
}) => event)
|
|
6374
|
+
},
|
|
6375
|
+
"text block.*": {
|
|
6376
|
+
actions: emit(({
|
|
6377
|
+
event
|
|
6378
|
+
}) => event)
|
|
6385
6379
|
}
|
|
6386
6380
|
}
|
|
6387
6381
|
}
|
|
@@ -6562,11 +6556,25 @@ function createEditorFromActor(editorActor) {
|
|
|
6562
6556
|
send: (event) => {
|
|
6563
6557
|
editorActor.send(event);
|
|
6564
6558
|
},
|
|
6565
|
-
on: (event, listener) => editorActor.on(
|
|
6566
|
-
|
|
6567
|
-
|
|
6568
|
-
|
|
6569
|
-
|
|
6559
|
+
on: (event, listener) => editorActor.on(event, (event2) => {
|
|
6560
|
+
switch (event2.type) {
|
|
6561
|
+
case "blurred":
|
|
6562
|
+
case "done loading":
|
|
6563
|
+
case "editable":
|
|
6564
|
+
case "error":
|
|
6565
|
+
case "focused":
|
|
6566
|
+
case "invalid value":
|
|
6567
|
+
case "loading":
|
|
6568
|
+
case "mutation":
|
|
6569
|
+
case "patch":
|
|
6570
|
+
case "read only":
|
|
6571
|
+
case "ready":
|
|
6572
|
+
case "selection":
|
|
6573
|
+
case "value changed":
|
|
6574
|
+
listener(event2);
|
|
6575
|
+
break;
|
|
6576
|
+
}
|
|
6577
|
+
}),
|
|
6570
6578
|
_internal: {
|
|
6571
6579
|
editable,
|
|
6572
6580
|
editorActor,
|