slate 0.76.1 → 0.77.0-202231217352
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/index.es.js +76 -68
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +90 -83
- package/dist/index.js.map +1 -1
- package/dist/slate.js +90 -83
- package/dist/slate.min.js +1 -1
- package/dist/transforms/node.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -4893,92 +4893,98 @@ var NodeTransforms = {
|
|
|
4893
4893
|
var beforeRef = Editor.pointRef(editor, at, {
|
|
4894
4894
|
affinity: 'backward'
|
|
4895
4895
|
});
|
|
4896
|
-
var
|
|
4897
|
-
at,
|
|
4898
|
-
match,
|
|
4899
|
-
mode,
|
|
4900
|
-
voids
|
|
4901
|
-
});
|
|
4896
|
+
var afterRef;
|
|
4902
4897
|
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4898
|
+
try {
|
|
4899
|
+
var [highest] = Editor.nodes(editor, {
|
|
4900
|
+
at,
|
|
4901
|
+
match,
|
|
4902
|
+
mode,
|
|
4903
|
+
voids
|
|
4904
|
+
});
|
|
4906
4905
|
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4906
|
+
if (!highest) {
|
|
4907
|
+
return;
|
|
4908
|
+
}
|
|
4909
|
+
|
|
4910
|
+
var voidMatch = Editor.void(editor, {
|
|
4911
|
+
at,
|
|
4912
|
+
mode: 'highest'
|
|
4913
|
+
});
|
|
4914
|
+
var nudge = 0;
|
|
4912
4915
|
|
|
4913
|
-
|
|
4914
|
-
|
|
4916
|
+
if (!voids && voidMatch) {
|
|
4917
|
+
var [voidNode, voidPath] = voidMatch;
|
|
4915
4918
|
|
|
4916
|
-
|
|
4917
|
-
|
|
4919
|
+
if (Element.isElement(voidNode) && editor.isInline(voidNode)) {
|
|
4920
|
+
var after = Editor.after(editor, voidPath);
|
|
4918
4921
|
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4922
|
+
if (!after) {
|
|
4923
|
+
var text = {
|
|
4924
|
+
text: ''
|
|
4925
|
+
};
|
|
4926
|
+
var afterPath = Path.next(voidPath);
|
|
4927
|
+
Transforms.insertNodes(editor, text, {
|
|
4928
|
+
at: afterPath,
|
|
4929
|
+
voids
|
|
4930
|
+
});
|
|
4931
|
+
after = Editor.point(editor, afterPath);
|
|
4932
|
+
}
|
|
4933
|
+
|
|
4934
|
+
at = after;
|
|
4935
|
+
always = true;
|
|
4929
4936
|
}
|
|
4930
4937
|
|
|
4931
|
-
|
|
4938
|
+
var siblingHeight = at.path.length - voidPath.length;
|
|
4939
|
+
height = siblingHeight + 1;
|
|
4932
4940
|
always = true;
|
|
4933
4941
|
}
|
|
4934
4942
|
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
var afterRef = Editor.pointRef(editor, at);
|
|
4941
|
-
var depth = at.path.length - height;
|
|
4942
|
-
var [, highestPath] = highest;
|
|
4943
|
-
var lowestPath = at.path.slice(0, depth);
|
|
4944
|
-
var position = height === 0 ? at.offset : at.path[depth] + nudge;
|
|
4943
|
+
afterRef = Editor.pointRef(editor, at);
|
|
4944
|
+
var depth = at.path.length - height;
|
|
4945
|
+
var [, highestPath] = highest;
|
|
4946
|
+
var lowestPath = at.path.slice(0, depth);
|
|
4947
|
+
var position = height === 0 ? at.offset : at.path[depth] + nudge;
|
|
4945
4948
|
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4949
|
+
for (var [node, _path2] of Editor.levels(editor, {
|
|
4950
|
+
at: lowestPath,
|
|
4951
|
+
reverse: true,
|
|
4952
|
+
voids
|
|
4953
|
+
})) {
|
|
4954
|
+
var split = false;
|
|
4952
4955
|
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
+
if (_path2.length < highestPath.length || _path2.length === 0 || !voids && Editor.isVoid(editor, node)) {
|
|
4957
|
+
break;
|
|
4958
|
+
}
|
|
4956
4959
|
|
|
4957
|
-
|
|
4958
|
-
|
|
4960
|
+
var _point = beforeRef.current;
|
|
4961
|
+
var isEnd = Editor.isEnd(editor, _point, _path2);
|
|
4962
|
+
|
|
4963
|
+
if (always || !beforeRef || !Editor.isEdge(editor, _point, _path2)) {
|
|
4964
|
+
split = true;
|
|
4965
|
+
var properties = Node.extractProps(node);
|
|
4966
|
+
editor.apply({
|
|
4967
|
+
type: 'split_node',
|
|
4968
|
+
path: _path2,
|
|
4969
|
+
position,
|
|
4970
|
+
properties
|
|
4971
|
+
});
|
|
4972
|
+
}
|
|
4959
4973
|
|
|
4960
|
-
|
|
4961
|
-
split = true;
|
|
4962
|
-
var properties = Node.extractProps(node);
|
|
4963
|
-
editor.apply({
|
|
4964
|
-
type: 'split_node',
|
|
4965
|
-
path: _path2,
|
|
4966
|
-
position,
|
|
4967
|
-
properties
|
|
4968
|
-
});
|
|
4974
|
+
position = _path2[_path2.length - 1] + (split || isEnd ? 1 : 0);
|
|
4969
4975
|
}
|
|
4970
4976
|
|
|
4971
|
-
|
|
4972
|
-
|
|
4977
|
+
if (options.at == null) {
|
|
4978
|
+
var _point2 = afterRef.current || Editor.end(editor, []);
|
|
4973
4979
|
|
|
4974
|
-
|
|
4975
|
-
|
|
4980
|
+
Transforms.select(editor, _point2);
|
|
4981
|
+
}
|
|
4982
|
+
} finally {
|
|
4983
|
+
var _afterRef;
|
|
4976
4984
|
|
|
4977
|
-
|
|
4985
|
+
beforeRef.unref();
|
|
4986
|
+
(_afterRef = afterRef) === null || _afterRef === void 0 ? void 0 : _afterRef.unref();
|
|
4978
4987
|
}
|
|
4979
|
-
|
|
4980
|
-
beforeRef.unref();
|
|
4981
|
-
afterRef.unref();
|
|
4982
4988
|
});
|
|
4983
4989
|
},
|
|
4984
4990
|
|
|
@@ -5619,7 +5625,9 @@ var TextTransforms = {
|
|
|
5619
5625
|
});
|
|
5620
5626
|
}
|
|
5621
5627
|
|
|
5622
|
-
var
|
|
5628
|
+
var startUnref = startRef.unref();
|
|
5629
|
+
var endUnref = endRef.unref();
|
|
5630
|
+
var point = reverse ? startUnref || endUnref : endUnref || startUnref;
|
|
5623
5631
|
|
|
5624
5632
|
if (options.at == null && point) {
|
|
5625
5633
|
Transforms.select(editor, point);
|