slate 0.47.7 → 0.47.8
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/slate.js +27 -5
- package/dist/slate.min.js +1 -1
- package/lib/slate.es.js +27 -5
- package/lib/slate.es.js.map +1 -1
- package/lib/slate.js +27 -5
- package/lib/slate.js.map +1 -1
- package/package.json +2 -2
package/dist/slate.js
CHANGED
|
@@ -12353,7 +12353,7 @@ Commands$3.save = function (editor, operation) {
|
|
|
12353
12353
|
save = _editor$tmp.save,
|
|
12354
12354
|
merge = _editor$tmp.merge;
|
|
12355
12355
|
|
|
12356
|
-
if (save === false) return;
|
|
12356
|
+
if (save === false || !isValidOperation(operation)) return;
|
|
12357
12357
|
|
|
12358
12358
|
var undos = data.get('undos') || immutable.List();
|
|
12359
12359
|
var lastBatch = undos.last();
|
|
@@ -12414,13 +12414,13 @@ Commands$3.redo = function (editor) {
|
|
|
12414
12414
|
batch.forEach(function (op) {
|
|
12415
12415
|
var _op = op,
|
|
12416
12416
|
type = _op.type,
|
|
12417
|
-
|
|
12417
|
+
newProperties = _op.newProperties;
|
|
12418
12418
|
|
|
12419
12419
|
// When the operation mutates the selection, omit its `isFocused` value to
|
|
12420
12420
|
// prevent the editor focus from changing during redoing.
|
|
12421
12421
|
|
|
12422
12422
|
if (type === 'set_selection') {
|
|
12423
|
-
op = op.set('
|
|
12423
|
+
op = op.set('newProperties', omit_1(newProperties, 'isFocused'));
|
|
12424
12424
|
}
|
|
12425
12425
|
|
|
12426
12426
|
editor.applyOperation(op);
|
|
@@ -12458,13 +12458,13 @@ Commands$3.undo = function (editor) {
|
|
|
12458
12458
|
}).forEach(function (inverse) {
|
|
12459
12459
|
var _inverse = inverse,
|
|
12460
12460
|
type = _inverse.type,
|
|
12461
|
-
|
|
12461
|
+
newProperties = _inverse.newProperties;
|
|
12462
12462
|
|
|
12463
12463
|
// When the operation mutates the selection, omit its `isFocused` value to
|
|
12464
12464
|
// prevent the editor focus from changing during undoing.
|
|
12465
12465
|
|
|
12466
12466
|
if (type === 'set_selection') {
|
|
12467
|
-
inverse = inverse.set('
|
|
12467
|
+
inverse = inverse.set('newProperties', omit_1(newProperties, 'isFocused'));
|
|
12468
12468
|
}
|
|
12469
12469
|
|
|
12470
12470
|
editor.applyOperation(inverse);
|
|
@@ -12525,6 +12525,28 @@ function shouldMerge(o, p) {
|
|
|
12525
12525
|
return merge;
|
|
12526
12526
|
}
|
|
12527
12527
|
|
|
12528
|
+
/**
|
|
12529
|
+
* Check weather an operation needs to be saved to the history
|
|
12530
|
+
* @param {Object} o - operation
|
|
12531
|
+
* @returns {Boolean}
|
|
12532
|
+
*/
|
|
12533
|
+
|
|
12534
|
+
function isValidOperation(o) {
|
|
12535
|
+
if (o.type === 'set_selection') {
|
|
12536
|
+
var _o$newProperties = o.newProperties,
|
|
12537
|
+
isFocused = _o$newProperties.isFocused,
|
|
12538
|
+
anchor = _o$newProperties.anchor,
|
|
12539
|
+
focus = _o$newProperties.focus;
|
|
12540
|
+
|
|
12541
|
+
// this is blur/focus operation, dont need to store it into the history
|
|
12542
|
+
|
|
12543
|
+
if (isFocused !== undefined && !anchor && !focus) {
|
|
12544
|
+
return false;
|
|
12545
|
+
}
|
|
12546
|
+
}
|
|
12547
|
+
return true;
|
|
12548
|
+
}
|
|
12549
|
+
|
|
12528
12550
|
var Commands$4 = {};
|
|
12529
12551
|
|
|
12530
12552
|
Commands$4.blur = function (editor) {
|