@worktile/theia 3.0.1 → 3.0.2
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 +27 -6
- package/bundles/worktile-theia.umd.js.map +1 -1
- package/core/utils/index.d.ts +1 -0
- package/core/utils/merge-array.d.ts +1 -0
- package/esm2015/core/utils/index.js +2 -1
- package/esm2015/core/utils/merge-array.js +18 -0
- package/esm2015/core/utils/merge-deep-plugins.js +1 -3
- package/esm2015/core/utils/merge-options.js +4 -3
- package/esm2015/editor.component.js +3 -2
- package/esm2015/interfaces/plugins/plugins.js +1 -1
- package/esm2015/plugins/autoformat/autoformat.plugin.js +1 -1
- package/esm2015/plugins/index.js +2 -2
- package/fesm2015/worktile-theia.js +23 -6
- package/fesm2015/worktile-theia.js.map +1 -1
- package/interfaces/plugins/plugins.d.ts +3 -0
- package/package.json +1 -1
- package/plugins/autoformat/autoformat.plugin.d.ts +1 -1
- package/plugins/index.d.ts +1 -1
|
@@ -1429,12 +1429,32 @@
|
|
|
1429
1429
|
|
|
1430
1430
|
var getPluginOptions = function (editor, key) { var _a, _b; return (_b = (_a = getPlugin(editor, key)) === null || _a === void 0 ? void 0 : _a.options) !== null && _b !== void 0 ? _b : {}; };
|
|
1431
1431
|
|
|
1432
|
+
var mergeArray = function (origin, source) {
|
|
1433
|
+
if (!Array.isArray(source))
|
|
1434
|
+
return source;
|
|
1435
|
+
var _loop_1 = function (i) {
|
|
1436
|
+
var value = source[i];
|
|
1437
|
+
if (util.isObject(value) && (value === null || value === void 0 ? void 0 : value.key) && origin.some(function (item) { return (item === null || item === void 0 ? void 0 : item.key) === (value === null || value === void 0 ? void 0 : value.key); })) {
|
|
1438
|
+
var index = origin.findIndex(function (item) { return (item === null || item === void 0 ? void 0 : item.key) === (value === null || value === void 0 ? void 0 : value.key); });
|
|
1439
|
+
origin[index] = Object.assign(Object.assign({}, origin[index]), value);
|
|
1440
|
+
return "continue";
|
|
1441
|
+
}
|
|
1442
|
+
if (origin.includes(source[i]))
|
|
1443
|
+
return "continue";
|
|
1444
|
+
origin.push(source[i]);
|
|
1445
|
+
};
|
|
1446
|
+
for (var i = 0; i < source.length; i++) {
|
|
1447
|
+
_loop_1(i);
|
|
1448
|
+
}
|
|
1449
|
+
return origin;
|
|
1450
|
+
};
|
|
1451
|
+
|
|
1432
1452
|
var mergeOptions = function (plugin, override) {
|
|
1433
1453
|
var options = plugin.options;
|
|
1434
1454
|
var newOptions = {};
|
|
1435
1455
|
for (var option in options) {
|
|
1436
|
-
if (Array.isArray(options[option])) {
|
|
1437
|
-
newOptions[option] =
|
|
1456
|
+
if (Array.isArray(options[option]) && override.options[option]) {
|
|
1457
|
+
newOptions[option] = mergeArray(options[option], override.options[option]);
|
|
1438
1458
|
continue;
|
|
1439
1459
|
}
|
|
1440
1460
|
if (util.isObject(options[option])) {
|
|
@@ -1463,7 +1483,6 @@
|
|
|
1463
1483
|
newPlugins.forEach(function (p) {
|
|
1464
1484
|
if (editor.pluginsByKey[p.key]) {
|
|
1465
1485
|
mergeOptions(p, plugin.overrideByKey[p.key]);
|
|
1466
|
-
editor.pluginsByKey[p.key] = _.defaultsDeep(p, plugin.overrideByKey[p.key]);
|
|
1467
1486
|
}
|
|
1468
1487
|
});
|
|
1469
1488
|
}
|
|
@@ -13334,7 +13353,7 @@
|
|
|
13334
13353
|
]
|
|
13335
13354
|
});
|
|
13336
13355
|
|
|
13337
|
-
var internalPlugins = [
|
|
13356
|
+
var internalPlugins = function () { return [
|
|
13338
13357
|
createTheHistoryPlugin(),
|
|
13339
13358
|
createAutoInsertDataPlugin(),
|
|
13340
13359
|
createRemoveEmptyPlugin(),
|
|
@@ -13369,7 +13388,7 @@
|
|
|
13369
13388
|
createDeserializeMdPlugin(),
|
|
13370
13389
|
createQuickInsertPlugin(),
|
|
13371
13390
|
createInlineCodePlugin()
|
|
13372
|
-
];
|
|
13391
|
+
]; };
|
|
13373
13392
|
|
|
13374
13393
|
var HOTKEYS = {
|
|
13375
13394
|
'mod+b': exports.MarkTypes.bold,
|
|
@@ -14194,7 +14213,8 @@
|
|
|
14194
14213
|
TheEditorComponent.prototype.initialize = function () {
|
|
14195
14214
|
var _this = this;
|
|
14196
14215
|
var _a, _b;
|
|
14197
|
-
var
|
|
14216
|
+
var defaultPlugins = internalPlugins();
|
|
14217
|
+
var plugins = __spreadArray(__spreadArray([], __read(defaultPlugins)), __read(this.thePlugins));
|
|
14198
14218
|
this.editor = withTheia(slateHistory.withHistory(i1.withAngular(slate.createEditor(), CLIPBOARD_FORMAT_KEY)), plugins);
|
|
14199
14219
|
this.generateDecorate();
|
|
14200
14220
|
this.editor.disabled = (_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.disabled;
|
|
@@ -14914,6 +14934,7 @@
|
|
|
14914
14934
|
exports.internalPlugins = internalPlugins;
|
|
14915
14935
|
exports.isCleanEmptyParagraph = isCleanEmptyParagraph;
|
|
14916
14936
|
exports.isPureEmptyParagraph = isPureEmptyParagraph;
|
|
14937
|
+
exports.mergeArray = mergeArray;
|
|
14917
14938
|
exports.mergeDeepPlugins = mergeDeepPlugins;
|
|
14918
14939
|
exports.mergeElementOptions = mergeElementOptions;
|
|
14919
14940
|
exports.mergeOptions = mergeOptions;
|