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.
@@ -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,MAuR/B,CAAA"}
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
- var getDirtyPaths = op => {
341
- switch (op.type) {
342
- case 'insert_text':
343
- case 'remove_text':
344
- case 'set_node':
345
- {
346
- var {
347
- path
348
- } = op;
349
- return Path.levels(path);
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
- case 'insert_node':
353
- {
354
- var {
355
- node,
356
- path: _path2
357
- } = op;
358
- var levels = Path.levels(_path2);
359
- var descendants = Text.isText(node) ? [] : Array.from(Node.nodes(node), _ref3 => {
360
- var [, p] = _ref3;
361
- return _path2.concat(p);
362
- });
363
- return [...levels, ...descendants];
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
- case 'merge_node':
367
- {
368
- var {
369
- path: _path3
370
- } = op;
371
- var ancestors = Path.ancestors(_path3);
372
- var previousPath = Path.previous(_path3);
373
- return [...ancestors, previousPath];
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
- case 'move_node':
377
- {
378
- var {
379
- path: _path4,
380
- newPath
381
- } = op;
373
+ case 'move_node':
374
+ {
375
+ var {
376
+ path: _path4,
377
+ newPath
378
+ } = op;
382
379
 
383
- if (Path.equals(_path4, newPath)) {
384
- return [];
385
- }
380
+ if (Path.equals(_path4, newPath)) {
381
+ return [];
382
+ }
386
383
 
387
- var oldAncestors = [];
388
- var newAncestors = [];
384
+ var oldAncestors = [];
385
+ var newAncestors = [];
389
386
 
390
- for (var ancestor of Path.ancestors(_path4)) {
391
- var p = Path.transform(ancestor, op);
392
- oldAncestors.push(p);
393
- }
387
+ for (var ancestor of Path.ancestors(_path4)) {
388
+ var p = Path.transform(ancestor, op);
389
+ oldAncestors.push(p);
390
+ }
394
391
 
395
- for (var _ancestor of Path.ancestors(newPath)) {
396
- var _p = Path.transform(_ancestor, op);
392
+ for (var _ancestor of Path.ancestors(newPath)) {
393
+ var _p = Path.transform(_ancestor, op);
397
394
 
398
- newAncestors.push(_p);
399
- }
395
+ newAncestors.push(_p);
396
+ }
400
397
 
401
- var newParent = newAncestors[newAncestors.length - 1];
402
- var newIndex = newPath[newPath.length - 1];
403
- var resultPath = newParent.concat(newIndex);
404
- return [...oldAncestors, ...newAncestors, resultPath];
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
- case 'remove_node':
408
- {
409
- var {
410
- path: _path5
411
- } = op;
404
+ case 'remove_node':
405
+ {
406
+ var {
407
+ path: _path5
408
+ } = op;
412
409
 
413
- var _ancestors = Path.ancestors(_path5);
410
+ var _ancestors = Path.ancestors(_path5);
414
411
 
415
- return [..._ancestors];
416
- }
412
+ return [..._ancestors];
413
+ }
417
414
 
418
- case 'split_node':
419
- {
420
- var {
421
- path: _path6
422
- } = op;
415
+ case 'split_node':
416
+ {
417
+ var {
418
+ path: _path6
419
+ } = op;
423
420
 
424
- var _levels = Path.levels(_path6);
421
+ var _levels = Path.levels(_path6);
425
422
 
426
- var nextPath = Path.next(_path6);
427
- return [..._levels, nextPath];
428
- }
423
+ var nextPath = Path.next(_path6);
424
+ return [..._levels, nextPath];
425
+ }
429
426
 
430
- default:
431
- {
432
- return [];
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
  },