@portabletext/editor 1.48.9 → 1.48.11

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.
Files changed (80) hide show
  1. package/lib/_chunks-cjs/editor-provider.cjs +879 -169
  2. package/lib/_chunks-cjs/editor-provider.cjs.map +1 -1
  3. package/lib/_chunks-cjs/selector.get-focus-inline-object.cjs +2 -2
  4. package/lib/_chunks-cjs/selector.get-focus-inline-object.cjs.map +1 -1
  5. package/lib/_chunks-cjs/selector.get-text-before.cjs +2 -2
  6. package/lib/_chunks-cjs/selector.get-text-before.cjs.map +1 -1
  7. package/lib/_chunks-cjs/selector.is-selecting-entire-blocks.cjs +464 -19
  8. package/lib/_chunks-cjs/selector.is-selecting-entire-blocks.cjs.map +1 -1
  9. package/lib/_chunks-cjs/util.selection-point-to-block-offset.cjs +9 -1
  10. package/lib/_chunks-cjs/util.selection-point-to-block-offset.cjs.map +1 -1
  11. package/lib/_chunks-cjs/util.slice-blocks.cjs +2 -2
  12. package/lib/_chunks-es/editor-provider.js +773 -65
  13. package/lib/_chunks-es/editor-provider.js.map +1 -1
  14. package/lib/_chunks-es/selector.get-focus-inline-object.js +1 -1
  15. package/lib/_chunks-es/selector.get-text-before.js +1 -1
  16. package/lib/_chunks-es/selector.is-selecting-entire-blocks.js +448 -3
  17. package/lib/_chunks-es/selector.is-selecting-entire-blocks.js.map +1 -1
  18. package/lib/_chunks-es/util.selection-point-to-block-offset.js +9 -1
  19. package/lib/_chunks-es/util.selection-point-to-block-offset.js.map +1 -1
  20. package/lib/_chunks-es/util.slice-blocks.js +2 -2
  21. package/lib/behaviors/index.cjs +27 -377
  22. package/lib/behaviors/index.cjs.map +1 -1
  23. package/lib/behaviors/index.d.cts +3696 -13915
  24. package/lib/behaviors/index.d.ts +3696 -13915
  25. package/lib/behaviors/index.js +22 -377
  26. package/lib/behaviors/index.js.map +1 -1
  27. package/lib/index.cjs +17 -17
  28. package/lib/index.cjs.map +1 -1
  29. package/lib/index.d.cts +3008 -394
  30. package/lib/index.d.ts +3008 -394
  31. package/lib/index.js +4 -5
  32. package/lib/index.js.map +1 -1
  33. package/lib/plugins/index.cjs +347 -30
  34. package/lib/plugins/index.cjs.map +1 -1
  35. package/lib/plugins/index.d.cts +3008 -395
  36. package/lib/plugins/index.d.ts +3008 -395
  37. package/lib/plugins/index.js +324 -8
  38. package/lib/plugins/index.js.map +1 -1
  39. package/lib/selectors/index.cjs +29 -29
  40. package/lib/selectors/index.cjs.map +1 -1
  41. package/lib/selectors/index.d.cts +3007 -387
  42. package/lib/selectors/index.d.ts +3007 -387
  43. package/lib/selectors/index.js +2 -3
  44. package/lib/selectors/index.js.map +1 -1
  45. package/lib/utils/index.cjs +5 -5
  46. package/lib/utils/index.cjs.map +1 -1
  47. package/lib/utils/index.d.cts +3008 -389
  48. package/lib/utils/index.d.ts +3008 -389
  49. package/lib/utils/index.js +2 -3
  50. package/lib/utils/index.js.map +1 -1
  51. package/package.json +1 -1
  52. package/src/behaviors/behavior.emoji-picker.ts +0 -6
  53. package/src/behaviors/behavior.markdown.ts +0 -48
  54. package/src/behaviors/index.ts +0 -15
  55. package/src/editor/create-editor.ts +0 -3
  56. package/src/editor/editor-machine.ts +105 -52
  57. package/src/editor/sync-machine.ts +10 -4
  58. package/src/internal-utils/__tests__/operationToPatches.test.ts +0 -2
  59. package/src/internal-utils/__tests__/patchToOperations.test.ts +0 -2
  60. package/src/plugins/plugin.core.tsx +1 -1
  61. package/lib/_chunks-cjs/behavior.core.cjs +0 -700
  62. package/lib/_chunks-cjs/behavior.core.cjs.map +0 -1
  63. package/lib/_chunks-cjs/behavior.markdown.cjs +0 -321
  64. package/lib/_chunks-cjs/behavior.markdown.cjs.map +0 -1
  65. package/lib/_chunks-cjs/selector.is-overlapping-selection.cjs +0 -449
  66. package/lib/_chunks-cjs/selector.is-overlapping-selection.cjs.map +0 -1
  67. package/lib/_chunks-cjs/util.get-selection-start-point.cjs +0 -10
  68. package/lib/_chunks-cjs/util.get-selection-start-point.cjs.map +0 -1
  69. package/lib/_chunks-es/behavior.core.js +0 -703
  70. package/lib/_chunks-es/behavior.core.js.map +0 -1
  71. package/lib/_chunks-es/behavior.markdown.js +0 -325
  72. package/lib/_chunks-es/behavior.markdown.js.map +0 -1
  73. package/lib/_chunks-es/selector.is-overlapping-selection.js +0 -451
  74. package/lib/_chunks-es/selector.is-overlapping-selection.js.map +0 -1
  75. package/lib/_chunks-es/util.get-selection-start-point.js +0 -11
  76. package/lib/_chunks-es/util.get-selection-start-point.js.map +0 -1
  77. package/src/behaviors/behavior.code-editor.ts +0 -77
  78. package/src/behaviors/behavior.links.ts +0 -84
  79. package/src/internal-utils/looks-like-url.test.ts +0 -19
  80. package/src/internal-utils/looks-like-url.ts +0 -15
@@ -11,7 +11,7 @@ import { unset, set, setIfMissing, insert, diffMatchPatch as diffMatchPatch$1, a
11
11
  import flatten from "lodash/flatten.js";
12
12
  import isPlainObject from "lodash/isPlainObject.js";
13
13
  import uniq from "lodash/uniq.js";
14
- import { isTextBlock, parseBlock, sliceBlocks, parseAnnotation, blockOffsetToSpanSelectionPoint, parseInlineObject, isSpan, isListBlock, isEmptyTextBlock, getBlockEndPoint, getBlockStartPoint, getTextBlockText } from "./util.slice-blocks.js";
14
+ import { isTextBlock, parseBlock, sliceBlocks, parseAnnotation, blockOffsetToSpanSelectionPoint, parseInlineObject, isSpan$1 as isSpan, isListBlock, isEmptyTextBlock, getBlockStartPoint, getBlockEndPoint, isEqualSelectionPoints, getTextBlockText } from "./util.slice-blocks.js";
15
15
  import getRandomValues from "get-random-values-esm";
16
16
  import { htmlToBlocks } from "@portabletext/block-tools";
17
17
  import { toHTML } from "@portabletext/to-html";
@@ -21,13 +21,11 @@ import isUndefined from "lodash/isUndefined.js";
21
21
  import omitBy from "lodash/omitBy.js";
22
22
  import { isKeySegment, defineType, defineField, isPortableTextSpan as isPortableTextSpan$1 } from "@sanity/types";
23
23
  import omit from "lodash/omit.js";
24
- import { selectionPointToBlockOffset, blockOffsetsToSelection } from "./util.selection-point-to-block-offset.js";
25
- import { getTrimmedSelection, isActiveAnnotation, isActiveDecorator, getSelectedTextBlocks, isActiveListItem, isActiveStyle, isSelectingEntireBlocks, getActiveAnnotations } from "./selector.is-selecting-entire-blocks.js";
24
+ import { selectionPointToBlockOffset, blockOffsetsToSelection, getSelectionStartPoint, getSelectionEndPoint } from "./util.selection-point-to-block-offset.js";
25
+ import { getTrimmedSelection, isSelectionCollapsed, getCaretWordSelection, isSelectionExpanded, getFocusBlockObject, getPreviousBlock, getNextBlock, getFocusTextBlock, isOverlappingSelection, isAtTheEndOfBlock, getFocusSpan, isAtTheStartOfBlock, getFirstBlock as getFirstBlock$1, getLastBlock as getLastBlock$1, getSelectedBlocks, getSelectionStartBlock as getSelectionStartBlock$1, getSelectionEndBlock as getSelectionEndBlock$1, getFocusListBlock, isActiveAnnotation, isActiveDecorator, getSelectedTextBlocks, isActiveListItem, isActiveStyle, isSelectingEntireBlocks, getActiveAnnotations } from "./selector.is-selecting-entire-blocks.js";
26
26
  import { DOMEditor } from "slate-dom";
27
27
  import startCase from "lodash.startcase";
28
- import { defineBehavior, raise, coreBehaviors } from "./behavior.core.js";
29
- import { getFocusTextBlock, getPreviousBlock, getNextBlock, getFocusBlockObject, getFocusSpan, isSelectionCollapsed, isOverlappingSelection, getSelectedBlocks, isSelectionExpanded } from "./selector.is-overlapping-selection.js";
30
- import { getSelectionStartPoint, getSelectionEndPoint } from "./util.get-selection-start-point.js";
28
+ import { defineBehavior, raise } from "../behaviors/index.js";
31
29
  import { Subject } from "rxjs";
32
30
  import { useEffectEvent } from "use-effect-event";
33
31
  const rootName = "sanity-pte:";
@@ -1652,8 +1650,11 @@ const debug$d = debugWithName("sync machine"), syncValueCallback = ({
1652
1650
  event
1653
1651
  }) => (assertEvent(event, "done syncing"), event.value)
1654
1652
  }),
1655
- "emit done syncing initial value": emit({
1656
- type: "done syncing initial value"
1653
+ "emit done syncing value": emit({
1654
+ type: "done syncing value"
1655
+ }),
1656
+ "emit syncing value": emit({
1657
+ type: "syncing value"
1657
1658
  })
1658
1659
  },
1659
1660
  guards: {
@@ -1729,7 +1730,7 @@ const debug$d = debugWithName("sync machine"), syncValueCallback = ({
1729
1730
  }
1730
1731
  },
1731
1732
  "done syncing initial value": {
1732
- entry: ["emit done syncing initial value", () => {
1733
+ entry: ["emit done syncing value", () => {
1733
1734
  debug$d("entry: done syncing initial value");
1734
1735
  }],
1735
1736
  exit: [() => {
@@ -1788,10 +1789,10 @@ const debug$d = debugWithName("sync machine"), syncValueCallback = ({
1788
1789
  syncing: {
1789
1790
  entry: [() => {
1790
1791
  debug$d("entry: syncing->syncing");
1791
- }],
1792
+ }, "emit syncing value"],
1792
1793
  exit: [() => {
1793
1794
  debug$d("exit: syncing->syncing");
1794
- }],
1795
+ }, "emit done syncing value"],
1795
1796
  always: {
1796
1797
  guard: "pending value equals previous value",
1797
1798
  target: "idle",
@@ -5720,7 +5721,6 @@ function editorConfigToMachineInput(config) {
5720
5721
  schema
5721
5722
  } = compileSchemasFromEditorConfig(config);
5722
5723
  return {
5723
- behaviors: config.behaviors,
5724
5724
  converters: createCoreConverters(legacySchema),
5725
5725
  getLegacySchema: () => legacySchema,
5726
5726
  keyGenerator: config.keyGenerator ?? defaultKeyGenerator,
@@ -5752,7 +5752,6 @@ function createInternalEditor(editorActor) {
5752
5752
  switch (event.type) {
5753
5753
  case "add behavior":
5754
5754
  case "remove behavior":
5755
- case "update behaviors":
5756
5755
  case "update key generator":
5757
5756
  case "update readOnly":
5758
5757
  case "patches":
@@ -5834,7 +5833,669 @@ function createGloballyScopedContext(key, defaultValue) {
5834
5833
  const symbol = Symbol.for(key);
5835
5834
  return typeof document > "u" ? createContext(defaultValue) : (globalScope[symbol] = globalScope[symbol] ?? createContext(defaultValue), globalScope[symbol]);
5836
5835
  }
5837
- const EditorContext = createGloballyScopedContext("@portabletext/editor/context/editor", null), abstractAnnotationBehaviors = [defineBehavior({
5836
+ const EditorContext = createGloballyScopedContext("@portabletext/editor/context/editor", null), addAnnotationOnCollapsedSelection = defineBehavior({
5837
+ on: "annotation.add",
5838
+ guard: ({
5839
+ snapshot
5840
+ }) => {
5841
+ if (!isSelectionCollapsed(snapshot))
5842
+ return !1;
5843
+ const caretWordSelection = getCaretWordSelection(snapshot);
5844
+ return !caretWordSelection || !isSelectionExpanded({
5845
+ context: {
5846
+ ...snapshot.context,
5847
+ selection: caretWordSelection
5848
+ }
5849
+ }) ? !1 : {
5850
+ caretWordSelection
5851
+ };
5852
+ },
5853
+ actions: [({
5854
+ event
5855
+ }, {
5856
+ caretWordSelection
5857
+ }) => [raise({
5858
+ type: "select",
5859
+ at: caretWordSelection
5860
+ }), raise({
5861
+ type: "annotation.add",
5862
+ annotation: event.annotation
5863
+ })]]
5864
+ }), coreAnnotationBehaviors = {
5865
+ addAnnotationOnCollapsedSelection
5866
+ }, IS_MAC = typeof window < "u" && /Mac|iPod|iPhone|iPad/.test(window.navigator.userAgent), modifiers = {
5867
+ alt: "altKey",
5868
+ control: "ctrlKey",
5869
+ meta: "metaKey",
5870
+ shift: "shiftKey"
5871
+ }, aliases = {
5872
+ add: "+",
5873
+ break: "pause",
5874
+ cmd: "meta",
5875
+ command: "meta",
5876
+ ctl: "control",
5877
+ ctrl: "control",
5878
+ del: "delete",
5879
+ down: "arrowdown",
5880
+ esc: "escape",
5881
+ ins: "insert",
5882
+ left: "arrowleft",
5883
+ mod: IS_MAC ? "meta" : "control",
5884
+ opt: "alt",
5885
+ option: "alt",
5886
+ return: "enter",
5887
+ right: "arrowright",
5888
+ space: " ",
5889
+ spacebar: " ",
5890
+ up: "arrowup",
5891
+ win: "meta",
5892
+ windows: "meta"
5893
+ }, keyCodes = {
5894
+ backspace: 8,
5895
+ tab: 9,
5896
+ enter: 13,
5897
+ shift: 16,
5898
+ control: 17,
5899
+ alt: 18,
5900
+ pause: 19,
5901
+ capslock: 20,
5902
+ escape: 27,
5903
+ " ": 32,
5904
+ pageup: 33,
5905
+ pagedown: 34,
5906
+ end: 35,
5907
+ home: 36,
5908
+ arrowleft: 37,
5909
+ arrowup: 38,
5910
+ arrowright: 39,
5911
+ arrowdown: 40,
5912
+ insert: 45,
5913
+ delete: 46,
5914
+ meta: 91,
5915
+ numlock: 144,
5916
+ scrolllock: 145,
5917
+ ";": 186,
5918
+ "=": 187,
5919
+ ",": 188,
5920
+ "-": 189,
5921
+ ".": 190,
5922
+ "/": 191,
5923
+ "`": 192,
5924
+ "[": 219,
5925
+ "\\": 220,
5926
+ "]": 221,
5927
+ "'": 222,
5928
+ f1: 112,
5929
+ f2: 113,
5930
+ f3: 114,
5931
+ f4: 115,
5932
+ f5: 116,
5933
+ f6: 117,
5934
+ f7: 118,
5935
+ f8: 119,
5936
+ f9: 120,
5937
+ f10: 121,
5938
+ f11: 122,
5939
+ f12: 123,
5940
+ f13: 124,
5941
+ f14: 125,
5942
+ f15: 126,
5943
+ f16: 127,
5944
+ f17: 128,
5945
+ f18: 129,
5946
+ f19: 130,
5947
+ f20: 131
5948
+ };
5949
+ function isHotkey(hotkey, event) {
5950
+ return compareHotkey(parseHotkey(hotkey), event);
5951
+ }
5952
+ function parseHotkey(hotkey) {
5953
+ const parsedHotkey = {
5954
+ altKey: !1,
5955
+ ctrlKey: !1,
5956
+ metaKey: !1,
5957
+ shiftKey: !1
5958
+ }, hotkeySegments = hotkey.replace("++", "+add").split("+");
5959
+ for (const rawHotkeySegment of hotkeySegments) {
5960
+ 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];
5961
+ if (hotkeySegment.length > 1 && modifier === void 0 && alias === void 0 && code === void 0)
5962
+ throw new TypeError(`Unknown modifier: "${hotkeySegment}"`);
5963
+ (hotkeySegments.length === 1 || modifier === void 0) && (parsedHotkey.key = keyName, parsedHotkey.keyCode = toKeyCode(hotkeySegment)), modifier !== void 0 && (parsedHotkey[modifier] = optional ? null : !0);
5964
+ }
5965
+ return parsedHotkey;
5966
+ }
5967
+ function compareHotkey(parsedHotkey, event) {
5968
+ 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;
5969
+ }
5970
+ function toKeyCode(name) {
5971
+ const keyName = toKeyName(name);
5972
+ return keyCodes[keyName] ?? keyName.toUpperCase().charCodeAt(0);
5973
+ }
5974
+ function toKeyName(name) {
5975
+ const keyName = name.toLowerCase();
5976
+ return aliases[keyName] ?? keyName;
5977
+ }
5978
+ const arrowDownOnLonelyBlockObject = defineBehavior({
5979
+ on: "keyboard.keydown",
5980
+ guard: ({
5981
+ snapshot,
5982
+ event
5983
+ }) => {
5984
+ if (!isHotkey("ArrowDown", event.originEvent) || !isSelectionCollapsed(snapshot))
5985
+ return !1;
5986
+ const focusBlockObject = getFocusBlockObject(snapshot), nextBlock = getNextBlock(snapshot);
5987
+ return focusBlockObject && !nextBlock;
5988
+ },
5989
+ actions: [({
5990
+ snapshot
5991
+ }) => [raise({
5992
+ type: "insert.block",
5993
+ block: {
5994
+ _type: snapshot.context.schema.block.name
5995
+ },
5996
+ placement: "after"
5997
+ })]]
5998
+ }), arrowUpOnLonelyBlockObject = defineBehavior({
5999
+ on: "keyboard.keydown",
6000
+ guard: ({
6001
+ snapshot,
6002
+ event
6003
+ }) => {
6004
+ if (!isHotkey("ArrowUp", event.originEvent) || !isSelectionCollapsed(snapshot))
6005
+ return !1;
6006
+ const focusBlockObject = getFocusBlockObject(snapshot), previousBlock = getPreviousBlock(snapshot);
6007
+ return focusBlockObject && !previousBlock;
6008
+ },
6009
+ actions: [({
6010
+ snapshot
6011
+ }) => [raise({
6012
+ type: "insert.block",
6013
+ block: {
6014
+ _type: snapshot.context.schema.block.name
6015
+ },
6016
+ placement: "before"
6017
+ })]]
6018
+ }), breakingBlockObject = defineBehavior({
6019
+ on: "insert.break",
6020
+ guard: ({
6021
+ snapshot
6022
+ }) => {
6023
+ const focusBlockObject = getFocusBlockObject(snapshot);
6024
+ return isSelectionCollapsed(snapshot) && focusBlockObject !== void 0;
6025
+ },
6026
+ actions: [({
6027
+ snapshot
6028
+ }) => [raise({
6029
+ type: "insert.block",
6030
+ block: {
6031
+ _type: snapshot.context.schema.block.name
6032
+ },
6033
+ placement: "after"
6034
+ })]]
6035
+ }), clickingAboveLonelyBlockObject = defineBehavior({
6036
+ on: "mouse.click",
6037
+ guard: ({
6038
+ snapshot,
6039
+ event
6040
+ }) => {
6041
+ if (snapshot.context.readOnly || snapshot.context.selection && !isSelectionCollapsed(snapshot))
6042
+ return !1;
6043
+ const focusBlockObject = getFocusBlockObject({
6044
+ context: {
6045
+ ...snapshot.context,
6046
+ selection: event.position.selection
6047
+ }
6048
+ }), previousBlock = getPreviousBlock({
6049
+ context: {
6050
+ ...snapshot.context,
6051
+ selection: event.position.selection
6052
+ }
6053
+ });
6054
+ return event.position.isEditor && event.position.block === "start" && focusBlockObject && !previousBlock;
6055
+ },
6056
+ actions: [({
6057
+ snapshot,
6058
+ event
6059
+ }) => [raise({
6060
+ type: "select",
6061
+ at: event.position.selection
6062
+ }), raise({
6063
+ type: "insert.block",
6064
+ block: {
6065
+ _type: snapshot.context.schema.block.name
6066
+ },
6067
+ placement: "before",
6068
+ select: "start"
6069
+ })]]
6070
+ }), clickingBelowLonelyBlockObject = defineBehavior({
6071
+ on: "mouse.click",
6072
+ guard: ({
6073
+ snapshot,
6074
+ event
6075
+ }) => {
6076
+ if (snapshot.context.readOnly || snapshot.context.selection && !isSelectionCollapsed(snapshot))
6077
+ return !1;
6078
+ const focusBlockObject = getFocusBlockObject({
6079
+ context: {
6080
+ ...snapshot.context,
6081
+ selection: event.position.selection
6082
+ }
6083
+ }), nextBlock = getNextBlock({
6084
+ context: {
6085
+ ...snapshot.context,
6086
+ selection: event.position.selection
6087
+ }
6088
+ });
6089
+ return event.position.isEditor && event.position.block === "end" && focusBlockObject && !nextBlock;
6090
+ },
6091
+ actions: [({
6092
+ snapshot,
6093
+ event
6094
+ }) => [raise({
6095
+ type: "select",
6096
+ at: event.position.selection
6097
+ }), raise({
6098
+ type: "insert.block",
6099
+ block: {
6100
+ _type: snapshot.context.schema.block.name
6101
+ },
6102
+ placement: "after",
6103
+ select: "start"
6104
+ })]]
6105
+ }), deletingEmptyTextBlockAfterBlockObject = defineBehavior({
6106
+ on: "delete.backward",
6107
+ guard: ({
6108
+ snapshot
6109
+ }) => {
6110
+ const focusTextBlock = getFocusTextBlock(snapshot), selectionCollapsed = isSelectionCollapsed(snapshot), previousBlock = getPreviousBlock(snapshot);
6111
+ return !focusTextBlock || !selectionCollapsed || !previousBlock ? !1 : isEmptyTextBlock(snapshot.context, focusTextBlock.node) && !isTextBlock(snapshot.context, previousBlock.node) ? {
6112
+ focusTextBlock,
6113
+ previousBlock
6114
+ } : !1;
6115
+ },
6116
+ actions: [(_, {
6117
+ focusTextBlock,
6118
+ previousBlock
6119
+ }) => [raise({
6120
+ type: "delete.block",
6121
+ at: focusTextBlock.path
6122
+ }), raise({
6123
+ type: "select",
6124
+ at: {
6125
+ anchor: {
6126
+ path: previousBlock.path,
6127
+ offset: 0
6128
+ },
6129
+ focus: {
6130
+ path: previousBlock.path,
6131
+ offset: 0
6132
+ }
6133
+ }
6134
+ })]]
6135
+ }), deletingEmptyTextBlockBeforeBlockObject = defineBehavior({
6136
+ on: "delete.forward",
6137
+ guard: ({
6138
+ snapshot
6139
+ }) => {
6140
+ const focusTextBlock = getFocusTextBlock(snapshot), selectionCollapsed = isSelectionCollapsed(snapshot), nextBlock = getNextBlock(snapshot);
6141
+ return !focusTextBlock || !selectionCollapsed || !nextBlock ? !1 : isEmptyTextBlock(snapshot.context, focusTextBlock.node) && !isTextBlock(snapshot.context, nextBlock.node) ? {
6142
+ focusTextBlock,
6143
+ nextBlock
6144
+ } : !1;
6145
+ },
6146
+ actions: [(_, {
6147
+ focusTextBlock,
6148
+ nextBlock
6149
+ }) => [raise({
6150
+ type: "delete.block",
6151
+ at: focusTextBlock.path
6152
+ }), raise({
6153
+ type: "select",
6154
+ at: {
6155
+ anchor: {
6156
+ path: nextBlock.path,
6157
+ offset: 0
6158
+ },
6159
+ focus: {
6160
+ path: nextBlock.path,
6161
+ offset: 0
6162
+ }
6163
+ }
6164
+ })]]
6165
+ }), coreBlockObjectBehaviors = {
6166
+ arrowDownOnLonelyBlockObject,
6167
+ arrowUpOnLonelyBlockObject,
6168
+ breakingBlockObject,
6169
+ clickingAboveLonelyBlockObject,
6170
+ clickingBelowLonelyBlockObject,
6171
+ deletingEmptyTextBlockAfterBlockObject,
6172
+ deletingEmptyTextBlockBeforeBlockObject
6173
+ }, coreDecoratorBehaviors = {
6174
+ strongShortcut: defineBehavior({
6175
+ on: "keyboard.keydown",
6176
+ guard: ({
6177
+ snapshot,
6178
+ event
6179
+ }) => isHotkey("mod+b", event.originEvent) && snapshot.context.schema.decorators.some((decorator) => decorator.name === "strong"),
6180
+ actions: [() => [raise({
6181
+ type: "decorator.toggle",
6182
+ decorator: "strong"
6183
+ })]]
6184
+ }),
6185
+ emShortcut: defineBehavior({
6186
+ on: "keyboard.keydown",
6187
+ guard: ({
6188
+ snapshot,
6189
+ event
6190
+ }) => isHotkey("mod+i", event.originEvent) && snapshot.context.schema.decorators.some((decorator) => decorator.name === "em"),
6191
+ actions: [() => [raise({
6192
+ type: "decorator.toggle",
6193
+ decorator: "em"
6194
+ })]]
6195
+ }),
6196
+ underlineShortcut: defineBehavior({
6197
+ on: "keyboard.keydown",
6198
+ guard: ({
6199
+ snapshot,
6200
+ event
6201
+ }) => isHotkey("mod+u", event.originEvent) && snapshot.context.schema.decorators.some((decorator) => decorator.name === "underline"),
6202
+ actions: [() => [raise({
6203
+ type: "decorator.toggle",
6204
+ decorator: "underline"
6205
+ })]]
6206
+ }),
6207
+ codeShortcut: defineBehavior({
6208
+ on: "keyboard.keydown",
6209
+ guard: ({
6210
+ snapshot,
6211
+ event
6212
+ }) => isHotkey("mod+'", event.originEvent) && snapshot.context.schema.decorators.some((decorator) => decorator.name === "code"),
6213
+ actions: [() => [raise({
6214
+ type: "decorator.toggle",
6215
+ decorator: "code"
6216
+ })]]
6217
+ })
6218
+ }, coreDndBehaviors = [
6219
+ /**
6220
+ * When dragging over the drag origin, we don't want to show the caret in the
6221
+ * text.
6222
+ */
6223
+ defineBehavior({
6224
+ on: "drag.dragover",
6225
+ guard: ({
6226
+ snapshot,
6227
+ event
6228
+ }) => {
6229
+ const dragOrigin = snapshot.beta.internalDrag?.origin;
6230
+ return dragOrigin ? isOverlappingSelection(event.position.selection)({
6231
+ ...snapshot,
6232
+ context: {
6233
+ ...snapshot.context,
6234
+ selection: dragOrigin.selection
6235
+ }
6236
+ }) : !1;
6237
+ },
6238
+ actions: []
6239
+ })
6240
+ ], breakingAtTheEndOfTextBlock = defineBehavior({
6241
+ on: "insert.break",
6242
+ guard: ({
6243
+ snapshot
6244
+ }) => {
6245
+ const focusTextBlock = getFocusTextBlock(snapshot), selectionCollapsed = isSelectionCollapsed(snapshot);
6246
+ if (!snapshot.context.selection || !focusTextBlock || !selectionCollapsed)
6247
+ return !1;
6248
+ const atTheEndOfBlock = isAtTheEndOfBlock(focusTextBlock)(snapshot), focusListItem = focusTextBlock.node.listItem, focusLevel = focusTextBlock.node.level;
6249
+ return atTheEndOfBlock ? {
6250
+ focusListItem,
6251
+ focusLevel
6252
+ } : !1;
6253
+ },
6254
+ actions: [({
6255
+ snapshot
6256
+ }, {
6257
+ focusListItem,
6258
+ focusLevel
6259
+ }) => [raise({
6260
+ type: "insert.block",
6261
+ block: {
6262
+ _type: snapshot.context.schema.block.name,
6263
+ children: [{
6264
+ _type: snapshot.context.schema.span.name,
6265
+ text: "",
6266
+ marks: []
6267
+ }],
6268
+ markDefs: [],
6269
+ listItem: focusListItem,
6270
+ level: focusLevel,
6271
+ style: snapshot.context.schema.styles[0]?.name
6272
+ },
6273
+ placement: "after"
6274
+ })]]
6275
+ }), breakingAtTheStartOfTextBlock = defineBehavior({
6276
+ on: "insert.break",
6277
+ guard: ({
6278
+ snapshot
6279
+ }) => {
6280
+ const focusTextBlock = getFocusTextBlock(snapshot), selectionCollapsed = isSelectionCollapsed(snapshot);
6281
+ if (!snapshot.context.selection || !focusTextBlock || !selectionCollapsed)
6282
+ return !1;
6283
+ const focusSpan = getFocusSpan(snapshot), focusDecorators = focusSpan?.node.marks?.filter((mark) => snapshot.context.schema.decorators.some((decorator) => decorator.name === mark) ?? []), focusAnnotations = focusSpan?.node.marks?.filter((mark) => !snapshot.context.schema.decorators.some((decorator) => decorator.name === mark)) ?? [], focusListItem = focusTextBlock.node.listItem, focusLevel = focusTextBlock.node.level;
6284
+ return isAtTheStartOfBlock(focusTextBlock)(snapshot) ? {
6285
+ focusAnnotations,
6286
+ focusDecorators,
6287
+ focusListItem,
6288
+ focusLevel
6289
+ } : !1;
6290
+ },
6291
+ actions: [({
6292
+ snapshot
6293
+ }, {
6294
+ focusAnnotations,
6295
+ focusDecorators,
6296
+ focusListItem,
6297
+ focusLevel
6298
+ }) => [raise({
6299
+ type: "insert.block",
6300
+ block: {
6301
+ _type: snapshot.context.schema.block.name,
6302
+ children: [{
6303
+ _type: snapshot.context.schema.span.name,
6304
+ marks: focusAnnotations.length === 0 ? focusDecorators : [],
6305
+ text: ""
6306
+ }],
6307
+ listItem: focusListItem,
6308
+ level: focusLevel,
6309
+ style: snapshot.context.schema.styles[0]?.name
6310
+ },
6311
+ placement: "before",
6312
+ select: "none"
6313
+ })]]
6314
+ }), breakingEntireDocument = defineBehavior({
6315
+ on: "insert.break",
6316
+ guard: ({
6317
+ snapshot
6318
+ }) => {
6319
+ if (!snapshot.context.selection || !isSelectionExpanded(snapshot))
6320
+ return !1;
6321
+ const firstBlock = getFirstBlock$1(snapshot), lastBlock = getLastBlock$1(snapshot);
6322
+ if (!firstBlock || !lastBlock)
6323
+ return !1;
6324
+ const firstBlockStartPoint = getBlockStartPoint({
6325
+ context: snapshot.context,
6326
+ block: firstBlock
6327
+ }), selectionStartPoint = getSelectionStartPoint(snapshot.context.selection), lastBlockEndPoint = getBlockEndPoint({
6328
+ context: snapshot.context,
6329
+ block: lastBlock
6330
+ }), selectionEndPoint = getSelectionEndPoint(snapshot.context.selection);
6331
+ return isEqualSelectionPoints(firstBlockStartPoint, selectionStartPoint) && isEqualSelectionPoints(lastBlockEndPoint, selectionEndPoint) ? {
6332
+ selection: snapshot.context.selection
6333
+ } : !1;
6334
+ },
6335
+ actions: [(_, {
6336
+ selection
6337
+ }) => [raise({
6338
+ type: "delete",
6339
+ at: selection
6340
+ })]]
6341
+ }), breakingEntireBlocks = defineBehavior({
6342
+ on: "insert.break",
6343
+ guard: ({
6344
+ snapshot
6345
+ }) => {
6346
+ if (!snapshot.context.selection || !isSelectionExpanded(snapshot))
6347
+ return !1;
6348
+ const selectedBlocks = getSelectedBlocks(snapshot), selectionStartBlock = getSelectionStartBlock$1(snapshot), selectionEndBlock = getSelectionEndBlock$1(snapshot);
6349
+ if (!selectionStartBlock || !selectionEndBlock)
6350
+ return !1;
6351
+ const startBlockStartPoint = getBlockStartPoint({
6352
+ context: snapshot.context,
6353
+ block: selectionStartBlock
6354
+ }), selectionStartPoint = getSelectionStartPoint(snapshot.context.selection), endBlockEndPoint = getBlockEndPoint({
6355
+ context: snapshot.context,
6356
+ block: selectionEndBlock
6357
+ }), selectionEndPoint = getSelectionEndPoint(snapshot.context.selection);
6358
+ return isEqualSelectionPoints(selectionStartPoint, startBlockStartPoint) && isEqualSelectionPoints(selectionEndPoint, endBlockEndPoint) ? {
6359
+ selectedBlocks
6360
+ } : !1;
6361
+ },
6362
+ actions: [({
6363
+ snapshot
6364
+ }, {
6365
+ selectedBlocks
6366
+ }) => [raise({
6367
+ type: "insert.block",
6368
+ block: {
6369
+ _type: snapshot.context.schema.block.name,
6370
+ children: [{
6371
+ _type: snapshot.context.schema.span.name,
6372
+ text: "",
6373
+ marks: []
6374
+ }]
6375
+ },
6376
+ placement: "before",
6377
+ select: "start"
6378
+ }), ...selectedBlocks.map((block) => raise({
6379
+ type: "delete.block",
6380
+ at: block.path
6381
+ }))]]
6382
+ }), coreInsertBreakBehaviors = {
6383
+ breakingAtTheEndOfTextBlock,
6384
+ breakingAtTheStartOfTextBlock,
6385
+ breakingEntireDocument,
6386
+ breakingEntireBlocks
6387
+ }, MAX_LIST_LEVEL = 10, clearListOnBackspace = defineBehavior({
6388
+ on: "delete.backward",
6389
+ guard: ({
6390
+ snapshot
6391
+ }) => {
6392
+ const selectionCollapsed = isSelectionCollapsed(snapshot), focusTextBlock = getFocusTextBlock(snapshot), focusSpan = getFocusSpan(snapshot);
6393
+ return !selectionCollapsed || !focusTextBlock || !focusSpan ? !1 : focusTextBlock.node.children[0]._key === focusSpan.node._key && snapshot.context.selection?.focus.offset === 0 && focusTextBlock.node.level === 1 ? {
6394
+ focusTextBlock
6395
+ } : !1;
6396
+ },
6397
+ actions: [(_, {
6398
+ focusTextBlock
6399
+ }) => [raise({
6400
+ type: "block.unset",
6401
+ props: ["listItem", "level"],
6402
+ at: focusTextBlock.path
6403
+ })]]
6404
+ }), unindentListOnBackspace = defineBehavior({
6405
+ on: "delete.backward",
6406
+ guard: ({
6407
+ snapshot
6408
+ }) => {
6409
+ const selectionCollapsed = isSelectionCollapsed(snapshot), focusTextBlock = getFocusTextBlock(snapshot), focusSpan = getFocusSpan(snapshot);
6410
+ return !selectionCollapsed || !focusTextBlock || !focusSpan ? !1 : focusTextBlock.node.children[0]._key === focusSpan.node._key && snapshot.context.selection?.focus.offset === 0 && focusTextBlock.node.level !== void 0 && focusTextBlock.node.level > 1 ? {
6411
+ focusTextBlock,
6412
+ level: focusTextBlock.node.level - 1
6413
+ } : !1;
6414
+ },
6415
+ actions: [(_, {
6416
+ focusTextBlock,
6417
+ level
6418
+ }) => [raise({
6419
+ type: "block.set",
6420
+ props: {
6421
+ level
6422
+ },
6423
+ at: focusTextBlock.path
6424
+ })]]
6425
+ }), clearListOnEnter = defineBehavior({
6426
+ on: "insert.break",
6427
+ guard: ({
6428
+ snapshot
6429
+ }) => {
6430
+ const selectionCollapsed = isSelectionCollapsed(snapshot), focusListBlock = getFocusListBlock(snapshot);
6431
+ return !selectionCollapsed || !focusListBlock || !isEmptyTextBlock(snapshot.context, focusListBlock.node) ? !1 : {
6432
+ focusListBlock
6433
+ };
6434
+ },
6435
+ actions: [(_, {
6436
+ focusListBlock
6437
+ }) => [raise({
6438
+ type: "block.unset",
6439
+ props: ["listItem", "level"],
6440
+ at: focusListBlock.path
6441
+ })]]
6442
+ }), indentListOnTab = defineBehavior({
6443
+ on: "keyboard.keydown",
6444
+ guard: ({
6445
+ snapshot,
6446
+ event
6447
+ }) => {
6448
+ if (!isHotkey("Tab", event.originEvent))
6449
+ return !1;
6450
+ const selectedBlocks = getSelectedBlocks(snapshot), selectedListBlocks = selectedBlocks.flatMap((block) => isListBlock(snapshot.context, block.node) ? [{
6451
+ node: block.node,
6452
+ path: block.path
6453
+ }] : []);
6454
+ return selectedListBlocks.length === selectedBlocks.length ? {
6455
+ selectedListBlocks
6456
+ } : !1;
6457
+ },
6458
+ actions: [(_, {
6459
+ selectedListBlocks
6460
+ }) => selectedListBlocks.map((selectedListBlock) => raise({
6461
+ type: "block.set",
6462
+ props: {
6463
+ level: Math.min(MAX_LIST_LEVEL, Math.max(1, selectedListBlock.node.level + 1))
6464
+ },
6465
+ at: selectedListBlock.path
6466
+ }))]
6467
+ }), unindentListOnShiftTab = defineBehavior({
6468
+ on: "keyboard.keydown",
6469
+ guard: ({
6470
+ snapshot,
6471
+ event
6472
+ }) => {
6473
+ if (!isHotkey("Shift+Tab", event.originEvent))
6474
+ return !1;
6475
+ const selectedBlocks = getSelectedBlocks(snapshot), selectedListBlocks = selectedBlocks.flatMap((block) => isListBlock(snapshot.context, block.node) ? [{
6476
+ node: block.node,
6477
+ path: block.path
6478
+ }] : []);
6479
+ return selectedListBlocks.length === selectedBlocks.length ? {
6480
+ selectedListBlocks
6481
+ } : !1;
6482
+ },
6483
+ actions: [(_, {
6484
+ selectedListBlocks
6485
+ }) => selectedListBlocks.map((selectedListBlock) => raise({
6486
+ type: "block.set",
6487
+ props: {
6488
+ level: Math.min(MAX_LIST_LEVEL, Math.max(1, selectedListBlock.node.level - 1))
6489
+ },
6490
+ at: selectedListBlock.path
6491
+ }))]
6492
+ }), coreListBehaviors = {
6493
+ clearListOnBackspace,
6494
+ unindentListOnBackspace,
6495
+ clearListOnEnter,
6496
+ indentListOnTab,
6497
+ unindentListOnShiftTab
6498
+ }, coreBehaviors = [coreAnnotationBehaviors.addAnnotationOnCollapsedSelection, coreDecoratorBehaviors.strongShortcut, coreDecoratorBehaviors.emShortcut, coreDecoratorBehaviors.underlineShortcut, coreDecoratorBehaviors.codeShortcut, ...coreDndBehaviors, coreBlockObjectBehaviors.clickingAboveLonelyBlockObject, coreBlockObjectBehaviors.clickingBelowLonelyBlockObject, coreBlockObjectBehaviors.arrowDownOnLonelyBlockObject, coreBlockObjectBehaviors.arrowUpOnLonelyBlockObject, coreBlockObjectBehaviors.breakingBlockObject, coreBlockObjectBehaviors.deletingEmptyTextBlockAfterBlockObject, coreBlockObjectBehaviors.deletingEmptyTextBlockBeforeBlockObject, coreListBehaviors.clearListOnBackspace, coreListBehaviors.unindentListOnBackspace, coreListBehaviors.clearListOnEnter, coreListBehaviors.indentListOnTab, coreListBehaviors.unindentListOnShiftTab, coreInsertBreakBehaviors.breakingAtTheEndOfTextBlock, coreInsertBreakBehaviors.breakingAtTheStartOfTextBlock, coreInsertBreakBehaviors.breakingEntireDocument, coreInsertBreakBehaviors.breakingEntireBlocks], abstractAnnotationBehaviors = [defineBehavior({
5838
6499
  on: "annotation.toggle",
5839
6500
  guard: ({
5840
6501
  snapshot,
@@ -6962,11 +7623,6 @@ const editorMachine = setup({
6962
7623
  event
6963
7624
  }) => (assertEvent(event, "remove behavior"), context.behaviors.delete(event.behavior), /* @__PURE__ */ new Set([...context.behaviors]))
6964
7625
  }),
6965
- "assign behaviors": assign({
6966
- behaviors: ({
6967
- event
6968
- }) => (assertEvent(event, "update behaviors"), /* @__PURE__ */ new Set([...event.behaviors]))
6969
- }),
6970
7626
  "assign schema": assign({
6971
7627
  schema: ({
6972
7628
  event
@@ -7012,6 +7668,22 @@ const editorMachine = setup({
7012
7668
  "clear pending events": assign({
7013
7669
  pendingEvents: []
7014
7670
  }),
7671
+ "defer incoming patches": assign({
7672
+ pendingIncomingPatchesEvents: ({
7673
+ context,
7674
+ event
7675
+ }) => event.type === "patches" ? [...context.pendingIncomingPatchesEvents, event] : context.pendingIncomingPatchesEvents
7676
+ }),
7677
+ "emit pending incoming patches": enqueueActions(({
7678
+ context,
7679
+ enqueue
7680
+ }) => {
7681
+ for (const event of context.pendingIncomingPatchesEvents)
7682
+ enqueue.emit(event);
7683
+ }),
7684
+ "clear pending incoming patches": assign({
7685
+ pendingIncomingPatchesEvents: []
7686
+ }),
7015
7687
  "handle blur": ({
7016
7688
  event
7017
7689
  }) => {
@@ -7074,11 +7746,12 @@ const editorMachine = setup({
7074
7746
  context: ({
7075
7747
  input
7076
7748
  }) => ({
7077
- behaviors: /* @__PURE__ */ new Set([...input.behaviors ?? coreBehaviors]),
7749
+ behaviors: /* @__PURE__ */ new Set([...coreBehaviors]),
7078
7750
  converters: new Set(input.converters ?? []),
7079
7751
  getLegacySchema: input.getLegacySchema,
7080
7752
  keyGenerator: input.keyGenerator,
7081
7753
  pendingEvents: [],
7754
+ pendingIncomingPatchesEvents: [],
7082
7755
  schema: input.schema,
7083
7756
  selection: null,
7084
7757
  initialReadOnly: input.readOnly ?? !1,
@@ -7162,14 +7835,6 @@ const editorMachine = setup({
7162
7835
  "remove behavior": {
7163
7836
  actions: "remove behavior from context"
7164
7837
  },
7165
- patches: {
7166
- actions: emit(({
7167
- event
7168
- }) => event)
7169
- },
7170
- "update behaviors": {
7171
- actions: "assign behaviors"
7172
- },
7173
7838
  "update key generator": {
7174
7839
  actions: assign({
7175
7840
  keyGenerator: ({
@@ -7213,7 +7878,7 @@ const editorMachine = setup({
7213
7878
  states: {
7214
7879
  "determine initial edit mode": {
7215
7880
  on: {
7216
- "done syncing initial value": [{
7881
+ "done syncing value": [{
7217
7882
  target: "#editor.edit mode.read only.read only",
7218
7883
  guard: ({
7219
7884
  context
@@ -7329,7 +7994,7 @@ const editorMachine = setup({
7329
7994
  initial: "setting up",
7330
7995
  states: {
7331
7996
  "setting up": {
7332
- exit: ["emit ready"],
7997
+ exit: ["emit ready", "emit pending incoming patches", "clear pending incoming patches"],
7333
7998
  on: {
7334
7999
  "internal.patch": {
7335
8000
  actions: "defer event"
@@ -7337,54 +8002,95 @@ const editorMachine = setup({
7337
8002
  mutation: {
7338
8003
  actions: "defer event"
7339
8004
  },
7340
- "done syncing initial value": {
7341
- target: "pristine"
8005
+ "done syncing value": {
8006
+ target: "set up"
8007
+ },
8008
+ patches: {
8009
+ actions: ["defer incoming patches"]
7342
8010
  }
7343
8011
  }
7344
8012
  },
7345
- pristine: {
7346
- initial: "idle",
8013
+ "set up": {
8014
+ type: "parallel",
7347
8015
  states: {
7348
- idle: {
7349
- on: {
7350
- normalizing: {
7351
- target: "normalizing"
7352
- },
7353
- "internal.patch": {
7354
- actions: "defer event",
7355
- target: "#editor.setup.dirty"
8016
+ "value sync": {
8017
+ initial: "idle",
8018
+ states: {
8019
+ idle: {
8020
+ on: {
8021
+ patches: {
8022
+ actions: [emit(({
8023
+ event
8024
+ }) => event)]
8025
+ },
8026
+ "syncing value": {
8027
+ target: "syncing value"
8028
+ }
8029
+ }
7356
8030
  },
7357
- mutation: {
7358
- actions: "defer event",
7359
- target: "#editor.setup.dirty"
8031
+ "syncing value": {
8032
+ exit: ["emit pending incoming patches", "clear pending incoming patches"],
8033
+ on: {
8034
+ patches: {
8035
+ actions: ["defer incoming patches"]
8036
+ },
8037
+ "done syncing value": {
8038
+ target: "idle"
8039
+ }
8040
+ }
7360
8041
  }
7361
8042
  }
7362
8043
  },
7363
- normalizing: {
7364
- on: {
7365
- "done normalizing": {
7366
- target: "idle"
7367
- },
7368
- "internal.patch": {
7369
- actions: "defer event"
8044
+ writing: {
8045
+ initial: "pristine",
8046
+ states: {
8047
+ pristine: {
8048
+ initial: "idle",
8049
+ states: {
8050
+ idle: {
8051
+ on: {
8052
+ normalizing: {
8053
+ target: "normalizing"
8054
+ },
8055
+ "internal.patch": {
8056
+ actions: "defer event",
8057
+ target: "#editor.setup.set up.writing.dirty"
8058
+ },
8059
+ mutation: {
8060
+ actions: "defer event",
8061
+ target: "#editor.setup.set up.writing.dirty"
8062
+ }
8063
+ }
8064
+ },
8065
+ normalizing: {
8066
+ on: {
8067
+ "done normalizing": {
8068
+ target: "idle"
8069
+ },
8070
+ "internal.patch": {
8071
+ actions: "defer event"
8072
+ },
8073
+ mutation: {
8074
+ actions: "defer event"
8075
+ }
8076
+ }
8077
+ }
8078
+ }
7370
8079
  },
7371
- mutation: {
7372
- actions: "defer event"
8080
+ dirty: {
8081
+ entry: ["emit pending events", "clear pending events"],
8082
+ on: {
8083
+ "internal.patch": {
8084
+ actions: "emit patch event"
8085
+ },
8086
+ mutation: {
8087
+ actions: "emit mutation event"
8088
+ }
8089
+ }
7373
8090
  }
7374
8091
  }
7375
8092
  }
7376
8093
  }
7377
- },
7378
- dirty: {
7379
- entry: ["emit pending events", "clear pending events"],
7380
- on: {
7381
- "internal.patch": {
7382
- actions: "emit patch event"
7383
- },
7384
- mutation: {
7385
- actions: "emit mutation event"
7386
- }
7387
- }
7388
8094
  }
7389
8095
  }
7390
8096
  }
@@ -7959,6 +8665,7 @@ export {
7959
8665
  EditorProvider,
7960
8666
  KEY_TO_VALUE_ELEMENT,
7961
8667
  PortableTextEditor,
8668
+ coreBehaviors,
7962
8669
  debugWithName,
7963
8670
  defaultKeyGenerator,
7964
8671
  defineSchema,
@@ -7968,6 +8675,7 @@ export {
7968
8675
  getLastBlock,
7969
8676
  getNodeBlock,
7970
8677
  isEqualToEmptyEditor,
8678
+ isHotkey,
7971
8679
  moveRangeByOperation,
7972
8680
  slateRangeToSelection,
7973
8681
  toSlateRange,