@portabletext/editor 1.12.3 → 1.13.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/index.d.mts +234 -14
- package/lib/index.d.ts +234 -14
- package/lib/index.esm.js +361 -192
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +361 -192
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +361 -192
- package/lib/index.mjs.map +1 -1
- package/package.json +5 -5
- package/src/editor/Editable.tsx +60 -5
- package/src/editor/behavior/behavior.action.insert-break.ts +21 -24
- package/src/editor/behavior/behavior.actions.ts +125 -3
- package/src/editor/behavior/behavior.code-editor.ts +86 -0
- package/src/editor/behavior/behavior.core.block-objects.ts +34 -1
- package/src/editor/behavior/behavior.core.ts +2 -0
- package/src/editor/behavior/behavior.links.ts +2 -2
- package/src/editor/behavior/behavior.markdown.ts +1 -1
- package/src/editor/behavior/behavior.types.ts +37 -2
- package/src/editor/behavior/behavior.utils.ts +2 -2
- package/src/editor/editor-machine.ts +5 -2
- package/src/editor/plugins/createWithHotKeys.ts +1 -48
- package/src/index.ts +4 -0
- package/src/utils/is-hotkey.test.ts +97 -46
- package/src/utils/is-hotkey.ts +1 -1
package/lib/index.js
CHANGED
|
@@ -5,11 +5,123 @@ function _interopDefaultCompat(e) {
|
|
|
5
5
|
return e && typeof e == "object" && "default" in e ? e : { default: e };
|
|
6
6
|
}
|
|
7
7
|
var startCase__default = /* @__PURE__ */ _interopDefaultCompat(startCase), isEqual__default = /* @__PURE__ */ _interopDefaultCompat(isEqual), noop__default = /* @__PURE__ */ _interopDefaultCompat(noop), React__default = /* @__PURE__ */ _interopDefaultCompat(React), debug__default = /* @__PURE__ */ _interopDefaultCompat(debug$m), uniq__default = /* @__PURE__ */ _interopDefaultCompat(uniq), throttle__default = /* @__PURE__ */ _interopDefaultCompat(throttle), debounce__default = /* @__PURE__ */ _interopDefaultCompat(debounce), flatten__default = /* @__PURE__ */ _interopDefaultCompat(flatten), isPlainObject__default = /* @__PURE__ */ _interopDefaultCompat(isPlainObject), getRandomValues__default = /* @__PURE__ */ _interopDefaultCompat(getRandomValues), get__default = /* @__PURE__ */ _interopDefaultCompat(get), isUndefined__default = /* @__PURE__ */ _interopDefaultCompat(isUndefined), omitBy__default = /* @__PURE__ */ _interopDefaultCompat(omitBy);
|
|
8
|
+
const IS_MAC = typeof window < "u" && /Mac|iPod|iPhone|iPad/.test(window.navigator.userAgent), modifiers = {
|
|
9
|
+
alt: "altKey",
|
|
10
|
+
control: "ctrlKey",
|
|
11
|
+
meta: "metaKey",
|
|
12
|
+
shift: "shiftKey"
|
|
13
|
+
}, aliases = {
|
|
14
|
+
add: "+",
|
|
15
|
+
break: "pause",
|
|
16
|
+
cmd: "meta",
|
|
17
|
+
command: "meta",
|
|
18
|
+
ctl: "control",
|
|
19
|
+
ctrl: "control",
|
|
20
|
+
del: "delete",
|
|
21
|
+
down: "arrowdown",
|
|
22
|
+
esc: "escape",
|
|
23
|
+
ins: "insert",
|
|
24
|
+
left: "arrowleft",
|
|
25
|
+
mod: IS_MAC ? "meta" : "control",
|
|
26
|
+
opt: "alt",
|
|
27
|
+
option: "alt",
|
|
28
|
+
return: "enter",
|
|
29
|
+
right: "arrowright",
|
|
30
|
+
space: " ",
|
|
31
|
+
spacebar: " ",
|
|
32
|
+
up: "arrowup",
|
|
33
|
+
win: "meta",
|
|
34
|
+
windows: "meta"
|
|
35
|
+
}, keyCodes = {
|
|
36
|
+
backspace: 8,
|
|
37
|
+
tab: 9,
|
|
38
|
+
enter: 13,
|
|
39
|
+
shift: 16,
|
|
40
|
+
control: 17,
|
|
41
|
+
alt: 18,
|
|
42
|
+
pause: 19,
|
|
43
|
+
capslock: 20,
|
|
44
|
+
escape: 27,
|
|
45
|
+
" ": 32,
|
|
46
|
+
pageup: 33,
|
|
47
|
+
pagedown: 34,
|
|
48
|
+
end: 35,
|
|
49
|
+
home: 36,
|
|
50
|
+
arrowleft: 37,
|
|
51
|
+
arrowup: 38,
|
|
52
|
+
arrowright: 39,
|
|
53
|
+
arrowdown: 40,
|
|
54
|
+
insert: 45,
|
|
55
|
+
delete: 46,
|
|
56
|
+
meta: 91,
|
|
57
|
+
numlock: 144,
|
|
58
|
+
scrolllock: 145,
|
|
59
|
+
";": 186,
|
|
60
|
+
"=": 187,
|
|
61
|
+
",": 188,
|
|
62
|
+
"-": 189,
|
|
63
|
+
".": 190,
|
|
64
|
+
"/": 191,
|
|
65
|
+
"`": 192,
|
|
66
|
+
"[": 219,
|
|
67
|
+
"\\": 220,
|
|
68
|
+
"]": 221,
|
|
69
|
+
"'": 222,
|
|
70
|
+
f1: 112,
|
|
71
|
+
f2: 113,
|
|
72
|
+
f3: 114,
|
|
73
|
+
f4: 115,
|
|
74
|
+
f5: 116,
|
|
75
|
+
f6: 117,
|
|
76
|
+
f7: 118,
|
|
77
|
+
f8: 119,
|
|
78
|
+
f9: 120,
|
|
79
|
+
f10: 121,
|
|
80
|
+
f11: 122,
|
|
81
|
+
f12: 123,
|
|
82
|
+
f13: 124,
|
|
83
|
+
f14: 125,
|
|
84
|
+
f15: 126,
|
|
85
|
+
f16: 127,
|
|
86
|
+
f17: 128,
|
|
87
|
+
f18: 129,
|
|
88
|
+
f19: 130,
|
|
89
|
+
f20: 131
|
|
90
|
+
};
|
|
91
|
+
function isHotkey(hotkey, event) {
|
|
92
|
+
return compareHotkey(parseHotkey(hotkey), event);
|
|
93
|
+
}
|
|
94
|
+
function parseHotkey(hotkey) {
|
|
95
|
+
const parsedHotkey = {
|
|
96
|
+
altKey: !1,
|
|
97
|
+
ctrlKey: !1,
|
|
98
|
+
metaKey: !1,
|
|
99
|
+
shiftKey: !1
|
|
100
|
+
}, hotkeySegments = hotkey.replace("++", "+add").split("+");
|
|
101
|
+
for (const rawHotkeySegment of hotkeySegments) {
|
|
102
|
+
const optional = rawHotkeySegment.endsWith("?") && rawHotkeySegment.length > 1, hotkeySegment = optional ? rawHotkeySegment.slice(0, -1) : rawHotkeySegment, keyName = toKeyName(hotkeySegment), modifier = modifiers[keyName], alias = aliases[hotkeySegment], code = keyCodes[keyName];
|
|
103
|
+
if (hotkeySegment.length > 1 && modifier === void 0 && alias === void 0 && code === void 0)
|
|
104
|
+
throw new TypeError(`Unknown modifier: "${hotkeySegment}"`);
|
|
105
|
+
(hotkeySegments.length === 1 || modifier === void 0) && (parsedHotkey.key = keyName, parsedHotkey.keyCode = toKeyCode(hotkeySegment)), modifier !== void 0 && (parsedHotkey[modifier] = optional ? null : !0);
|
|
106
|
+
}
|
|
107
|
+
return parsedHotkey;
|
|
108
|
+
}
|
|
109
|
+
function compareHotkey(parsedHotkey, event) {
|
|
110
|
+
return (parsedHotkey.altKey == null || parsedHotkey.altKey === event.altKey) && (parsedHotkey.ctrlKey == null || parsedHotkey.ctrlKey === event.ctrlKey) && (parsedHotkey.metaKey == null || parsedHotkey.metaKey === event.metaKey) && (parsedHotkey.shiftKey == null || parsedHotkey.shiftKey === event.shiftKey) ? parsedHotkey.keyCode !== void 0 && event.keyCode !== void 0 ? parsedHotkey.keyCode === 91 && event.keyCode === 93 ? !0 : parsedHotkey.keyCode === event.keyCode : parsedHotkey.keyCode === event.keyCode || parsedHotkey.key === event.key.toLowerCase() : !1;
|
|
111
|
+
}
|
|
112
|
+
function toKeyCode(name) {
|
|
113
|
+
const keyName = toKeyName(name);
|
|
114
|
+
return keyCodes[keyName] ?? keyName.toUpperCase().charCodeAt(0);
|
|
115
|
+
}
|
|
116
|
+
function toKeyName(name) {
|
|
117
|
+
const keyName = name.toLowerCase();
|
|
118
|
+
return aliases[keyName] ?? keyName;
|
|
119
|
+
}
|
|
8
120
|
function defineBehavior(behavior) {
|
|
9
121
|
return behavior;
|
|
10
122
|
}
|
|
11
123
|
function selectionIsCollapsed(context) {
|
|
12
|
-
return context.selection?.anchor.path
|
|
124
|
+
return JSON.stringify(context.selection?.anchor.path) === JSON.stringify(context.selection?.focus.path) && context.selection?.anchor.offset === context.selection?.focus.offset;
|
|
13
125
|
}
|
|
14
126
|
function getFocusBlock(context) {
|
|
15
127
|
const key = context.selection && types.isKeySegment(context.selection.focus.path[0]) ? context.selection.focus.path[0]._key : void 0, node = key ? context.value.find((block) => block._key === key) : void 0;
|
|
@@ -125,11 +237,42 @@ function isEmptyTextBlock(block) {
|
|
|
125
237
|
function getTextBlockText(block) {
|
|
126
238
|
return block.children.map((child) => child.text ?? "").join("");
|
|
127
239
|
}
|
|
128
|
-
const
|
|
240
|
+
const arrowDownOnLonelyBlockObject = {
|
|
241
|
+
on: "key.down",
|
|
242
|
+
guard: ({
|
|
243
|
+
context,
|
|
244
|
+
event
|
|
245
|
+
}) => {
|
|
246
|
+
const isArrowDown = isHotkey("ArrowDown", event.keyboardEvent), focusBlockObject = getFocusBlockObject(context), nextBlock = getNextBlock(context);
|
|
247
|
+
return isArrowDown && focusBlockObject && !nextBlock;
|
|
248
|
+
},
|
|
249
|
+
actions: [() => [{
|
|
250
|
+
type: "insert text block",
|
|
251
|
+
placement: "after"
|
|
252
|
+
}]]
|
|
253
|
+
}, arrowUpOnLonelyBlockObject = {
|
|
254
|
+
on: "key.down",
|
|
255
|
+
guard: ({
|
|
256
|
+
context,
|
|
257
|
+
event
|
|
258
|
+
}) => {
|
|
259
|
+
const isArrowUp = isHotkey("ArrowUp", event.keyboardEvent), focusBlockObject = getFocusBlockObject(context), previousBlock = getPreviousBlock(context);
|
|
260
|
+
return isArrowUp && focusBlockObject && !previousBlock;
|
|
261
|
+
},
|
|
262
|
+
actions: [() => [{
|
|
263
|
+
type: "insert text block",
|
|
264
|
+
placement: "before"
|
|
265
|
+
}, {
|
|
266
|
+
type: "select previous block"
|
|
267
|
+
}]]
|
|
268
|
+
}, breakingBlockObject = {
|
|
129
269
|
on: "insert break",
|
|
130
270
|
guard: ({
|
|
131
271
|
context
|
|
132
|
-
}) =>
|
|
272
|
+
}) => {
|
|
273
|
+
const focusBlockObject = getFocusBlockObject(context);
|
|
274
|
+
return selectionIsCollapsed(context) && focusBlockObject !== void 0;
|
|
275
|
+
},
|
|
133
276
|
actions: [() => [{
|
|
134
277
|
type: "insert text block",
|
|
135
278
|
placement: "after"
|
|
@@ -195,6 +338,8 @@ const breakingBlockObject = {
|
|
|
195
338
|
}
|
|
196
339
|
}]]
|
|
197
340
|
}, coreBlockObjectBehaviors = {
|
|
341
|
+
arrowDownOnLonelyBlockObject,
|
|
342
|
+
arrowUpOnLonelyBlockObject,
|
|
198
343
|
breakingBlockObject,
|
|
199
344
|
deletingEmptyTextBlockAfterBlockObject,
|
|
200
345
|
deletingEmptyTextBlockBeforeBlockObject
|
|
@@ -278,7 +423,7 @@ const breakingBlockObject = {
|
|
|
278
423
|
text: `
|
|
279
424
|
`
|
|
280
425
|
}]]
|
|
281
|
-
}, coreBehaviors = [softReturn, coreDecoratorBehaviors.decoratorAdd, coreDecoratorBehaviors.decoratorRemove, coreDecoratorBehaviors.decoratorToggle, coreBlockObjectBehaviors.breakingBlockObject, coreBlockObjectBehaviors.deletingEmptyTextBlockAfterBlockObject, coreBlockObjectBehaviors.deletingEmptyTextBlockBeforeBlockObject, coreListBehaviors.clearListOnBackspace, coreListBehaviors.unindentListOnBackspace], coreBehavior = {
|
|
426
|
+
}, coreBehaviors = [softReturn, coreDecoratorBehaviors.decoratorAdd, coreDecoratorBehaviors.decoratorRemove, coreDecoratorBehaviors.decoratorToggle, coreBlockObjectBehaviors.arrowDownOnLonelyBlockObject, coreBlockObjectBehaviors.arrowUpOnLonelyBlockObject, coreBlockObjectBehaviors.breakingBlockObject, coreBlockObjectBehaviors.deletingEmptyTextBlockAfterBlockObject, coreBlockObjectBehaviors.deletingEmptyTextBlockBeforeBlockObject, coreListBehaviors.clearListOnBackspace, coreListBehaviors.unindentListOnBackspace], coreBehavior = {
|
|
282
427
|
softReturn,
|
|
283
428
|
decorators: coreDecoratorBehaviors,
|
|
284
429
|
blockObjects: coreBlockObjectBehaviors,
|
|
@@ -291,7 +436,7 @@ function createLinkBehaviors(config) {
|
|
|
291
436
|
context,
|
|
292
437
|
event
|
|
293
438
|
}) => {
|
|
294
|
-
const selectionCollapsed = selectionIsCollapsed(context), text = event.
|
|
439
|
+
const selectionCollapsed = selectionIsCollapsed(context), text = event.data.getData("text/plain"), url = looksLikeUrl(text) ? text : void 0, annotation = url !== void 0 ? config.linkAnnotation?.({
|
|
295
440
|
url,
|
|
296
441
|
schema: context.schema
|
|
297
442
|
}) : void 0;
|
|
@@ -314,7 +459,7 @@ function createLinkBehaviors(config) {
|
|
|
314
459
|
const focusSpan = getFocusSpan(context), selectionCollapsed = selectionIsCollapsed(context);
|
|
315
460
|
if (!focusSpan || !selectionCollapsed)
|
|
316
461
|
return !1;
|
|
317
|
-
const text = event.
|
|
462
|
+
const text = event.data.getData("text/plain"), url = looksLikeUrl(text) ? text : void 0, annotation = url !== void 0 ? config.linkAnnotation?.({
|
|
318
463
|
url,
|
|
319
464
|
schema: context.schema
|
|
320
465
|
}) : void 0;
|
|
@@ -590,7 +735,7 @@ function createMarkdownBehaviors(config) {
|
|
|
590
735
|
context,
|
|
591
736
|
event
|
|
592
737
|
}) => {
|
|
593
|
-
const text = event.
|
|
738
|
+
const text = event.data.getData("text/plain"), hrRegExp = /^(---)$|(___)$|(\*\*\*)$/gm, hrCharacters = text.match(hrRegExp)?.[0], hrObject = config.horizontalRuleObject?.({
|
|
594
739
|
schema: context.schema
|
|
595
740
|
}), focusBlock = getFocusBlock(context);
|
|
596
741
|
return !hrCharacters || !hrObject || !focusBlock ? !1 : {
|
|
@@ -786,6 +931,53 @@ function createMarkdownBehaviors(config) {
|
|
|
786
931
|
};
|
|
787
932
|
return [automaticBlockquoteOnSpace, automaticHeadingOnSpace, automaticHr, automaticHrOnPaste, clearStyleOnBackspace, automaticListOnSpace];
|
|
788
933
|
}
|
|
934
|
+
function createCodeEditorBehaviors(config) {
|
|
935
|
+
return [{
|
|
936
|
+
on: "key.down",
|
|
937
|
+
guard: ({
|
|
938
|
+
context,
|
|
939
|
+
event
|
|
940
|
+
}) => {
|
|
941
|
+
if (!isHotkey(config.moveBlockUpShortcut, event.keyboardEvent) || !selectionIsCollapsed(context))
|
|
942
|
+
return !1;
|
|
943
|
+
const focusBlock = getFocusBlock(context), previousBlock = getPreviousBlock(context);
|
|
944
|
+
return focusBlock && previousBlock ? {
|
|
945
|
+
focusBlock,
|
|
946
|
+
previousBlock
|
|
947
|
+
} : !1;
|
|
948
|
+
},
|
|
949
|
+
actions: [(_, {
|
|
950
|
+
focusBlock,
|
|
951
|
+
previousBlock
|
|
952
|
+
}) => [{
|
|
953
|
+
type: "move block",
|
|
954
|
+
blockPath: focusBlock.path,
|
|
955
|
+
to: previousBlock.path
|
|
956
|
+
}]]
|
|
957
|
+
}, {
|
|
958
|
+
on: "key.down",
|
|
959
|
+
guard: ({
|
|
960
|
+
context,
|
|
961
|
+
event
|
|
962
|
+
}) => {
|
|
963
|
+
if (!isHotkey(config.moveBlockDownShortcut, event.keyboardEvent) || !selectionIsCollapsed(context))
|
|
964
|
+
return !1;
|
|
965
|
+
const focusBlock = getFocusBlock(context), nextBlock = getNextBlock(context);
|
|
966
|
+
return focusBlock && nextBlock ? {
|
|
967
|
+
focusBlock,
|
|
968
|
+
nextBlock
|
|
969
|
+
} : !1;
|
|
970
|
+
},
|
|
971
|
+
actions: [(_, {
|
|
972
|
+
focusBlock,
|
|
973
|
+
nextBlock
|
|
974
|
+
}) => [{
|
|
975
|
+
type: "move block",
|
|
976
|
+
blockPath: focusBlock.path,
|
|
977
|
+
to: nextBlock.path
|
|
978
|
+
}]]
|
|
979
|
+
}];
|
|
980
|
+
}
|
|
789
981
|
function getPortableTextMemberSchemaTypes(portableTextType) {
|
|
790
982
|
if (!portableTextType)
|
|
791
983
|
throw new Error("Parameter 'portabletextType' missing (required)");
|
|
@@ -5417,43 +5609,31 @@ const addAnnotationActionImplementation = ({
|
|
|
5417
5609
|
at: editor.selection.focus,
|
|
5418
5610
|
match: (n) => editor.isTextSpan(n),
|
|
5419
5611
|
voids: !1
|
|
5420
|
-
}))[0] ?? [void 0], focusDecorators = focusSpan
|
|
5612
|
+
}))[0] ?? [void 0], focusDecorators = focusSpan?.marks?.filter((mark) => schema2.decorators.some((decorator) => decorator.value === mark)) ?? [], focusAnnotations = focusSpan?.marks?.filter((mark) => !schema2.decorators.some((decorator) => decorator.value === mark)) ?? [], anchorBlockPath = editor.selection.anchor.path.slice(0, 1), focusBlockPath = editor.selection.focus.path.slice(0, 1), focusBlock = slate.Node.descendant(editor, focusBlockPath);
|
|
5421
5613
|
if (editor.isTextBlock(focusBlock)) {
|
|
5422
|
-
const [start, end] = slate.Range.edges(editor.selection),
|
|
5614
|
+
const [start, end] = slate.Range.edges(editor.selection), lastFocusBlockChild = focusBlock.children[focusBlock.children.length - 1], atTheEndOfBlock = isEqual__default.default(start, {
|
|
5615
|
+
path: [...focusBlockPath, focusBlock.children.length - 1],
|
|
5616
|
+
offset: editor.isTextSpan(lastFocusBlockChild) ? lastFocusBlockChild.text.length : 0
|
|
5617
|
+
}), atTheStartOfBlock = isEqual__default.default(end, {
|
|
5423
5618
|
path: [...focusBlockPath, 0],
|
|
5424
5619
|
offset: 0
|
|
5425
5620
|
});
|
|
5426
|
-
if (
|
|
5621
|
+
if (atTheEndOfBlock && slate.Range.isCollapsed(editor.selection)) {
|
|
5427
5622
|
slate.Editor.insertNode(editor, editor.pteCreateTextBlock({
|
|
5428
|
-
decorators:
|
|
5623
|
+
decorators: [],
|
|
5429
5624
|
listItem: focusBlock.listItem,
|
|
5430
5625
|
level: focusBlock.level
|
|
5431
5626
|
}));
|
|
5432
|
-
const [nextBlockPath] = slate.Path.next(focusBlockPath);
|
|
5433
|
-
slate.Transforms.select(editor, {
|
|
5434
|
-
anchor: {
|
|
5435
|
-
path: [nextBlockPath, 0],
|
|
5436
|
-
offset: 0
|
|
5437
|
-
},
|
|
5438
|
-
focus: {
|
|
5439
|
-
path: [nextBlockPath, 0],
|
|
5440
|
-
offset: 0
|
|
5441
|
-
}
|
|
5442
|
-
});
|
|
5443
5627
|
return;
|
|
5444
5628
|
}
|
|
5445
|
-
|
|
5446
|
-
path: [...focusBlockPath, focusBlock.children.length - 1],
|
|
5447
|
-
offset: editor.isTextSpan(lastFocusBlockChild) ? lastFocusBlockChild.text.length : 0
|
|
5448
|
-
});
|
|
5449
|
-
if (atTheEndOfBlock && slate.Range.isCollapsed(editor.selection)) {
|
|
5629
|
+
if (atTheStartOfBlock && slate.Range.isCollapsed(editor.selection)) {
|
|
5450
5630
|
slate.Editor.insertNode(editor, editor.pteCreateTextBlock({
|
|
5451
|
-
decorators: [],
|
|
5631
|
+
decorators: focusAnnotations.length === 0 ? focusDecorators : [],
|
|
5452
5632
|
listItem: focusBlock.listItem,
|
|
5453
5633
|
level: focusBlock.level
|
|
5454
5634
|
}));
|
|
5455
5635
|
const [nextBlockPath] = slate.Path.next(focusBlockPath);
|
|
5456
|
-
slate.Transforms.
|
|
5636
|
+
slate.Transforms.select(editor, {
|
|
5457
5637
|
anchor: {
|
|
5458
5638
|
path: [nextBlockPath, 0],
|
|
5459
5639
|
offset: 0
|
|
@@ -5465,7 +5645,8 @@ const addAnnotationActionImplementation = ({
|
|
|
5465
5645
|
});
|
|
5466
5646
|
return;
|
|
5467
5647
|
}
|
|
5468
|
-
|
|
5648
|
+
const selectionAcrossBlocks = anchorBlockPath[0] !== focusBlockPath[0];
|
|
5649
|
+
if (!atTheStartOfBlock && !atTheEndOfBlock && !selectionAcrossBlocks) {
|
|
5469
5650
|
slate.Editor.withoutNormalizing(editor, () => {
|
|
5470
5651
|
if (!editor.selection)
|
|
5471
5652
|
return;
|
|
@@ -5514,6 +5695,9 @@ const addAnnotationActionImplementation = ({
|
|
|
5514
5695
|
return;
|
|
5515
5696
|
}
|
|
5516
5697
|
}
|
|
5698
|
+
slate.Transforms.splitNodes(editor, {
|
|
5699
|
+
always: !0
|
|
5700
|
+
});
|
|
5517
5701
|
}, insertSoftBreakActionImplementation = ({
|
|
5518
5702
|
context,
|
|
5519
5703
|
action
|
|
@@ -5614,6 +5798,8 @@ const addAnnotationActionImplementation = ({
|
|
|
5614
5798
|
});
|
|
5615
5799
|
}
|
|
5616
5800
|
},
|
|
5801
|
+
copy: () => {
|
|
5802
|
+
},
|
|
5617
5803
|
"delete backward": ({
|
|
5618
5804
|
action
|
|
5619
5805
|
}) => {
|
|
@@ -5713,10 +5899,48 @@ const addAnnotationActionImplementation = ({
|
|
|
5713
5899
|
}) => {
|
|
5714
5900
|
action.effect();
|
|
5715
5901
|
},
|
|
5716
|
-
|
|
5902
|
+
"key.down": () => {
|
|
5903
|
+
},
|
|
5904
|
+
"key.up": () => {
|
|
5905
|
+
},
|
|
5906
|
+
"move block": ({
|
|
5717
5907
|
action
|
|
5718
5908
|
}) => {
|
|
5719
|
-
|
|
5909
|
+
const location = toSlateRange({
|
|
5910
|
+
anchor: {
|
|
5911
|
+
path: action.blockPath,
|
|
5912
|
+
offset: 0
|
|
5913
|
+
},
|
|
5914
|
+
focus: {
|
|
5915
|
+
path: action.blockPath,
|
|
5916
|
+
offset: 0
|
|
5917
|
+
}
|
|
5918
|
+
}, action.editor);
|
|
5919
|
+
if (!location) {
|
|
5920
|
+
console.error("Unable to find Slate range from selection points");
|
|
5921
|
+
return;
|
|
5922
|
+
}
|
|
5923
|
+
const newLocation = toSlateRange({
|
|
5924
|
+
anchor: {
|
|
5925
|
+
path: action.to,
|
|
5926
|
+
offset: 0
|
|
5927
|
+
},
|
|
5928
|
+
focus: {
|
|
5929
|
+
path: action.to,
|
|
5930
|
+
offset: 0
|
|
5931
|
+
}
|
|
5932
|
+
}, action.editor);
|
|
5933
|
+
if (!newLocation) {
|
|
5934
|
+
console.error("Unable to find Slate range from selection points");
|
|
5935
|
+
return;
|
|
5936
|
+
}
|
|
5937
|
+
slate.Transforms.moveNodes(action.editor, {
|
|
5938
|
+
at: location,
|
|
5939
|
+
to: newLocation.anchor.path.slice(0, 1),
|
|
5940
|
+
mode: "highest"
|
|
5941
|
+
});
|
|
5942
|
+
},
|
|
5943
|
+
paste: () => {
|
|
5720
5944
|
},
|
|
5721
5945
|
select: ({
|
|
5722
5946
|
action
|
|
@@ -5724,6 +5948,31 @@ const addAnnotationActionImplementation = ({
|
|
|
5724
5948
|
const newSelection = toSlateRange(action.selection, action.editor);
|
|
5725
5949
|
newSelection ? slate.Transforms.select(action.editor, newSelection) : slate.Transforms.deselect(action.editor);
|
|
5726
5950
|
},
|
|
5951
|
+
"select previous block": ({
|
|
5952
|
+
action
|
|
5953
|
+
}) => {
|
|
5954
|
+
if (!action.editor.selection) {
|
|
5955
|
+
console.error("Unable to select previous block without a selection");
|
|
5956
|
+
return;
|
|
5957
|
+
}
|
|
5958
|
+
const blockPath = action.editor.selection.focus.path.slice(0, 1);
|
|
5959
|
+
if (!slate.Path.hasPrevious(blockPath)) {
|
|
5960
|
+
console.error("There's no previous block to select");
|
|
5961
|
+
return;
|
|
5962
|
+
}
|
|
5963
|
+
const previousBlockPath = slate.Path.previous(blockPath);
|
|
5964
|
+
slate.Transforms.select(action.editor, previousBlockPath);
|
|
5965
|
+
},
|
|
5966
|
+
"select next block": ({
|
|
5967
|
+
action
|
|
5968
|
+
}) => {
|
|
5969
|
+
if (!action.editor.selection) {
|
|
5970
|
+
console.error("Unable to select next block without a selection");
|
|
5971
|
+
return;
|
|
5972
|
+
}
|
|
5973
|
+
const nextBlockPath = [action.editor.selection.focus.path.slice(0, 1)[0] + 1];
|
|
5974
|
+
slate.Transforms.select(action.editor, nextBlockPath);
|
|
5975
|
+
},
|
|
5727
5976
|
reselect: ({
|
|
5728
5977
|
action
|
|
5729
5978
|
}) => {
|
|
@@ -5775,6 +6024,13 @@ function performAction({
|
|
|
5775
6024
|
});
|
|
5776
6025
|
break;
|
|
5777
6026
|
}
|
|
6027
|
+
case "move block": {
|
|
6028
|
+
behaviorActionImplementations["move block"]({
|
|
6029
|
+
context,
|
|
6030
|
+
action
|
|
6031
|
+
});
|
|
6032
|
+
break;
|
|
6033
|
+
}
|
|
5778
6034
|
case "set block": {
|
|
5779
6035
|
behaviorActionImplementations["set block"]({
|
|
5780
6036
|
context,
|
|
@@ -5803,6 +6059,20 @@ function performAction({
|
|
|
5803
6059
|
});
|
|
5804
6060
|
break;
|
|
5805
6061
|
}
|
|
6062
|
+
case "select previous block": {
|
|
6063
|
+
behaviorActionImplementations["select previous block"]({
|
|
6064
|
+
context,
|
|
6065
|
+
action
|
|
6066
|
+
});
|
|
6067
|
+
break;
|
|
6068
|
+
}
|
|
6069
|
+
case "select next block": {
|
|
6070
|
+
behaviorActionImplementations["select next block"]({
|
|
6071
|
+
context,
|
|
6072
|
+
action
|
|
6073
|
+
});
|
|
6074
|
+
break;
|
|
6075
|
+
}
|
|
5806
6076
|
case "reselect": {
|
|
5807
6077
|
behaviorActionImplementations.reselect({
|
|
5808
6078
|
context,
|
|
@@ -5843,6 +6113,8 @@ function performDefaultAction({
|
|
|
5843
6113
|
});
|
|
5844
6114
|
break;
|
|
5845
6115
|
}
|
|
6116
|
+
case "copy":
|
|
6117
|
+
break;
|
|
5846
6118
|
case "decorator.add": {
|
|
5847
6119
|
behaviorActionImplementations["decorator.add"]({
|
|
5848
6120
|
context,
|
|
@@ -5906,11 +6178,6 @@ function performDefaultAction({
|
|
|
5906
6178
|
});
|
|
5907
6179
|
break;
|
|
5908
6180
|
}
|
|
5909
|
-
default:
|
|
5910
|
-
behaviorActionImplementations.paste({
|
|
5911
|
-
context,
|
|
5912
|
-
action
|
|
5913
|
-
});
|
|
5914
6181
|
}
|
|
5915
6182
|
}
|
|
5916
6183
|
const editorMachine = xstate.setup({
|
|
@@ -5987,10 +6254,10 @@ const editorMachine = xstate.setup({
|
|
|
5987
6254
|
};
|
|
5988
6255
|
let behaviorOverwritten = !1;
|
|
5989
6256
|
for (const eventBehavior of eventBehaviors) {
|
|
5990
|
-
const shouldRun = eventBehavior.guard
|
|
6257
|
+
const shouldRun = eventBehavior.guard === void 0 || eventBehavior.guard({
|
|
5991
6258
|
context: behaviorContext,
|
|
5992
6259
|
event: event.behaviorEvent
|
|
5993
|
-
})
|
|
6260
|
+
});
|
|
5994
6261
|
if (!shouldRun)
|
|
5995
6262
|
continue;
|
|
5996
6263
|
const actionIntendSets = eventBehavior.actions.map((actionSet) => actionSet({
|
|
@@ -6003,8 +6270,10 @@ const editorMachine = xstate.setup({
|
|
|
6003
6270
|
editor: event.editor,
|
|
6004
6271
|
actionIntends
|
|
6005
6272
|
});
|
|
6006
|
-
if (behaviorOverwritten)
|
|
6273
|
+
if (behaviorOverwritten) {
|
|
6274
|
+
event.nativeEvent?.preventDefault();
|
|
6007
6275
|
break;
|
|
6276
|
+
}
|
|
6008
6277
|
}
|
|
6009
6278
|
behaviorOverwritten || enqueue.raise({
|
|
6010
6279
|
type: "behavior action intends",
|
|
@@ -6603,118 +6872,6 @@ const debug$3 = debugWithName("components:Leaf"), EMPTY_MARKS = [], Leaf = (prop
|
|
|
6603
6872
|
return React.useMemo(() => /* @__PURE__ */ jsxRuntime.jsx("span", { ...attributes, ref: spanRef, children: content }, leaf._key), [leaf, attributes, content]);
|
|
6604
6873
|
};
|
|
6605
6874
|
Leaf.displayName = "Leaf";
|
|
6606
|
-
const IS_MAC = typeof window < "u" && /Mac|iPod|iPhone|iPad/.test(window.navigator.userAgent), modifiers = {
|
|
6607
|
-
alt: "altKey",
|
|
6608
|
-
control: "ctrlKey",
|
|
6609
|
-
meta: "metaKey",
|
|
6610
|
-
shift: "shiftKey"
|
|
6611
|
-
}, aliases = {
|
|
6612
|
-
add: "+",
|
|
6613
|
-
break: "pause",
|
|
6614
|
-
cmd: "meta",
|
|
6615
|
-
command: "meta",
|
|
6616
|
-
ctl: "control",
|
|
6617
|
-
ctrl: "control",
|
|
6618
|
-
del: "delete",
|
|
6619
|
-
down: "arrowdown",
|
|
6620
|
-
esc: "escape",
|
|
6621
|
-
ins: "insert",
|
|
6622
|
-
left: "arrowleft",
|
|
6623
|
-
mod: IS_MAC ? "meta" : "control",
|
|
6624
|
-
opt: "alt",
|
|
6625
|
-
option: "alt",
|
|
6626
|
-
return: "enter",
|
|
6627
|
-
right: "arrowright",
|
|
6628
|
-
space: " ",
|
|
6629
|
-
spacebar: " ",
|
|
6630
|
-
up: "arrowup",
|
|
6631
|
-
win: "meta",
|
|
6632
|
-
windows: "meta"
|
|
6633
|
-
}, keyCodes = {
|
|
6634
|
-
backspace: 8,
|
|
6635
|
-
tab: 9,
|
|
6636
|
-
enter: 13,
|
|
6637
|
-
shift: 16,
|
|
6638
|
-
control: 17,
|
|
6639
|
-
alt: 18,
|
|
6640
|
-
pause: 19,
|
|
6641
|
-
capslock: 20,
|
|
6642
|
-
escape: 27,
|
|
6643
|
-
" ": 32,
|
|
6644
|
-
pageup: 33,
|
|
6645
|
-
pagedown: 34,
|
|
6646
|
-
end: 35,
|
|
6647
|
-
home: 36,
|
|
6648
|
-
arrowleft: 37,
|
|
6649
|
-
arrowup: 38,
|
|
6650
|
-
arrowright: 39,
|
|
6651
|
-
arrowdown: 40,
|
|
6652
|
-
insert: 45,
|
|
6653
|
-
delete: 46,
|
|
6654
|
-
meta: 91,
|
|
6655
|
-
numlock: 144,
|
|
6656
|
-
scrolllock: 145,
|
|
6657
|
-
";": 186,
|
|
6658
|
-
"=": 187,
|
|
6659
|
-
",": 188,
|
|
6660
|
-
"-": 189,
|
|
6661
|
-
".": 190,
|
|
6662
|
-
"/": 191,
|
|
6663
|
-
"`": 192,
|
|
6664
|
-
"[": 219,
|
|
6665
|
-
"\\": 220,
|
|
6666
|
-
"]": 221,
|
|
6667
|
-
"'": 222,
|
|
6668
|
-
f1: 112,
|
|
6669
|
-
f2: 113,
|
|
6670
|
-
f3: 114,
|
|
6671
|
-
f4: 115,
|
|
6672
|
-
f5: 116,
|
|
6673
|
-
f6: 117,
|
|
6674
|
-
f7: 118,
|
|
6675
|
-
f8: 119,
|
|
6676
|
-
f9: 120,
|
|
6677
|
-
f10: 121,
|
|
6678
|
-
f11: 122,
|
|
6679
|
-
f12: 123,
|
|
6680
|
-
f13: 124,
|
|
6681
|
-
f14: 125,
|
|
6682
|
-
f15: 126,
|
|
6683
|
-
f16: 127,
|
|
6684
|
-
f17: 128,
|
|
6685
|
-
f18: 129,
|
|
6686
|
-
f19: 130,
|
|
6687
|
-
f20: 131
|
|
6688
|
-
};
|
|
6689
|
-
function isHotkey(hotkey, event) {
|
|
6690
|
-
return compareHotkey(parseHotkey(hotkey), event);
|
|
6691
|
-
}
|
|
6692
|
-
function parseHotkey(hotkey) {
|
|
6693
|
-
const parsedHotkey = {
|
|
6694
|
-
altKey: !1,
|
|
6695
|
-
ctrlKey: !1,
|
|
6696
|
-
metaKey: !1,
|
|
6697
|
-
shiftKey: !1
|
|
6698
|
-
}, hotkeySegments = hotkey.replace("++", "+add").split("+");
|
|
6699
|
-
for (const rawHotkeySegment of hotkeySegments) {
|
|
6700
|
-
const optional = rawHotkeySegment.endsWith("?") && rawHotkeySegment.length > 1, hotkeySegment = optional ? rawHotkeySegment.slice(0, -1) : rawHotkeySegment, keyName = toKeyName(hotkeySegment), modifier = modifiers[keyName], alias = aliases[hotkeySegment], code = keyCodes[keyName];
|
|
6701
|
-
if (hotkeySegment.length > 1 && modifier === void 0 && alias === void 0 && code === void 0)
|
|
6702
|
-
throw new TypeError(`Unknown modifier: "${hotkeySegment}"`);
|
|
6703
|
-
(hotkeySegments.length === 1 || modifier === void 0) && (parsedHotkey.key = keyName, parsedHotkey.keyCode = toKeyCode(hotkeySegment)), modifier !== void 0 && (parsedHotkey[modifier] = optional ? null : !0);
|
|
6704
|
-
}
|
|
6705
|
-
return parsedHotkey;
|
|
6706
|
-
}
|
|
6707
|
-
function compareHotkey(parsedHotkey, event) {
|
|
6708
|
-
return (parsedHotkey.altKey == null || parsedHotkey.altKey === event.altKey) && (parsedHotkey.ctrlKey == null || parsedHotkey.ctrlKey === event.ctrlKey) && (parsedHotkey.metaKey == null || parsedHotkey.metaKey === event.metaKey) && (parsedHotkey.shiftKey == null || parsedHotkey.shiftKey === event.shiftKey) ? parsedHotkey.keyCode !== void 0 && event.keyCode !== void 0 ? parsedHotkey.keyCode === 91 && event.keyCode === 93 ? !0 : parsedHotkey.keyCode === event.keyCode : parsedHotkey.keyCode === event.keyCode || parsedHotkey.key === event.key.toLowerCase() : !1;
|
|
6709
|
-
}
|
|
6710
|
-
function toKeyCode(name) {
|
|
6711
|
-
const keyName = toKeyName(name);
|
|
6712
|
-
return keyCodes[keyName] ?? keyName.toUpperCase().charCodeAt(0);
|
|
6713
|
-
}
|
|
6714
|
-
function toKeyName(name) {
|
|
6715
|
-
const keyName = name.toLowerCase();
|
|
6716
|
-
return aliases[keyName] ?? keyName;
|
|
6717
|
-
}
|
|
6718
6875
|
const debug$2 = debugWithName("plugin:withHotKeys"), DEFAULT_HOTKEYS = {
|
|
6719
6876
|
marks: {
|
|
6720
6877
|
"mod+b": "strong",
|
|
@@ -6762,38 +6919,7 @@ function createWithHotkeys(editorActor, portableTextEditor, hotkeysFromOptions)
|
|
|
6762
6919
|
}
|
|
6763
6920
|
}
|
|
6764
6921
|
});
|
|
6765
|
-
const isEnter = isHotkey("enter", event.nativeEvent), isTab = isHotkey("tab", event.nativeEvent), isShiftEnter = isHotkey("shift+enter", event.nativeEvent), isShiftTab = isHotkey("shift+tab", event.nativeEvent)
|
|
6766
|
-
if (isArrowDown && editor.selection) {
|
|
6767
|
-
const focusBlock = slate.Node.descendant(editor, editor.selection.focus.path.slice(0, 1));
|
|
6768
|
-
if (focusBlock && slate.Editor.isVoid(editor, focusBlock)) {
|
|
6769
|
-
const nextPath = slate.Path.next(editor.selection.focus.path.slice(0, 1));
|
|
6770
|
-
if (!slate.Node.has(editor, nextPath)) {
|
|
6771
|
-
slate.Transforms.insertNodes(editor, editor.pteCreateTextBlock({
|
|
6772
|
-
decorators: []
|
|
6773
|
-
}), {
|
|
6774
|
-
at: nextPath
|
|
6775
|
-
}), slate.Transforms.select(editor, {
|
|
6776
|
-
path: [...nextPath, 0],
|
|
6777
|
-
offset: 0
|
|
6778
|
-
}), editor.onChange();
|
|
6779
|
-
return;
|
|
6780
|
-
}
|
|
6781
|
-
}
|
|
6782
|
-
}
|
|
6783
|
-
if (isArrowUp && editor.selection) {
|
|
6784
|
-
const isFirstBlock = editor.selection.focus.path[0] === 0, focusBlock = slate.Node.descendant(editor, editor.selection.focus.path.slice(0, 1));
|
|
6785
|
-
if (isFirstBlock && focusBlock && slate.Editor.isVoid(editor, focusBlock)) {
|
|
6786
|
-
slate.Transforms.insertNodes(editor, editor.pteCreateTextBlock({
|
|
6787
|
-
decorators: []
|
|
6788
|
-
}), {
|
|
6789
|
-
at: [0]
|
|
6790
|
-
}), slate.Transforms.select(editor, {
|
|
6791
|
-
path: [0, 0],
|
|
6792
|
-
offset: 0
|
|
6793
|
-
}), editor.onChange();
|
|
6794
|
-
return;
|
|
6795
|
-
}
|
|
6796
|
-
}
|
|
6922
|
+
const isEnter = isHotkey("enter", event.nativeEvent), isTab = isHotkey("tab", event.nativeEvent), isShiftEnter = isHotkey("shift+enter", event.nativeEvent), isShiftTab = isHotkey("shift+tab", event.nativeEvent);
|
|
6797
6923
|
if ((isTab || isShiftTab) && editor.selection) {
|
|
6798
6924
|
const [focusChild] = slate.Editor.node(editor, editor.selection.focus, {
|
|
6799
6925
|
depth: 2
|
|
@@ -7140,8 +7266,16 @@ const debug = debugWithName("component:Editable"), PLACEHOLDER_STYLE = {
|
|
|
7140
7266
|
return () => teardown();
|
|
7141
7267
|
}, [slateEditor, syncRangeDecorations]);
|
|
7142
7268
|
const handleCopy = React.useCallback((event) => {
|
|
7143
|
-
onCopy
|
|
7144
|
-
|
|
7269
|
+
onCopy ? onCopy(event) !== void 0 && event.preventDefault() : event.nativeEvent.clipboardData && editorActor.send({
|
|
7270
|
+
type: "behavior event",
|
|
7271
|
+
behaviorEvent: {
|
|
7272
|
+
type: "copy",
|
|
7273
|
+
data: event.nativeEvent.clipboardData
|
|
7274
|
+
},
|
|
7275
|
+
editor: slateEditor,
|
|
7276
|
+
nativeEvent: event
|
|
7277
|
+
});
|
|
7278
|
+
}, [onCopy, editorActor, slateEditor]), handlePaste = React.useCallback((event_0) => {
|
|
7145
7279
|
const value_0 = PortableTextEditor.getValue(portableTextEditor), path = toPortableTextRange(value_0, slateEditor.selection, schemaTypes)?.focus.path || [], onPasteResult = onPaste?.({
|
|
7146
7280
|
event: event_0,
|
|
7147
7281
|
value: value_0,
|
|
@@ -7158,14 +7292,15 @@ const debug = debugWithName("component:Editable"), PLACEHOLDER_STYLE = {
|
|
|
7158
7292
|
editorActor.send({
|
|
7159
7293
|
type: "done loading"
|
|
7160
7294
|
});
|
|
7161
|
-
})) : event_0.nativeEvent.clipboardData &&
|
|
7295
|
+
})) : event_0.nativeEvent.clipboardData && editorActor.send({
|
|
7162
7296
|
type: "behavior event",
|
|
7163
7297
|
behaviorEvent: {
|
|
7164
7298
|
type: "paste",
|
|
7165
|
-
|
|
7299
|
+
data: event_0.nativeEvent.clipboardData
|
|
7166
7300
|
},
|
|
7167
|
-
editor: slateEditor
|
|
7168
|
-
|
|
7301
|
+
editor: slateEditor,
|
|
7302
|
+
nativeEvent: event_0
|
|
7303
|
+
}), debug("No result from custom paste handler, pasting normally");
|
|
7169
7304
|
}, [editorActor, onPaste, portableTextEditor, schemaTypes, slateEditor]), handleOnFocus = React.useCallback((event_1) => {
|
|
7170
7305
|
if (onFocus && onFocus(event_1), !event_1.isDefaultPrevented()) {
|
|
7171
7306
|
const selection = PortableTextEditor.getSelection(portableTextEditor);
|
|
@@ -7226,8 +7361,40 @@ const debug = debugWithName("component:Editable"), PLACEHOLDER_STYLE = {
|
|
|
7226
7361
|
}
|
|
7227
7362
|
}, [validateSelection, editableElement]);
|
|
7228
7363
|
const handleKeyDown = React.useCallback((event_5) => {
|
|
7229
|
-
props.onKeyDown && props.onKeyDown(event_5), event_5.isDefaultPrevented() || slateEditor.pteWithHotKeys(event_5)
|
|
7230
|
-
|
|
7364
|
+
props.onKeyDown && props.onKeyDown(event_5), event_5.isDefaultPrevented() || slateEditor.pteWithHotKeys(event_5), event_5.isDefaultPrevented() || editorActor.send({
|
|
7365
|
+
type: "behavior event",
|
|
7366
|
+
behaviorEvent: {
|
|
7367
|
+
type: "key.down",
|
|
7368
|
+
keyboardEvent: {
|
|
7369
|
+
key: event_5.key,
|
|
7370
|
+
code: event_5.code,
|
|
7371
|
+
altKey: event_5.altKey,
|
|
7372
|
+
ctrlKey: event_5.ctrlKey,
|
|
7373
|
+
metaKey: event_5.metaKey,
|
|
7374
|
+
shiftKey: event_5.shiftKey
|
|
7375
|
+
}
|
|
7376
|
+
},
|
|
7377
|
+
editor: slateEditor,
|
|
7378
|
+
nativeEvent: event_5
|
|
7379
|
+
});
|
|
7380
|
+
}, [props, editorActor, slateEditor]), handleKeyUp = React.useCallback((event_6) => {
|
|
7381
|
+
props.onKeyUp && props.onKeyUp(event_6), event_6.isDefaultPrevented() || editorActor.send({
|
|
7382
|
+
type: "behavior event",
|
|
7383
|
+
behaviorEvent: {
|
|
7384
|
+
type: "key.up",
|
|
7385
|
+
keyboardEvent: {
|
|
7386
|
+
key: event_6.key,
|
|
7387
|
+
code: event_6.code,
|
|
7388
|
+
altKey: event_6.altKey,
|
|
7389
|
+
ctrlKey: event_6.ctrlKey,
|
|
7390
|
+
metaKey: event_6.metaKey,
|
|
7391
|
+
shiftKey: event_6.shiftKey
|
|
7392
|
+
}
|
|
7393
|
+
},
|
|
7394
|
+
editor: slateEditor,
|
|
7395
|
+
nativeEvent: event_6
|
|
7396
|
+
});
|
|
7397
|
+
}, [props, editorActor, slateEditor]), scrollSelectionIntoViewToSlate = React.useMemo(() => {
|
|
7231
7398
|
if (scrollSelectionIntoView !== void 0)
|
|
7232
7399
|
return scrollSelectionIntoView === null ? noop__default.default : (_editor, domRange) => {
|
|
7233
7400
|
scrollSelectionIntoView(portableTextEditor, domRange);
|
|
@@ -7274,6 +7441,7 @@ const debug = debugWithName("component:Editable"), PLACEHOLDER_STYLE = {
|
|
|
7274
7441
|
onDOMBeforeInput: handleOnBeforeInput,
|
|
7275
7442
|
onFocus: handleOnFocus,
|
|
7276
7443
|
onKeyDown: handleKeyDown,
|
|
7444
|
+
onKeyUp: handleKeyUp,
|
|
7277
7445
|
onPaste: handlePaste,
|
|
7278
7446
|
readOnly,
|
|
7279
7447
|
renderPlaceholder: void 0,
|
|
@@ -7337,6 +7505,7 @@ exports.PortableTextEditable = PortableTextEditable;
|
|
|
7337
7505
|
exports.PortableTextEditor = PortableTextEditor;
|
|
7338
7506
|
exports.coreBehavior = coreBehavior;
|
|
7339
7507
|
exports.coreBehaviors = coreBehaviors;
|
|
7508
|
+
exports.createCodeEditorBehaviors = createCodeEditorBehaviors;
|
|
7340
7509
|
exports.createLinkBehaviors = createLinkBehaviors;
|
|
7341
7510
|
exports.createMarkdownBehaviors = createMarkdownBehaviors;
|
|
7342
7511
|
exports.defineBehavior = defineBehavior;
|