@worktile/theia 3.0.0-next.2 → 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 +173 -184
- 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 +2 -2
- 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 +1 -1
- 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 +165 -178
- 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,7 +1433,7 @@
|
|
|
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
|
|
|
@@ -1468,30 +1451,165 @@
|
|
|
1468
1451
|
return plugin;
|
|
1469
1452
|
};
|
|
1470
1453
|
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
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
|
+
}
|
|
1487
1473
|
});
|
|
1488
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);
|
|
1489
1549
|
}
|
|
1490
|
-
|
|
1491
|
-
|
|
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);
|
|
1492
1607
|
}
|
|
1493
|
-
return plugin;
|
|
1494
1608
|
};
|
|
1609
|
+
var createTheHistoryPlugin = createPluginFactory({
|
|
1610
|
+
key: exports.PluginKeys.theHistory,
|
|
1611
|
+
withOverrides: withTheHistory
|
|
1612
|
+
});
|
|
1495
1613
|
|
|
1496
1614
|
var setMarks = function (editor, marks, at) {
|
|
1497
1615
|
slate.Transforms.setNodes(editor, marks, {
|
|
@@ -1521,8 +1639,6 @@
|
|
|
1521
1639
|
}
|
|
1522
1640
|
};
|
|
1523
1641
|
|
|
1524
|
-
var insertElement = function (editor, element) { return editor.insertElement(element); };
|
|
1525
|
-
|
|
1526
1642
|
var isAncestor = function (node) { return slate.Element.isElement(node) || slate.Editor.isEditor(node); };
|
|
1527
1643
|
|
|
1528
1644
|
var getLastChild$1 = function (node, level) {
|
|
@@ -2347,7 +2463,7 @@
|
|
|
2347
2463
|
someNode: someNode
|
|
2348
2464
|
});
|
|
2349
2465
|
|
|
2350
|
-
var
|
|
2466
|
+
var insertElements = function (editor, element) {
|
|
2351
2467
|
var _a;
|
|
2352
2468
|
if (slate.Range.isExpanded(editor.selection)) {
|
|
2353
2469
|
slate.Editor.deleteFragment(editor);
|
|
@@ -2575,8 +2691,7 @@
|
|
|
2575
2691
|
__proto__: null,
|
|
2576
2692
|
setMarks: setMarks,
|
|
2577
2693
|
clearMarks: clearMarks,
|
|
2578
|
-
|
|
2579
|
-
insertElementNext: insertElementNext,
|
|
2694
|
+
insertElements: insertElements,
|
|
2580
2695
|
insertParagraph: insertParagraph,
|
|
2581
2696
|
setNode: setNode,
|
|
2582
2697
|
unwrapNodesByType: unwrapNodesByType,
|
|
@@ -2593,134 +2708,6 @@
|
|
|
2593
2708
|
handleContinualInsertBreak: handleContinualInsertBreak
|
|
2594
2709
|
});
|
|
2595
2710
|
|
|
2596
|
-
var withTheia = function (editor, plugins) {
|
|
2597
|
-
if (plugins === void 0) { plugins = []; }
|
|
2598
|
-
var e = editor;
|
|
2599
|
-
e.renderElement = function (element) { return null; };
|
|
2600
|
-
e.renderLeaf = function (text) { return null; };
|
|
2601
|
-
e.insertElement = function (element) { return insertElementNext(e, element); };
|
|
2602
|
-
e.isContainer = function (value) { return false; };
|
|
2603
|
-
e.extraElementOptions = [];
|
|
2604
|
-
e.disabled = false;
|
|
2605
|
-
e.plugins = [];
|
|
2606
|
-
e.pluginsByKey = {};
|
|
2607
|
-
e.nestedStructureByKey = {};
|
|
2608
|
-
// withOverridesByKey
|
|
2609
|
-
flattenDeepPlugins(e, plugins);
|
|
2610
|
-
// 如果 plugin.overrideByKey 存在,则把 plugin.overrideByKey 中的所有 key 覆盖到 editor.pluginsByKey 中
|
|
2611
|
-
editor.plugins.forEach(function (plugin) {
|
|
2612
|
-
if (plugin.overrideByKey) {
|
|
2613
|
-
var newPlugins = editor.plugins.map(function (p) {
|
|
2614
|
-
return overridePluginsByKey(p, plugin.overrideByKey);
|
|
2615
|
-
});
|
|
2616
|
-
editor.plugins = [];
|
|
2617
|
-
editor.pluginsByKey = {};
|
|
2618
|
-
// 再次扁平化覆盖
|
|
2619
|
-
flattenDeepPlugins(editor, newPlugins);
|
|
2620
|
-
}
|
|
2621
|
-
});
|
|
2622
|
-
// withOverrides
|
|
2623
|
-
e.plugins.forEach(function (plugin) {
|
|
2624
|
-
if (plugin.withOverrides) {
|
|
2625
|
-
e = plugin.withOverrides(e, plugin);
|
|
2626
|
-
}
|
|
2627
|
-
});
|
|
2628
|
-
return e;
|
|
2629
|
-
};
|
|
2630
|
-
|
|
2631
|
-
var createPluginFactory = function (defaultPlugin) { return function (override, overrideByKey) {
|
|
2632
|
-
if (overrideByKey === void 0) { overrideByKey = {}; }
|
|
2633
|
-
overrideByKey[defaultPlugin.key] = override;
|
|
2634
|
-
return overridePluginsByKey(Object.assign({}, defaultPlugin), overrideByKey);
|
|
2635
|
-
}; };
|
|
2636
|
-
|
|
2637
|
-
var toolbarInitialize = function (toolbarItems, global, inline, quick) {
|
|
2638
|
-
if (global === void 0) { global = DefaultGlobalToolbarDefinition; }
|
|
2639
|
-
if (inline === void 0) { inline = DefaultInlineToolbarDefinition; }
|
|
2640
|
-
if (quick === void 0) { quick = DefaultQuickToolbarDefinition; }
|
|
2641
|
-
var toolbarDefinition = {
|
|
2642
|
-
global: global,
|
|
2643
|
-
inline: inline,
|
|
2644
|
-
quick: quick
|
|
2645
|
-
};
|
|
2646
|
-
var toolbarOperations = new Map();
|
|
2647
|
-
toolbarItems.forEach(function (i) { return toolbarOperations.set(i.key, i); });
|
|
2648
|
-
var toolbarEntity = nextToolbarEntity(toolbarDefinition, toolbarOperations);
|
|
2649
|
-
return {
|
|
2650
|
-
toolbarDefinition: toolbarDefinition,
|
|
2651
|
-
toolbarOperations: toolbarOperations,
|
|
2652
|
-
toolbarEntity: toolbarEntity
|
|
2653
|
-
};
|
|
2654
|
-
};
|
|
2655
|
-
var nextToolbarEntity = function (toolbarDefinition, toolbarItems) {
|
|
2656
|
-
var entity = {};
|
|
2657
|
-
for (var defKey in toolbarDefinition) {
|
|
2658
|
-
entity[defKey] = getToolbarItemByKeys(toolbarDefinition[defKey], toolbarItems);
|
|
2659
|
-
}
|
|
2660
|
-
return entity;
|
|
2661
|
-
};
|
|
2662
|
-
var getToolbarItemByKeys = function (keys, toolbarItems) {
|
|
2663
|
-
var items = [];
|
|
2664
|
-
keys.forEach(function (key) {
|
|
2665
|
-
if (key === "split") {
|
|
2666
|
-
items.push({ key: "split" });
|
|
2667
|
-
return;
|
|
2668
|
-
}
|
|
2669
|
-
var item = toolbarItems.get(key);
|
|
2670
|
-
if (item && item.includes) {
|
|
2671
|
-
items.push(Object.assign(Object.assign({}, item), { includes: getToolbarItemByKeys(item.includes, toolbarItems) }));
|
|
2672
|
-
return;
|
|
2673
|
-
}
|
|
2674
|
-
if (item) {
|
|
2675
|
-
items.push(item);
|
|
2676
|
-
}
|
|
2677
|
-
});
|
|
2678
|
-
return items;
|
|
2679
|
-
};
|
|
2680
|
-
var createToolbar = function (editor, toolbar) {
|
|
2681
|
-
var toolbarItems = editor === null || editor === void 0 ? void 0 : editor.plugins.reduce(function (prevItems, nextPlugin) {
|
|
2682
|
-
var _a;
|
|
2683
|
-
prevItems.push.apply(prevItems, __spreadArray([], __read(((_a = nextPlugin === null || nextPlugin === void 0 ? void 0 : nextPlugin.toolbarItems) !== null && _a !== void 0 ? _a : []))));
|
|
2684
|
-
return prevItems;
|
|
2685
|
-
}, []);
|
|
2686
|
-
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);
|
|
2687
|
-
var globalToolbarClass = ['the-global-toolbar', getToolbarClass(editor)];
|
|
2688
|
-
var toolbarEntity = toolbarOption.toolbarEntity;
|
|
2689
|
-
return {
|
|
2690
|
-
globalToolbarClass: globalToolbarClass,
|
|
2691
|
-
toolbarEntity: toolbarEntity
|
|
2692
|
-
};
|
|
2693
|
-
};
|
|
2694
|
-
|
|
2695
|
-
var UNDOING = new WeakMap();
|
|
2696
|
-
var REDOING = new WeakMap();
|
|
2697
|
-
var withTheHistory = function (editor) {
|
|
2698
|
-
var undo = editor.undo, redo = editor.redo;
|
|
2699
|
-
editor.undo = function () {
|
|
2700
|
-
UNDOING.set(editor, true);
|
|
2701
|
-
undo();
|
|
2702
|
-
UNDOING.set(editor, false);
|
|
2703
|
-
};
|
|
2704
|
-
editor.redo = function () {
|
|
2705
|
-
REDOING.set(editor, true);
|
|
2706
|
-
redo();
|
|
2707
|
-
REDOING.set(editor, false);
|
|
2708
|
-
};
|
|
2709
|
-
return editor;
|
|
2710
|
-
};
|
|
2711
|
-
var TheHistoryEditor = {
|
|
2712
|
-
isUndoing: function (editor) {
|
|
2713
|
-
return UNDOING.get(editor);
|
|
2714
|
-
},
|
|
2715
|
-
isRedoing: function (editor) {
|
|
2716
|
-
return REDOING.get(editor);
|
|
2717
|
-
}
|
|
2718
|
-
};
|
|
2719
|
-
var createTheHistoryPlugin = createPluginFactory({
|
|
2720
|
-
key: exports.PluginKeys.theHistory,
|
|
2721
|
-
withOverrides: withTheHistory
|
|
2722
|
-
});
|
|
2723
|
-
|
|
2724
2711
|
var TheConversionHintComponent = /** @class */ (function () {
|
|
2725
2712
|
function TheConversionHintComponent() {
|
|
2726
2713
|
this.duration = 10000;
|
|
@@ -4410,7 +4397,6 @@
|
|
|
4410
4397
|
}
|
|
4411
4398
|
// wrap
|
|
4412
4399
|
ListEditor.buildListItem(editor);
|
|
4413
|
-
// Todo: types
|
|
4414
4400
|
slate.Transforms.wrapNodes(editor, { type: type, children: [], start: startIndex }, {
|
|
4415
4401
|
at: editor.selection,
|
|
4416
4402
|
match: function (node) { return slate.Element.isElement(node) && node.type === exports.ElementKinds.listItem; }
|
|
@@ -4925,7 +4911,7 @@
|
|
|
4925
4911
|
|
|
4926
4912
|
var HrEditor = {
|
|
4927
4913
|
insertHr: function (editor) {
|
|
4928
|
-
|
|
4914
|
+
insertElements(editor, { type: exports.ElementKinds.hr, children: [{ text: '' }] });
|
|
4929
4915
|
}
|
|
4930
4916
|
};
|
|
4931
4917
|
|
|
@@ -5545,7 +5531,7 @@
|
|
|
5545
5531
|
}
|
|
5546
5532
|
// Create the table node
|
|
5547
5533
|
var table = createTable(opts, columns, rows, getCellContent);
|
|
5548
|
-
|
|
5534
|
+
insertElements(editor, table);
|
|
5549
5535
|
}
|
|
5550
5536
|
|
|
5551
5537
|
/**
|
|
@@ -6416,13 +6402,13 @@
|
|
|
6416
6402
|
|
|
6417
6403
|
var BlockquoteEditor = {
|
|
6418
6404
|
toggleBlockquote: function (editor) {
|
|
6405
|
+
var _a;
|
|
6419
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) || [];
|
|
6420
6408
|
if (!isActive) {
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
};
|
|
6425
|
-
insertElement(editor, blockquoteElement);
|
|
6409
|
+
slate.Transforms.wrapNodes(editor, { type: exports.ElementKinds.blockquote, children: [] }, {
|
|
6410
|
+
mode: 'lowest'
|
|
6411
|
+
});
|
|
6426
6412
|
}
|
|
6427
6413
|
else {
|
|
6428
6414
|
slate.Transforms.unwrapNodes(editor, { match: function (n) { return slate.Element.isElement(n) && n.type === exports.ElementKinds.blockquote; } });
|
|
@@ -6510,7 +6496,7 @@
|
|
|
6510
6496
|
language: DEFAULT_LANGUAGE.value,
|
|
6511
6497
|
children: [{ text: '' }]
|
|
6512
6498
|
};
|
|
6513
|
-
|
|
6499
|
+
insertElements(editor, codeElement);
|
|
6514
6500
|
}
|
|
6515
6501
|
else {
|
|
6516
6502
|
var codeElement = {
|
|
@@ -6519,7 +6505,7 @@
|
|
|
6519
6505
|
language: DEFAULT_LANGUAGE.value,
|
|
6520
6506
|
children: [{ text: '' }]
|
|
6521
6507
|
};
|
|
6522
|
-
|
|
6508
|
+
insertElements(editor, codeElement);
|
|
6523
6509
|
}
|
|
6524
6510
|
}
|
|
6525
6511
|
};
|
|
@@ -14873,6 +14859,7 @@
|
|
|
14873
14859
|
exports.autoFocus = autoFocus;
|
|
14874
14860
|
exports.autoScrollViewHandle = autoScrollViewHandle;
|
|
14875
14861
|
exports.coercePixelsFromCssValue = coercePixelsFromCssValue;
|
|
14862
|
+
exports.combinePlugins = combinePlugins;
|
|
14876
14863
|
exports.createEmptyParagraph = createEmptyParagraph;
|
|
14877
14864
|
exports.createPluginFactory = createPluginFactory;
|
|
14878
14865
|
exports.createToolbar = createToolbar;
|
|
@@ -14890,9 +14877,9 @@
|
|
|
14890
14877
|
exports.getElementWidth = getElementWidth;
|
|
14891
14878
|
exports.getEndBlock = getEndBlock;
|
|
14892
14879
|
exports.getPlugin = getPlugin;
|
|
14880
|
+
exports.getPluginByKey = getPluginByKey;
|
|
14893
14881
|
exports.getPluginOptions = getPluginOptions;
|
|
14894
14882
|
exports.getPlugins = getPlugins;
|
|
14895
|
-
exports.getPluginsByKey = getPluginsByKey;
|
|
14896
14883
|
exports.getRowsTotalHeight = getRowsTotalHeight;
|
|
14897
14884
|
exports.getStartBlock = getStartBlock;
|
|
14898
14885
|
exports.getToolbarClass = getToolbarClass;
|
|
@@ -14903,10 +14890,12 @@
|
|
|
14903
14890
|
exports.internalPlugins = internalPlugins;
|
|
14904
14891
|
exports.isCleanEmptyParagraph = isCleanEmptyParagraph;
|
|
14905
14892
|
exports.isPureEmptyParagraph = isPureEmptyParagraph;
|
|
14893
|
+
exports.mergeDeepPlugins = mergeDeepPlugins;
|
|
14906
14894
|
exports.mergeElementOptions = mergeElementOptions;
|
|
14907
14895
|
exports.mergeOptions = mergeOptions;
|
|
14908
|
-
exports.
|
|
14896
|
+
exports.nestedStructureByKey = nestedStructureByKey;
|
|
14909
14897
|
exports.plainToTheia = plainToTheia;
|
|
14898
|
+
exports.pluginsByKey = pluginsByKey;
|
|
14910
14899
|
exports.setEditorUUID = setEditorUUID;
|
|
14911
14900
|
exports.useElementStyle = useElementStyle;
|
|
14912
14901
|
exports.withTheia = withTheia;
|