slate-angular 1.9.0 → 1.9.3
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/bundles/slate-angular.umd.js +43 -23
- package/bundles/slate-angular.umd.js.map +1 -1
- package/esm2015/components/editable/editable.component.js +4 -1
- package/esm2015/plugins/angular-editor.js +1 -1
- package/esm2015/plugins/with-angular.js +12 -7
- package/esm2015/utils/environment.js +4 -2
- package/fesm2015/slate-angular.js +17 -7
- package/fesm2015/slate-angular.js.map +1 -1
- package/package.json +1 -1
- package/plugins/angular-editor.d.ts +1 -1
|
@@ -610,7 +610,9 @@
|
|
|
610
610
|
var IS_CHROME = typeof navigator !== 'undefined' && /Chrome/i.test(navigator.userAgent);
|
|
611
611
|
// Native beforeInput events don't work well with react on Chrome 75 and older, Chrome 76+ can use beforeInput
|
|
612
612
|
var IS_CHROME_LEGACY = typeof navigator !== 'undefined' &&
|
|
613
|
-
/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])/i.test(navigator.userAgent)
|
|
613
|
+
/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])/i.test(navigator.userAgent) &&
|
|
614
|
+
// Exclude Chrome version greater than 3 bits,Chrome releases v100 on 2022.03.29
|
|
615
|
+
!/Chrome?\/(?:\d{3,})/i.test(navigator.userAgent);
|
|
614
616
|
// Firefox did not support `beforeInput` until `v87`.
|
|
615
617
|
var IS_FIREFOX_LEGACY = typeof navigator !== 'undefined' &&
|
|
616
618
|
/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])).*/i.test(navigator.userAgent);
|
|
@@ -1432,15 +1434,15 @@
|
|
|
1432
1434
|
}
|
|
1433
1435
|
};
|
|
1434
1436
|
e.apply = function (op) {
|
|
1435
|
-
var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
|
|
1437
|
+
var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e;
|
|
1436
1438
|
var matches = [];
|
|
1437
1439
|
switch (op.type) {
|
|
1438
1440
|
case 'insert_text':
|
|
1439
1441
|
case 'remove_text':
|
|
1440
1442
|
case 'set_node': {
|
|
1441
1443
|
try {
|
|
1442
|
-
for (var
|
|
1443
|
-
var
|
|
1444
|
+
for (var _f = __values(slate.Editor.levels(e, { at: op.path })), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
1445
|
+
var _h = __read(_g.value, 2), node = _h[0], path = _h[1];
|
|
1444
1446
|
var key = AngularEditor.findKey(e, node);
|
|
1445
1447
|
matches.push([path, key]);
|
|
1446
1448
|
}
|
|
@@ -1448,7 +1450,7 @@
|
|
|
1448
1450
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1449
1451
|
finally {
|
|
1450
1452
|
try {
|
|
1451
|
-
if (
|
|
1453
|
+
if (_g && !_g.done && (_a = _f.return)) _a.call(_f);
|
|
1452
1454
|
}
|
|
1453
1455
|
finally { if (e_1) throw e_1.error; }
|
|
1454
1456
|
}
|
|
@@ -1459,10 +1461,10 @@
|
|
|
1459
1461
|
case 'merge_node':
|
|
1460
1462
|
case 'split_node': {
|
|
1461
1463
|
try {
|
|
1462
|
-
for (var
|
|
1464
|
+
for (var _j = __values(slate.Editor.levels(e, {
|
|
1463
1465
|
at: slate.Path.parent(op.path),
|
|
1464
|
-
})),
|
|
1465
|
-
var
|
|
1466
|
+
})), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
1467
|
+
var _l = __read(_k.value, 2), node = _l[0], path = _l[1];
|
|
1466
1468
|
var key = AngularEditor.findKey(e, node);
|
|
1467
1469
|
matches.push([path, key]);
|
|
1468
1470
|
}
|
|
@@ -1470,46 +1472,61 @@
|
|
|
1470
1472
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1471
1473
|
finally {
|
|
1472
1474
|
try {
|
|
1473
|
-
if (
|
|
1475
|
+
if (_k && !_k.done && (_b = _j.return)) _b.call(_j);
|
|
1474
1476
|
}
|
|
1475
1477
|
finally { if (e_2) throw e_2.error; }
|
|
1476
1478
|
}
|
|
1477
1479
|
break;
|
|
1478
1480
|
}
|
|
1479
1481
|
case 'move_node': {
|
|
1482
|
+
var commonPath = slate.Path.common(slate.Path.parent(op.path), slate.Path.parent(op.newPath));
|
|
1480
1483
|
try {
|
|
1481
|
-
for (var
|
|
1482
|
-
|
|
1483
|
-
})), _m = _l.next(); !_m.done; _m = _l.next()) {
|
|
1484
|
-
var _o = __read(_m.value, 2), node = _o[0], path = _o[1];
|
|
1484
|
+
for (var _m = __values(slate.Editor.levels(e, { at: slate.Path.parent(op.path) })), _o = _m.next(); !_o.done; _o = _m.next()) {
|
|
1485
|
+
var _p = __read(_o.value, 2), node = _p[0], path = _p[1];
|
|
1485
1486
|
var key = AngularEditor.findKey(e, node);
|
|
1486
|
-
matches.push([path, key]);
|
|
1487
|
+
matches.push([slate.Editor.pathRef(editor, path), key]);
|
|
1487
1488
|
}
|
|
1488
1489
|
}
|
|
1489
1490
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1490
1491
|
finally {
|
|
1491
1492
|
try {
|
|
1492
|
-
if (
|
|
1493
|
+
if (_o && !_o.done && (_c = _m.return)) _c.call(_m);
|
|
1493
1494
|
}
|
|
1494
1495
|
finally { if (e_3) throw e_3.error; }
|
|
1495
1496
|
}
|
|
1497
|
+
try {
|
|
1498
|
+
for (var _q = __values(slate.Editor.levels(e, { at: slate.Path.parent(op.newPath) })), _r = _q.next(); !_r.done; _r = _q.next()) {
|
|
1499
|
+
var _s = __read(_r.value, 2), node = _s[0], path = _s[1];
|
|
1500
|
+
if (path.length > commonPath.length) {
|
|
1501
|
+
var key = AngularEditor.findKey(e, node);
|
|
1502
|
+
matches.push([slate.Editor.pathRef(editor, path), key]);
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
1507
|
+
finally {
|
|
1508
|
+
try {
|
|
1509
|
+
if (_r && !_r.done && (_d = _q.return)) _d.call(_q);
|
|
1510
|
+
}
|
|
1511
|
+
finally { if (e_4) throw e_4.error; }
|
|
1512
|
+
}
|
|
1496
1513
|
break;
|
|
1497
1514
|
}
|
|
1498
1515
|
}
|
|
1499
1516
|
apply(op);
|
|
1500
1517
|
try {
|
|
1501
1518
|
for (var matches_1 = __values(matches), matches_1_1 = matches_1.next(); !matches_1_1.done; matches_1_1 = matches_1.next()) {
|
|
1502
|
-
var
|
|
1503
|
-
var
|
|
1519
|
+
var _t = __read(matches_1_1.value, 2), source = _t[0], key = _t[1];
|
|
1520
|
+
var _u = __read(slate.Editor.node(e, slate.Path.isPath(source) ? source : source.current), 1), node = _u[0];
|
|
1504
1521
|
NODE_TO_KEY.set(node, key);
|
|
1505
1522
|
}
|
|
1506
1523
|
}
|
|
1507
|
-
catch (
|
|
1524
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
1508
1525
|
finally {
|
|
1509
1526
|
try {
|
|
1510
|
-
if (matches_1_1 && !matches_1_1.done && (
|
|
1527
|
+
if (matches_1_1 && !matches_1_1.done && (_e = matches_1.return)) _e.call(matches_1);
|
|
1511
1528
|
}
|
|
1512
|
-
finally { if (
|
|
1529
|
+
finally { if (e_5) throw e_5.error; }
|
|
1513
1530
|
}
|
|
1514
1531
|
};
|
|
1515
1532
|
e.onChange = function () {
|
|
@@ -1626,7 +1643,7 @@
|
|
|
1626
1643
|
return false;
|
|
1627
1644
|
};
|
|
1628
1645
|
e.insertTextData = function (data) {
|
|
1629
|
-
var
|
|
1646
|
+
var e_6, _a;
|
|
1630
1647
|
var text = data.getData('text/plain');
|
|
1631
1648
|
if (text) {
|
|
1632
1649
|
var lines = text.split(/\r\n|\r|\n/);
|
|
@@ -1641,12 +1658,12 @@
|
|
|
1641
1658
|
split = true;
|
|
1642
1659
|
}
|
|
1643
1660
|
}
|
|
1644
|
-
catch (
|
|
1661
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
1645
1662
|
finally {
|
|
1646
1663
|
try {
|
|
1647
1664
|
if (lines_1_1 && !lines_1_1.done && (_a = lines_1.return)) _a.call(lines_1);
|
|
1648
1665
|
}
|
|
1649
|
-
finally { if (
|
|
1666
|
+
finally { if (e_6) throw e_6.error; }
|
|
1650
1667
|
}
|
|
1651
1668
|
return true;
|
|
1652
1669
|
}
|
|
@@ -3222,6 +3239,9 @@
|
|
|
3222
3239
|
domSelection.setBaseAndExtent(newDomRange_1.startContainer, newDomRange_1.startOffset, newDomRange_1.endContainer, newDomRange_1.endOffset);
|
|
3223
3240
|
}
|
|
3224
3241
|
}
|
|
3242
|
+
else {
|
|
3243
|
+
domSelection.removeAllRanges();
|
|
3244
|
+
}
|
|
3225
3245
|
setTimeout(function () {
|
|
3226
3246
|
// COMPAT: In Firefox, it's not enough to create a range, you also need
|
|
3227
3247
|
// to focus the contenteditable element too. (2016/11/16)
|