slate-vue3 0.7.16 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{batch-dirty-paths-BikbYJJS.js → batch-dirty-paths-BzU_eHbr.js} +18 -21
- package/dist/core.js +3 -3
- package/dist/{create-editor-f8bkw-Um.js → create-editor-CRaAMfCG.js} +2 -2
- package/dist/dom.js +3 -3
- package/dist/history.js +1 -1
- package/dist/{hotkeys-2JskVzHQ.js → hotkeys-DZktq_-0.js} +5 -5
- package/dist/hyperscript.js +2 -2
- package/dist/index.js +5 -5
- package/dist/{location-srcQyGzN.js → location-Cd7btYEI.js} +1 -1
- package/dist/slate-vue/utils/interface.d.ts +2 -2
- package/dist/{use-focused-CwUfb13w.js → use-focused-Qxq4kR2I.js} +39 -35
- package/dist/yjs.js +4 -4
- package/package.json +6 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toRaw
|
|
1
|
+
import { toRaw } from "vue";
|
|
2
2
|
class toRawWeakMap extends WeakMap {
|
|
3
3
|
constructor() {
|
|
4
4
|
super();
|
|
@@ -8,29 +8,26 @@ class toRawWeakMap extends WeakMap {
|
|
|
8
8
|
* @returns true if the element was successfully removed, or false if it was not present.
|
|
9
9
|
*/
|
|
10
10
|
delete(key) {
|
|
11
|
-
return super.delete(
|
|
11
|
+
return super.delete(toRaw(key));
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* @returns a specified element.
|
|
15
15
|
*/
|
|
16
16
|
get(key) {
|
|
17
|
-
return super.get(
|
|
17
|
+
return super.get(toRaw(key));
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* @returns a boolean indicating whether an element with the specified key exists or not.
|
|
21
21
|
*/
|
|
22
22
|
has(key) {
|
|
23
|
-
return super.has(
|
|
23
|
+
return super.has(toRaw(key));
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* Adds a new element with a specified key and value.
|
|
27
27
|
* @param key Must be an object or symbol.
|
|
28
28
|
*/
|
|
29
29
|
set(key, value) {
|
|
30
|
-
return super.set(
|
|
31
|
-
isProxy(key) ? toRaw(key) : key,
|
|
32
|
-
isProxy(value) ? toRaw(value) : value
|
|
33
|
-
);
|
|
30
|
+
return super.set(toRaw(key), toRaw(value));
|
|
34
31
|
}
|
|
35
32
|
}
|
|
36
33
|
class toRawWeakSet extends WeakSet {
|
|
@@ -42,20 +39,20 @@ class toRawWeakSet extends WeakSet {
|
|
|
42
39
|
* @returns true if the element was successfully removed, or false if it was not present.
|
|
43
40
|
*/
|
|
44
41
|
delete(value) {
|
|
45
|
-
return super.delete(
|
|
42
|
+
return super.delete(toRaw(value));
|
|
46
43
|
}
|
|
47
44
|
/**
|
|
48
45
|
* @returns a boolean indicating whether an element with the specified value exists or not.
|
|
49
46
|
*/
|
|
50
47
|
has(value) {
|
|
51
|
-
return super.has(
|
|
48
|
+
return super.has(toRaw(value));
|
|
52
49
|
}
|
|
53
50
|
/**
|
|
54
51
|
* Adds a new element with a specified value.
|
|
55
52
|
* @param value Must be an object or symbol.
|
|
56
53
|
*/
|
|
57
54
|
add(value) {
|
|
58
|
-
return super.add(
|
|
55
|
+
return super.add(toRaw(value));
|
|
59
56
|
}
|
|
60
57
|
}
|
|
61
58
|
const DIRTY_PATHS = new toRawWeakMap();
|
|
@@ -774,10 +771,10 @@ function isFunction(value) {
|
|
|
774
771
|
return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
|
|
775
772
|
}
|
|
776
773
|
var coreJsData = root["__core-js_shared__"];
|
|
777
|
-
var maskSrcKey = function() {
|
|
774
|
+
var maskSrcKey = (function() {
|
|
778
775
|
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
|
|
779
776
|
return uid ? "Symbol(src)_1." + uid : "";
|
|
780
|
-
}();
|
|
777
|
+
})();
|
|
781
778
|
function isMasked(func) {
|
|
782
779
|
return !!maskSrcKey && maskSrcKey in func;
|
|
783
780
|
}
|
|
@@ -820,7 +817,7 @@ function getNative(object, key) {
|
|
|
820
817
|
}
|
|
821
818
|
var WeakMap$1 = getNative(root, "WeakMap");
|
|
822
819
|
var objectCreate = Object.create;
|
|
823
|
-
var baseCreate = /* @__PURE__ */ function() {
|
|
820
|
+
var baseCreate = /* @__PURE__ */ (function() {
|
|
824
821
|
function object() {
|
|
825
822
|
}
|
|
826
823
|
return function(proto) {
|
|
@@ -835,15 +832,15 @@ var baseCreate = /* @__PURE__ */ function() {
|
|
|
835
832
|
object.prototype = void 0;
|
|
836
833
|
return result;
|
|
837
834
|
};
|
|
838
|
-
}();
|
|
839
|
-
var defineProperty = function() {
|
|
835
|
+
})();
|
|
836
|
+
var defineProperty = (function() {
|
|
840
837
|
try {
|
|
841
838
|
var func = getNative(Object, "defineProperty");
|
|
842
839
|
func({}, "", {});
|
|
843
840
|
return func;
|
|
844
841
|
} catch (e) {
|
|
845
842
|
}
|
|
846
|
-
}();
|
|
843
|
+
})();
|
|
847
844
|
function arrayEach(array, iteratee) {
|
|
848
845
|
var index = -1, length = array == null ? 0 : array.length;
|
|
849
846
|
while (++index < length) {
|
|
@@ -909,9 +906,9 @@ function baseIsArguments(value) {
|
|
|
909
906
|
var objectProto$6 = Object.prototype;
|
|
910
907
|
var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
|
|
911
908
|
var propertyIsEnumerable$1 = objectProto$6.propertyIsEnumerable;
|
|
912
|
-
var isArguments = baseIsArguments(/* @__PURE__ */ function() {
|
|
909
|
+
var isArguments = baseIsArguments(/* @__PURE__ */ (function() {
|
|
913
910
|
return arguments;
|
|
914
|
-
}()) ? baseIsArguments : function(value) {
|
|
911
|
+
})()) ? baseIsArguments : function(value) {
|
|
915
912
|
return isObjectLike(value) && hasOwnProperty$5.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
|
|
916
913
|
};
|
|
917
914
|
function stubFalse() {
|
|
@@ -940,7 +937,7 @@ var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType &
|
|
|
940
937
|
var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
|
|
941
938
|
var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
|
|
942
939
|
var freeProcess = moduleExports$1 && freeGlobal.process;
|
|
943
|
-
var nodeUtil = function() {
|
|
940
|
+
var nodeUtil = (function() {
|
|
944
941
|
try {
|
|
945
942
|
var types = freeModule$1 && freeModule$1.require && freeModule$1.require("util").types;
|
|
946
943
|
if (types) {
|
|
@@ -949,7 +946,7 @@ var nodeUtil = function() {
|
|
|
949
946
|
return freeProcess && freeProcess.binding && freeProcess.binding("util");
|
|
950
947
|
} catch (e) {
|
|
951
948
|
}
|
|
952
|
-
}();
|
|
949
|
+
})();
|
|
953
950
|
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
|
954
951
|
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
|
955
952
|
var objectProto$5 = Object.prototype;
|
package/dist/core.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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-
|
|
2
|
-
import { E as E2, a as a10, I as I2, N as N2, O as O2, P as P2, b as b2, R as R2, S as S2, T as T2, c as c2, i as i2, d as d2 } from "./batch-dirty-paths-
|
|
3
|
-
import { L as L2, S as S3 } from "./location-
|
|
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-CRaAMfCG.js";
|
|
2
|
+
import { E as E2, a as a10, I as I2, N as N2, O as O2, P as P2, b as b2, R as R2, S as S2, T as T2, c as c2, i as i2, d as d2 } from "./batch-dirty-paths-BzU_eHbr.js";
|
|
3
|
+
import { L as L2, S as S3 } from "./location-Cd7btYEI.js";
|
|
4
4
|
export {
|
|
5
5
|
E2 as Editor,
|
|
6
6
|
a10 as Element,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { P as Path, b as Point, R as Range, E as Editor, D as DIRTY_PATHS, e as DIRTY_PATH_KEYS, f as isBatchingDirtyPaths, c as Transforms, F as FLUSHING, T as Text, N as Node, a as Element, g as NORMALIZING, h as PATH_REFS, j as POINT_REFS, k as RANGE_REFS, l as cloneDeep, m as getDefaultInsertLocation, S as Scrubber, n as batchDirtyPaths, I as IS_EDITOR_SET } from "./batch-dirty-paths-
|
|
1
|
+
import { P as Path, b as Point, R as Range, E as Editor, D as DIRTY_PATHS, e as DIRTY_PATH_KEYS, f as isBatchingDirtyPaths, c as Transforms, F as FLUSHING, T as Text, N as Node, a as Element, g as NORMALIZING, h as PATH_REFS, j as POINT_REFS, k as RANGE_REFS, l as cloneDeep, m as getDefaultInsertLocation, S as Scrubber, n as batchDirtyPaths, I as IS_EDITOR_SET } from "./batch-dirty-paths-BzU_eHbr.js";
|
|
2
2
|
import { reactive } from "vue";
|
|
3
|
-
import { S as Span } from "./location-
|
|
3
|
+
import { S as Span } from "./location-Cd7btYEI.js";
|
|
4
4
|
const PathRef = {
|
|
5
5
|
transform(ref, op) {
|
|
6
6
|
const { current, affinity } = ref;
|
package/dist/dom.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as DOMEditor, r as reconcileChildren, E as EDITOR_TO_KEY_TO_ELEMENT, a as EDITOR_TO_USER_MARKS, b as EDITOR_TO_USER_SELECTION, N as NODE_TO_KEY, i as isDOMText, g as getPlainText, c as getSlateFragmentAttribute, d as EDITOR_TO_ON_CHANGE } from "./hotkeys-
|
|
2
|
-
import { C, G, J, L, H, F, I, v, M, w, x, O, y, P, A, z, B, K, Q, R, S, T, e, f, h, j, k, l, m, o, p, q, s, t, u, n } from "./hotkeys-
|
|
3
|
-
import { E as Editor, R as Range, a as Element, c as Transforms, N as Node, P as Path } from "./batch-dirty-paths-
|
|
1
|
+
import { D as DOMEditor, r as reconcileChildren, E as EDITOR_TO_KEY_TO_ELEMENT, a as EDITOR_TO_USER_MARKS, b as EDITOR_TO_USER_SELECTION, N as NODE_TO_KEY, i as isDOMText, g as getPlainText, c as getSlateFragmentAttribute, d as EDITOR_TO_ON_CHANGE } from "./hotkeys-DZktq_-0.js";
|
|
2
|
+
import { C, G, J, L, H, F, I, v, M, w, x, O, y, P, A, z, B, K, Q, R, S, T, e, f, h, j, k, l, m, o, p, q, s, t, u, n } from "./hotkeys-DZktq_-0.js";
|
|
3
|
+
import { E as Editor, R as Range, a as Element, c as Transforms, N as Node, P as Path } from "./batch-dirty-paths-BzU_eHbr.js";
|
|
4
4
|
import { reactive } from "vue";
|
|
5
5
|
const doRectsIntersect = (rect, compareRect) => {
|
|
6
6
|
const middle = (compareRect.top + compareRect.bottom) / 2;
|
package/dist/history.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as isObject, O as Operation, t as toRawWeakMap, E as Editor, c as Transforms, P as Path } from "./batch-dirty-paths-
|
|
1
|
+
import { d as isObject, O as Operation, t as toRawWeakMap, E as Editor, c as Transforms, P as Path } from "./batch-dirty-paths-BzU_eHbr.js";
|
|
2
2
|
import "vue";
|
|
3
3
|
const History = {
|
|
4
4
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as Scrubber, t as toRawWeakMap, R as Range, E as Editor, a as Element, c as Transforms, P as Path } from "./batch-dirty-paths-
|
|
2
|
-
import { markRaw } from "vue";
|
|
1
|
+
import { S as Scrubber, t as toRawWeakMap, R as Range, E as Editor, a as Element, c as Transforms, P as Path } from "./batch-dirty-paths-BzU_eHbr.js";
|
|
2
|
+
import { markRaw, toRaw } from "vue";
|
|
3
3
|
const getDefaultView = (value) => {
|
|
4
4
|
return value && value.ownerDocument && value.ownerDocument.defaultView || null;
|
|
5
5
|
};
|
|
@@ -79,7 +79,7 @@ const getEditableChildAndIndex = (parent, index, direction) => {
|
|
|
79
79
|
i += direction === "forward" ? 1 : -1;
|
|
80
80
|
}
|
|
81
81
|
while (child.nodeType === 3 && child.textContent === "") {
|
|
82
|
-
index
|
|
82
|
+
index += direction === "forward" ? 1 : -1;
|
|
83
83
|
child = childNodes[index];
|
|
84
84
|
}
|
|
85
85
|
if (!child) {
|
|
@@ -1144,7 +1144,7 @@ class ChildrenHelper {
|
|
|
1144
1144
|
pointerIndex;
|
|
1145
1145
|
constructor(editor, children) {
|
|
1146
1146
|
this.editor = editor;
|
|
1147
|
-
this.children = children;
|
|
1147
|
+
this.children = toRaw(children);
|
|
1148
1148
|
this.cachedKeys = markRaw(new Array(children.length));
|
|
1149
1149
|
this.pointerIndex = 0;
|
|
1150
1150
|
}
|
|
@@ -1193,7 +1193,7 @@ class ChildrenHelper {
|
|
|
1193
1193
|
* by one and compare it to the known key.
|
|
1194
1194
|
*/
|
|
1195
1195
|
lookAhead(node, key) {
|
|
1196
|
-
const elementResult = this.children.indexOf(node, this.pointerIndex);
|
|
1196
|
+
const elementResult = this.children.indexOf(toRaw(node), this.pointerIndex);
|
|
1197
1197
|
if (elementResult > -1) return elementResult - this.pointerIndex;
|
|
1198
1198
|
for (let i = this.pointerIndex; i < this.children.length; i++) {
|
|
1199
1199
|
const candidateNode = this.children[i];
|
package/dist/hyperscript.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as toRawWeakMap, R as Range, N as Node, T as Text, a as Element, d as isObject } from "./batch-dirty-paths-
|
|
2
|
-
import { c as createEditor$1 } from "./create-editor-
|
|
1
|
+
import { t as toRawWeakMap, R as Range, N as Node, T as Text, a as Element, d as isObject } from "./batch-dirty-paths-BzU_eHbr.js";
|
|
2
|
+
import { c as createEditor$1 } from "./create-editor-CRaAMfCG.js";
|
|
3
3
|
import "vue";
|
|
4
4
|
const ANCHOR = new toRawWeakMap();
|
|
5
5
|
const FOCUS = new toRawWeakMap();
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { S as SLATE_USE_ELEMENT, u as useEditor, a as SLATE_USE_SELECTION } from "./use-focused-
|
|
2
|
-
import { g, D, c, e, f, d, E, b, h, i, j } from "./use-focused-
|
|
3
|
-
import { E as Editor, R as Range } from "./batch-dirty-paths-
|
|
4
|
-
import { t } from "./batch-dirty-paths-
|
|
1
|
+
import { S as SLATE_USE_ELEMENT, u as useEditor, a as SLATE_USE_SELECTION } from "./use-focused-Qxq4kR2I.js";
|
|
2
|
+
import { g, D, c, e, f, d, E, b, h, i, j } from "./use-focused-Qxq4kR2I.js";
|
|
3
|
+
import { E as Editor, R as Range } from "./batch-dirty-paths-BzU_eHbr.js";
|
|
4
|
+
import { t } from "./batch-dirty-paths-BzU_eHbr.js";
|
|
5
5
|
import { inject, computed } from "vue";
|
|
6
|
-
import { D as DOMEditor } from "./hotkeys-
|
|
6
|
+
import { D as DOMEditor } from "./hotkeys-DZktq_-0.js";
|
|
7
7
|
const useElement = () => {
|
|
8
8
|
const element = inject(SLATE_USE_ELEMENT);
|
|
9
9
|
if (element === void 0) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Text, Element, LeafPosition, Editor } from '../../slate/index.ts';
|
|
2
|
-
import { HTMLAttributes, VNode,
|
|
2
|
+
import { HTMLAttributes, VNode, VNodeChild, VNodeProps, VNodeRef } from 'vue';
|
|
3
3
|
/**
|
|
4
4
|
* `RenderChunkProps` are passed to the `renderChunk` handler
|
|
5
5
|
*/
|
|
@@ -25,7 +25,7 @@ export interface RenderPlaceholderProps {
|
|
|
25
25
|
* `RenderLeafProps` are passed to the `renderLeaf` handler.
|
|
26
26
|
*/
|
|
27
27
|
export interface RenderLeafProps {
|
|
28
|
-
children:
|
|
28
|
+
children: VNodeChild[] | VNode;
|
|
29
29
|
/**
|
|
30
30
|
* The leaf node with any applied decorations.
|
|
31
31
|
* If no decorations are applied, it will be identical to the `text` property.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { h, defineComponent, provide, ref, computed, onMounted, onUnmounted, renderSlot, inject, watch, renderList, onUpdated, reactive, useAttrs, toRaw } from "vue";
|
|
2
|
-
import { R as Range, N as Node, S as Scrubber, T as Text, P as Path, E as Editor, a as Element, c as Transforms } from "./batch-dirty-paths-
|
|
3
|
-
import { I as IS_ANDROID, p as isDOMNode, D as DOMEditor, Q as MARK_PLACEHOLDER_SYMBOL, d as EDITOR_TO_ON_CHANGE, w as IS_FIREFOX, z as IS_WEBKIT, E as EDITOR_TO_KEY_TO_ELEMENT, L as ELEMENT_TO_NODE, R as NODE_TO_ELEMENT, S as NODE_TO_INDEX, T as NODE_TO_PARENT, r as reconcileChildren, e as applyStringDiff, q as isDOMSelection, n as normalizeStringDiff, P as IS_READ_ONLY, h as getDefaultView, J as EDITOR_TO_WINDOW, G as EDITOR_TO_ELEMENT, H as HAS_BEFORE_INPUT_SUPPORT, C as CAN_USE_DOM, f as getActiveElement, j as getSelection, O as IS_FOCUSED, s as isPlainTextOnlyPaste, M as IS_COMPOSING, F as Hotkeys, v as IS_CHROME, x as IS_FIREFOX_LEGACY, y as IS_IOS, B as IS_WECHATBROWSER, A as IS_UC_MOBILE, a as EDITOR_TO_USER_MARKS, o as isDOMElement, b as EDITOR_TO_USER_SELECTION } from "./hotkeys-
|
|
2
|
+
import { R as Range, N as Node, S as Scrubber, T as Text, P as Path, E as Editor, a as Element, c as Transforms } from "./batch-dirty-paths-BzU_eHbr.js";
|
|
3
|
+
import { I as IS_ANDROID, p as isDOMNode, D as DOMEditor, Q as MARK_PLACEHOLDER_SYMBOL, d as EDITOR_TO_ON_CHANGE, w as IS_FIREFOX, z as IS_WEBKIT, E as EDITOR_TO_KEY_TO_ELEMENT, L as ELEMENT_TO_NODE, R as NODE_TO_ELEMENT, S as NODE_TO_INDEX, T as NODE_TO_PARENT, r as reconcileChildren, e as applyStringDiff, q as isDOMSelection, n as normalizeStringDiff, P as IS_READ_ONLY, h as getDefaultView, J as EDITOR_TO_WINDOW, G as EDITOR_TO_ELEMENT, H as HAS_BEFORE_INPUT_SUPPORT, C as CAN_USE_DOM, f as getActiveElement, j as getSelection, O as IS_FOCUSED, s as isPlainTextOnlyPaste, M as IS_COMPOSING, F as Hotkeys, v as IS_CHROME, x as IS_FIREFOX_LEGACY, y as IS_IOS, B as IS_WECHATBROWSER, A as IS_UC_MOBILE, a as EDITOR_TO_USER_MARKS, o as isDOMElement, b as EDITOR_TO_USER_SELECTION } from "./hotkeys-DZktq_-0.js";
|
|
4
4
|
const SLATE_USE_EDITOR = Symbol("SLATE_USE_EDITOR");
|
|
5
5
|
const SLATE_USE_ELEMENT = Symbol("SLATE_USE_ELEMENT");
|
|
6
6
|
const SLATE_USE_FOCUSED = Symbol("SLATE_USE_FOCUSED");
|
|
@@ -514,7 +514,7 @@ const TextComp = defineComponent({
|
|
|
514
514
|
setup(props) {
|
|
515
515
|
const { text, element } = props;
|
|
516
516
|
const editor = useEditor();
|
|
517
|
-
const
|
|
517
|
+
const textRef = ref();
|
|
518
518
|
const decorate = useDecorate();
|
|
519
519
|
const markPlaceholder = useMarkPlaceholder();
|
|
520
520
|
const leaves = computed(() => {
|
|
@@ -537,17 +537,17 @@ const TextComp = defineComponent({
|
|
|
537
537
|
});
|
|
538
538
|
onMounted(() => {
|
|
539
539
|
const key = DOMEditor.findKey(editor, text);
|
|
540
|
-
if (
|
|
540
|
+
if (textRef.value) {
|
|
541
541
|
const KEY_TO_ELEMENT = EDITOR_TO_KEY_TO_ELEMENT.get(editor);
|
|
542
|
-
KEY_TO_ELEMENT?.set(key,
|
|
543
|
-
ELEMENT_TO_NODE.set(
|
|
544
|
-
NODE_TO_ELEMENT.set(text,
|
|
542
|
+
KEY_TO_ELEMENT?.set(key, textRef.value);
|
|
543
|
+
ELEMENT_TO_NODE.set(textRef.value, text);
|
|
544
|
+
NODE_TO_ELEMENT.set(text, textRef.value);
|
|
545
545
|
}
|
|
546
546
|
});
|
|
547
547
|
onUnmounted(() => {
|
|
548
548
|
NODE_TO_ELEMENT.delete(text);
|
|
549
|
-
if (
|
|
550
|
-
ELEMENT_TO_NODE.delete(
|
|
549
|
+
if (textRef.value) {
|
|
550
|
+
ELEMENT_TO_NODE.delete(textRef.value);
|
|
551
551
|
}
|
|
552
552
|
});
|
|
553
553
|
const isLastText = computed(() => {
|
|
@@ -570,7 +570,7 @@ const TextComp = defineComponent({
|
|
|
570
570
|
const showPlaceholder = usePlaceholderShow();
|
|
571
571
|
return () => renderText({
|
|
572
572
|
text,
|
|
573
|
-
attributes: { "data-slate-node": "text", ref:
|
|
573
|
+
attributes: { "data-slate-node": "text", ref: textRef },
|
|
574
574
|
children: renderList(
|
|
575
575
|
leaves.value,
|
|
576
576
|
(leaf, i) => renderLeaf({
|
|
@@ -578,16 +578,22 @@ const TextComp = defineComponent({
|
|
|
578
578
|
leaf: leaf.leaf,
|
|
579
579
|
leafPosition: leaf.position,
|
|
580
580
|
attributes: { "data-slate-leaf": true },
|
|
581
|
-
children: [
|
|
581
|
+
children: showPlaceholder.value ? [
|
|
582
582
|
h(StringComp, {
|
|
583
583
|
text,
|
|
584
584
|
element,
|
|
585
585
|
leaf: leaf.leaf,
|
|
586
|
-
isLast:
|
|
587
|
-
key:
|
|
586
|
+
isLast: true,
|
|
587
|
+
key: DOMEditor.findKey(editor, leaf.leaf).id
|
|
588
588
|
}),
|
|
589
|
-
|
|
590
|
-
]
|
|
589
|
+
h(PlaceholderComp)
|
|
590
|
+
] : h(StringComp, {
|
|
591
|
+
text,
|
|
592
|
+
element,
|
|
593
|
+
leaf: leaf.leaf,
|
|
594
|
+
isLast: isLastText.value && i === leaves.value.length - 1,
|
|
595
|
+
key: DOMEditor.findKey(editor, leaf.leaf).id
|
|
596
|
+
})
|
|
591
597
|
})
|
|
592
598
|
)
|
|
593
599
|
});
|
|
@@ -723,23 +729,9 @@ const ChildrenComp = defineComponent({
|
|
|
723
729
|
setup(props) {
|
|
724
730
|
const editor = useEditor();
|
|
725
731
|
const element = props.element;
|
|
726
|
-
const isBlock =
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
NODE_TO_PARENT.set(n2, element);
|
|
730
|
-
const key = DOMEditor.findKey(editor, n2);
|
|
731
|
-
return Text.isText(n2) ? h(TextComp, {
|
|
732
|
-
text: n2,
|
|
733
|
-
element,
|
|
734
|
-
key: key.id
|
|
735
|
-
}) : h(ElementComp, {
|
|
736
|
-
element: n2,
|
|
737
|
-
key: key.id
|
|
738
|
-
});
|
|
739
|
-
});
|
|
740
|
-
if (isBlock) {
|
|
741
|
-
return renderElementOrText;
|
|
742
|
-
}
|
|
732
|
+
const isBlock = computed(
|
|
733
|
+
() => !Editor.isEditor(element) && Element.isElement(element) && !editor.isInline(element)
|
|
734
|
+
);
|
|
743
735
|
const chunkSize = computed(
|
|
744
736
|
() => Editor.hasInlines(editor, element) ? null : editor.getChunkSize(element)
|
|
745
737
|
);
|
|
@@ -772,11 +764,23 @@ const ChildrenComp = defineComponent({
|
|
|
772
764
|
});
|
|
773
765
|
provide(SLATE_INNER_STATIC_CHUNK_ROOT, staticChunkTree);
|
|
774
766
|
return () => {
|
|
775
|
-
if (
|
|
776
|
-
return
|
|
767
|
+
if (chunkSize.value === null || isBlock.value) {
|
|
768
|
+
return renderList(element.children, (n2, i) => {
|
|
769
|
+
NODE_TO_INDEX.set(n2, i);
|
|
770
|
+
NODE_TO_PARENT.set(n2, element);
|
|
771
|
+
const key = DOMEditor.findKey(editor, n2);
|
|
772
|
+
return Text.isText(n2) ? h(TextComp, {
|
|
773
|
+
text: n2,
|
|
774
|
+
element,
|
|
775
|
+
key: key.id
|
|
776
|
+
}) : h(ElementComp, {
|
|
777
|
+
element: n2,
|
|
778
|
+
key: key.id
|
|
779
|
+
});
|
|
780
|
+
});
|
|
777
781
|
} else {
|
|
778
782
|
return h(ChunkComp, {
|
|
779
|
-
ancestor:
|
|
783
|
+
ancestor: chunkTree.value
|
|
780
784
|
});
|
|
781
785
|
}
|
|
782
786
|
};
|
package/dist/yjs.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { d as isObject, T as Text, N as Node, P as Path, E as Editor, t as toRawWeakMap, c as Transforms, R as Range } from "./batch-dirty-paths-
|
|
1
|
+
import { d as isObject, T as Text, N as Node, P as Path, E as Editor, t as toRawWeakMap, c as Transforms, R as Range } from "./batch-dirty-paths-BzU_eHbr.js";
|
|
2
2
|
import { toRaw, ref, onMounted, onUnmounted, watch, onUpdated, computed } from "vue";
|
|
3
3
|
import { XmlText, YTextEvent, createRelativePositionFromTypeIndex, createAbsolutePositionFromRelativePosition, createRelativePositionFromJSON, decodeRelativePosition, encodeRelativePosition, UndoManager, compareRelativePositions } from "yjs";
|
|
4
|
-
import { L as Location } from "./location-
|
|
5
|
-
import { u as useEditor, i as useFocused } from "./use-focused-
|
|
6
|
-
import { D as DOMEditor } from "./hotkeys-
|
|
4
|
+
import { L as Location } from "./location-Cd7btYEI.js";
|
|
5
|
+
import { u as useEditor, i as useFocused } from "./use-focused-Qxq4kR2I.js";
|
|
6
|
+
import { D as DOMEditor } from "./hotkeys-DZktq_-0.js";
|
|
7
7
|
function deepEquals(node, another) {
|
|
8
8
|
for (const key in node) {
|
|
9
9
|
const a = node[key];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "slate-vue3",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -68,27 +68,27 @@
|
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@faker-js/faker": "^10.0.0",
|
|
71
|
-
"@liveblocks/client": "^3.
|
|
72
|
-
"@liveblocks/yjs": "^3.
|
|
71
|
+
"@liveblocks/client": "^3.7.1",
|
|
72
|
+
"@liveblocks/yjs": "^3.7.1",
|
|
73
73
|
"@playwright/test": "^1.55.0",
|
|
74
74
|
"@testing-library/vue": "^8.1.0",
|
|
75
75
|
"@types/is-hotkey": "^0.1.10",
|
|
76
76
|
"@types/is-url": "^1.2.32",
|
|
77
77
|
"@types/lodash-es": "^4.17.12",
|
|
78
|
-
"@types/node": "^24.
|
|
78
|
+
"@types/node": "^24.5.2",
|
|
79
79
|
"@types/prismjs": "^1.26.5",
|
|
80
80
|
"@vitejs/plugin-vue": "^6.0.1",
|
|
81
81
|
"babel-plugin-transform-regex": "^6.0.1",
|
|
82
82
|
"image-extensions": "^1.1.0",
|
|
83
83
|
"is-url": "^1.2.4",
|
|
84
|
-
"jsdom": "^
|
|
84
|
+
"jsdom": "^27.0.0",
|
|
85
85
|
"prismjs": "^1.30.0",
|
|
86
86
|
"remark-gfm": "^4.0.1",
|
|
87
87
|
"remark-parse": "^11.0.0",
|
|
88
88
|
"remark-slate-transformer": "^0.9.0",
|
|
89
89
|
"typescript": "~5.9.2",
|
|
90
90
|
"unified": "^11.0.5",
|
|
91
|
-
"vite": "^7.1.
|
|
91
|
+
"vite": "^7.1.6",
|
|
92
92
|
"vite-plugin-babel": "^1.3.2",
|
|
93
93
|
"vite-plugin-dts": "^4.5.4",
|
|
94
94
|
"vitest": "^3.2.4",
|