slate-vue3 0.12.2 → 0.13.1

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/dist/core.js CHANGED
@@ -1,5 +1,5 @@
1
- import { a6, a7, a8, d, e, f, a, h, aj, c, i, j, k, ap, ak, l, m, o, p, q, g, b, r, t, u, v, w, x, aq, y, a9, z, A, B, C, D, E, F, G, H, I, J, aa, K, ab, al, ac, L, M, N, O, n, P, S, Q, R, V, T, U, W, X, _, Y, Z, $, ad, am, ae, a0, an, ao, a5, s, af, a1, a2, a3, ag, ah, a4, ai } from "./create-editor-CKqY-8iC.js";
2
- import { E as E2, a as a10, L as L2, N as N2, O as O2, P as P2, b as b2, R as R2, c as c2, S as S2, T as T2, d as d2, i as i2, e as e2 } from "./index-BzxeM0Pe.js";
1
+ import { P, a, R, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, Q, S, T, U, V, W, X, Y, Z, _, $, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, al, am, an, ao, ap, aq } from "./create-editor-DUZVKniJ.js";
2
+ import { E as E2, a as a10, L as L2, N as N2, O as O2, P as P2, b as b2, R as R2, S as S2, c as c2, T as T2, d as d2, i as i2, e as e2 } from "./index-C2VZD0rk.js";
3
3
  export {
4
4
  E2 as Editor,
5
5
  a10 as Element,
@@ -7,93 +7,93 @@ export {
7
7
  N2 as Node,
8
8
  O2 as Operation,
9
9
  P2 as Path,
10
- a6 as PathRef,
10
+ P as PathRef,
11
11
  b2 as Point,
12
- a7 as PointRef,
12
+ a as PointRef,
13
13
  R2 as Range,
14
- a8 as RangeRef,
15
- c2 as Scrubber,
16
- S2 as Span,
14
+ R as RangeRef,
15
+ S2 as Scrubber,
16
+ c2 as Span,
17
17
  T2 as Text,
18
18
  d2 as Transforms,
19
- d as above,
20
- e as addMark,
21
- f as after,
22
- a as apply,
23
- h as before,
24
- aj as collapse,
25
- c as createEditor,
19
+ b as above,
20
+ c as addMark,
21
+ d as after,
22
+ e as apply,
23
+ f as before,
24
+ g as collapse,
25
+ h as createEditor,
26
26
  i as deleteBackward,
27
27
  j as deleteForward,
28
28
  k as deleteFragment,
29
- ap as deleteText,
30
- ak as deselect,
31
- l as edges,
32
- m as elementReadOnly,
33
- o as end,
34
- p as first,
35
- q as fragment,
36
- g as getDirtyPaths,
37
- b as getFragment,
38
- r as getVoid,
39
- t as hasBlocks,
40
- u as hasInlines,
41
- v as hasPath,
42
- w as hasTexts,
43
- x as insertBreak,
44
- aq as insertFragment,
45
- y as insertNode,
46
- a9 as insertNodes,
47
- z as insertSoftBreak,
48
- A as insertText,
49
- B as isBlock,
50
- C as isEdge,
29
+ l as deleteText,
30
+ m as deselect,
31
+ n as edges,
32
+ o as elementReadOnly,
33
+ p as end,
34
+ q as first,
35
+ r as fragment,
36
+ s as getDirtyPaths,
37
+ t as getFragment,
38
+ u as getVoid,
39
+ v as hasBlocks,
40
+ w as hasInlines,
41
+ x as hasPath,
42
+ y as hasTexts,
43
+ z as insertBreak,
44
+ A as insertFragment,
45
+ B as insertNode,
46
+ C as insertNodes,
47
+ D as insertSoftBreak,
48
+ E as insertText,
49
+ F as isBlock,
50
+ G as isEdge,
51
51
  i2 as isEditor,
52
- D as isEmpty,
53
- E as isEnd,
54
- F as isNormalizing,
52
+ H as isEmpty,
53
+ I as isEnd,
54
+ J as isNormalizing,
55
55
  e2 as isObject,
56
- G as isStart,
57
- H as last,
58
- I as leaf,
59
- J as levels,
60
- aa as liftNodes,
61
- K as marks,
62
- ab as mergeNodes,
63
- al as move,
64
- ac as moveNodes,
65
- L as next,
66
- M as node,
67
- N as nodes,
68
- O as normalize,
69
- n as normalizeNode,
70
- P as parent,
71
- S as path,
72
- Q as pathRef,
73
- R as pathRefs,
74
- V as point,
75
- T as pointRef,
76
- U as pointRefs,
77
- W as positions,
78
- X as previous,
79
- _ as range,
80
- Y as rangeRef,
81
- Z as rangeRefs,
82
- $ as removeMark,
83
- ad as removeNodes,
84
- am as select,
85
- ae as setNodes,
86
- a0 as setNormalizing,
87
- an as setPoint,
88
- ao as setSelection,
89
- a5 as shouldMergeNodesRemovePrevNode,
90
- s as shouldNormalize,
91
- af as splitNodes,
92
- a1 as start,
93
- a2 as string,
94
- a3 as unhangRange,
95
- ag as unsetNodes,
96
- ah as unwrapNodes,
97
- a4 as withoutNormalizing,
98
- ai as wrapNodes
56
+ K as isStart,
57
+ L as last,
58
+ M as leaf,
59
+ N as levels,
60
+ O as liftNodes,
61
+ Q as marks,
62
+ S as mergeNodes,
63
+ T as move,
64
+ U as moveNodes,
65
+ V as next,
66
+ W as node,
67
+ X as nodes,
68
+ Y as normalize,
69
+ Z as normalizeNode,
70
+ _ as parent,
71
+ $ as path,
72
+ a0 as pathRef,
73
+ a1 as pathRefs,
74
+ a2 as point,
75
+ a3 as pointRef,
76
+ a4 as pointRefs,
77
+ a5 as positions,
78
+ a6 as previous,
79
+ a7 as range,
80
+ a8 as rangeRef,
81
+ a9 as rangeRefs,
82
+ aa as removeMark,
83
+ ab as removeNodes,
84
+ ac as select,
85
+ ad as setNodes,
86
+ ae as setNormalizing,
87
+ af as setPoint,
88
+ ag as setSelection,
89
+ ah as shouldMergeNodesRemovePrevNode,
90
+ ai as shouldNormalize,
91
+ aj as splitNodes,
92
+ ak as start,
93
+ al as string,
94
+ am as unhangRange,
95
+ an as unsetNodes,
96
+ ao as unwrapNodes,
97
+ ap as withoutNormalizing,
98
+ aq as wrapNodes
99
99
  };
@@ -1,4 +1,4 @@
1
- import { P as Path, b as Point, R as Range, E as Editor, d as Transforms, N as Node, T as Text, L as Location, g as getDefaultInsertLocation, c as Scrubber } from "./index-BzxeM0Pe.js";
1
+ import { P as Path, b as Point, R as Range, E as Editor, d as Transforms, N as Node, T as Text, L as Location, g as getDefaultInsertLocation, S as Scrubber } from "./index-C2VZD0rk.js";
2
2
  import { shallowReactive, ref } from "vue";
3
3
  const PathRef = {
4
4
  transform(ref2, op) {
@@ -364,7 +364,6 @@ const apply = (editor, op) => {
364
364
  if (op.type === "set_selection") {
365
365
  editor.marks = null;
366
366
  }
367
- editor.onImmediateChange({ operation: op });
368
367
  Promise.resolve().then(() => {
369
368
  editor.onChange({ operation: op });
370
369
  editor.operations = [];
@@ -977,7 +976,7 @@ const normalize = (editor, options = {}) => {
977
976
  const entry = Editor.node(editor, dirtyPath);
978
977
  const [node2, _] = entry;
979
978
  if (Node.isElement(node2) && node2.children.length === 0) {
980
- editor.normalizeNode(entry, { operation });
979
+ editor.normalizeNode(entry, { operation, force });
981
980
  }
982
981
  }
983
982
  }
@@ -996,7 +995,7 @@ const normalize = (editor, options = {}) => {
996
995
  const dirtyPath = popDirtyPath(editor);
997
996
  if (Node.has(editor, dirtyPath)) {
998
997
  const entry = Editor.node(editor, dirtyPath);
999
- editor.normalizeNode(entry, { operation });
998
+ editor.normalizeNode(entry, { operation, force });
1000
999
  }
1001
1000
  iteration++;
1002
1001
  dirtyPaths = getDirtyPaths2(editor);
@@ -3148,8 +3147,6 @@ const createEditor = () => {
3148
3147
  markableVoid: () => false,
3149
3148
  onChange: () => {
3150
3149
  },
3151
- onImmediateChange: () => {
3152
- },
3153
3150
  // Core
3154
3151
  apply: (...args) => apply(editor, ...args),
3155
3152
  // Editor
@@ -3243,85 +3240,85 @@ const createEditor = () => {
3243
3240
  return editor;
3244
3241
  };
3245
3242
  export {
3246
- removeMark as $,
3247
- insertText as A,
3248
- isBlock as B,
3249
- isEdge as C,
3250
- isEmpty as D,
3251
- isEnd as E,
3252
- isNormalizing as F,
3253
- isStart as G,
3254
- last as H,
3255
- leaf as I,
3256
- levels as J,
3257
- marks as K,
3258
- next as L,
3259
- node as M,
3260
- nodes as N,
3261
- normalize as O,
3262
- parent as P,
3263
- pathRef as Q,
3264
- pathRefs as R,
3265
- path as S,
3266
- pointRef as T,
3267
- pointRefs as U,
3268
- point as V,
3269
- positions as W,
3270
- previous as X,
3271
- rangeRef as Y,
3272
- rangeRefs as Z,
3273
- range as _,
3274
- apply as a,
3275
- setNormalizing as a0,
3276
- start as a1,
3277
- string as a2,
3278
- unhangRange as a3,
3279
- withoutNormalizing as a4,
3280
- shouldMergeNodesRemovePrevNode as a5,
3281
- PathRef as a6,
3282
- PointRef as a7,
3283
- RangeRef as a8,
3284
- insertNodes as a9,
3285
- liftNodes as aa,
3286
- mergeNodes as ab,
3287
- moveNodes as ac,
3288
- removeNodes as ad,
3289
- setNodes as ae,
3290
- splitNodes as af,
3291
- unsetNodes as ag,
3292
- unwrapNodes as ah,
3293
- wrapNodes as ai,
3294
- collapse as aj,
3295
- deselect as ak,
3296
- move as al,
3297
- select as am,
3298
- setPoint as an,
3299
- setSelection as ao,
3300
- deleteText as ap,
3301
- insertFragment as aq,
3302
- getFragment as b,
3303
- createEditor as c,
3304
- above as d,
3305
- addMark as e,
3306
- after as f,
3307
- getDirtyPaths as g,
3308
- before as h,
3243
+ path as $,
3244
+ insertFragment as A,
3245
+ insertNode as B,
3246
+ insertNodes as C,
3247
+ insertSoftBreak as D,
3248
+ insertText as E,
3249
+ isBlock as F,
3250
+ isEdge as G,
3251
+ isEmpty as H,
3252
+ isEnd as I,
3253
+ isNormalizing as J,
3254
+ isStart as K,
3255
+ last as L,
3256
+ leaf as M,
3257
+ levels as N,
3258
+ liftNodes as O,
3259
+ PathRef as P,
3260
+ marks as Q,
3261
+ RangeRef as R,
3262
+ mergeNodes as S,
3263
+ move as T,
3264
+ moveNodes as U,
3265
+ next as V,
3266
+ node as W,
3267
+ nodes as X,
3268
+ normalize as Y,
3269
+ normalizeNode as Z,
3270
+ parent as _,
3271
+ PointRef as a,
3272
+ pathRef as a0,
3273
+ pathRefs as a1,
3274
+ point as a2,
3275
+ pointRef as a3,
3276
+ pointRefs as a4,
3277
+ positions as a5,
3278
+ previous as a6,
3279
+ range as a7,
3280
+ rangeRef as a8,
3281
+ rangeRefs as a9,
3282
+ removeMark as aa,
3283
+ removeNodes as ab,
3284
+ select as ac,
3285
+ setNodes as ad,
3286
+ setNormalizing as ae,
3287
+ setPoint as af,
3288
+ setSelection as ag,
3289
+ shouldMergeNodesRemovePrevNode as ah,
3290
+ shouldNormalize as ai,
3291
+ splitNodes as aj,
3292
+ start as ak,
3293
+ string as al,
3294
+ unhangRange as am,
3295
+ unsetNodes as an,
3296
+ unwrapNodes as ao,
3297
+ withoutNormalizing as ap,
3298
+ wrapNodes as aq,
3299
+ above as b,
3300
+ addMark as c,
3301
+ after as d,
3302
+ apply as e,
3303
+ before as f,
3304
+ collapse as g,
3305
+ createEditor as h,
3309
3306
  deleteBackward as i,
3310
3307
  deleteForward as j,
3311
3308
  deleteFragment as k,
3312
- edges as l,
3313
- elementReadOnly as m,
3314
- normalizeNode as n,
3315
- end as o,
3316
- first as p,
3317
- fragment as q,
3318
- getVoid as r,
3319
- shouldNormalize as s,
3320
- hasBlocks as t,
3321
- hasInlines as u,
3322
- hasPath as v,
3323
- hasTexts as w,
3324
- insertBreak as x,
3325
- insertNode as y,
3326
- insertSoftBreak as z
3309
+ deleteText as l,
3310
+ deselect as m,
3311
+ edges as n,
3312
+ elementReadOnly as o,
3313
+ end as p,
3314
+ first as q,
3315
+ fragment as r,
3316
+ getDirtyPaths as s,
3317
+ getFragment as t,
3318
+ getVoid as u,
3319
+ hasBlocks as v,
3320
+ hasInlines as w,
3321
+ hasPath as x,
3322
+ hasTexts as y,
3323
+ insertBreak as z
3327
3324
  };
package/dist/dom.js CHANGED
@@ -1,6 +1,6 @@
1
- import { D as DOMEditor, E as EDITOR_TO_KEY_TO_ELEMENT, a as EDITOR_TO_USER_MARKS, g as getChunkTreeForNode, b as EDITOR_TO_USER_SELECTION, N as NODE_TO_KEY, i as isDOMText, c as getPlainText, d as getSlateFragmentAttribute, e as EDITOR_TO_ON_CHANGE, f as EDITOR_TO_ON_IMMEDIATE_CHANGE } from "./hotkeys-D6R9vfnD.js";
2
- import { R, $, _, a0, T, U, F, M, C, K, L, a4, J, G, O, a3, I, a2, S, P, H, Q, W, V, a5, a1, Y, Z, h, A, B, x, u, j, t, s, v, r, z, y, k, l, m, o, p, w, q, n, X } from "./hotkeys-D6R9vfnD.js";
3
- import { E as Editor, R as Range, N as Node, d as Transforms, P as Path } from "./index-BzxeM0Pe.js";
1
+ import { D as DOMEditor, E as EDITOR_TO_KEY_TO_ELEMENT, a as EDITOR_TO_USER_MARKS, g as getChunkTreeForNode, b as EDITOR_TO_USER_SELECTION, N as NODE_TO_KEY, i as isDOMText, c as getPlainText, d as getSlateFragmentAttribute, e as EDITOR_TO_ON_CHANGE } from "./hotkeys-D-Urs0nl.js";
2
+ import { C, f, h, j, H, k, I, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, K, A, M, B, F, G, J, L, O, P, Q, R, S, T, U, V, W, X, Y, Z, _, $, a0, a1, a2, a3, a4 } from "./hotkeys-D-Urs0nl.js";
3
+ import { E as Editor, R as Range, N as Node, d as Transforms, P as Path } from "./index-C2VZD0rk.js";
4
4
  import "vue";
5
5
  const doRectsIntersect = (rect, compareRect) => {
6
6
  const middle = (compareRect.top + compareRect.bottom) / 2;
@@ -47,14 +47,7 @@ const findCurrentLineRange = (editor, parentRange) => {
47
47
  };
48
48
  const withDOM = (editor, clipboardFormatKey = "x-slate-fragment") => {
49
49
  const e = editor;
50
- const {
51
- apply,
52
- onChange,
53
- onImmediateChange,
54
- deleteBackward,
55
- addMark,
56
- removeMark
57
- } = e;
50
+ const { apply, onChange, deleteBackward, addMark, removeMark } = e;
58
51
  EDITOR_TO_KEY_TO_ELEMENT.set(e, /* @__PURE__ */ new WeakMap());
59
52
  e.addMark = (key, value) => {
60
53
  EDITOR_TO_USER_MARKS.delete(e);
@@ -252,13 +245,6 @@ const withDOM = (editor, clipboardFormatKey = "x-slate-fragment") => {
252
245
  }
253
246
  onChange(options);
254
247
  };
255
- e.onImmediateChange = (options) => {
256
- const onContextImmediateChange = EDITOR_TO_ON_IMMEDIATE_CHANGE.get(e);
257
- if (onContextImmediateChange) {
258
- onContextImmediateChange(options);
259
- }
260
- onImmediateChange(options);
261
- };
262
248
  return e;
263
249
  };
264
250
  const getMatches = (e, path) => {
@@ -352,68 +338,67 @@ const splitDecorationsByChild = (editor, node, decorations) => {
352
338
  return decorationsByChild;
353
339
  };
354
340
  export {
355
- R as CAN_USE_DOM,
341
+ C as CAN_USE_DOM,
356
342
  DOMEditor,
357
- $ as EDITOR_TO_ELEMENT,
343
+ f as EDITOR_TO_ELEMENT,
358
344
  EDITOR_TO_KEY_TO_ELEMENT,
359
345
  EDITOR_TO_ON_CHANGE,
360
- EDITOR_TO_ON_IMMEDIATE_CHANGE,
361
346
  EDITOR_TO_USER_MARKS,
362
347
  EDITOR_TO_USER_SELECTION,
363
- _ as EDITOR_TO_WINDOW,
364
- a0 as ELEMENT_TO_NODE,
365
- T as HAS_BEFORE_INPUT_SUPPORT,
366
- U as Hotkeys,
367
- F as IS_ANDROID,
368
- M as IS_ANDROID_CHROME_LEGACY,
369
- C as IS_APPLE,
370
- K as IS_CHROME,
371
- L as IS_CHROME_LEGACY,
372
- a4 as IS_COMPOSING,
373
- J as IS_EDGE_LEGACY,
374
- G as IS_FIREFOX,
375
- O as IS_FIREFOX_LEGACY,
376
- a3 as IS_FOCUSED,
377
- I as IS_IOS,
378
- a2 as IS_READ_ONLY,
379
- S as IS_SAFARI_LEGACY,
380
- P as IS_UC_MOBILE,
381
- H as IS_WEBKIT,
382
- Q as IS_WECHATBROWSER,
383
- W as KEY_TO_CHUNK_TREE,
384
- V as Key,
385
- a5 as MARK_PLACEHOLDER_SYMBOL,
386
- a1 as NODE_TO_ELEMENT,
387
- Y as NODE_TO_INDEX,
348
+ h as EDITOR_TO_WINDOW,
349
+ j as ELEMENT_TO_NODE,
350
+ H as HAS_BEFORE_INPUT_SUPPORT,
351
+ k as Hotkeys,
352
+ I as IS_ANDROID,
353
+ l as IS_ANDROID_CHROME_LEGACY,
354
+ m as IS_APPLE,
355
+ n as IS_CHROME,
356
+ o as IS_CHROME_LEGACY,
357
+ p as IS_COMPOSING,
358
+ q as IS_EDGE_LEGACY,
359
+ r as IS_FIREFOX,
360
+ s as IS_FIREFOX_LEGACY,
361
+ t as IS_FOCUSED,
362
+ u as IS_IOS,
363
+ v as IS_READ_ONLY,
364
+ w as IS_SAFARI_LEGACY,
365
+ x as IS_UC_MOBILE,
366
+ y as IS_WEBKIT,
367
+ z as IS_WECHATBROWSER,
368
+ K as KEY_TO_CHUNK_TREE,
369
+ A as Key,
370
+ M as MARK_PLACEHOLDER_SYMBOL,
371
+ B as NODE_TO_ELEMENT,
372
+ F as NODE_TO_INDEX,
388
373
  NODE_TO_KEY,
389
- Z as NODE_TO_PARENT,
390
- h as applyStringDiff,
391
- A as closestShadowAware,
392
- B as containsShadowAware,
393
- x as getActiveElement,
374
+ G as NODE_TO_PARENT,
375
+ J as applyStringDiff,
376
+ L as closestShadowAware,
377
+ O as containsShadowAware,
378
+ P as getActiveElement,
394
379
  getChunkTreeForNode,
395
- u as getClipboardData,
396
- j as getDefaultView,
397
- t as getEditableChild,
398
- s as getEditableChildAndIndex,
380
+ Q as getClipboardData,
381
+ R as getDefaultView,
382
+ S as getEditableChild,
383
+ T as getEditableChildAndIndex,
399
384
  getPlainText,
400
- v as getSelection,
385
+ U as getSelection,
401
386
  getSlateFragmentAttribute,
402
- r as hasShadowRoot,
403
- z as isAfter,
404
- y as isBefore,
405
- k as isDOMComment,
406
- l as isDOMElement,
407
- m as isDOMNode,
408
- o as isDOMSelection,
387
+ V as hasShadowRoot,
388
+ W as isAfter,
389
+ X as isBefore,
390
+ Y as isDOMComment,
391
+ Z as isDOMElement,
392
+ _ as isDOMNode,
393
+ $ as isDOMSelection,
409
394
  isDOMText,
410
395
  isElementDecorationsEqual,
411
- p as isPlainTextOnlyPaste,
396
+ a0 as isPlainTextOnlyPaste,
412
397
  isTextDecorationsEqual,
413
- w as isTrackedMutation,
414
- q as normalizeDOMPoint,
415
- n as normalizeStringDiff,
416
- X as reconcileChildren,
398
+ a1 as isTrackedMutation,
399
+ a2 as normalizeDOMPoint,
400
+ a3 as normalizeStringDiff,
401
+ a4 as reconcileChildren,
417
402
  shallowCompare,
418
403
  splitDecorationsByChild,
419
404
  withDOM
package/dist/history.js CHANGED
@@ -1,4 +1,4 @@
1
- import { e as isObject, O as Operation, E as Editor, d as Transforms, P as Path } from "./index-BzxeM0Pe.js";
1
+ import { e as isObject, O as Operation, E as Editor, d as Transforms, P as Path } from "./index-C2VZD0rk.js";
2
2
  import { shallowReactive } from "vue";
3
3
  const History = {
4
4
  /**
@@ -1,5 +1,5 @@
1
- import { shallowReactive } from "vue";
2
- import { c as Scrubber, R as Range, E as Editor, N as Node, d as Transforms, P as Path } from "./index-BzxeM0Pe.js";
1
+ import { toRaw } from "vue";
2
+ import { S as Scrubber, R as Range, E as Editor, N as Node, d as Transforms, P as Path } from "./index-C2VZD0rk.js";
3
3
  import { t as toRawWeakMap } from "./index-Ban80MbP.js";
4
4
  const getDefaultView = (value) => {
5
5
  return value && value.ownerDocument && value.ownerDocument.defaultView || null;
@@ -262,7 +262,6 @@ const IS_FOCUSED = /* @__PURE__ */ new WeakMap();
262
262
  const IS_COMPOSING = /* @__PURE__ */ new WeakMap();
263
263
  const EDITOR_TO_USER_SELECTION = /* @__PURE__ */ new WeakMap();
264
264
  const EDITOR_TO_ON_CHANGE = /* @__PURE__ */ new WeakMap();
265
- const EDITOR_TO_ON_IMMEDIATE_CHANGE = /* @__PURE__ */ new WeakMap();
266
265
  const EDITOR_TO_USER_MARKS = /* @__PURE__ */ new WeakMap();
267
266
  const MARK_PLACEHOLDER_SYMBOL = /* @__PURE__ */ Symbol(
268
267
  "mark-placeholder"
@@ -671,10 +670,16 @@ const DOMEditor = {
671
670
  const node = parentNode.hasAttribute("data-slate-node") ? parentNode : parentNode.closest("[data-slate-node]");
672
671
  if (node && DOMEditor.hasDOMNode(editor, node, { editable: true })) {
673
672
  const slateNode2 = DOMEditor.toSlateNode(editor, node);
674
- const start = Editor.start(
675
- editor,
676
- DOMEditor.findPath(editor, slateNode2)
677
- );
673
+ let nodePath;
674
+ try {
675
+ nodePath = DOMEditor.findPath(editor, slateNode2);
676
+ } catch (e) {
677
+ if (suppressThrow) {
678
+ return null;
679
+ }
680
+ throw e;
681
+ }
682
+ const start = Editor.start(editor, nodePath);
678
683
  const { path: path2 } = start;
679
684
  let { offset: offset2 } = start;
680
685
  if (!node.querySelector("[data-slate-leaf]")) {
@@ -692,7 +697,15 @@ const DOMEditor = {
692
697
  );
693
698
  }
694
699
  const slateNode = DOMEditor.toSlateNode(editor, textNode);
695
- const path = DOMEditor.findPath(editor, slateNode);
700
+ let path;
701
+ try {
702
+ path = DOMEditor.findPath(editor, slateNode);
703
+ } catch (e) {
704
+ if (suppressThrow) {
705
+ return null;
706
+ }
707
+ throw e;
708
+ }
696
709
  return { path, offset };
697
710
  },
698
711
  toSlateRange: (editor, domRange, options) => {
@@ -802,7 +815,7 @@ const getChunkTreeForNode = (editor, node) => {
802
815
  chunkTree = {
803
816
  type: "root",
804
817
  movedNodeKeys: /* @__PURE__ */ new Set(),
805
- children: shallowReactive([])
818
+ children: []
806
819
  };
807
820
  KEY_TO_CHUNK_TREE.set(key, chunkTree);
808
821
  }
@@ -1147,8 +1160,10 @@ class ChunkTreeHelper {
1147
1160
  parent,
1148
1161
  children: []
1149
1162
  };
1150
- chunk.children = shallowReactive(
1151
- groupIntoChunks(chunkNodes, chunk, perChunk / this.chunkSize)
1163
+ chunk.children = groupIntoChunks(
1164
+ chunkNodes,
1165
+ chunk,
1166
+ perChunk / this.chunkSize
1152
1167
  );
1153
1168
  chunks2.push(chunk);
1154
1169
  }
@@ -1208,6 +1223,7 @@ class ChunkTreeHelper {
1208
1223
  class ChildrenHelper {
1209
1224
  editor;
1210
1225
  children;
1226
+ rawChildren;
1211
1227
  /**
1212
1228
  * Sparse array of Slate node keys, each index corresponding to an index in
1213
1229
  * the children array
@@ -1221,7 +1237,8 @@ class ChildrenHelper {
1221
1237
  pointerIndex;
1222
1238
  constructor(editor, children) {
1223
1239
  this.editor = editor;
1224
- this.children = children;
1240
+ this.children = [...children];
1241
+ this.rawChildren = toRaw(children);
1225
1242
  this.cachedKeys = new Array(children.length);
1226
1243
  this.pointerIndex = 0;
1227
1244
  }
@@ -1254,7 +1271,7 @@ class ChildrenHelper {
1254
1271
  * Whether all children have been read
1255
1272
  */
1256
1273
  get reachedEnd() {
1257
- return this.pointerIndex >= this.children.length;
1274
+ return this.pointerIndex >= this.rawChildren.length;
1258
1275
  }
1259
1276
  /**
1260
1277
  * Determine whether a node with a given key appears in the unread part of the
@@ -1270,10 +1287,13 @@ class ChildrenHelper {
1270
1287
  * by one and compare it to the known key.
1271
1288
  */
1272
1289
  lookAhead(node, key) {
1273
- const elementResult = this.children.indexOf(node, this.pointerIndex);
1290
+ const elementResult = this.rawChildren.indexOf(
1291
+ toRaw(node),
1292
+ this.pointerIndex
1293
+ );
1274
1294
  if (elementResult > -1) return elementResult - this.pointerIndex;
1275
- for (let i = this.pointerIndex; i < this.children.length; i++) {
1276
- const candidateNode = this.children[i];
1295
+ for (let i = this.pointerIndex; i < this.rawChildren.length; i++) {
1296
+ const candidateNode = this.rawChildren[i];
1277
1297
  const candidateKey = this.findKey(candidateNode, i);
1278
1298
  if (candidateKey === key) return i - this.pointerIndex;
1279
1299
  }
@@ -1297,7 +1317,7 @@ class ChildrenHelper {
1297
1317
  findKey(node, index) {
1298
1318
  const cachedKey = this.cachedKeys[index];
1299
1319
  if (cachedKey) return cachedKey;
1300
- const key = DOMEditor.findKey(this.editor, node);
1320
+ const key = DOMEditor.findKey(this.editor, toRaw(node));
1301
1321
  this.cachedKeys[index] = key;
1302
1322
  return key;
1303
1323
  }
@@ -1681,64 +1701,63 @@ const Hotkeys = {
1681
1701
  isUndo: create("undo")
1682
1702
  };
1683
1703
  export {
1684
- EDITOR_TO_ELEMENT as $,
1685
- closestShadowAware as A,
1686
- containsShadowAware as B,
1687
- IS_APPLE as C,
1704
+ isDOMSelection as $,
1705
+ Key as A,
1706
+ NODE_TO_ELEMENT as B,
1707
+ CAN_USE_DOM as C,
1688
1708
  DOMEditor as D,
1689
1709
  EDITOR_TO_KEY_TO_ELEMENT as E,
1690
- IS_ANDROID as F,
1691
- IS_FIREFOX as G,
1692
- IS_WEBKIT as H,
1693
- IS_IOS as I,
1694
- IS_EDGE_LEGACY as J,
1695
- IS_CHROME as K,
1696
- IS_CHROME_LEGACY as L,
1697
- IS_ANDROID_CHROME_LEGACY as M,
1710
+ NODE_TO_INDEX as F,
1711
+ NODE_TO_PARENT as G,
1712
+ HAS_BEFORE_INPUT_SUPPORT as H,
1713
+ IS_ANDROID as I,
1714
+ applyStringDiff as J,
1715
+ KEY_TO_CHUNK_TREE as K,
1716
+ closestShadowAware as L,
1717
+ MARK_PLACEHOLDER_SYMBOL as M,
1698
1718
  NODE_TO_KEY as N,
1699
- IS_FIREFOX_LEGACY as O,
1700
- IS_UC_MOBILE as P,
1701
- IS_WECHATBROWSER as Q,
1702
- CAN_USE_DOM as R,
1703
- IS_SAFARI_LEGACY as S,
1704
- HAS_BEFORE_INPUT_SUPPORT as T,
1705
- Hotkeys as U,
1706
- Key as V,
1707
- KEY_TO_CHUNK_TREE as W,
1708
- reconcileChildren as X,
1709
- NODE_TO_INDEX as Y,
1710
- NODE_TO_PARENT as Z,
1711
- EDITOR_TO_WINDOW as _,
1719
+ containsShadowAware as O,
1720
+ getActiveElement as P,
1721
+ getClipboardData as Q,
1722
+ getDefaultView as R,
1723
+ getEditableChild as S,
1724
+ getEditableChildAndIndex as T,
1725
+ getSelection as U,
1726
+ hasShadowRoot as V,
1727
+ isAfter as W,
1728
+ isBefore as X,
1729
+ isDOMComment as Y,
1730
+ isDOMElement as Z,
1731
+ isDOMNode as _,
1712
1732
  EDITOR_TO_USER_MARKS as a,
1713
- ELEMENT_TO_NODE as a0,
1714
- NODE_TO_ELEMENT as a1,
1715
- IS_READ_ONLY as a2,
1716
- IS_FOCUSED as a3,
1717
- IS_COMPOSING as a4,
1718
- MARK_PLACEHOLDER_SYMBOL as a5,
1733
+ isPlainTextOnlyPaste as a0,
1734
+ isTrackedMutation as a1,
1735
+ normalizeDOMPoint as a2,
1736
+ normalizeStringDiff as a3,
1737
+ reconcileChildren as a4,
1719
1738
  EDITOR_TO_USER_SELECTION as b,
1720
1739
  getPlainText as c,
1721
1740
  getSlateFragmentAttribute as d,
1722
1741
  EDITOR_TO_ON_CHANGE as e,
1723
- EDITOR_TO_ON_IMMEDIATE_CHANGE as f,
1742
+ EDITOR_TO_ELEMENT as f,
1724
1743
  getChunkTreeForNode as g,
1725
- applyStringDiff as h,
1744
+ EDITOR_TO_WINDOW as h,
1726
1745
  isDOMText as i,
1727
- getDefaultView as j,
1728
- isDOMComment as k,
1729
- isDOMElement as l,
1730
- isDOMNode as m,
1731
- normalizeStringDiff as n,
1732
- isDOMSelection as o,
1733
- isPlainTextOnlyPaste as p,
1734
- normalizeDOMPoint as q,
1735
- hasShadowRoot as r,
1736
- getEditableChildAndIndex as s,
1737
- getEditableChild as t,
1738
- getClipboardData as u,
1739
- getSelection as v,
1740
- isTrackedMutation as w,
1741
- getActiveElement as x,
1742
- isBefore as y,
1743
- isAfter as z
1746
+ ELEMENT_TO_NODE as j,
1747
+ Hotkeys as k,
1748
+ IS_ANDROID_CHROME_LEGACY as l,
1749
+ IS_APPLE as m,
1750
+ IS_CHROME as n,
1751
+ IS_CHROME_LEGACY as o,
1752
+ IS_COMPOSING as p,
1753
+ IS_EDGE_LEGACY as q,
1754
+ IS_FIREFOX as r,
1755
+ IS_FIREFOX_LEGACY as s,
1756
+ IS_FOCUSED as t,
1757
+ IS_IOS as u,
1758
+ IS_READ_ONLY as v,
1759
+ IS_SAFARI_LEGACY as w,
1760
+ IS_UC_MOBILE as x,
1761
+ IS_WEBKIT as y,
1762
+ IS_WECHATBROWSER as z
1744
1763
  };
@@ -1,5 +1,5 @@
1
- import { R as Range, N as Node, T as Text, a as Element, e as isObject } from "./index-BzxeM0Pe.js";
2
- import { c as createEditor$1 } from "./create-editor-CKqY-8iC.js";
1
+ import { R as Range, N as Node, T as Text, a as Element, e as isObject } from "./index-C2VZD0rk.js";
2
+ import { h as createEditor$1 } from "./create-editor-DUZVKniJ.js";
3
3
  import "vue";
4
4
  import { t as toRawWeakMap } from "./index-Ban80MbP.js";
5
5
  const ANCHOR = new toRawWeakMap();
@@ -1550,11 +1550,11 @@ export {
1550
1550
  Operation as O,
1551
1551
  Path as P,
1552
1552
  Range as R,
1553
- Span as S,
1553
+ Scrubber as S,
1554
1554
  Text as T,
1555
1555
  Element as a,
1556
1556
  Point as b,
1557
- Scrubber as c,
1557
+ Span as c,
1558
1558
  Transforms as d,
1559
1559
  isObject as e,
1560
1560
  getDefaultInsertLocation as g,
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { u as useElementIf, a as useEditor, S as SLATE_USE_SELECTION } from "./use-focused-rvrvwwCw.js";
2
- import { n, p, k, l, o, D, m, E, b, j, h, g, i, c, f, d, e } from "./use-focused-rvrvwwCw.js";
3
- import { E as Editor, R as Range } from "./index-BzxeM0Pe.js";
1
+ import { u as useElementIf, a as useEditor, S as SLATE_USE_SELECTION } from "./use-focused-DBkYw-GW.js";
2
+ import { D, b, c, d, e, f, g, E, h, i, j, k, l, m, n, o, p } from "./use-focused-DBkYw-GW.js";
3
+ import { E as Editor, R as Range } from "./index-C2VZD0rk.js";
4
4
  import { computed, inject } from "vue";
5
- import { D as DOMEditor } from "./hotkeys-D6R9vfnD.js";
5
+ import { D as DOMEditor } from "./hotkeys-D-Urs0nl.js";
6
6
  import { t } from "./index-Ban80MbP.js";
7
7
  const useSelected = () => {
8
8
  const element = useElementIf();
@@ -37,27 +37,27 @@ const useInheritRef = (attribute) => {
37
37
  return attribute;
38
38
  };
39
39
  export {
40
- n as DEFAULT_CHUNK_RENDER,
41
- p as DEFAULT_DECORATE_FN,
42
- k as DEFAULT_ELEMENT_RENDER,
43
- l as DEFAULT_LEAF_RENDER,
44
- o as DEFAULT_PLACEHOLDER_RENDER,
45
- D as DEFAULT_SCROLL_INTO_VIEW,
46
- m as DEFAULT_TEXT_RENDER,
40
+ D as DEFAULT_CHUNK_RENDER,
41
+ b as DEFAULT_DECORATE_FN,
42
+ c as DEFAULT_ELEMENT_RENDER,
43
+ d as DEFAULT_LEAF_RENDER,
44
+ e as DEFAULT_PLACEHOLDER_RENDER,
45
+ f as DEFAULT_SCROLL_INTO_VIEW,
46
+ g as DEFAULT_TEXT_RENDER,
47
47
  E as Editable,
48
- b as Slate,
49
- j as handleNativeHistoryEvents,
50
- h as isDOMEventHandled,
51
- g as isDOMEventTargetInput,
52
- i as isEventHandled,
48
+ h as Slate,
49
+ i as handleNativeHistoryEvents,
50
+ j as isDOMEventHandled,
51
+ k as isDOMEventTargetInput,
52
+ l as isEventHandled,
53
53
  t as toRawWeakMap,
54
- c as useComposing,
54
+ m as useComposing,
55
55
  useEditor,
56
- f as useElement,
56
+ n as useElement,
57
57
  useElementIf,
58
- d as useFocused,
58
+ o as useFocused,
59
59
  useInheritRef,
60
- e as useReadOnly,
60
+ p as useReadOnly,
61
61
  useSelected,
62
62
  useSelection
63
63
  };
@@ -21,9 +21,7 @@ export interface BaseEditor {
21
21
  normalizeNode: (entry: NodeEntry, options?: {
22
22
  operation?: Operation;
23
23
  fallbackElement?: () => Element;
24
- }) => void;
25
- onImmediateChange: (options?: {
26
- operation?: Operation;
24
+ force?: boolean;
27
25
  }) => void;
28
26
  onChange: (options?: {
29
27
  operation?: Operation;
@@ -6,8 +6,9 @@ import { ChunkLeaf } from './types';
6
6
  * children array with a chunk tree
7
7
  */
8
8
  export declare class ChildrenHelper {
9
- private editor;
10
- private children;
9
+ private readonly editor;
10
+ private readonly children;
11
+ private readonly rawChildren;
11
12
  /**
12
13
  * Sparse array of Slate node keys, each index corresponding to an index in
13
14
  * the children array
@@ -33,11 +33,5 @@ export declare const EDITOR_TO_USER_SELECTION: WeakMap<Editor, RangeRef | null>;
33
33
  export declare const EDITOR_TO_ON_CHANGE: WeakMap<import('../../slate/index.ts').BaseEditor, (options?: {
34
34
  operation?: Operation;
35
35
  }) => void>;
36
- /**
37
- * Weak map for trigger chunk tree reconciliation on immediate changes.
38
- */
39
- export declare const EDITOR_TO_ON_IMMEDIATE_CHANGE: WeakMap<import('../../slate/index.ts').BaseEditor, (options?: {
40
- operation?: Operation;
41
- }) => void>;
42
36
  export declare const EDITOR_TO_USER_MARKS: WeakMap<Editor, Partial<Text> | null>;
43
37
  export declare const MARK_PLACEHOLDER_SYMBOL: string;
@@ -1,12 +1,9 @@
1
1
  import { Ancestor } from '../../slate/index.ts';
2
- import { VNode } from 'vue';
3
2
  /**
4
3
  * Children.
5
4
  */
6
5
  export declare const ChildrenComp: import('vue').DefineComponent<{
7
6
  element: Ancestor;
8
- }, (() => import('vue').VNodeChild[]) | (() => VNode<import('vue').RendererNode, import('vue').RendererElement, {
9
- [key: string]: any;
10
- }>), {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
7
+ }, () => import('vue').VNodeChild[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
11
8
  element: Ancestor;
12
9
  }> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
@@ -1,6 +1,4 @@
1
1
  import { ChunkAncestor } from '../../slate-dom/index.ts';
2
- export declare const ChunkComp: import('vue').DefineComponent<{
3
- ancestor: ChunkAncestor;
4
- }, () => import('vue').VNodeChild[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
5
- ancestor: ChunkAncestor;
6
- }> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
2
+ import { VNode } from 'vue';
3
+ import { RenderChunkProps } from '../utils/interface';
4
+ export declare const ChunkCompFc: (ancestor: ChunkAncestor, renderChunk: (props: RenderChunkProps) => VNode, highest?: boolean) => import('vue').VNodeChild[];
@@ -2,6 +2,3 @@ import { Ref } from 'vue';
2
2
  export declare const SLATE_INNER_EDITOR_VERSION: unique symbol;
3
3
  export declare const provideEditorVersion: (version: Ref<number>) => void;
4
4
  export declare const useEditorVersion: () => Ref<number, number>;
5
- export declare const SLATE_INNER_EDITOR_NODE_VERSION: unique symbol;
6
- export declare const provideEditorNodeVersion: (version: Ref<number>) => void;
7
- export declare const useEditorNodeVersion: () => Ref<number, number>;
@@ -9,6 +9,7 @@ export interface RenderChunkProps {
9
9
  children: any;
10
10
  attributes: {
11
11
  "data-slate-chunk": true;
12
+ key: string;
12
13
  };
13
14
  }
14
15
  /**
@@ -1,6 +1,6 @@
1
1
  import { h, inject, provide, computed, defineComponent, ref, onMounted, onUnmounted, renderSlot, renderList, watch, onUpdated, useAttrs, reactive, toRaw } from "vue";
2
- import { R as Range, N as Node, c as Scrubber, T as Text, E as Editor, P as Path, d as Transforms, a as Element } from "./index-BzxeM0Pe.js";
3
- import { F as IS_ANDROID, m as isDOMNode, D as DOMEditor, a5 as MARK_PLACEHOLDER_SYMBOL, e as EDITOR_TO_ON_CHANGE, f as EDITOR_TO_ON_IMMEDIATE_CHANGE, H as IS_WEBKIT, E as EDITOR_TO_KEY_TO_ELEMENT, a0 as ELEMENT_TO_NODE, a1 as NODE_TO_ELEMENT, Y as NODE_TO_INDEX, Z as NODE_TO_PARENT, G as IS_FIREFOX, g as getChunkTreeForNode, X as reconcileChildren, h as applyStringDiff, o as isDOMSelection, n as normalizeStringDiff, a2 as IS_READ_ONLY, j as getDefaultView, _ as EDITOR_TO_WINDOW, $ as EDITOR_TO_ELEMENT, v as getSelection, T as HAS_BEFORE_INPUT_SUPPORT, R as CAN_USE_DOM, B as containsShadowAware, x as getActiveElement, a3 as IS_FOCUSED, p as isPlainTextOnlyPaste, a4 as IS_COMPOSING, U as Hotkeys, K as IS_CHROME, O as IS_FIREFOX_LEGACY, I as IS_IOS, Q as IS_WECHATBROWSER, P as IS_UC_MOBILE, a as EDITOR_TO_USER_MARKS, l as isDOMElement, b as EDITOR_TO_USER_SELECTION } from "./hotkeys-D6R9vfnD.js";
2
+ import { R as Range, N as Node, S as Scrubber, T as Text, E as Editor, P as Path, d as Transforms, a as Element } from "./index-C2VZD0rk.js";
3
+ import { I as IS_ANDROID, _ as isDOMNode, D as DOMEditor, M as MARK_PLACEHOLDER_SYMBOL, e as EDITOR_TO_ON_CHANGE, y as IS_WEBKIT, E as EDITOR_TO_KEY_TO_ELEMENT, j as ELEMENT_TO_NODE, B as NODE_TO_ELEMENT, F as NODE_TO_INDEX, G as NODE_TO_PARENT, r as IS_FIREFOX, g as getChunkTreeForNode, a4 as reconcileChildren, J as applyStringDiff, $ as isDOMSelection, a3 as normalizeStringDiff, v as IS_READ_ONLY, R as getDefaultView, h as EDITOR_TO_WINDOW, f as EDITOR_TO_ELEMENT, U as getSelection, H as HAS_BEFORE_INPUT_SUPPORT, C as CAN_USE_DOM, O as containsShadowAware, P as getActiveElement, t as IS_FOCUSED, a0 as isPlainTextOnlyPaste, p as IS_COMPOSING, k as Hotkeys, n as IS_CHROME, s as IS_FIREFOX_LEGACY, u as IS_IOS, z as IS_WECHATBROWSER, x as IS_UC_MOBILE, a as EDITOR_TO_USER_MARKS, Z as isDOMElement, b as EDITOR_TO_USER_SELECTION } from "./hotkeys-D-Urs0nl.js";
4
4
  const SLATE_USE_EDITOR = /* @__PURE__ */ Symbol("SLATE_USE_EDITOR");
5
5
  const SLATE_USE_ELEMENT = /* @__PURE__ */ Symbol("SLATE_USE_ELEMENT");
6
6
  const SLATE_USE_FOCUSED = /* @__PURE__ */ Symbol("SLATE_USE_FOCUSED");
@@ -267,21 +267,6 @@ const useEditorVersion = () => {
267
267
  }
268
268
  return EDITOR_VERSION;
269
269
  };
270
- const SLATE_INNER_EDITOR_NODE_VERSION = /* @__PURE__ */ Symbol(
271
- "SLATE_INNER_EDITOR_NODE_VERSION"
272
- );
273
- const provideEditorNodeVersion = (version) => provide(SLATE_INNER_EDITOR_NODE_VERSION, version);
274
- const useEditorNodeVersion = () => {
275
- const EDITOR_NODE_VERSION = inject(
276
- SLATE_INNER_EDITOR_NODE_VERSION
277
- );
278
- if (EDITOR_NODE_VERSION === void 0) {
279
- throw new Error(
280
- `The \`useEditorNodeVersion\` hook must be used inside the <Slate> component's context.`
281
- );
282
- }
283
- return EDITOR_NODE_VERSION;
284
- };
285
270
  const SLATE_INNER_PLACEHOLDER = /* @__PURE__ */ Symbol("SLATE_INNER_PLACEHOLDER");
286
271
  const providePlaceholder = (placeholder) => {
287
272
  provide(SLATE_INNER_PLACEHOLDER, placeholder);
@@ -369,15 +354,6 @@ const SLATE_INNER_STATIC_CHUNK_ROOT = /* @__PURE__ */ Symbol(
369
354
  const provideChunkRoot = (chunkRoot) => {
370
355
  provide(SLATE_INNER_STATIC_CHUNK_ROOT, chunkRoot);
371
356
  };
372
- const useChunkRoot = () => {
373
- const CHUNK_STATIC_ROOT = inject(SLATE_INNER_STATIC_CHUNK_ROOT);
374
- if (CHUNK_STATIC_ROOT === void 0) {
375
- throw new Error(
376
- `The \`useStaticChunk\` hook must be used inside the <Slate> component's context.`
377
- );
378
- }
379
- return CHUNK_STATIC_ROOT;
380
- };
381
357
  const SLATE_INNER_RENDER_CHUNK = /* @__PURE__ */ Symbol("SLATE_INNER_RENDER_CHUNK");
382
358
  const provideRenderChunk = (fn) => provide(SLATE_INNER_RENDER_CHUNK, fn);
383
359
  const useRenderChunk = () => {
@@ -456,9 +432,7 @@ const Slate = defineComponent({
456
432
  provide(SLATE_USE_SELECTION, selection);
457
433
  const focusCb = () => isFocus.value = DOMEditor.isFocused(editor);
458
434
  const editorVersion = ref(0);
459
- const editorNodeVersion = ref(0);
460
435
  provideEditorVersion(editorVersion);
461
- provideEditorNodeVersion(editorNodeVersion);
462
436
  const markPlaceholder = computed(() => {
463
437
  if (editor.selection && Range.isCollapsed(editor.selection) && editor.marks) {
464
438
  const anchor = editor.selection.anchor;
@@ -493,16 +467,6 @@ const Slate = defineComponent({
493
467
  emit("valuechange", options);
494
468
  }
495
469
  });
496
- EDITOR_TO_ON_IMMEDIATE_CHANGE.set(
497
- editor,
498
- (options) => {
499
- const type = options?.operation?.type;
500
- if (!type || ["set_selection", "insert_text", "remove_text"].includes(type)) {
501
- return;
502
- }
503
- editorNodeVersion.value++;
504
- }
505
- );
506
470
  });
507
471
  onUnmounted(() => {
508
472
  document.removeEventListener("focusin", focusCb);
@@ -842,32 +806,20 @@ const ElementComp = defineComponent({
842
806
  });
843
807
  }
844
808
  });
845
- const ChunkComp = defineComponent({
846
- name: "slate-chunk",
847
- props: ["ancestor"],
848
- setup(props) {
849
- const ancestor = props.ancestor;
850
- const root = useChunkRoot();
851
- const renderChunk = useRenderChunk();
852
- return () => renderList(ancestor.children, (chunkNode) => {
853
- if (chunkNode.type === "chunk") {
854
- return renderChunk({
855
- highest: root === ancestor,
856
- lowest: chunkNode.children.some((c) => c.type === "leaf"),
857
- attributes: { "data-slate-chunk": true },
858
- children: h(ChunkComp, {
859
- ancestor: chunkNode,
860
- key: chunkNode.key.id
861
- })
862
- });
863
- }
864
- return h(ElementComp, {
865
- // @ts-expect-error Only blocks containing no inlines are chunked
866
- element: chunkNode.node,
867
- key: chunkNode.key.id
868
- });
809
+ const ChunkCompFc = (ancestor, renderChunk, highest) => renderList(ancestor.children, (chunkNode) => {
810
+ if (chunkNode.type === "chunk") {
811
+ return renderChunk({
812
+ highest: highest === true,
813
+ lowest: chunkNode.children.some((c) => c.type === "leaf"),
814
+ attributes: { "data-slate-chunk": true, key: chunkNode.key.id },
815
+ children: ChunkCompFc(chunkNode, renderChunk, false)
869
816
  });
870
817
  }
818
+ return h(ElementComp, {
819
+ // @ts-expect-error Only blocks containing no inlines are chunked
820
+ element: chunkNode.node,
821
+ key: chunkNode.key.id
822
+ });
871
823
  });
872
824
  const ChildrenComp = defineComponent({
873
825
  name: "slate-children",
@@ -895,10 +847,12 @@ const ChildrenComp = defineComponent({
895
847
  });
896
848
  }
897
849
  const cacheTree = getChunkTreeForNode(editor, props.element);
898
- const editorNodeVersion = useEditorNodeVersion();
850
+ const version = ref(0);
899
851
  watch(
900
- editorNodeVersion,
852
+ element.children,
901
853
  () => {
854
+ version.value++;
855
+ console.time("Reconcile children chunks");
902
856
  reconcileChildren(editor, element.children, {
903
857
  chunkTree: cacheTree,
904
858
  chunkSize,
@@ -914,15 +868,19 @@ const ChildrenComp = defineComponent({
914
868
  NODE_TO_INDEX.set(n2, i);
915
869
  }
916
870
  });
871
+ console.timeEnd("Reconcile children chunks");
917
872
  },
918
873
  {
874
+ deep: false,
919
875
  immediate: true
920
876
  }
921
877
  );
922
878
  provideChunkRoot(cacheTree);
923
- return () => h(ChunkComp, {
924
- ancestor: cacheTree
925
- });
879
+ const renderChunk = useRenderChunk();
880
+ return () => {
881
+ version.value;
882
+ return ChunkCompFc(cacheTree, renderChunk, true);
883
+ };
926
884
  }
927
885
  });
928
886
  const useComposing = () => {
@@ -2130,24 +2088,24 @@ const useFocused = () => {
2130
2088
  return isFocus;
2131
2089
  };
2132
2090
  export {
2133
- DEFAULT_SCROLL_INTO_VIEW as D,
2091
+ DEFAULT_CHUNK_RENDER as D,
2134
2092
  Editable as E,
2135
2093
  SLATE_USE_SELECTION as S,
2136
2094
  useEditor as a,
2137
- Slate as b,
2138
- useComposing as c,
2139
- useFocused as d,
2140
- useReadOnly as e,
2141
- useElement as f,
2142
- isDOMEventTargetInput as g,
2143
- isDOMEventHandled as h,
2144
- isEventHandled as i,
2145
- handleNativeHistoryEvents as j,
2146
- DEFAULT_ELEMENT_RENDER as k,
2147
- DEFAULT_LEAF_RENDER as l,
2148
- DEFAULT_TEXT_RENDER as m,
2149
- DEFAULT_CHUNK_RENDER as n,
2150
- DEFAULT_PLACEHOLDER_RENDER as o,
2151
- DEFAULT_DECORATE_FN as p,
2095
+ DEFAULT_DECORATE_FN as b,
2096
+ DEFAULT_ELEMENT_RENDER as c,
2097
+ DEFAULT_LEAF_RENDER as d,
2098
+ DEFAULT_PLACEHOLDER_RENDER as e,
2099
+ DEFAULT_SCROLL_INTO_VIEW as f,
2100
+ DEFAULT_TEXT_RENDER as g,
2101
+ Slate as h,
2102
+ handleNativeHistoryEvents as i,
2103
+ isDOMEventHandled as j,
2104
+ isDOMEventTargetInput as k,
2105
+ isEventHandled as l,
2106
+ useComposing as m,
2107
+ useElement as n,
2108
+ useFocused as o,
2109
+ useReadOnly as p,
2152
2110
  useElementIf as u
2153
2111
  };
package/dist/yjs.js CHANGED
@@ -1,8 +1,8 @@
1
- import { e as isObject, N as Node, P as Path, E as Editor, L as Location, d as Transforms, R as Range } from "./index-BzxeM0Pe.js";
1
+ import { e as isObject, N as Node, P as Path, E as Editor, L as Location, d as Transforms, R as Range } from "./index-C2VZD0rk.js";
2
2
  import { ref, onMounted, onUnmounted, watch, onUpdated, computed } from "vue";
3
- import { XmlText, YTextEvent, createRelativePositionFromTypeIndex, createAbsolutePositionFromRelativePosition, createRelativePositionFromJSON, decodeRelativePosition, encodeRelativePosition, UndoManager, compareRelativePositions } from "yjs";
4
- import { a as useEditor, d as useFocused } from "./use-focused-rvrvwwCw.js";
5
- import { D as DOMEditor } from "./hotkeys-D6R9vfnD.js";
3
+ import { XmlText, YTextEvent, createAbsolutePositionFromRelativePosition, createRelativePositionFromTypeIndex, createRelativePositionFromJSON, decodeRelativePosition, encodeRelativePosition, UndoManager, compareRelativePositions } from "yjs";
4
+ import { a as useEditor, o as useFocused } from "./use-focused-DBkYw-GW.js";
5
+ import { D as DOMEditor } from "./hotkeys-D-Urs0nl.js";
6
6
  function deepEquals(node, another) {
7
7
  for (const key in node) {
8
8
  const a = node[key];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slate-vue3",
3
- "version": "0.12.2",
3
+ "version": "0.13.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -69,50 +69,50 @@
69
69
  "dependencies": {
70
70
  "direction": "^2.0.1",
71
71
  "is-hotkey": "^0.2.0",
72
- "lodash-es": "^4.17.22",
72
+ "lodash-es": "^4.17.23",
73
73
  "scroll-into-view-if-needed": "^3.1.0"
74
74
  },
75
75
  "peerDependencies": {
76
76
  "vue": "^3.0.0"
77
77
  },
78
78
  "devDependencies": {
79
- "@actions/core": "^2.0.2",
80
- "@eslint/js": "^9.39.2",
81
- "@faker-js/faker": "^10.2.0",
82
- "@liveblocks/client": "^3.13.1",
83
- "@liveblocks/yjs": "^3.13.1",
84
- "@playwright/test": "^1.57.0",
79
+ "@actions/core": "^3.0.0",
80
+ "@eslint/js": "^10.0.1",
81
+ "@faker-js/faker": "^10.3.0",
82
+ "@liveblocks/client": "^3.13.4",
83
+ "@liveblocks/yjs": "^3.13.4",
84
+ "@playwright/test": "^1.58.2",
85
85
  "@testing-library/vue": "^8.1.0",
86
86
  "@types/is-hotkey": "^0.1.10",
87
87
  "@types/is-url": "^1.2.32",
88
88
  "@types/lodash-es": "^4.17.12",
89
- "@types/node": "^25.0.9",
90
- "@types/prismjs": "^1.26.5",
91
- "@vitejs/plugin-vue": "^6.0.3",
89
+ "@types/node": "^25.2.3",
90
+ "@types/prismjs": "^1.26.6",
91
+ "@vitejs/plugin-vue": "^6.0.4",
92
92
  "@vue/eslint-config-prettier": "^10.2.0",
93
93
  "babel-plugin-transform-regex": "^6.1.0",
94
- "eslint": "^9.39.2",
94
+ "eslint": "^10.0.0",
95
95
  "eslint-plugin-vue": "^10.7.0",
96
- "globals": "^17.0.0",
96
+ "globals": "^17.3.0",
97
97
  "husky": "^9.1.7",
98
98
  "image-extensions": "^1.1.0",
99
99
  "is-url": "^1.2.4",
100
100
  "jiti": "^2.6.1",
101
- "jsdom": "^27.4.0",
101
+ "jsdom": "^28.0.0",
102
102
  "lint-staged": "^16.2.7",
103
103
  "prismjs": "^1.30.0",
104
104
  "remark-gfm": "^4.0.1",
105
105
  "remark-parse": "^11.0.0",
106
106
  "remark-slate-transformer": "^0.9.0",
107
107
  "typescript": "~5.9.3",
108
- "typescript-eslint": "^8.53.0",
108
+ "typescript-eslint": "^8.55.0",
109
109
  "unified": "^11.0.5",
110
110
  "vite": "^7.3.1",
111
- "vite-plugin-babel": "^1.4.1",
111
+ "vite-plugin-babel": "^1.5.1",
112
112
  "vite-plugin-dts": "^4.5.4",
113
113
  "vite-plugin-eslint": "^1.8.1",
114
- "vitest": "^4.0.17",
115
- "vue-router": "^4.6.4",
114
+ "vitest": "^4.0.18",
115
+ "vue-router": "^5.0.2",
116
116
  "yjs": "^13.6.29"
117
117
  },
118
118
  "publishConfig": {