@worktile/theia 3.0.0-next.0 → 3.0.0-next.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/worktile-theia.umd.js +177 -189
- package/bundles/worktile-theia.umd.js.map +1 -1
- package/core/utils/combine-plugins.d.ts +2 -0
- package/core/utils/get-plugin-by-key.d.ts +2 -0
- package/core/utils/index.d.ts +5 -2
- package/core/utils/merge-deep-plugins.d.ts +2 -0
- package/core/utils/merge-options.d.ts +1 -1
- package/core/utils/nested-structure-by-key.d.ts +2 -0
- package/core/utils/plugins-by-key.d.ts +2 -0
- package/esm2015/core/create-plugin.js +2 -4
- package/esm2015/core/utils/combine-plugins.js +10 -0
- package/esm2015/core/utils/flatten-deep-plugins.js +2 -20
- package/esm2015/core/utils/get-plugin-by-key.js +8 -0
- package/esm2015/core/utils/get-plugin.js +3 -3
- package/esm2015/core/utils/index.js +6 -3
- package/esm2015/core/utils/merge-deep-plugins.js +16 -0
- package/esm2015/core/utils/merge-options.js +5 -5
- package/esm2015/core/utils/nested-structure-by-key.js +11 -0
- package/esm2015/core/utils/plugins-by-key.js +10 -0
- package/esm2015/core/with-theia.js +9 -22
- package/esm2015/interfaces/editor.js +1 -1
- package/esm2015/plugins/blockquote/blockquote.editor.js +8 -8
- package/esm2015/plugins/code/code.editor.js +3 -3
- package/esm2015/plugins/hr/hr.editor.js +2 -2
- package/esm2015/plugins/list/list.editor.js +1 -2
- package/esm2015/plugins/table/transforms/insert-table.js +2 -2
- package/esm2015/transforms/index.js +3 -4
- package/esm2015/transforms/insert-elements.js +40 -0
- package/fesm2015/worktile-theia.js +169 -182
- package/fesm2015/worktile-theia.js.map +1 -1
- package/interfaces/editor.d.ts +0 -1
- package/package.json +1 -1
- package/transforms/index.d.ts +2 -3
- package/transforms/insert-elements.d.ts +2 -0
- package/core/utils/get-plugins-by-key.d.ts +0 -2
- package/core/utils/override-plugins-by-key.d.ts +0 -5
- package/esm2015/core/utils/get-plugins-by-key.js +0 -8
- package/esm2015/core/utils/override-plugins-by-key.js +0 -27
- package/esm2015/transforms/insert-element-next.js +0 -40
- package/esm2015/transforms/insert-element.js +0 -2
- package/transforms/insert-element-next.d.ts +0 -2
- package/transforms/insert-element.d.ts +0 -3
|
@@ -1415,24 +1415,7 @@
|
|
|
1415
1415
|
p.options = {};
|
|
1416
1416
|
if (!p.nestedStructureByKey)
|
|
1417
1417
|
p.nestedStructureByKey = {};
|
|
1418
|
-
|
|
1419
|
-
for (var key in p.nestedStructureByKey) {
|
|
1420
|
-
if (!editor.nestedStructureByKey[key]) {
|
|
1421
|
-
editor.nestedStructureByKey[key] = p.nestedStructureByKey[key];
|
|
1422
|
-
}
|
|
1423
|
-
}
|
|
1424
|
-
if (!editor.pluginsByKey[p.key]) {
|
|
1425
|
-
editor.plugins.push(p);
|
|
1426
|
-
editor.pluginsByKey[p.key] = p;
|
|
1427
|
-
}
|
|
1428
|
-
else {
|
|
1429
|
-
var index = editor.plugins.indexOf(editor.pluginsByKey[p.key]);
|
|
1430
|
-
var mergedPlugin = _.defaultsDeep(p, editor.pluginsByKey[p.key]);
|
|
1431
|
-
if (index >= 0) {
|
|
1432
|
-
editor.plugins[index] = mergedPlugin;
|
|
1433
|
-
}
|
|
1434
|
-
editor.pluginsByKey[p.key] = mergedPlugin;
|
|
1435
|
-
}
|
|
1418
|
+
editor.plugins.push(p);
|
|
1436
1419
|
flattenDeepPlugins(editor, p.plugins);
|
|
1437
1420
|
});
|
|
1438
1421
|
};
|
|
@@ -1442,7 +1425,7 @@
|
|
|
1442
1425
|
return (_a = editor === null || editor === void 0 ? void 0 : editor.plugins) !== null && _a !== void 0 ? _a : [];
|
|
1443
1426
|
};
|
|
1444
1427
|
|
|
1445
|
-
var
|
|
1428
|
+
var getPluginByKey = function (editor) {
|
|
1446
1429
|
var plugins = {};
|
|
1447
1430
|
if (editor === null || editor === void 0 ? void 0 : editor.pluginsByKey) {
|
|
1448
1431
|
return editor.pluginsByKey;
|
|
@@ -1450,49 +1433,183 @@
|
|
|
1450
1433
|
return plugins;
|
|
1451
1434
|
};
|
|
1452
1435
|
|
|
1453
|
-
var getPlugin = function (editor, key) { return
|
|
1436
|
+
var getPlugin = function (editor, key) { return getPluginByKey(editor)[key]; };
|
|
1454
1437
|
|
|
1455
1438
|
var getPluginOptions = function (editor, key) { var _a; return (_a = getPlugin(editor, key).options) !== null && _a !== void 0 ? _a : {}; };
|
|
1456
1439
|
|
|
1457
|
-
var mergeOptions = function (plugin,
|
|
1458
|
-
|
|
1459
|
-
var options = overrideByKey[plugin.key].options;
|
|
1440
|
+
var mergeOptions = function (plugin, override) {
|
|
1441
|
+
var options = plugin.options;
|
|
1460
1442
|
var newOptions = {};
|
|
1461
1443
|
for (var option in options) {
|
|
1462
1444
|
if (Array.isArray(options[option])) {
|
|
1463
|
-
newOptions[option] = _.
|
|
1445
|
+
newOptions[option] = _.union(options[option], override.options[option]);
|
|
1464
1446
|
continue;
|
|
1465
1447
|
}
|
|
1466
|
-
newOptions[option] =
|
|
1448
|
+
newOptions[option] = options[option];
|
|
1467
1449
|
}
|
|
1468
1450
|
plugin.options = newOptions;
|
|
1469
1451
|
return plugin;
|
|
1470
1452
|
};
|
|
1471
1453
|
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1454
|
+
var combinePlugins = function (editor) {
|
|
1455
|
+
// withOverrides
|
|
1456
|
+
editor.plugins.forEach(function (plugin) {
|
|
1457
|
+
if (plugin.withOverrides) {
|
|
1458
|
+
editor = plugin.withOverrides(editor, plugin);
|
|
1459
|
+
}
|
|
1460
|
+
});
|
|
1461
|
+
return editor;
|
|
1462
|
+
};
|
|
1463
|
+
|
|
1464
|
+
var mergeDeepPlugins = function (editor, _plugins) {
|
|
1465
|
+
_plugins.forEach(function (plugin) {
|
|
1466
|
+
if (plugin.overrideByKey) {
|
|
1467
|
+
var newPlugins = _plugins.filter(function (p) { return plugin.overrideByKey[p.key]; });
|
|
1468
|
+
newPlugins.forEach(function (p) {
|
|
1469
|
+
if (editor.pluginsByKey[p.key]) {
|
|
1470
|
+
p = mergeOptions(p, plugin.overrideByKey[p.key]);
|
|
1471
|
+
editor.pluginsByKey[p.key] = _.defaultsDeep(p, plugin.overrideByKey[p.key]);
|
|
1472
|
+
}
|
|
1488
1473
|
});
|
|
1489
1474
|
}
|
|
1475
|
+
});
|
|
1476
|
+
};
|
|
1477
|
+
|
|
1478
|
+
var nestedStructureByKey = function (editor, plugins) {
|
|
1479
|
+
// 如果有 key 重复则进行覆盖
|
|
1480
|
+
plugins.forEach(function (p) {
|
|
1481
|
+
for (var key in p.nestedStructureByKey) {
|
|
1482
|
+
if (!editor.nestedStructureByKey[key]) {
|
|
1483
|
+
editor.nestedStructureByKey[key] = p.nestedStructureByKey[key];
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
});
|
|
1487
|
+
};
|
|
1488
|
+
|
|
1489
|
+
var pluginsByKey = function (editor, plugins) {
|
|
1490
|
+
if (!plugins)
|
|
1491
|
+
return;
|
|
1492
|
+
plugins.forEach(function (p) {
|
|
1493
|
+
if (!editor.pluginsByKey[p.key]) {
|
|
1494
|
+
editor.pluginsByKey[p.key] = p;
|
|
1495
|
+
}
|
|
1496
|
+
});
|
|
1497
|
+
};
|
|
1498
|
+
|
|
1499
|
+
var withTheia = function (editor, plugins) {
|
|
1500
|
+
if (plugins === void 0) { plugins = []; }
|
|
1501
|
+
var e = editor;
|
|
1502
|
+
e.renderElement = function (element) { return null; };
|
|
1503
|
+
e.renderLeaf = function (text) { return null; };
|
|
1504
|
+
e.isContainer = function (value) { return false; };
|
|
1505
|
+
e.extraElementOptions = [];
|
|
1506
|
+
e.disabled = false;
|
|
1507
|
+
e.plugins = [];
|
|
1508
|
+
e.pluginsByKey = {};
|
|
1509
|
+
e.nestedStructureByKey = {};
|
|
1510
|
+
// withOverridesByKey
|
|
1511
|
+
flattenDeepPlugins(e, plugins);
|
|
1512
|
+
// mount pluginsByKey
|
|
1513
|
+
pluginsByKey(e, plugins);
|
|
1514
|
+
// mount nestedStructureByKey
|
|
1515
|
+
nestedStructureByKey(e, e.plugins);
|
|
1516
|
+
// merge plugin to pluginByKey
|
|
1517
|
+
mergeDeepPlugins(e, e.plugins);
|
|
1518
|
+
e = combinePlugins(e);
|
|
1519
|
+
return e;
|
|
1520
|
+
};
|
|
1521
|
+
|
|
1522
|
+
var createPluginFactory = function (defaultPlugin) { return function (override, overrideByKey) {
|
|
1523
|
+
if (overrideByKey === void 0) { overrideByKey = {}; }
|
|
1524
|
+
return defaultPlugin;
|
|
1525
|
+
}; };
|
|
1526
|
+
|
|
1527
|
+
var toolbarInitialize = function (toolbarItems, global, inline, quick) {
|
|
1528
|
+
if (global === void 0) { global = DefaultGlobalToolbarDefinition; }
|
|
1529
|
+
if (inline === void 0) { inline = DefaultInlineToolbarDefinition; }
|
|
1530
|
+
if (quick === void 0) { quick = DefaultQuickToolbarDefinition; }
|
|
1531
|
+
var toolbarDefinition = {
|
|
1532
|
+
global: global,
|
|
1533
|
+
inline: inline,
|
|
1534
|
+
quick: quick
|
|
1535
|
+
};
|
|
1536
|
+
var toolbarOperations = new Map();
|
|
1537
|
+
toolbarItems.forEach(function (i) { return toolbarOperations.set(i.key, i); });
|
|
1538
|
+
var toolbarEntity = nextToolbarEntity(toolbarDefinition, toolbarOperations);
|
|
1539
|
+
return {
|
|
1540
|
+
toolbarDefinition: toolbarDefinition,
|
|
1541
|
+
toolbarOperations: toolbarOperations,
|
|
1542
|
+
toolbarEntity: toolbarEntity
|
|
1543
|
+
};
|
|
1544
|
+
};
|
|
1545
|
+
var nextToolbarEntity = function (toolbarDefinition, toolbarItems) {
|
|
1546
|
+
var entity = {};
|
|
1547
|
+
for (var defKey in toolbarDefinition) {
|
|
1548
|
+
entity[defKey] = getToolbarItemByKeys(toolbarDefinition[defKey], toolbarItems);
|
|
1490
1549
|
}
|
|
1491
|
-
|
|
1492
|
-
|
|
1550
|
+
return entity;
|
|
1551
|
+
};
|
|
1552
|
+
var getToolbarItemByKeys = function (keys, toolbarItems) {
|
|
1553
|
+
var items = [];
|
|
1554
|
+
keys.forEach(function (key) {
|
|
1555
|
+
if (key === "split") {
|
|
1556
|
+
items.push({ key: "split" });
|
|
1557
|
+
return;
|
|
1558
|
+
}
|
|
1559
|
+
var item = toolbarItems.get(key);
|
|
1560
|
+
if (item && item.includes) {
|
|
1561
|
+
items.push(Object.assign(Object.assign({}, item), { includes: getToolbarItemByKeys(item.includes, toolbarItems) }));
|
|
1562
|
+
return;
|
|
1563
|
+
}
|
|
1564
|
+
if (item) {
|
|
1565
|
+
items.push(item);
|
|
1566
|
+
}
|
|
1567
|
+
});
|
|
1568
|
+
return items;
|
|
1569
|
+
};
|
|
1570
|
+
var createToolbar = function (editor, toolbar) {
|
|
1571
|
+
var toolbarItems = editor === null || editor === void 0 ? void 0 : editor.plugins.reduce(function (prevItems, nextPlugin) {
|
|
1572
|
+
var _a;
|
|
1573
|
+
prevItems.push.apply(prevItems, __spreadArray([], __read(((_a = nextPlugin === null || nextPlugin === void 0 ? void 0 : nextPlugin.toolbarItems) !== null && _a !== void 0 ? _a : []))));
|
|
1574
|
+
return prevItems;
|
|
1575
|
+
}, []);
|
|
1576
|
+
var toolbarOption = toolbarInitialize(toolbarItems, toolbar === null || toolbar === void 0 ? void 0 : toolbar.global, toolbar === null || toolbar === void 0 ? void 0 : toolbar.inline, toolbar === null || toolbar === void 0 ? void 0 : toolbar.quick);
|
|
1577
|
+
var globalToolbarClass = ['the-global-toolbar', getToolbarClass(editor)];
|
|
1578
|
+
var toolbarEntity = toolbarOption.toolbarEntity;
|
|
1579
|
+
return {
|
|
1580
|
+
globalToolbarClass: globalToolbarClass,
|
|
1581
|
+
toolbarEntity: toolbarEntity
|
|
1582
|
+
};
|
|
1583
|
+
};
|
|
1584
|
+
|
|
1585
|
+
var UNDOING = new WeakMap();
|
|
1586
|
+
var REDOING = new WeakMap();
|
|
1587
|
+
var withTheHistory = function (editor) {
|
|
1588
|
+
var undo = editor.undo, redo = editor.redo;
|
|
1589
|
+
editor.undo = function () {
|
|
1590
|
+
UNDOING.set(editor, true);
|
|
1591
|
+
undo();
|
|
1592
|
+
UNDOING.set(editor, false);
|
|
1593
|
+
};
|
|
1594
|
+
editor.redo = function () {
|
|
1595
|
+
REDOING.set(editor, true);
|
|
1596
|
+
redo();
|
|
1597
|
+
REDOING.set(editor, false);
|
|
1598
|
+
};
|
|
1599
|
+
return editor;
|
|
1600
|
+
};
|
|
1601
|
+
var TheHistoryEditor = {
|
|
1602
|
+
isUndoing: function (editor) {
|
|
1603
|
+
return UNDOING.get(editor);
|
|
1604
|
+
},
|
|
1605
|
+
isRedoing: function (editor) {
|
|
1606
|
+
return REDOING.get(editor);
|
|
1493
1607
|
}
|
|
1494
|
-
return plugin;
|
|
1495
1608
|
};
|
|
1609
|
+
var createTheHistoryPlugin = createPluginFactory({
|
|
1610
|
+
key: exports.PluginKeys.theHistory,
|
|
1611
|
+
withOverrides: withTheHistory
|
|
1612
|
+
});
|
|
1496
1613
|
|
|
1497
1614
|
var setMarks = function (editor, marks, at) {
|
|
1498
1615
|
slate.Transforms.setNodes(editor, marks, {
|
|
@@ -1522,8 +1639,6 @@
|
|
|
1522
1639
|
}
|
|
1523
1640
|
};
|
|
1524
1641
|
|
|
1525
|
-
var insertElement = function (editor, element) { return editor.insertElement(element); };
|
|
1526
|
-
|
|
1527
1642
|
var isAncestor = function (node) { return slate.Element.isElement(node) || slate.Editor.isEditor(node); };
|
|
1528
1643
|
|
|
1529
1644
|
var getLastChild$1 = function (node, level) {
|
|
@@ -2348,7 +2463,7 @@
|
|
|
2348
2463
|
someNode: someNode
|
|
2349
2464
|
});
|
|
2350
2465
|
|
|
2351
|
-
var
|
|
2466
|
+
var insertElements = function (editor, element) {
|
|
2352
2467
|
var _a;
|
|
2353
2468
|
if (slate.Range.isExpanded(editor.selection)) {
|
|
2354
2469
|
slate.Editor.deleteFragment(editor);
|
|
@@ -2576,8 +2691,7 @@
|
|
|
2576
2691
|
__proto__: null,
|
|
2577
2692
|
setMarks: setMarks,
|
|
2578
2693
|
clearMarks: clearMarks,
|
|
2579
|
-
|
|
2580
|
-
insertElementNext: insertElementNext,
|
|
2694
|
+
insertElements: insertElements,
|
|
2581
2695
|
insertParagraph: insertParagraph,
|
|
2582
2696
|
setNode: setNode,
|
|
2583
2697
|
unwrapNodesByType: unwrapNodesByType,
|
|
@@ -2594,134 +2708,6 @@
|
|
|
2594
2708
|
handleContinualInsertBreak: handleContinualInsertBreak
|
|
2595
2709
|
});
|
|
2596
2710
|
|
|
2597
|
-
var withTheia = function (editor, plugins) {
|
|
2598
|
-
if (plugins === void 0) { plugins = []; }
|
|
2599
|
-
var e = editor;
|
|
2600
|
-
e.renderElement = function (element) { return null; };
|
|
2601
|
-
e.renderLeaf = function (text) { return null; };
|
|
2602
|
-
e.insertElement = function (element) { return insertElementNext(e, element); };
|
|
2603
|
-
e.isContainer = function (value) { return false; };
|
|
2604
|
-
e.extraElementOptions = [];
|
|
2605
|
-
e.disabled = false;
|
|
2606
|
-
e.plugins = [];
|
|
2607
|
-
e.pluginsByKey = {};
|
|
2608
|
-
e.nestedStructureByKey = {};
|
|
2609
|
-
// withOverridesByKey
|
|
2610
|
-
flattenDeepPlugins(e, plugins);
|
|
2611
|
-
// 如果 plugin.overrideByKey 存在,则把 plugin.overrideByKey 中的所有 key 覆盖到 editor.pluginsByKey 中
|
|
2612
|
-
editor.plugins.forEach(function (plugin) {
|
|
2613
|
-
if (plugin.overrideByKey) {
|
|
2614
|
-
var newPlugins = editor.plugins.map(function (p) {
|
|
2615
|
-
return overridePluginsByKey(p, plugin.overrideByKey);
|
|
2616
|
-
});
|
|
2617
|
-
editor.plugins = [];
|
|
2618
|
-
editor.pluginsByKey = {};
|
|
2619
|
-
// 再次扁平化覆盖
|
|
2620
|
-
flattenDeepPlugins(editor, newPlugins);
|
|
2621
|
-
}
|
|
2622
|
-
});
|
|
2623
|
-
// withOverrides
|
|
2624
|
-
e.plugins.forEach(function (plugin) {
|
|
2625
|
-
if (plugin.withOverrides) {
|
|
2626
|
-
e = plugin.withOverrides(e, plugin);
|
|
2627
|
-
}
|
|
2628
|
-
});
|
|
2629
|
-
return e;
|
|
2630
|
-
};
|
|
2631
|
-
|
|
2632
|
-
var createPluginFactory = function (defaultPlugin) { return function (override, overrideByKey) {
|
|
2633
|
-
if (overrideByKey === void 0) { overrideByKey = {}; }
|
|
2634
|
-
overrideByKey[defaultPlugin.key] = override;
|
|
2635
|
-
return overridePluginsByKey(Object.assign({}, defaultPlugin), overrideByKey);
|
|
2636
|
-
}; };
|
|
2637
|
-
|
|
2638
|
-
var toolbarInitialize = function (toolbarItems, global, inline, quick) {
|
|
2639
|
-
if (global === void 0) { global = DefaultGlobalToolbarDefinition; }
|
|
2640
|
-
if (inline === void 0) { inline = DefaultInlineToolbarDefinition; }
|
|
2641
|
-
if (quick === void 0) { quick = DefaultQuickToolbarDefinition; }
|
|
2642
|
-
var toolbarDefinition = {
|
|
2643
|
-
global: global,
|
|
2644
|
-
inline: inline,
|
|
2645
|
-
quick: quick
|
|
2646
|
-
};
|
|
2647
|
-
var toolbarOperations = new Map();
|
|
2648
|
-
toolbarItems.forEach(function (i) { return toolbarOperations.set(i.key, i); });
|
|
2649
|
-
var toolbarEntity = nextToolbarEntity(toolbarDefinition, toolbarOperations);
|
|
2650
|
-
return {
|
|
2651
|
-
toolbarDefinition: toolbarDefinition,
|
|
2652
|
-
toolbarOperations: toolbarOperations,
|
|
2653
|
-
toolbarEntity: toolbarEntity
|
|
2654
|
-
};
|
|
2655
|
-
};
|
|
2656
|
-
var nextToolbarEntity = function (toolbarDefinition, toolbarItems) {
|
|
2657
|
-
var entity = {};
|
|
2658
|
-
for (var defKey in toolbarDefinition) {
|
|
2659
|
-
entity[defKey] = getToolbarItemByKeys(toolbarDefinition[defKey], toolbarItems);
|
|
2660
|
-
}
|
|
2661
|
-
return entity;
|
|
2662
|
-
};
|
|
2663
|
-
var getToolbarItemByKeys = function (keys, toolbarItems) {
|
|
2664
|
-
var items = [];
|
|
2665
|
-
keys.forEach(function (key) {
|
|
2666
|
-
if (key === "split") {
|
|
2667
|
-
items.push({ key: "split" });
|
|
2668
|
-
return;
|
|
2669
|
-
}
|
|
2670
|
-
var item = toolbarItems.get(key);
|
|
2671
|
-
if (item && item.includes) {
|
|
2672
|
-
items.push(Object.assign(Object.assign({}, item), { includes: getToolbarItemByKeys(item.includes, toolbarItems) }));
|
|
2673
|
-
return;
|
|
2674
|
-
}
|
|
2675
|
-
if (item) {
|
|
2676
|
-
items.push(item);
|
|
2677
|
-
}
|
|
2678
|
-
});
|
|
2679
|
-
return items;
|
|
2680
|
-
};
|
|
2681
|
-
var createToolbar = function (editor, toolbar) {
|
|
2682
|
-
var toolbarItems = editor === null || editor === void 0 ? void 0 : editor.plugins.reduce(function (prevItems, nextPlugin) {
|
|
2683
|
-
var _a;
|
|
2684
|
-
prevItems.push.apply(prevItems, __spreadArray([], __read(((_a = nextPlugin === null || nextPlugin === void 0 ? void 0 : nextPlugin.toolbarItems) !== null && _a !== void 0 ? _a : []))));
|
|
2685
|
-
return prevItems;
|
|
2686
|
-
}, []);
|
|
2687
|
-
var toolbarOption = toolbarInitialize(toolbarItems, toolbar === null || toolbar === void 0 ? void 0 : toolbar.global, toolbar === null || toolbar === void 0 ? void 0 : toolbar.inline, toolbar === null || toolbar === void 0 ? void 0 : toolbar.quick);
|
|
2688
|
-
var globalToolbarClass = ['the-global-toolbar', getToolbarClass(editor)];
|
|
2689
|
-
var toolbarEntity = toolbarOption.toolbarEntity;
|
|
2690
|
-
return {
|
|
2691
|
-
globalToolbarClass: globalToolbarClass,
|
|
2692
|
-
toolbarEntity: toolbarEntity
|
|
2693
|
-
};
|
|
2694
|
-
};
|
|
2695
|
-
|
|
2696
|
-
var UNDOING = new WeakMap();
|
|
2697
|
-
var REDOING = new WeakMap();
|
|
2698
|
-
var withTheHistory = function (editor) {
|
|
2699
|
-
var undo = editor.undo, redo = editor.redo;
|
|
2700
|
-
editor.undo = function () {
|
|
2701
|
-
UNDOING.set(editor, true);
|
|
2702
|
-
undo();
|
|
2703
|
-
UNDOING.set(editor, false);
|
|
2704
|
-
};
|
|
2705
|
-
editor.redo = function () {
|
|
2706
|
-
REDOING.set(editor, true);
|
|
2707
|
-
redo();
|
|
2708
|
-
REDOING.set(editor, false);
|
|
2709
|
-
};
|
|
2710
|
-
return editor;
|
|
2711
|
-
};
|
|
2712
|
-
var TheHistoryEditor = {
|
|
2713
|
-
isUndoing: function (editor) {
|
|
2714
|
-
return UNDOING.get(editor);
|
|
2715
|
-
},
|
|
2716
|
-
isRedoing: function (editor) {
|
|
2717
|
-
return REDOING.get(editor);
|
|
2718
|
-
}
|
|
2719
|
-
};
|
|
2720
|
-
var createTheHistoryPlugin = createPluginFactory({
|
|
2721
|
-
key: exports.PluginKeys.theHistory,
|
|
2722
|
-
withOverrides: withTheHistory
|
|
2723
|
-
});
|
|
2724
|
-
|
|
2725
2711
|
var TheConversionHintComponent = /** @class */ (function () {
|
|
2726
2712
|
function TheConversionHintComponent() {
|
|
2727
2713
|
this.duration = 10000;
|
|
@@ -4411,7 +4397,6 @@
|
|
|
4411
4397
|
}
|
|
4412
4398
|
// wrap
|
|
4413
4399
|
ListEditor.buildListItem(editor);
|
|
4414
|
-
// Todo: types
|
|
4415
4400
|
slate.Transforms.wrapNodes(editor, { type: type, children: [], start: startIndex }, {
|
|
4416
4401
|
at: editor.selection,
|
|
4417
4402
|
match: function (node) { return slate.Element.isElement(node) && node.type === exports.ElementKinds.listItem; }
|
|
@@ -4926,7 +4911,7 @@
|
|
|
4926
4911
|
|
|
4927
4912
|
var HrEditor = {
|
|
4928
4913
|
insertHr: function (editor) {
|
|
4929
|
-
|
|
4914
|
+
insertElements(editor, { type: exports.ElementKinds.hr, children: [{ text: '' }] });
|
|
4930
4915
|
}
|
|
4931
4916
|
};
|
|
4932
4917
|
|
|
@@ -5546,7 +5531,7 @@
|
|
|
5546
5531
|
}
|
|
5547
5532
|
// Create the table node
|
|
5548
5533
|
var table = createTable(opts, columns, rows, getCellContent);
|
|
5549
|
-
|
|
5534
|
+
insertElements(editor, table);
|
|
5550
5535
|
}
|
|
5551
5536
|
|
|
5552
5537
|
/**
|
|
@@ -6417,13 +6402,13 @@
|
|
|
6417
6402
|
|
|
6418
6403
|
var BlockquoteEditor = {
|
|
6419
6404
|
toggleBlockquote: function (editor) {
|
|
6405
|
+
var _a;
|
|
6420
6406
|
var isActive = isBlockActive(editor, exports.ElementKinds.blockquote);
|
|
6407
|
+
var allowParentTypes = ((_a = getPluginOptions(editor, exports.PluginKeys.blockquote)) === null || _a === void 0 ? void 0 : _a.allowParentTypes) || [];
|
|
6421
6408
|
if (!isActive) {
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
};
|
|
6426
|
-
insertElement(editor, blockquoteElement);
|
|
6409
|
+
slate.Transforms.wrapNodes(editor, { type: exports.ElementKinds.blockquote, children: [] }, {
|
|
6410
|
+
mode: 'lowest'
|
|
6411
|
+
});
|
|
6427
6412
|
}
|
|
6428
6413
|
else {
|
|
6429
6414
|
slate.Transforms.unwrapNodes(editor, { match: function (n) { return slate.Element.isElement(n) && n.type === exports.ElementKinds.blockquote; } });
|
|
@@ -6511,7 +6496,7 @@
|
|
|
6511
6496
|
language: DEFAULT_LANGUAGE.value,
|
|
6512
6497
|
children: [{ text: '' }]
|
|
6513
6498
|
};
|
|
6514
|
-
|
|
6499
|
+
insertElements(editor, codeElement);
|
|
6515
6500
|
}
|
|
6516
6501
|
else {
|
|
6517
6502
|
var codeElement = {
|
|
@@ -6520,7 +6505,7 @@
|
|
|
6520
6505
|
language: DEFAULT_LANGUAGE.value,
|
|
6521
6506
|
children: [{ text: '' }]
|
|
6522
6507
|
};
|
|
6523
|
-
|
|
6508
|
+
insertElements(editor, codeElement);
|
|
6524
6509
|
}
|
|
6525
6510
|
}
|
|
6526
6511
|
};
|
|
@@ -14874,6 +14859,7 @@
|
|
|
14874
14859
|
exports.autoFocus = autoFocus;
|
|
14875
14860
|
exports.autoScrollViewHandle = autoScrollViewHandle;
|
|
14876
14861
|
exports.coercePixelsFromCssValue = coercePixelsFromCssValue;
|
|
14862
|
+
exports.combinePlugins = combinePlugins;
|
|
14877
14863
|
exports.createEmptyParagraph = createEmptyParagraph;
|
|
14878
14864
|
exports.createPluginFactory = createPluginFactory;
|
|
14879
14865
|
exports.createToolbar = createToolbar;
|
|
@@ -14891,9 +14877,9 @@
|
|
|
14891
14877
|
exports.getElementWidth = getElementWidth;
|
|
14892
14878
|
exports.getEndBlock = getEndBlock;
|
|
14893
14879
|
exports.getPlugin = getPlugin;
|
|
14880
|
+
exports.getPluginByKey = getPluginByKey;
|
|
14894
14881
|
exports.getPluginOptions = getPluginOptions;
|
|
14895
14882
|
exports.getPlugins = getPlugins;
|
|
14896
|
-
exports.getPluginsByKey = getPluginsByKey;
|
|
14897
14883
|
exports.getRowsTotalHeight = getRowsTotalHeight;
|
|
14898
14884
|
exports.getStartBlock = getStartBlock;
|
|
14899
14885
|
exports.getToolbarClass = getToolbarClass;
|
|
@@ -14904,10 +14890,12 @@
|
|
|
14904
14890
|
exports.internalPlugins = internalPlugins;
|
|
14905
14891
|
exports.isCleanEmptyParagraph = isCleanEmptyParagraph;
|
|
14906
14892
|
exports.isPureEmptyParagraph = isPureEmptyParagraph;
|
|
14893
|
+
exports.mergeDeepPlugins = mergeDeepPlugins;
|
|
14907
14894
|
exports.mergeElementOptions = mergeElementOptions;
|
|
14908
14895
|
exports.mergeOptions = mergeOptions;
|
|
14909
|
-
exports.
|
|
14896
|
+
exports.nestedStructureByKey = nestedStructureByKey;
|
|
14910
14897
|
exports.plainToTheia = plainToTheia;
|
|
14898
|
+
exports.pluginsByKey = pluginsByKey;
|
|
14911
14899
|
exports.setEditorUUID = setEditorUUID;
|
|
14912
14900
|
exports.useElementStyle = useElementStyle;
|
|
14913
14901
|
exports.withTheia = withTheia;
|