slate-vue3 0.4.0 → 0.4.2
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-1Ahs6kkr.js → batch-dirty-paths-DGoKWQz8.js} +31 -62
- package/dist/core.js +4 -3
- package/dist/{create-editor-UR4aFGAf.js → create-editor-BECAnoU4.js} +2 -2
- package/dist/dom.js +3 -3
- package/dist/history.js +2 -2
- package/dist/{hotkeys-BSLjSKb9.js → hotkeys-DdYAaAmE.js} +1 -1
- package/dist/hyperscript.js +3 -3
- package/dist/index.js +3 -3
- package/dist/{location-MosjNIh-.js → location-H02Ot2Mm.js} +1 -1
- package/dist/share-tools/index.d.ts +0 -1
- package/dist/slate/index.d.ts +1 -0
- package/dist/slate/interfaces/editor.d.ts +4 -1
- package/dist/slate/interfaces/element.d.ts +6 -3
- package/dist/slate/interfaces/node.d.ts +5 -2
- package/dist/slate/utils/index.d.ts +1 -0
- package/dist/slate/utils/is-object.d.ts +1 -0
- package/dist/slate-dom/custom-types.d.ts +1 -1
- package/dist/slate-vue/utils/interface.d.ts +4 -4
- package/dist/{use-focused-Br7Xa-S6.js → use-focused-De6S1bT0.js} +2 -6
- package/dist/yjs.js +5 -5
- package/package.json +15 -15
|
@@ -1,25 +1,4 @@
|
|
|
1
1
|
import { toRaw, isProxy } from "vue";
|
|
2
|
-
/*!
|
|
3
|
-
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
6
|
-
* Released under the MIT License.
|
|
7
|
-
*/
|
|
8
|
-
function isObject$1(o) {
|
|
9
|
-
return Object.prototype.toString.call(o) === "[object Object]";
|
|
10
|
-
}
|
|
11
|
-
function isPlainObject(o) {
|
|
12
|
-
var ctor, prot;
|
|
13
|
-
if (isObject$1(o) === false) return false;
|
|
14
|
-
ctor = o.constructor;
|
|
15
|
-
if (ctor === void 0) return true;
|
|
16
|
-
prot = ctor.prototype;
|
|
17
|
-
if (isObject$1(prot) === false) return false;
|
|
18
|
-
if (prot.hasOwnProperty("isPrototypeOf") === false) {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
return true;
|
|
22
|
-
}
|
|
23
2
|
class toRawWeakMap extends WeakMap {
|
|
24
3
|
constructor() {
|
|
25
4
|
super();
|
|
@@ -595,17 +574,18 @@ const SelectionTransforms = {
|
|
|
595
574
|
editor.setSelection(props);
|
|
596
575
|
}
|
|
597
576
|
};
|
|
577
|
+
const isObject$1 = (value) => typeof value === "object" && value !== null;
|
|
598
578
|
const isDeepEqual = (node, another) => {
|
|
599
579
|
for (const key in node) {
|
|
600
580
|
const a = node[key];
|
|
601
581
|
const b = another[key];
|
|
602
|
-
if (
|
|
603
|
-
if (!isDeepEqual(a, b)) return false;
|
|
604
|
-
} else if (Array.isArray(a) && Array.isArray(b)) {
|
|
582
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
605
583
|
if (a.length !== b.length) return false;
|
|
606
584
|
for (let i = 0; i < a.length; i++) {
|
|
607
585
|
if (a[i] !== b[i]) return false;
|
|
608
586
|
}
|
|
587
|
+
} else if (isObject$1(a) && isObject$1(b)) {
|
|
588
|
+
if (!isDeepEqual(a, b)) return false;
|
|
609
589
|
} else if (a !== b) {
|
|
610
590
|
return false;
|
|
611
591
|
}
|
|
@@ -685,7 +665,7 @@ const Range = {
|
|
|
685
665
|
return !Range.isBackward(range);
|
|
686
666
|
},
|
|
687
667
|
isRange(value) {
|
|
688
|
-
return
|
|
668
|
+
return isObject$1(value) && Point.isPoint(value.anchor) && Point.isPoint(value.focus);
|
|
689
669
|
},
|
|
690
670
|
*points(range) {
|
|
691
671
|
yield [range.anchor, "anchor"];
|
|
@@ -1419,16 +1399,20 @@ var CLONE_DEEP_FLAG = 1, CLONE_SYMBOLS_FLAG = 4;
|
|
|
1419
1399
|
function cloneDeep(value) {
|
|
1420
1400
|
return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
|
|
1421
1401
|
}
|
|
1422
|
-
const isElement = (value) => {
|
|
1423
|
-
|
|
1402
|
+
const isElement = (value, { deep = false } = {}) => {
|
|
1403
|
+
if (!isObject$1(value)) return false;
|
|
1404
|
+
const isEditor2 = typeof value.apply === "function";
|
|
1405
|
+
if (isEditor2) return false;
|
|
1406
|
+
const isChildrenValid = deep ? Node.isNodeList(value.children) : Array.isArray(value.children);
|
|
1407
|
+
return isChildrenValid;
|
|
1424
1408
|
};
|
|
1425
1409
|
const Element = {
|
|
1426
|
-
isAncestor(value) {
|
|
1427
|
-
return
|
|
1410
|
+
isAncestor(value, { deep = false } = {}) {
|
|
1411
|
+
return isObject$1(value) && Node.isNodeList(value.children, { deep });
|
|
1428
1412
|
},
|
|
1429
1413
|
isElement,
|
|
1430
|
-
isElementList(value) {
|
|
1431
|
-
return Array.isArray(value) && value.every((val) => Element.isElement(val));
|
|
1414
|
+
isElementList(value, { deep = false } = {}) {
|
|
1415
|
+
return Array.isArray(value) && value.every((val) => Element.isElement(val, { deep }));
|
|
1432
1416
|
},
|
|
1433
1417
|
isElementProps(props) {
|
|
1434
1418
|
return props.children !== void 0;
|
|
@@ -1448,7 +1432,6 @@ const Element = {
|
|
|
1448
1432
|
return true;
|
|
1449
1433
|
}
|
|
1450
1434
|
};
|
|
1451
|
-
const IS_NODE_LIST_CACHE = new toRawWeakMap();
|
|
1452
1435
|
const Node = {
|
|
1453
1436
|
ancestor(root2, path) {
|
|
1454
1437
|
const node = Node.get(root2, path);
|
|
@@ -1615,20 +1598,11 @@ const Node = {
|
|
|
1615
1598
|
}
|
|
1616
1599
|
return true;
|
|
1617
1600
|
},
|
|
1618
|
-
isNode(value) {
|
|
1619
|
-
return Text.isText(value) || Element.isElement(value) || Editor.isEditor(value);
|
|
1601
|
+
isNode(value, { deep = false } = {}) {
|
|
1602
|
+
return Text.isText(value) || Element.isElement(value, { deep }) || Editor.isEditor(value, { deep });
|
|
1620
1603
|
},
|
|
1621
|
-
isNodeList(value) {
|
|
1622
|
-
|
|
1623
|
-
return false;
|
|
1624
|
-
}
|
|
1625
|
-
const cachedResult = IS_NODE_LIST_CACHE.get(value);
|
|
1626
|
-
if (cachedResult !== void 0) {
|
|
1627
|
-
return cachedResult;
|
|
1628
|
-
}
|
|
1629
|
-
const isNodeList = value.every((val) => Node.isNode(val));
|
|
1630
|
-
IS_NODE_LIST_CACHE.set(value, isNodeList);
|
|
1631
|
-
return isNodeList;
|
|
1604
|
+
isNodeList(value, { deep = false } = {}) {
|
|
1605
|
+
return Array.isArray(value) && value.every((val) => Node.isNode(val, { deep }));
|
|
1632
1606
|
},
|
|
1633
1607
|
last(root2, path) {
|
|
1634
1608
|
const p = path.slice();
|
|
@@ -1739,7 +1713,7 @@ const Operation = {
|
|
|
1739
1713
|
return Operation.isOperation(value) && value.type.endsWith("_node");
|
|
1740
1714
|
},
|
|
1741
1715
|
isOperation(value) {
|
|
1742
|
-
if (!
|
|
1716
|
+
if (!isObject$1(value)) {
|
|
1743
1717
|
return false;
|
|
1744
1718
|
}
|
|
1745
1719
|
switch (value.type) {
|
|
@@ -1748,7 +1722,7 @@ const Operation = {
|
|
|
1748
1722
|
case "insert_text":
|
|
1749
1723
|
return typeof value.offset === "number" && typeof value.text === "string" && Path.isPath(value.path);
|
|
1750
1724
|
case "merge_node":
|
|
1751
|
-
return typeof value.position === "number" && Path.isPath(value.path) &&
|
|
1725
|
+
return typeof value.position === "number" && Path.isPath(value.path) && isObject$1(value.properties);
|
|
1752
1726
|
case "move_node":
|
|
1753
1727
|
return Path.isPath(value.path) && Path.isPath(value.newPath);
|
|
1754
1728
|
case "remove_node":
|
|
@@ -1756,11 +1730,11 @@ const Operation = {
|
|
|
1756
1730
|
case "remove_text":
|
|
1757
1731
|
return typeof value.offset === "number" && typeof value.text === "string" && Path.isPath(value.path);
|
|
1758
1732
|
case "set_node":
|
|
1759
|
-
return Path.isPath(value.path) &&
|
|
1733
|
+
return Path.isPath(value.path) && isObject$1(value.properties) && isObject$1(value.newProperties);
|
|
1760
1734
|
case "set_selection":
|
|
1761
|
-
return value.properties === null && Range.isRange(value.newProperties) || value.newProperties === null && Range.isRange(value.properties) ||
|
|
1735
|
+
return value.properties === null && Range.isRange(value.newProperties) || value.newProperties === null && Range.isRange(value.properties) || isObject$1(value.properties) && isObject$1(value.newProperties);
|
|
1762
1736
|
case "split_node":
|
|
1763
|
-
return Path.isPath(value.path) && typeof value.position === "number" &&
|
|
1737
|
+
return Path.isPath(value.path) && typeof value.position === "number" && isObject$1(value.properties);
|
|
1764
1738
|
default:
|
|
1765
1739
|
return false;
|
|
1766
1740
|
}
|
|
@@ -1831,17 +1805,12 @@ const Operation = {
|
|
|
1831
1805
|
}
|
|
1832
1806
|
}
|
|
1833
1807
|
};
|
|
1834
|
-
|
|
1835
|
-
const isEditor = (value) => {
|
|
1836
|
-
|
|
1837
|
-
if (cachedIsEditor !== void 0) {
|
|
1838
|
-
return cachedIsEditor;
|
|
1839
|
-
}
|
|
1840
|
-
if (!isPlainObject(value)) {
|
|
1808
|
+
new toRawWeakMap();
|
|
1809
|
+
const isEditor = (value, { deep = false } = {}) => {
|
|
1810
|
+
if (!isObject$1(value)) {
|
|
1841
1811
|
return false;
|
|
1842
1812
|
}
|
|
1843
|
-
const isEditor2 = typeof value.addMark === "function" && typeof value.apply === "function" && typeof value.deleteFragment === "function" && typeof value.insertBreak === "function" && typeof value.insertSoftBreak === "function" && typeof value.insertFragment === "function" && typeof value.insertNode === "function" && typeof value.insertText === "function" && typeof value.isElementReadOnly === "function" && typeof value.isInline === "function" && typeof value.isSelectable === "function" && typeof value.isVoid === "function" && typeof value.normalizeNode === "function" && typeof value.onChange === "function" && typeof value.removeMark === "function" && typeof value.getDirtyPaths === "function" && (value.marks === null ||
|
|
1844
|
-
IS_EDITOR_CACHE.set(value, isEditor2);
|
|
1813
|
+
const isEditor2 = typeof value.addMark === "function" && typeof value.apply === "function" && typeof value.deleteFragment === "function" && typeof value.insertBreak === "function" && typeof value.insertSoftBreak === "function" && typeof value.insertFragment === "function" && typeof value.insertNode === "function" && typeof value.insertText === "function" && typeof value.isElementReadOnly === "function" && typeof value.isInline === "function" && typeof value.isSelectable === "function" && typeof value.isVoid === "function" && typeof value.normalizeNode === "function" && typeof value.onChange === "function" && typeof value.removeMark === "function" && typeof value.getDirtyPaths === "function" && (value.marks === null || isObject$1(value.marks)) && (value.selection === null || Range.isRange(value.selection)) && (!deep || Node.isNodeList(value.children)) && Operation.isOperationList(value.operations);
|
|
1845
1814
|
return isEditor2;
|
|
1846
1815
|
};
|
|
1847
1816
|
const Editor = {
|
|
@@ -2048,7 +2017,7 @@ const Point = {
|
|
|
2048
2017
|
return point.offset === another.offset && Path.equals(point.path, another.path);
|
|
2049
2018
|
},
|
|
2050
2019
|
isPoint(value) {
|
|
2051
|
-
return
|
|
2020
|
+
return isObject$1(value) && typeof value.offset === "number" && Path.isPath(value.path);
|
|
2052
2021
|
},
|
|
2053
2022
|
transform(point, op, options = {}) {
|
|
2054
2023
|
let p = cloneDeep(point);
|
|
@@ -2131,7 +2100,7 @@ const Text = {
|
|
|
2131
2100
|
);
|
|
2132
2101
|
},
|
|
2133
2102
|
isText(value) {
|
|
2134
|
-
return
|
|
2103
|
+
return isObject$1(value) && typeof value.text === "string";
|
|
2135
2104
|
},
|
|
2136
2105
|
isTextList(value) {
|
|
2137
2106
|
return Array.isArray(value) && value.every((val) => Text.isText(val));
|
|
@@ -2297,7 +2266,7 @@ export {
|
|
|
2297
2266
|
Element as a,
|
|
2298
2267
|
Point as b,
|
|
2299
2268
|
Transforms as c,
|
|
2300
|
-
|
|
2269
|
+
isObject$1 as d,
|
|
2301
2270
|
DIRTY_PATH_KEYS as e,
|
|
2302
2271
|
isBatchingDirtyPaths as f,
|
|
2303
2272
|
NORMALIZING as g,
|
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, 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 } 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-BECAnoU4.js";
|
|
2
|
+
import { E as E2, a as a10, 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-DGoKWQz8.js";
|
|
3
|
+
import { L as L2, S as S3 } from "./location-H02Ot2Mm.js";
|
|
4
4
|
export {
|
|
5
5
|
E2 as Editor,
|
|
6
6
|
a10 as Element,
|
|
@@ -53,6 +53,7 @@ export {
|
|
|
53
53
|
D as isEmpty,
|
|
54
54
|
E as isEnd,
|
|
55
55
|
F as isNormalizing,
|
|
56
|
+
d2 as isObject,
|
|
56
57
|
G as isStart,
|
|
57
58
|
H as last,
|
|
58
59
|
I as leaf,
|
|
@@ -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 } 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 } from "./batch-dirty-paths-DGoKWQz8.js";
|
|
2
2
|
import { reactive } from "vue";
|
|
3
|
-
import { S as Span } from "./location-
|
|
3
|
+
import { S as Span } from "./location-H02Ot2Mm.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, 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, F, G, J, H, B, I, u, L, v, w, M, x, O, z, y, A, K, P, Q, R, S, e, f, h, j, k, l, m, o, p, q, r, s, t, n } from "./hotkeys-
|
|
3
|
-
import { E as Editor, R as Range, a as Element, c as Transforms, P as Path, N as Node } from "./batch-dirty-paths-
|
|
1
|
+
import { D as DOMEditor, 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-DdYAaAmE.js";
|
|
2
|
+
import { C, F, G, J, H, B, I, u, L, v, w, M, x, O, z, y, A, K, P, Q, R, S, e, f, h, j, k, l, m, o, p, q, r, s, t, n } from "./hotkeys-DdYAaAmE.js";
|
|
3
|
+
import { E as Editor, R as Range, a as Element, c as Transforms, P as Path, N as Node } from "./batch-dirty-paths-DGoKWQz8.js";
|
|
4
4
|
import "vue";
|
|
5
5
|
const doRectsIntersect = (rect, compareRect) => {
|
|
6
6
|
const middle = (compareRect.top + compareRect.bottom) / 2;
|
package/dist/history.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { d as
|
|
1
|
+
import { d as isObject, O as Operation, t as toRawWeakMap, E as Editor, c as Transforms, P as Path } from "./batch-dirty-paths-DGoKWQz8.js";
|
|
2
2
|
import "vue";
|
|
3
3
|
const History = {
|
|
4
4
|
/**
|
|
5
5
|
* Check if a value is a `History` object.
|
|
6
6
|
*/
|
|
7
7
|
isHistory(value) {
|
|
8
|
-
return
|
|
8
|
+
return isObject(value) && Array.isArray(value.redos) && Array.isArray(value.undos) && (value.redos.length === 0 || Operation.isOperationList(value.redos[0].operations)) && (value.undos.length === 0 || Operation.isOperationList(value.undos[0].operations));
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
11
|
const HISTORY = new toRawWeakMap();
|
|
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
var _a, _b;
|
|
5
|
-
import { t as toRawWeakMap, R as Range, E as Editor, S as Scrubber, a as Element, c as Transforms } from "./batch-dirty-paths-
|
|
5
|
+
import { t as toRawWeakMap, R as Range, E as Editor, S as Scrubber, a as Element, c as Transforms } from "./batch-dirty-paths-DGoKWQz8.js";
|
|
6
6
|
import "vue";
|
|
7
7
|
const getDefaultView = (value) => {
|
|
8
8
|
return value && value.ownerDocument && value.ownerDocument.defaultView || null;
|
package/dist/hyperscript.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { t as toRawWeakMap, R as Range, N as Node, T as Text, a as Element, d as
|
|
5
|
-
import { c as createEditor$1 } from "./create-editor-
|
|
4
|
+
import { t as toRawWeakMap, R as Range, N as Node, T as Text, a as Element, d as isObject } from "./batch-dirty-paths-DGoKWQz8.js";
|
|
5
|
+
import { c as createEditor$1 } from "./create-editor-BECAnoU4.js";
|
|
6
6
|
import "vue";
|
|
7
7
|
const ANCHOR = new toRawWeakMap();
|
|
8
8
|
const FOCUS = new toRawWeakMap();
|
|
@@ -217,7 +217,7 @@ const createFactory = (creators) => {
|
|
|
217
217
|
if (attributes == null) {
|
|
218
218
|
attributes = {};
|
|
219
219
|
}
|
|
220
|
-
if (!
|
|
220
|
+
if (!isObject(attributes)) {
|
|
221
221
|
children = [attributes].concat(children);
|
|
222
222
|
attributes = {};
|
|
223
223
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { S as SLATE_USE_SELECTED, a as SLATE_STATE_SELECTION } from "./use-focused-
|
|
2
|
-
import { g, D, c, e, f, d, E, b, u, j, h, i } from "./use-focused-
|
|
1
|
+
import { S as SLATE_USE_SELECTED, a as SLATE_STATE_SELECTION } from "./use-focused-De6S1bT0.js";
|
|
2
|
+
import { g, D, c, e, f, d, E, b, u, j, h, i } from "./use-focused-De6S1bT0.js";
|
|
3
3
|
import { inject } from "vue";
|
|
4
|
-
import { t } from "./batch-dirty-paths-
|
|
4
|
+
import { t } from "./batch-dirty-paths-DGoKWQz8.js";
|
|
5
5
|
const useSelected = () => {
|
|
6
6
|
const selected = inject(SLATE_USE_SELECTED);
|
|
7
7
|
if (selected === void 0) {
|
package/dist/slate/index.d.ts
CHANGED
|
@@ -145,6 +145,9 @@ export interface EditorElementReadOnlyOptions {
|
|
|
145
145
|
export interface EditorFragmentDeletionOptions {
|
|
146
146
|
direction?: TextDirection;
|
|
147
147
|
}
|
|
148
|
+
export interface EditorIsEditorOptions {
|
|
149
|
+
deep?: boolean;
|
|
150
|
+
}
|
|
148
151
|
export interface EditorLeafOptions {
|
|
149
152
|
depth?: number;
|
|
150
153
|
edge?: LeafEdge;
|
|
@@ -326,7 +329,7 @@ export interface EditorInterface {
|
|
|
326
329
|
/**
|
|
327
330
|
* Check if a value is an `Editor` object.
|
|
328
331
|
*/
|
|
329
|
-
isEditor: (value: any) => value is Editor;
|
|
332
|
+
isEditor: (value: any, options?: EditorIsEditorOptions) => value is Editor;
|
|
330
333
|
/**
|
|
331
334
|
* Check if a value is a read-only `Element` object.
|
|
332
335
|
*/
|
|
@@ -8,19 +8,22 @@ export interface BaseElement {
|
|
|
8
8
|
children: Descendant[];
|
|
9
9
|
}
|
|
10
10
|
export type Element = ExtendedType<'Element', BaseElement>;
|
|
11
|
+
export interface ElementIsElementOptions {
|
|
12
|
+
deep?: boolean;
|
|
13
|
+
}
|
|
11
14
|
export interface ElementInterface {
|
|
12
15
|
/**
|
|
13
16
|
* Check if a value implements the 'Ancestor' interface.
|
|
14
17
|
*/
|
|
15
|
-
isAncestor: (value: any) => value is Ancestor;
|
|
18
|
+
isAncestor: (value: any, options?: ElementIsElementOptions) => value is Ancestor;
|
|
16
19
|
/**
|
|
17
20
|
* Check if a value implements the `Element` interface.
|
|
18
21
|
*/
|
|
19
|
-
isElement: (value: any) => value is Element;
|
|
22
|
+
isElement: (value: any, options?: ElementIsElementOptions) => value is Element;
|
|
20
23
|
/**
|
|
21
24
|
* Check if a value is an array of `Element` objects.
|
|
22
25
|
*/
|
|
23
|
-
isElementList: (value: any) => value is Element[];
|
|
26
|
+
isElementList: (value: any, options?: ElementIsElementOptions) => value is Element[];
|
|
24
27
|
/**
|
|
25
28
|
* Check if a set of props is a partial of Element.
|
|
26
29
|
*/
|
|
@@ -24,6 +24,9 @@ export interface NodeElementsOptions {
|
|
|
24
24
|
reverse?: boolean;
|
|
25
25
|
pass?: (node: NodeEntry) => boolean;
|
|
26
26
|
}
|
|
27
|
+
export interface NodeIsNodeOptions {
|
|
28
|
+
deep?: boolean;
|
|
29
|
+
}
|
|
27
30
|
export interface NodeLevelsOptions {
|
|
28
31
|
reverse?: boolean;
|
|
29
32
|
}
|
|
@@ -105,11 +108,11 @@ export interface NodeInterface {
|
|
|
105
108
|
/**
|
|
106
109
|
* Check if a value implements the `Node` interface.
|
|
107
110
|
*/
|
|
108
|
-
isNode: (value: any) => value is Node;
|
|
111
|
+
isNode: (value: any, options?: NodeIsNodeOptions) => value is Node;
|
|
109
112
|
/**
|
|
110
113
|
* Check if a value is a list of `Node` objects.
|
|
111
114
|
*/
|
|
112
|
-
isNodeList: (value: any) => value is Node[];
|
|
115
|
+
isNodeList: (value: any, options?: NodeIsNodeOptions) => value is Node[];
|
|
113
116
|
/**
|
|
114
117
|
* Get the last node entry in a root node from a path.
|
|
115
118
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isObject: (value: any) => boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Text, Element, LeafPosition } from '../../slate/index.ts';
|
|
2
|
-
import { HTMLAttributes, VNode, VNodeProps } from 'vue';
|
|
2
|
+
import { HTMLAttributes, VNode, VNodeChild, VNodeProps, VNodeRef } from 'vue';
|
|
3
3
|
/**
|
|
4
4
|
* The props that get passed to renderPlaceholder
|
|
5
5
|
*/
|
|
@@ -40,7 +40,7 @@ export interface RenderElementProps {
|
|
|
40
40
|
"data-slate-inline"?: true;
|
|
41
41
|
"data-slate-void"?: true;
|
|
42
42
|
dir?: "rtl";
|
|
43
|
-
ref:
|
|
43
|
+
ref: VNodeRef;
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
@@ -48,9 +48,9 @@ export interface RenderElementProps {
|
|
|
48
48
|
*/
|
|
49
49
|
export interface RenderTextProps {
|
|
50
50
|
text: Text;
|
|
51
|
-
children:
|
|
51
|
+
children: VNodeChild[];
|
|
52
52
|
attributes: {
|
|
53
53
|
'data-slate-node': 'text';
|
|
54
|
-
ref:
|
|
54
|
+
ref: VNodeRef;
|
|
55
55
|
};
|
|
56
56
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { h, defineComponent, provide, ref, computed, onMounted, onUnmounted, renderSlot, inject, watch, renderList, Fragment, useAttrs, reactive, 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, P as MARK_PLACEHOLDER_SYMBOL, d as EDITOR_TO_ON_CHANGE, x as IS_IOS, E as EDITOR_TO_KEY_TO_ELEMENT, J as ELEMENT_TO_NODE, Q as NODE_TO_ELEMENT, R as NODE_TO_INDEX, S as NODE_TO_PARENT, y as IS_WEBKIT, e as applyStringDiff, q as isDOMSelection, n as normalizeStringDiff, O as IS_READ_ONLY, h as getDefaultView, G as EDITOR_TO_WINDOW, F as EDITOR_TO_ELEMENT, H as HAS_BEFORE_INPUT_SUPPORT, C as CAN_USE_DOM, f as getActiveElement, j as getSelection, M as IS_FOCUSED, r as isPlainTextOnlyPaste, L as IS_COMPOSING, B as Hotkeys, u as IS_CHROME, v as IS_FIREFOX, w as IS_FIREFOX_LEGACY, A as IS_WECHATBROWSER, z 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-DGoKWQz8.js";
|
|
3
|
+
import { I as IS_ANDROID, p as isDOMNode, D as DOMEditor, P as MARK_PLACEHOLDER_SYMBOL, d as EDITOR_TO_ON_CHANGE, x as IS_IOS, E as EDITOR_TO_KEY_TO_ELEMENT, J as ELEMENT_TO_NODE, Q as NODE_TO_ELEMENT, R as NODE_TO_INDEX, S as NODE_TO_PARENT, y as IS_WEBKIT, e as applyStringDiff, q as isDOMSelection, n as normalizeStringDiff, O as IS_READ_ONLY, h as getDefaultView, G as EDITOR_TO_WINDOW, F as EDITOR_TO_ELEMENT, H as HAS_BEFORE_INPUT_SUPPORT, C as CAN_USE_DOM, f as getActiveElement, j as getSelection, M as IS_FOCUSED, r as isPlainTextOnlyPaste, L as IS_COMPOSING, B as Hotkeys, u as IS_CHROME, v as IS_FIREFOX, w as IS_FIREFOX_LEGACY, A as IS_WECHATBROWSER, z as IS_UC_MOBILE, a as EDITOR_TO_USER_MARKS, o as isDOMElement, b as EDITOR_TO_USER_SELECTION } from "./hotkeys-DdYAaAmE.js";
|
|
4
4
|
const SLATE_USE_EDITOR = Symbol("SLATE_USE_EDITOR");
|
|
5
5
|
const SLATE_USE_DECORATE = Symbol("SLATE_USE_DECORATE");
|
|
6
6
|
const SLATE_USE_SELECTED = Symbol("SLATE_USE_SELECTED");
|
|
@@ -1114,10 +1114,6 @@ const Editable = defineComponent({
|
|
|
1114
1114
|
const deferredOperations = ref([]);
|
|
1115
1115
|
const onBeforeinput = (event) => {
|
|
1116
1116
|
var _a, _b, _c, _d, _e;
|
|
1117
|
-
const isInputEvent = event instanceof InputEvent;
|
|
1118
|
-
if (!isInputEvent) {
|
|
1119
|
-
return;
|
|
1120
|
-
}
|
|
1121
1117
|
if (HAS_BEFORE_INPUT_SUPPORT) {
|
|
1122
1118
|
handleNativeHistoryEvents(editor, event);
|
|
1123
1119
|
const el = DOMEditor.toDOMNode(editor, editor);
|
package/dist/yjs.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { d as
|
|
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-DGoKWQz8.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 { j as useEditor, h as useFocused } from "./use-focused-
|
|
6
|
-
import { D as DOMEditor } from "./hotkeys-
|
|
4
|
+
import { L as Location } from "./location-H02Ot2Mm.js";
|
|
5
|
+
import { j as useEditor, h as useFocused } from "./use-focused-De6S1bT0.js";
|
|
6
|
+
import { D as DOMEditor } from "./hotkeys-DdYAaAmE.js";
|
|
7
7
|
function deepEquals(node, another) {
|
|
8
8
|
for (const key in node) {
|
|
9
9
|
const a = node[key];
|
|
10
10
|
const b = another[key];
|
|
11
|
-
if (
|
|
11
|
+
if (isObject(a) && isObject(b)) {
|
|
12
12
|
if (!deepEquals(a, b)) {
|
|
13
13
|
return false;
|
|
14
14
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "slate-vue3",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -67,33 +67,33 @@
|
|
|
67
67
|
"vue": "^3.5.13"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@faker-js/faker": "^9.
|
|
71
|
-
"@liveblocks/client": "^2.
|
|
72
|
-
"@liveblocks/yjs": "^2.
|
|
73
|
-
"@playwright/test": "^1.
|
|
70
|
+
"@faker-js/faker": "^9.7.0",
|
|
71
|
+
"@liveblocks/client": "^2.24.1",
|
|
72
|
+
"@liveblocks/yjs": "^2.24.0",
|
|
73
|
+
"@playwright/test": "^1.52.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": "^22.
|
|
78
|
+
"@types/node": "^22.15.3",
|
|
79
79
|
"@types/prismjs": "^1.26.5",
|
|
80
|
-
"@vitejs/plugin-vue": "^5.2.
|
|
80
|
+
"@vitejs/plugin-vue": "^5.2.3",
|
|
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": "^26.
|
|
84
|
+
"jsdom": "^26.1.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
|
-
"typescript": "~5.8.
|
|
89
|
+
"typescript": "~5.8.3",
|
|
90
90
|
"unified": "^11.0.5",
|
|
91
|
-
"vite": "^6.3.
|
|
92
|
-
"vite-plugin-babel": "^1.3.
|
|
93
|
-
"vite-plugin-dts": "^4.5.
|
|
94
|
-
"vitest": "^3.
|
|
95
|
-
"vue-router": "^4.5.
|
|
96
|
-
"yjs": "^13.6.
|
|
91
|
+
"vite": "^6.3.4",
|
|
92
|
+
"vite-plugin-babel": "^1.3.1",
|
|
93
|
+
"vite-plugin-dts": "^4.5.3",
|
|
94
|
+
"vitest": "^3.1.2",
|
|
95
|
+
"vue-router": "^4.5.1",
|
|
96
|
+
"yjs": "^13.6.26"
|
|
97
97
|
},
|
|
98
98
|
"publishConfig": {
|
|
99
99
|
"registry": "https://registry.npmjs.org/"
|