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/index.js
CHANGED
|
@@ -2213,17 +2213,24 @@ var Text = {
|
|
|
2213
2213
|
|
|
2214
2214
|
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; }
|
|
2215
2215
|
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; }
|
|
2216
|
-
var insertChildren = function insertChildren(
|
|
2216
|
+
var insertChildren = function insertChildren(children, index) {
|
|
2217
2217
|
for (var _len = arguments.length, newValues = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
2218
2218
|
newValues[_key - 2] = arguments[_key];
|
|
2219
2219
|
}
|
|
2220
|
-
return
|
|
2220
|
+
return replaceChildren.apply(void 0, [children, index, 0].concat(newValues));
|
|
2221
2221
|
};
|
|
2222
|
-
var replaceChildren = function replaceChildren(
|
|
2222
|
+
var replaceChildren = function replaceChildren(children, index, removeCount) {
|
|
2223
|
+
var out = children.slice();
|
|
2223
2224
|
for (var _len2 = arguments.length, newValues = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
|
|
2224
2225
|
newValues[_key2 - 3] = arguments[_key2];
|
|
2225
2226
|
}
|
|
2226
|
-
|
|
2227
|
+
out.splice.apply(out, [index, removeCount].concat(newValues));
|
|
2228
|
+
return out;
|
|
2229
|
+
};
|
|
2230
|
+
var replaceChild = function replaceChild(children, index, newValue) {
|
|
2231
|
+
var out = children.slice();
|
|
2232
|
+
out[index] = newValue;
|
|
2233
|
+
return out;
|
|
2227
2234
|
};
|
|
2228
2235
|
var removeChildren = replaceChildren;
|
|
2229
2236
|
/**
|
|
@@ -2240,11 +2247,11 @@ var modifyDescendant = function modifyDescendant(root, path, f) {
|
|
|
2240
2247
|
var _index = slicedPath.pop();
|
|
2241
2248
|
var ancestorNode = Node.get(root, slicedPath);
|
|
2242
2249
|
modifiedNode = _objectSpread$b(_objectSpread$b({}, ancestorNode), {}, {
|
|
2243
|
-
children:
|
|
2250
|
+
children: replaceChild(ancestorNode.children, _index, modifiedNode)
|
|
2244
2251
|
});
|
|
2245
2252
|
}
|
|
2246
|
-
var index = slicedPath
|
|
2247
|
-
root.children =
|
|
2253
|
+
var index = slicedPath[0];
|
|
2254
|
+
root.children = replaceChild(root.children, index, modifiedNode);
|
|
2248
2255
|
};
|
|
2249
2256
|
/**
|
|
2250
2257
|
* Replace the children of a node, replacing all ancestors
|