slate 0.82.0 → 0.82.1-2022718736
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/create-editor.d.ts.map +1 -1
- package/dist/index.es.js +87 -87
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +95 -95
- package/dist/index.js.map +1 -1
- package/dist/interfaces/editor.d.ts +1 -0
- package/dist/interfaces/editor.d.ts.map +1 -1
- package/dist/slate.js +95 -95
- package/dist/slate.min.js +2 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-editor.d.ts","sourceRoot":"","sources":["packages/slate/src/create-editor.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAYP,MAAM,IAAI,CAAA;AAIX;;GAEG;AAEH,eAAO,MAAM,YAAY,QAAO,
|
|
1
|
+
{"version":3,"file":"create-editor.d.ts","sourceRoot":"","sources":["packages/slate/src/create-editor.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAYP,MAAM,IAAI,CAAA;AAIX;;GAEG;AAEH,eAAO,MAAM,YAAY,QAAO,MAmW/B,CAAA"}
|
package/dist/index.es.js
CHANGED
|
@@ -82,7 +82,7 @@ var createEditor = () => {
|
|
|
82
82
|
dirtyPathKeys = oldDirtyPathKeys;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
var newDirtyPaths = getDirtyPaths(op);
|
|
85
|
+
var newDirtyPaths = editor.getDirtyPaths(op);
|
|
86
86
|
|
|
87
87
|
for (var _path of newDirtyPaths) {
|
|
88
88
|
add(_path);
|
|
@@ -329,109 +329,109 @@ var createEditor = () => {
|
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
331
|
}
|
|
332
|
-
}
|
|
333
|
-
};
|
|
334
|
-
return editor;
|
|
335
|
-
};
|
|
336
|
-
/**
|
|
337
|
-
* Get the "dirty" paths generated from an operation.
|
|
338
|
-
*/
|
|
332
|
+
},
|
|
339
333
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
334
|
+
/**
|
|
335
|
+
* Get the "dirty" paths generated from an operation.
|
|
336
|
+
*/
|
|
337
|
+
getDirtyPaths: op => {
|
|
338
|
+
switch (op.type) {
|
|
339
|
+
case 'insert_text':
|
|
340
|
+
case 'remove_text':
|
|
341
|
+
case 'set_node':
|
|
342
|
+
{
|
|
343
|
+
var {
|
|
344
|
+
path
|
|
345
|
+
} = op;
|
|
346
|
+
return Path.levels(path);
|
|
347
|
+
}
|
|
351
348
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
349
|
+
case 'insert_node':
|
|
350
|
+
{
|
|
351
|
+
var {
|
|
352
|
+
node,
|
|
353
|
+
path: _path2
|
|
354
|
+
} = op;
|
|
355
|
+
var levels = Path.levels(_path2);
|
|
356
|
+
var descendants = Text.isText(node) ? [] : Array.from(Node.nodes(node), _ref3 => {
|
|
357
|
+
var [, p] = _ref3;
|
|
358
|
+
return _path2.concat(p);
|
|
359
|
+
});
|
|
360
|
+
return [...levels, ...descendants];
|
|
361
|
+
}
|
|
365
362
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
363
|
+
case 'merge_node':
|
|
364
|
+
{
|
|
365
|
+
var {
|
|
366
|
+
path: _path3
|
|
367
|
+
} = op;
|
|
368
|
+
var ancestors = Path.ancestors(_path3);
|
|
369
|
+
var previousPath = Path.previous(_path3);
|
|
370
|
+
return [...ancestors, previousPath];
|
|
371
|
+
}
|
|
375
372
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
373
|
+
case 'move_node':
|
|
374
|
+
{
|
|
375
|
+
var {
|
|
376
|
+
path: _path4,
|
|
377
|
+
newPath
|
|
378
|
+
} = op;
|
|
382
379
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
380
|
+
if (Path.equals(_path4, newPath)) {
|
|
381
|
+
return [];
|
|
382
|
+
}
|
|
386
383
|
|
|
387
|
-
|
|
388
|
-
|
|
384
|
+
var oldAncestors = [];
|
|
385
|
+
var newAncestors = [];
|
|
389
386
|
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
387
|
+
for (var ancestor of Path.ancestors(_path4)) {
|
|
388
|
+
var p = Path.transform(ancestor, op);
|
|
389
|
+
oldAncestors.push(p);
|
|
390
|
+
}
|
|
394
391
|
|
|
395
|
-
|
|
396
|
-
|
|
392
|
+
for (var _ancestor of Path.ancestors(newPath)) {
|
|
393
|
+
var _p = Path.transform(_ancestor, op);
|
|
397
394
|
|
|
398
|
-
|
|
399
|
-
|
|
395
|
+
newAncestors.push(_p);
|
|
396
|
+
}
|
|
400
397
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
398
|
+
var newParent = newAncestors[newAncestors.length - 1];
|
|
399
|
+
var newIndex = newPath[newPath.length - 1];
|
|
400
|
+
var resultPath = newParent.concat(newIndex);
|
|
401
|
+
return [...oldAncestors, ...newAncestors, resultPath];
|
|
402
|
+
}
|
|
406
403
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
404
|
+
case 'remove_node':
|
|
405
|
+
{
|
|
406
|
+
var {
|
|
407
|
+
path: _path5
|
|
408
|
+
} = op;
|
|
412
409
|
|
|
413
|
-
|
|
410
|
+
var _ancestors = Path.ancestors(_path5);
|
|
414
411
|
|
|
415
|
-
|
|
416
|
-
|
|
412
|
+
return [..._ancestors];
|
|
413
|
+
}
|
|
417
414
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
415
|
+
case 'split_node':
|
|
416
|
+
{
|
|
417
|
+
var {
|
|
418
|
+
path: _path6
|
|
419
|
+
} = op;
|
|
423
420
|
|
|
424
|
-
|
|
421
|
+
var _levels = Path.levels(_path6);
|
|
425
422
|
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
423
|
+
var nextPath = Path.next(_path6);
|
|
424
|
+
return [..._levels, nextPath];
|
|
425
|
+
}
|
|
429
426
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
427
|
+
default:
|
|
428
|
+
{
|
|
429
|
+
return [];
|
|
430
|
+
}
|
|
433
431
|
}
|
|
434
|
-
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
return editor;
|
|
435
435
|
};
|
|
436
436
|
|
|
437
437
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
@@ -1109,7 +1109,7 @@ var Editor = {
|
|
|
1109
1109
|
return false;
|
|
1110
1110
|
}
|
|
1111
1111
|
|
|
1112
|
-
var isEditor = typeof value.addMark === 'function' && typeof value.apply === 'function' && typeof value.deleteBackward === 'function' && typeof value.deleteForward === '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.isInline === 'function' && typeof value.isVoid === 'function' && typeof value.normalizeNode === 'function' && typeof value.onChange === 'function' && typeof value.removeMark === 'function' && (value.marks === null || isPlainObject(value.marks)) && (value.selection === null || Range.isRange(value.selection)) && Node.isNodeList(value.children) && Operation.isOperationList(value.operations);
|
|
1112
|
+
var isEditor = typeof value.addMark === 'function' && typeof value.apply === 'function' && typeof value.deleteBackward === 'function' && typeof value.deleteForward === '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.isInline === 'function' && typeof value.isVoid === 'function' && typeof value.normalizeNode === 'function' && typeof value.onChange === 'function' && typeof value.removeMark === 'function' && typeof value.getDirtyPaths === 'function' && (value.marks === null || isPlainObject(value.marks)) && (value.selection === null || Range.isRange(value.selection)) && Node.isNodeList(value.children) && Operation.isOperationList(value.operations);
|
|
1113
1113
|
IS_EDITOR_CACHE.set(value, isEditor);
|
|
1114
1114
|
return isEditor;
|
|
1115
1115
|
},
|