slate 0.134.0 → 0.134.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/index.es.js +16 -5
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +14 -7
- package/dist/index.js.map +1 -1
- package/dist/slate.js +14 -7
- package/dist/slate.min.js +1 -1
- package/dist/utils/modify.d.ts +4 -3
- package/dist/utils/modify.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/slate.js
CHANGED
|
@@ -2714,17 +2714,24 @@
|
|
|
2714
2714
|
|
|
2715
2715
|
function ownKeys$b(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2716
2716
|
function _objectSpread$b(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$b(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$b(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2717
|
-
var insertChildren = function insertChildren(
|
|
2717
|
+
var insertChildren = function insertChildren(children, index) {
|
|
2718
2718
|
for (var _len = arguments.length, newValues = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
2719
2719
|
newValues[_key - 2] = arguments[_key];
|
|
2720
2720
|
}
|
|
2721
|
-
return
|
|
2721
|
+
return replaceChildren.apply(void 0, [children, index, 0].concat(newValues));
|
|
2722
2722
|
};
|
|
2723
|
-
var replaceChildren = function replaceChildren(
|
|
2723
|
+
var replaceChildren = function replaceChildren(children, index, removeCount) {
|
|
2724
|
+
var out = children.slice();
|
|
2724
2725
|
for (var _len2 = arguments.length, newValues = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
|
|
2725
2726
|
newValues[_key2 - 3] = arguments[_key2];
|
|
2726
2727
|
}
|
|
2727
|
-
|
|
2728
|
+
out.splice.apply(out, [index, removeCount].concat(newValues));
|
|
2729
|
+
return out;
|
|
2730
|
+
};
|
|
2731
|
+
var replaceChild = function replaceChild(children, index, newValue) {
|
|
2732
|
+
var out = children.slice();
|
|
2733
|
+
out[index] = newValue;
|
|
2734
|
+
return out;
|
|
2728
2735
|
};
|
|
2729
2736
|
var removeChildren = replaceChildren;
|
|
2730
2737
|
/**
|
|
@@ -2741,11 +2748,11 @@
|
|
|
2741
2748
|
var _index = slicedPath.pop();
|
|
2742
2749
|
var ancestorNode = Node.get(root, slicedPath);
|
|
2743
2750
|
modifiedNode = _objectSpread$b(_objectSpread$b({}, ancestorNode), {}, {
|
|
2744
|
-
children:
|
|
2751
|
+
children: replaceChild(ancestorNode.children, _index, modifiedNode)
|
|
2745
2752
|
});
|
|
2746
2753
|
}
|
|
2747
|
-
var index = slicedPath
|
|
2748
|
-
root.children =
|
|
2754
|
+
var index = slicedPath[0];
|
|
2755
|
+
root.children = replaceChild(root.children, index, modifiedNode);
|
|
2749
2756
|
};
|
|
2750
2757
|
/**
|
|
2751
2758
|
* Replace the children of a node, replacing all ancestors
|