@portabletext/editor 1.40.2 → 1.40.3

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 (58) hide show
  1. package/lib/_chunks-cjs/behavior.core.cjs +37 -16
  2. package/lib/_chunks-cjs/behavior.core.cjs.map +1 -1
  3. package/lib/_chunks-cjs/behavior.markdown.cjs +22 -10
  4. package/lib/_chunks-cjs/behavior.markdown.cjs.map +1 -1
  5. package/lib/_chunks-cjs/editor-provider.cjs +27 -67
  6. package/lib/_chunks-cjs/editor-provider.cjs.map +1 -1
  7. package/lib/_chunks-cjs/util.merge-text-blocks.cjs +26 -0
  8. package/lib/_chunks-cjs/util.merge-text-blocks.cjs.map +1 -0
  9. package/lib/_chunks-cjs/util.selection-point-to-block-offset.cjs +1 -0
  10. package/lib/_chunks-cjs/util.selection-point-to-block-offset.cjs.map +1 -1
  11. package/lib/_chunks-es/behavior.core.js +37 -16
  12. package/lib/_chunks-es/behavior.core.js.map +1 -1
  13. package/lib/_chunks-es/behavior.markdown.js +22 -10
  14. package/lib/_chunks-es/behavior.markdown.js.map +1 -1
  15. package/lib/_chunks-es/editor-provider.js +27 -67
  16. package/lib/_chunks-es/editor-provider.js.map +1 -1
  17. package/lib/_chunks-es/util.merge-text-blocks.js +27 -0
  18. package/lib/_chunks-es/util.merge-text-blocks.js.map +1 -0
  19. package/lib/_chunks-es/util.selection-point-to-block-offset.js +1 -0
  20. package/lib/behaviors/index.d.cts +3881 -5053
  21. package/lib/behaviors/index.d.ts +3881 -5053
  22. package/lib/index.d.cts +3402 -4440
  23. package/lib/index.d.ts +3402 -4440
  24. package/lib/plugins/index.cjs +9 -127
  25. package/lib/plugins/index.cjs.map +1 -1
  26. package/lib/plugins/index.d.cts +3404 -4441
  27. package/lib/plugins/index.d.ts +3404 -4441
  28. package/lib/plugins/index.js +11 -129
  29. package/lib/plugins/index.js.map +1 -1
  30. package/lib/selectors/index.d.cts +3401 -4440
  31. package/lib/selectors/index.d.ts +3401 -4440
  32. package/lib/utils/index.cjs +45 -4
  33. package/lib/utils/index.cjs.map +1 -1
  34. package/lib/utils/index.d.cts +3402 -4441
  35. package/lib/utils/index.d.ts +3402 -4441
  36. package/lib/utils/index.js +45 -3
  37. package/lib/utils/index.js.map +1 -1
  38. package/package.json +7 -7
  39. package/src/behavior-actions/behavior.action.delete.block.ts +2 -2
  40. package/src/behavior-actions/behavior.actions.ts +0 -18
  41. package/src/behaviors/behavior.core.block-objects.ts +57 -7
  42. package/src/behaviors/behavior.core.insert-break.ts +0 -4
  43. package/src/behaviors/behavior.default.ts +1 -1
  44. package/src/behaviors/behavior.markdown.ts +22 -10
  45. package/src/behaviors/behavior.types.ts +171 -138
  46. package/src/editor/create-editor.ts +2 -0
  47. package/src/editor/editor-machine.ts +28 -28
  48. package/src/editor/plugins/create-with-event-listeners.ts +15 -0
  49. package/src/editor/plugins/createWithEditableAPI.ts +4 -4
  50. package/src/plugins/plugin.one-line.tsx +10 -128
  51. package/src/types/block-with-optional-key.ts +13 -0
  52. package/src/utils/util.is-text-block.ts +4 -3
  53. package/lib/_chunks-cjs/util.split-text-block.cjs +0 -68
  54. package/lib/_chunks-cjs/util.split-text-block.cjs.map +0 -1
  55. package/lib/_chunks-es/util.split-text-block.js +0 -70
  56. package/lib/_chunks-es/util.split-text-block.js.map +0 -1
  57. package/src/behavior-actions/behavior.action.insert.block-object.ts +0 -20
  58. package/src/behavior-actions/behavior.action.insert.text-block.ts +0 -33
@@ -1,13 +1,55 @@
1
- import { isEqualSelectionPoints } from "../_chunks-es/util.slice-blocks.js";
2
- import { blockOffsetToSpanSelectionPoint, getBlockEndPoint, getBlockStartPoint, getTextBlockText, isEmptyTextBlock, isKeyedSegment, isSpan, reverseSelection, sliceBlocks, spanSelectionPointToBlockOffset } from "../_chunks-es/util.slice-blocks.js";
1
+ import { isEqualSelectionPoints, sliceBlocks, isSpan } from "../_chunks-es/util.slice-blocks.js";
2
+ import { blockOffsetToSpanSelectionPoint, getBlockEndPoint, getBlockStartPoint, getTextBlockText, isEmptyTextBlock, isKeyedSegment, reverseSelection, spanSelectionPointToBlockOffset } from "../_chunks-es/util.slice-blocks.js";
3
3
  import { blockOffsetToBlockSelectionPoint, blockOffsetToSelectionPoint, blockOffsetsToSelection, childSelectionPointToBlockOffset, selectionPointToBlockOffset } from "../_chunks-es/util.selection-point-to-block-offset.js";
4
- import { isTextBlock, mergeTextBlocks, splitTextBlock } from "../_chunks-es/util.split-text-block.js";
4
+ import { isTextBlock } from "../_chunks-es/util.merge-text-blocks.js";
5
+ import { mergeTextBlocks } from "../_chunks-es/util.merge-text-blocks.js";
5
6
  function isEqualSelections(a, b) {
6
7
  return !a && !b ? !0 : !a || !b ? !1 : isEqualSelectionPoints(a.anchor, b.anchor) && isEqualSelectionPoints(a.focus, b.focus);
7
8
  }
8
9
  function isSelectionCollapsed(selection) {
9
10
  return selection ? selection.anchor.path.join() === selection.focus.path.join() && selection.anchor.offset === selection.focus.offset : !1;
10
11
  }
12
+ function splitTextBlock({
13
+ context,
14
+ block,
15
+ point
16
+ }) {
17
+ const firstChild = block.children.at(0), lastChild = block.children.at(block.children.length - 1);
18
+ if (!firstChild || !lastChild)
19
+ return;
20
+ const before = sliceBlocks({
21
+ blocks: [block],
22
+ selection: {
23
+ anchor: {
24
+ path: [{
25
+ _key: block._key
26
+ }, "children", {
27
+ _key: firstChild._key
28
+ }],
29
+ offset: 0
30
+ },
31
+ focus: point
32
+ }
33
+ }).at(0), after = sliceBlocks({
34
+ blocks: [block],
35
+ selection: {
36
+ anchor: point,
37
+ focus: {
38
+ path: [{
39
+ _key: block._key
40
+ }, "children", {
41
+ _key: lastChild._key
42
+ }],
43
+ offset: isSpan(context, lastChild) ? lastChild.text.length : 0
44
+ }
45
+ }
46
+ }).at(0);
47
+ if (!(!before || !after) && !(!isTextBlock(context, before) || !isTextBlock(context, after)))
48
+ return {
49
+ before,
50
+ after
51
+ };
52
+ }
11
53
  export {
12
54
  blockOffsetToBlockSelectionPoint,
13
55
  blockOffsetToSelectionPoint,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/utils/util.is-equal-selections.ts","../../src/utils/util.is-selection-collapsed.ts"],"sourcesContent":["import type {EditorSelection} from '../types/editor'\nimport {isEqualSelectionPoints} from './util.is-equal-selection-points'\n\n/**\n * @public\n */\nexport function isEqualSelections(a: EditorSelection, b: EditorSelection) {\n if (!a && !b) {\n return true\n }\n\n if (!a || !b) {\n return false\n }\n\n return (\n isEqualSelectionPoints(a.anchor, b.anchor) &&\n isEqualSelectionPoints(a.focus, b.focus)\n )\n}\n","import type {EditorSelection} from '../types/editor'\n\n/**\n * @public\n */\nexport function isSelectionCollapsed(selection: EditorSelection) {\n if (!selection) {\n return false\n }\n\n return (\n selection.anchor.path.join() === selection.focus.path.join() &&\n selection.anchor.offset === selection.focus.offset\n )\n}\n"],"names":["isEqualSelections","a","b","isEqualSelectionPoints","anchor","focus","isSelectionCollapsed","selection","path","join","offset"],"mappings":";;;;AAMgBA,SAAAA,kBAAkBC,GAAoBC,GAAoB;AACpE,SAAA,CAACD,KAAK,CAACC,IACF,KAGL,CAACD,KAAK,CAACC,IACF,KAIPC,uBAAuBF,EAAEG,QAAQF,EAAEE,MAAM,KACzCD,uBAAuBF,EAAEI,OAAOH,EAAEG,KAAK;AAE3C;ACdO,SAASC,qBAAqBC,WAA4B;AAC/D,SAAKA,YAKHA,UAAUH,OAAOI,KAAKC,KAAAA,MAAWF,UAAUF,MAAMG,KAAKC,KAAAA,KACtDF,UAAUH,OAAOM,WAAWH,UAAUF,MAAMK,SALrC;AAOX;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/utils/util.is-equal-selections.ts","../../src/utils/util.is-selection-collapsed.ts","../../src/utils/util.split-text-block.ts"],"sourcesContent":["import type {EditorSelection} from '../types/editor'\nimport {isEqualSelectionPoints} from './util.is-equal-selection-points'\n\n/**\n * @public\n */\nexport function isEqualSelections(a: EditorSelection, b: EditorSelection) {\n if (!a && !b) {\n return true\n }\n\n if (!a || !b) {\n return false\n }\n\n return (\n isEqualSelectionPoints(a.anchor, b.anchor) &&\n isEqualSelectionPoints(a.focus, b.focus)\n )\n}\n","import type {EditorSelection} from '../types/editor'\n\n/**\n * @public\n */\nexport function isSelectionCollapsed(selection: EditorSelection) {\n if (!selection) {\n return false\n }\n\n return (\n selection.anchor.path.join() === selection.focus.path.join() &&\n selection.anchor.offset === selection.focus.offset\n )\n}\n","import type {PortableTextTextBlock} from '@sanity/types'\nimport type {EditorSelectionPoint} from '..'\nimport type {EditorContext} from '../editor/editor-snapshot'\nimport {isSpan} from './util.is-span'\nimport {isTextBlock} from './util.is-text-block'\nimport {sliceBlocks} from './util.slice-blocks'\n\n/**\n * @beta\n */\nexport function splitTextBlock({\n context,\n block,\n point,\n}: {\n context: Pick<EditorContext, 'schema'>\n block: PortableTextTextBlock\n point: EditorSelectionPoint\n}): {before: PortableTextTextBlock; after: PortableTextTextBlock} | undefined {\n const firstChild = block.children.at(0)\n const lastChild = block.children.at(block.children.length - 1)\n\n if (!firstChild || !lastChild) {\n return undefined\n }\n\n const before = sliceBlocks({\n blocks: [block],\n selection: {\n anchor: {\n path: [{_key: block._key}, 'children', {_key: firstChild._key}],\n offset: 0,\n },\n focus: point,\n },\n }).at(0)\n const after = sliceBlocks({\n blocks: [block],\n selection: {\n anchor: point,\n focus: {\n path: [{_key: block._key}, 'children', {_key: lastChild._key}],\n offset: isSpan(context, lastChild) ? lastChild.text.length : 0,\n },\n },\n }).at(0)\n\n if (!before || !after) {\n return undefined\n }\n\n if (!isTextBlock(context, before) || !isTextBlock(context, after)) {\n return undefined\n }\n\n return {before, after}\n}\n"],"names":["isEqualSelections","a","b","isEqualSelectionPoints","anchor","focus","isSelectionCollapsed","selection","path","join","offset","splitTextBlock","context","block","point","firstChild","children","at","lastChild","length","before","sliceBlocks","blocks","_key","after","isSpan","text","isTextBlock"],"mappings":";;;;;AAMgBA,SAAAA,kBAAkBC,GAAoBC,GAAoB;AACpE,SAAA,CAACD,KAAK,CAACC,IACF,KAGL,CAACD,KAAK,CAACC,IACF,KAIPC,uBAAuBF,EAAEG,QAAQF,EAAEE,MAAM,KACzCD,uBAAuBF,EAAEI,OAAOH,EAAEG,KAAK;AAE3C;ACdO,SAASC,qBAAqBC,WAA4B;AAC/D,SAAKA,YAKHA,UAAUH,OAAOI,KAAKC,KAAAA,MAAWF,UAAUF,MAAMG,KAAKC,KAAAA,KACtDF,UAAUH,OAAOM,WAAWH,UAAUF,MAAMK,SALrC;AAOX;ACJO,SAASC,eAAe;AAAA,EAC7BC;AAAAA,EACAC;AAAAA,EACAC;AAKF,GAA8E;AAC5E,QAAMC,aAAaF,MAAMG,SAASC,GAAG,CAAC,GAChCC,YAAYL,MAAMG,SAASC,GAAGJ,MAAMG,SAASG,SAAS,CAAC;AAEzD,MAAA,CAACJ,cAAc,CAACG;AAClB;AAGF,QAAME,SAASC,YAAY;AAAA,IACzBC,QAAQ,CAACT,KAAK;AAAA,IACdN,WAAW;AAAA,MACTH,QAAQ;AAAA,QACNI,MAAM,CAAC;AAAA,UAACe,MAAMV,MAAMU;AAAAA,WAAO,YAAY;AAAA,UAACA,MAAMR,WAAWQ;AAAAA,QAAAA,CAAK;AAAA,QAC9Db,QAAQ;AAAA,MACV;AAAA,MACAL,OAAOS;AAAAA,IAAAA;AAAAA,EAEV,CAAA,EAAEG,GAAG,CAAC,GACDO,QAAQH,YAAY;AAAA,IACxBC,QAAQ,CAACT,KAAK;AAAA,IACdN,WAAW;AAAA,MACTH,QAAQU;AAAAA,MACRT,OAAO;AAAA,QACLG,MAAM,CAAC;AAAA,UAACe,MAAMV,MAAMU;AAAAA,WAAO,YAAY;AAAA,UAACA,MAAML,UAAUK;AAAAA,QAAAA,CAAK;AAAA,QAC7Db,QAAQe,OAAOb,SAASM,SAAS,IAAIA,UAAUQ,KAAKP,SAAS;AAAA,MAAA;AAAA,IAC/D;AAAA,EACF,CACD,EAAEF,GAAG,CAAC;AAEP,MAAI,EAACG,CAAAA,UAAU,CAACI,UAIZ,EAACG,CAAAA,YAAYf,SAASQ,MAAM,KAAK,CAACO,YAAYf,SAASY,KAAK;AAIzD,WAAA;AAAA,MAACJ;AAAAA,MAAQI;AAAAA,IAAK;AACvB;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@portabletext/editor",
3
- "version": "1.40.2",
3
+ "version": "1.40.3",
4
4
  "description": "Portable Text Editor made in React",
5
5
  "keywords": [
6
6
  "sanity",
@@ -79,15 +79,15 @@
79
79
  "slate-react": "0.112.1",
80
80
  "use-effect-event": "^1.0.2",
81
81
  "xstate": "^5.19.2",
82
- "@portabletext/patches": "1.1.3",
83
- "@portabletext/block-tools": "1.1.13"
82
+ "@portabletext/block-tools": "1.1.14",
83
+ "@portabletext/patches": "1.1.3"
84
84
  },
85
85
  "devDependencies": {
86
86
  "@portabletext/toolkit": "^2.0.17",
87
87
  "@sanity/diff-match-patch": "^3.2.0",
88
88
  "@sanity/pkg-utils": "^7.1.1",
89
- "@sanity/schema": "^3.79.0",
90
- "@sanity/types": "^3.79.0",
89
+ "@sanity/schema": "^3.80.1",
90
+ "@sanity/types": "^3.80.1",
91
91
  "@testing-library/jest-dom": "^6.6.3",
92
92
  "@testing-library/react": "^16.2.0",
93
93
  "@types/debug": "^4.1.12",
@@ -115,8 +115,8 @@
115
115
  "racejar": "1.2.2"
116
116
  },
117
117
  "peerDependencies": {
118
- "@sanity/schema": "^3.79.0",
119
- "@sanity/types": "^3.79.0",
118
+ "@sanity/schema": "^3.80.1",
119
+ "@sanity/types": "^3.80.1",
120
120
  "react": "^16.9 || ^17 || ^18 || ^19",
121
121
  "rxjs": "^7.8.2"
122
122
  },
@@ -7,8 +7,8 @@ export const deleteBlockActionImplementation: BehaviorActionImplementation<
7
7
  > = ({action}) => {
8
8
  const range = toSlateRange(
9
9
  {
10
- anchor: {path: action.blockPath, offset: 0},
11
- focus: {path: action.blockPath, offset: 0},
10
+ anchor: {path: action.at, offset: 0},
11
+ focus: {path: action.at, offset: 0},
12
12
  },
13
13
  action.editor,
14
14
  )
@@ -36,9 +36,7 @@ import {
36
36
  import {insertInlineObjectActionImplementation} from './behavior.action.insert-inline-object'
37
37
  import {insertSpanActionImplementation} from './behavior.action.insert-span'
38
38
  import {insertBlockActionImplementation} from './behavior.action.insert.block'
39
- import {insertBlockObjectActionImplementation} from './behavior.action.insert.block-object'
40
39
  import {insertTextActionImplementation} from './behavior.action.insert.text'
41
- import {insertTextBlockActionImplementation} from './behavior.action.insert.text-block'
42
40
  import {
43
41
  addListItemActionImplementation,
44
42
  removeListItemActionImplementation,
@@ -102,13 +100,11 @@ const behaviorActionImplementations: BehaviorActionImplementations = {
102
100
  'history.undo': historyUndoActionImplementation,
103
101
  'insert.block': insertBlockActionImplementation,
104
102
  'insert.blocks': insertBlocksActionImplementation,
105
- 'insert.block object': insertBlockObjectActionImplementation,
106
103
  'insert.break': insertBreakActionImplementation,
107
104
  'insert.inline object': insertInlineObjectActionImplementation,
108
105
  'insert.soft break': insertSoftBreakActionImplementation,
109
106
  'insert.span': insertSpanActionImplementation,
110
107
  'insert.text': insertTextActionImplementation,
111
- 'insert.text block': insertTextBlockActionImplementation,
112
108
  'effect': effectActionImplementation,
113
109
  'list item.add': addListItemActionImplementation,
114
110
  'list item.remove': removeListItemActionImplementation,
@@ -296,13 +292,6 @@ export function performAction({
296
292
  })
297
293
  break
298
294
  }
299
- case 'insert.block object': {
300
- behaviorActionImplementations['insert.block object']({
301
- context,
302
- action,
303
- })
304
- break
305
- }
306
295
  case 'insert.inline object': {
307
296
  behaviorActionImplementations['insert.inline object']({
308
297
  context,
@@ -338,13 +327,6 @@ export function performAction({
338
327
  })
339
328
  break
340
329
  }
341
- case 'insert.text block': {
342
- behaviorActionImplementations['insert.text block']({
343
- context,
344
- action,
345
- })
346
- break
347
- }
348
330
  case 'list item.add': {
349
331
  behaviorActionImplementations['list item.add']({
350
332
  context,
@@ -24,7 +24,17 @@ const arrowDownOnLonelyBlockObject = defineBehavior({
24
24
 
25
25
  return focusBlockObject && !nextBlock
26
26
  },
27
- actions: [() => [raise({type: 'insert.text block', placement: 'after'})]],
27
+ actions: [
28
+ ({snapshot}) => [
29
+ raise({
30
+ type: 'insert.block',
31
+ block: {
32
+ _type: snapshot.context.schema.block.name,
33
+ },
34
+ placement: 'after',
35
+ }),
36
+ ],
37
+ ],
28
38
  })
29
39
 
30
40
  const arrowUpOnLonelyBlockObject = defineBehavior({
@@ -47,7 +57,17 @@ const arrowUpOnLonelyBlockObject = defineBehavior({
47
57
 
48
58
  return focusBlockObject && !previousBlock
49
59
  },
50
- actions: [() => [raise({type: 'insert.text block', placement: 'before'})]],
60
+ actions: [
61
+ ({snapshot}) => [
62
+ raise({
63
+ type: 'insert.block',
64
+ block: {
65
+ _type: snapshot.context.schema.block.name,
66
+ },
67
+ placement: 'before',
68
+ }),
69
+ ],
70
+ ],
51
71
  })
52
72
 
53
73
  const breakingBlockObject = defineBehavior({
@@ -58,7 +78,17 @@ const breakingBlockObject = defineBehavior({
58
78
 
59
79
  return collapsedSelection && focusBlockObject !== undefined
60
80
  },
61
- actions: [() => [raise({type: 'insert.text block', placement: 'after'})]],
81
+ actions: [
82
+ ({snapshot}) => [
83
+ raise({
84
+ type: 'insert.block',
85
+ block: {
86
+ _type: snapshot.context.schema.block.name,
87
+ },
88
+ placement: 'after',
89
+ }),
90
+ ],
91
+ ],
62
92
  })
63
93
 
64
94
  const clickingAboveLonelyBlockObject = defineBehavior({
@@ -78,7 +108,17 @@ const clickingAboveLonelyBlockObject = defineBehavior({
78
108
  !previousBlock
79
109
  )
80
110
  },
81
- actions: [() => [raise({type: 'insert.text block', placement: 'before'})]],
111
+ actions: [
112
+ ({snapshot}) => [
113
+ raise({
114
+ type: 'insert.block',
115
+ block: {
116
+ _type: snapshot.context.schema.block.name,
117
+ },
118
+ placement: 'before',
119
+ }),
120
+ ],
121
+ ],
82
122
  })
83
123
 
84
124
  const clickingBelowLonelyBlockObject = defineBehavior({
@@ -98,7 +138,17 @@ const clickingBelowLonelyBlockObject = defineBehavior({
98
138
  !nextBlock
99
139
  )
100
140
  },
101
- actions: [() => [raise({type: 'insert.text block', placement: 'after'})]],
141
+ actions: [
142
+ ({snapshot}) => [
143
+ raise({
144
+ type: 'insert.block',
145
+ block: {
146
+ _type: snapshot.context.schema.block.name,
147
+ },
148
+ placement: 'after',
149
+ }),
150
+ ],
151
+ ],
102
152
  })
103
153
 
104
154
  const deletingEmptyTextBlockAfterBlockObject = defineBehavior({
@@ -125,7 +175,7 @@ const deletingEmptyTextBlockAfterBlockObject = defineBehavior({
125
175
  (_, {focusTextBlock, previousBlock}) => [
126
176
  raise({
127
177
  type: 'delete.block',
128
- blockPath: focusTextBlock.path,
178
+ at: focusTextBlock.path,
129
179
  }),
130
180
  raise({
131
181
  type: 'select',
@@ -162,7 +212,7 @@ const deletingEmptyTextBlockBeforeBlockObject = defineBehavior({
162
212
  (_, {focusTextBlock, nextBlock}) => [
163
213
  raise({
164
214
  type: 'delete.block',
165
- blockPath: focusTextBlock.path,
215
+ at: focusTextBlock.path,
166
216
  }),
167
217
  raise({
168
218
  type: 'select',
@@ -29,10 +29,8 @@ const breakingAtTheEndOfTextBlock = defineBehavior({
29
29
  type: 'insert.block',
30
30
  block: {
31
31
  _type: snapshot.context.schema.block.name,
32
- _key: snapshot.context.keyGenerator(),
33
32
  children: [
34
33
  {
35
- _key: snapshot.context.keyGenerator(),
36
34
  _type: snapshot.context.schema.span.name,
37
35
  text: '',
38
36
  marks: [],
@@ -94,11 +92,9 @@ const breakingAtTheStartOfTextBlock = defineBehavior({
94
92
  raise({
95
93
  type: 'insert.block',
96
94
  block: {
97
- _key: snapshot.context.keyGenerator(),
98
95
  _type: snapshot.context.schema.block.name,
99
96
  children: [
100
97
  {
101
- _key: snapshot.context.keyGenerator(),
102
98
  _type: snapshot.context.schema.span.name,
103
99
  marks: focusAnnotations.length === 0 ? focusDecorators : [],
104
100
  text: '',
@@ -359,7 +359,7 @@ export const defaultBehaviors = [
359
359
  ? draggedBlocks.map((block) =>
360
360
  raise({
361
361
  type: 'delete.block',
362
- blockPath: block.path,
362
+ at: block.path,
363
363
  }),
364
364
  )
365
365
  : [
@@ -204,9 +204,12 @@ export function createMarkdownBehaviors(config: MarkdownBehaviorsConfig) {
204
204
  ],
205
205
  (_, {hrObject, hrBlockOffsets}) => [
206
206
  {
207
- type: 'insert.block object',
207
+ type: 'insert.block',
208
208
  placement: 'before',
209
- blockObject: hrObject,
209
+ block: {
210
+ _type: hrObject.name,
211
+ ...(hrObject.value ?? {}),
212
+ },
210
213
  },
211
214
  {
212
215
  type: 'delete.text',
@@ -237,25 +240,34 @@ export function createMarkdownBehaviors(config: MarkdownBehaviorsConfig) {
237
240
  text: hrCharacters,
238
241
  },
239
242
  ],
240
- (_, {hrObject, focusBlock}) =>
243
+ ({snapshot}, {hrObject, focusBlock}) =>
241
244
  isPortableTextTextBlock(focusBlock.node)
242
245
  ? [
243
246
  {
244
- type: 'insert.text block',
245
- textBlock: {children: focusBlock.node.children},
247
+ type: 'insert.block',
248
+ block: {
249
+ _type: snapshot.context.schema.block.name,
250
+ children: focusBlock.node.children,
251
+ },
246
252
  placement: 'after',
247
253
  },
248
254
  {
249
- type: 'insert.block object',
250
- blockObject: hrObject,
255
+ type: 'insert.block',
256
+ block: {
257
+ _type: hrObject.name,
258
+ ...(hrObject.value ?? {}),
259
+ },
251
260
  placement: 'after',
252
261
  },
253
- {type: 'delete.block', blockPath: focusBlock.path},
262
+ {type: 'delete.block', at: focusBlock.path},
254
263
  ]
255
264
  : [
256
265
  {
257
- type: 'insert.block object',
258
- blockObject: hrObject,
266
+ type: 'insert.block',
267
+ block: {
268
+ _type: hrObject.name,
269
+ ...(hrObject.value ?? {}),
270
+ },
259
271
  placement: 'after',
260
272
  },
261
273
  ],