@worktile/theia 3.0.0-next.3 → 3.0.0-next.6
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 +113 -59
- package/bundles/worktile-theia.umd.js.map +1 -1
- package/core/utils/merge-options.d.ts +1 -1
- package/esm2015/core/utils/merge-deep-plugins.js +2 -2
- package/esm2015/core/utils/merge-options.js +6 -3
- package/esm2015/core/with-theia.js +1 -1
- package/esm2015/editor.component.js +2 -3
- package/esm2015/interfaces/editor.js +1 -1
- package/esm2015/interfaces/utility/nested-structure-by-key.js +1 -1
- package/esm2015/plugins/autoformat/autoformat.plugin.js +11 -11
- package/esm2015/plugins/image/image.editor.js +3 -8
- package/esm2015/plugins/list/list.plugin.js +3 -3
- package/esm2015/plugins/quick-insert/quick-insert.plugin.js +4 -4
- package/esm2015/plugins/table/table.plugin.js +3 -3
- package/esm2015/plugins/todo-item/todo-item.component.js +8 -9
- package/esm2015/plugins/todo-item/todo-item.plugin.js +3 -2
- package/esm2015/queries/get-insert-elements-path.js +73 -0
- package/esm2015/queries/index.js +3 -3
- package/esm2015/transforms/insert-elements.js +10 -15
- package/fesm2015/worktile-theia.js +102 -56
- package/fesm2015/worktile-theia.js.map +1 -1
- package/interfaces/editor.d.ts +1 -6
- package/interfaces/utility/nested-structure-by-key.d.ts +1 -1
- package/package.json +1 -1
- package/plugins/autoformat/autoformat.plugin.d.ts +5 -1
- package/plugins/quick-insert/quick-insert.plugin.d.ts +2 -0
- package/plugins/todo-item/todo-item.component.d.ts +1 -0
- package/plugins/todo-item/todo-item.plugin.d.ts +4 -1
- package/queries/get-insert-elements-path.d.ts +4 -0
- package/queries/index.d.ts +2 -2
- package/transforms/insert-elements.d.ts +1 -1
- package/esm2015/queries/is-types-in-parent.js +0 -16
- package/queries/is-types-in-parent.d.ts +0 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('slate-angular'), require('ngx-tethys/core'), require('is-hotkey'), require('slate'), require('slate-history'), require('rxjs'), require('ngx-tethys/popover'), require('ngx-tethys/icon'), require('ngx-tethys/input'), require('@atinc/selene'), require('lodash'), require('@angular/cdk/overlay'), require('marked'), require('ngx-tethys/alert'), require('rxjs/operators'), require('ngx-tethys/uploader'), require('@angular/platform-browser'), require('ngx-tethys/progress'), require('ngx-tethys/nav'), require('ngx-tethys/tooltip'), require('ng-codemirror'), require('ngx-tethys/notify'), require('ngx-tethys/action-menu'), require('ngx-tethys/switch'), require('ngx-tethys/resizable'), require('is-url'), require('ngx-tethys/button'), require('ngx-tethys/form'), require('ngx-tethys/shared'), require('ngx-tethys'), require('@angular/cdk/coercion'), require('@angular/cdk/portal'), require('ngx-tethys/list'), require('ngx-tethys/autocomplete'), require('ngx-tethys/avatar'), require('ngx-tethys/select')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@worktile/theia', ['exports', '@angular/core', '@angular/common', '@angular/forms', 'slate-angular', 'ngx-tethys/core', 'is-hotkey', 'slate', 'slate-history', 'rxjs', 'ngx-tethys/popover', 'ngx-tethys/icon', 'ngx-tethys/input', '@atinc/selene', 'lodash', '@angular/cdk/overlay', 'marked', 'ngx-tethys/alert', 'rxjs/operators', 'ngx-tethys/uploader', '@angular/platform-browser', 'ngx-tethys/progress', 'ngx-tethys/nav', 'ngx-tethys/tooltip', 'ng-codemirror', 'ngx-tethys/notify', 'ngx-tethys/action-menu', 'ngx-tethys/switch', 'ngx-tethys/resizable', 'is-url', 'ngx-tethys/button', 'ngx-tethys/form', 'ngx-tethys/shared', 'ngx-tethys', '@angular/cdk/coercion', '@angular/cdk/portal', 'ngx-tethys/list', 'ngx-tethys/autocomplete', 'ngx-tethys/avatar', 'ngx-tethys/select'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.worktile = global.worktile || {}, global.worktile.theia = {}), global.ng.core, global.ng.common, global.ng.forms, global.i1, global.core, global.isHotkey, global.slate, global.slateHistory, global.rxjs, global.i1$1, global.i4, global.i5, global.selene, global._lodash, global.ng.cdk.overlay, global.marked, global.i1$2, global.rxjs.operators, global.uploader, global.ng.platformBrowser, global.i6, global.i3, global.i5$1, global.i8, global.i1$4, global.i2$1, global.i5$2, global.i9, global.isUrl, global.i1$5, global.i2$2, global.i5$3, global.i1$6, global.ng.cdk.coercion, global.ng.cdk.portal, global.i1$7, global.autocomplete, global.avatar, global.select));
|
|
5
|
-
})(this, (function (exports, i0, i10, i4$1, i1, core, isHotkey, slate, slateHistory, rxjs, i1$1, i4, i5, selene, _lodash, i2, marked, i1$2, operators, uploader, i1$3, i6, i3, i5$1, i8, i1$4, i2$1, i5$2, i9, isUrl, i1$5, i2$2, i5$3, i1$6, coercion, portal, i1$7, autocomplete, avatar, select) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('slate-angular'), require('ngx-tethys/core'), require('is-hotkey'), require('slate'), require('slate-history'), require('rxjs'), require('ngx-tethys/popover'), require('ngx-tethys/icon'), require('ngx-tethys/input'), require('@atinc/selene'), require('lodash'), require('ngx-tethys/util'), require('@angular/cdk/overlay'), require('marked'), require('ngx-tethys/alert'), require('rxjs/operators'), require('ngx-tethys/uploader'), require('@angular/platform-browser'), require('ngx-tethys/progress'), require('ngx-tethys/nav'), require('ngx-tethys/tooltip'), require('ng-codemirror'), require('ngx-tethys/notify'), require('ngx-tethys/action-menu'), require('ngx-tethys/switch'), require('ngx-tethys/resizable'), require('is-url'), require('ngx-tethys/button'), require('ngx-tethys/form'), require('ngx-tethys/shared'), require('ngx-tethys'), require('@angular/cdk/coercion'), require('@angular/cdk/portal'), require('ngx-tethys/list'), require('ngx-tethys/autocomplete'), require('ngx-tethys/avatar'), require('ngx-tethys/select')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@worktile/theia', ['exports', '@angular/core', '@angular/common', '@angular/forms', 'slate-angular', 'ngx-tethys/core', 'is-hotkey', 'slate', 'slate-history', 'rxjs', 'ngx-tethys/popover', 'ngx-tethys/icon', 'ngx-tethys/input', '@atinc/selene', 'lodash', 'ngx-tethys/util', '@angular/cdk/overlay', 'marked', 'ngx-tethys/alert', 'rxjs/operators', 'ngx-tethys/uploader', '@angular/platform-browser', 'ngx-tethys/progress', 'ngx-tethys/nav', 'ngx-tethys/tooltip', 'ng-codemirror', 'ngx-tethys/notify', 'ngx-tethys/action-menu', 'ngx-tethys/switch', 'ngx-tethys/resizable', 'is-url', 'ngx-tethys/button', 'ngx-tethys/form', 'ngx-tethys/shared', 'ngx-tethys', '@angular/cdk/coercion', '@angular/cdk/portal', 'ngx-tethys/list', 'ngx-tethys/autocomplete', 'ngx-tethys/avatar', 'ngx-tethys/select'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.worktile = global.worktile || {}, global.worktile.theia = {}), global.ng.core, global.ng.common, global.ng.forms, global.i1, global.core, global.isHotkey, global.slate, global.slateHistory, global.rxjs, global.i1$1, global.i4, global.i5, global.selene, global._lodash, global.util, global.ng.cdk.overlay, global.marked, global.i1$2, global.rxjs.operators, global.uploader, global.ng.platformBrowser, global.i6, global.i3, global.i5$1, global.i8, global.i1$4, global.i2$1, global.i5$2, global.i9, global.isUrl, global.i1$5, global.i2$2, global.i5$3, global.i1$6, global.ng.cdk.coercion, global.ng.cdk.portal, global.i1$7, global.autocomplete, global.avatar, global.select));
|
|
5
|
+
})(this, (function (exports, i0, i10, i4$1, i1, core, isHotkey, slate, slateHistory, rxjs, i1$1, i4, i5, selene, _lodash, util, i2, marked, i1$2, operators, uploader, i1$3, i6, i3, i5$1, i8, i1$4, i2$1, i5$2, i9, isUrl, i1$5, i2$2, i5$3, i1$6, coercion, portal, i1$7, autocomplete, avatar, select) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -1445,10 +1445,12 @@
|
|
|
1445
1445
|
newOptions[option] = _.union(options[option], override.options[option]);
|
|
1446
1446
|
continue;
|
|
1447
1447
|
}
|
|
1448
|
-
|
|
1448
|
+
if (util.isObject(options[option])) {
|
|
1449
|
+
newOptions[option] = _.assign(options[option], override.options[option]);
|
|
1450
|
+
}
|
|
1451
|
+
newOptions[option] = override.options[option] ? override.options[option] : options[option];
|
|
1449
1452
|
}
|
|
1450
1453
|
plugin.options = newOptions;
|
|
1451
|
-
return plugin;
|
|
1452
1454
|
};
|
|
1453
1455
|
|
|
1454
1456
|
var combinePlugins = function (editor) {
|
|
@@ -1467,7 +1469,7 @@
|
|
|
1467
1469
|
var newPlugins = _plugins.filter(function (p) { return plugin.overrideByKey[p.key]; });
|
|
1468
1470
|
newPlugins.forEach(function (p) {
|
|
1469
1471
|
if (editor.pluginsByKey[p.key]) {
|
|
1470
|
-
|
|
1472
|
+
mergeOptions(p, plugin.overrideByKey[p.key]);
|
|
1471
1473
|
editor.pluginsByKey[p.key] = _.defaultsDeep(p, plugin.overrideByKey[p.key]);
|
|
1472
1474
|
}
|
|
1473
1475
|
});
|
|
@@ -2363,18 +2365,78 @@
|
|
|
2363
2365
|
return parentEntry;
|
|
2364
2366
|
};
|
|
2365
2367
|
|
|
2366
|
-
var
|
|
2367
|
-
if (!Array.isArray(types)) {
|
|
2368
|
-
types = [types];
|
|
2369
|
-
}
|
|
2368
|
+
var getInsertElementsPath = function (editor, allowParentTypes) {
|
|
2370
2369
|
var _a = __read(getBlockAbove(editor), 2), anchorPath = _a[1];
|
|
2371
2370
|
if (!anchorPath)
|
|
2372
2371
|
return false;
|
|
2373
|
-
var parentEntry = slate.Editor.above(editor, { match: function (n) { return
|
|
2372
|
+
var parentEntry = slate.Editor.above(editor, { match: function (n) { return slate.Editor.isBlock(editor, n) && allowParentTypes.includes(n.type); } });
|
|
2374
2373
|
if (!parentEntry)
|
|
2375
2374
|
return false;
|
|
2376
|
-
var _b = __read(
|
|
2377
|
-
|
|
2375
|
+
var _b = __read(anchorBlockEntry(editor), 2), anchorBlockPath = _b[1];
|
|
2376
|
+
var currentNodePath = anchorBlockPath.slice(0, parentEntry[1].length + 1);
|
|
2377
|
+
var illegalParentEntry = null;
|
|
2378
|
+
var _loop_1 = function () {
|
|
2379
|
+
var _illegalParentEntry = parentEntry &&
|
|
2380
|
+
slate.Editor.above(editor, {
|
|
2381
|
+
mode: 'lowest',
|
|
2382
|
+
at: parentEntry[1],
|
|
2383
|
+
match: function (n) { return n.type && !allowParentTypes.includes(n.type); }
|
|
2384
|
+
});
|
|
2385
|
+
if (_illegalParentEntry) {
|
|
2386
|
+
var childType = editor.nestedStructureByKey[_illegalParentEntry[0].type];
|
|
2387
|
+
if (!childType) {
|
|
2388
|
+
illegalParentEntry = _illegalParentEntry;
|
|
2389
|
+
}
|
|
2390
|
+
if (allowParentTypes.includes(childType)) {
|
|
2391
|
+
var rootKey_1 = findNestedStructureRootType(editor, _illegalParentEntry[0].type, '');
|
|
2392
|
+
parentEntry =
|
|
2393
|
+
parentEntry &&
|
|
2394
|
+
slate.Editor.above(editor, {
|
|
2395
|
+
mode: 'lowest',
|
|
2396
|
+
at: parentEntry[1],
|
|
2397
|
+
match: function (n) { return n.type && n.type === rootKey_1; }
|
|
2398
|
+
});
|
|
2399
|
+
}
|
|
2400
|
+
else {
|
|
2401
|
+
parentEntry = _illegalParentEntry;
|
|
2402
|
+
}
|
|
2403
|
+
}
|
|
2404
|
+
else {
|
|
2405
|
+
return "break";
|
|
2406
|
+
}
|
|
2407
|
+
};
|
|
2408
|
+
// 循环获取最外层的不可插入节点
|
|
2409
|
+
while (true) {
|
|
2410
|
+
var state_1 = _loop_1();
|
|
2411
|
+
if (state_1 === "break")
|
|
2412
|
+
break;
|
|
2413
|
+
}
|
|
2414
|
+
// 获取不可插入节点的根层节点
|
|
2415
|
+
if (illegalParentEntry) {
|
|
2416
|
+
var rootKey_2 = findNestedStructureRootType(editor, illegalParentEntry[0].type, '');
|
|
2417
|
+
if (rootKey_2 && illegalParentEntry[0].type !== rootKey_2) {
|
|
2418
|
+
illegalParentEntry = slate.Editor.above(editor, {
|
|
2419
|
+
mode: 'lowest',
|
|
2420
|
+
at: parentEntry[1],
|
|
2421
|
+
match: function (n) { return n.type && n.type === rootKey_2; }
|
|
2422
|
+
});
|
|
2423
|
+
}
|
|
2424
|
+
currentNodePath = illegalParentEntry && illegalParentEntry[1];
|
|
2425
|
+
}
|
|
2426
|
+
return currentNodePath && slate.Path.next(currentNodePath);
|
|
2427
|
+
};
|
|
2428
|
+
// 获取具有嵌套关系的根类型
|
|
2429
|
+
var findNestedStructureRootType = function (editor, type, rootKey) {
|
|
2430
|
+
var parentKey = _lodash__namespace.findKey(editor.nestedStructureByKey, function (value) {
|
|
2431
|
+
return value === type;
|
|
2432
|
+
});
|
|
2433
|
+
if (parentKey) {
|
|
2434
|
+
rootKey = parentKey;
|
|
2435
|
+
return findNestedStructureRootType(editor, parentKey, rootKey);
|
|
2436
|
+
}
|
|
2437
|
+
else {
|
|
2438
|
+
return rootKey || type;
|
|
2439
|
+
}
|
|
2378
2440
|
};
|
|
2379
2441
|
|
|
2380
2442
|
var isContainNestedType = function (editor, types) {
|
|
@@ -2452,7 +2514,7 @@
|
|
|
2452
2514
|
isBlockCardCursor: isBlockCardCursor,
|
|
2453
2515
|
isEmptyParagraphByPath: isEmptyParagraphByPath,
|
|
2454
2516
|
isContainer: isContainer,
|
|
2455
|
-
|
|
2517
|
+
getInsertElementsPath: getInsertElementsPath,
|
|
2456
2518
|
isContainNestedType: isContainNestedType,
|
|
2457
2519
|
anchorBlock: anchorBlock,
|
|
2458
2520
|
anchorBlockEntry: anchorBlockEntry,
|
|
@@ -2463,26 +2525,20 @@
|
|
|
2463
2525
|
someNode: someNode
|
|
2464
2526
|
});
|
|
2465
2527
|
|
|
2466
|
-
var insertElements = function (editor,
|
|
2528
|
+
var insertElements = function (editor, elements) {
|
|
2467
2529
|
var _a;
|
|
2468
2530
|
if (slate.Range.isExpanded(editor.selection)) {
|
|
2469
2531
|
slate.Editor.deleteFragment(editor);
|
|
2470
2532
|
}
|
|
2471
|
-
var type =
|
|
2533
|
+
var type = !util.isArray(elements) ? elements.type : elements[0].type; // 后期处理复制粘贴需要修改
|
|
2472
2534
|
var allowParentTypes = ((_a = getPluginOptions(editor, type)) === null || _a === void 0 ? void 0 : _a.allowParentTypes) || [];
|
|
2473
|
-
var
|
|
2535
|
+
var insertNodePath = getInsertElementsPath(editor, allowParentTypes);
|
|
2474
2536
|
var _b = __read(anchorBlockEntry(editor), 2), anchorBlock = _b[0], anchorBlockPath = _b[1];
|
|
2475
2537
|
var isEmpty = slate.Editor.isEmpty(editor, anchorBlock);
|
|
2476
|
-
|
|
2477
|
-
if (isAllowInsert && isContainNested) {
|
|
2478
|
-
var _c = __read(slate.Editor.above(editor, {
|
|
2479
|
-
match: function (n) { return slate.Editor.isBlock(editor, n) && allowParentTypes.includes(n.type); },
|
|
2480
|
-
at: editor.selection
|
|
2481
|
-
}), 2), containerPath_1 = _c[1];
|
|
2538
|
+
if (insertNodePath) {
|
|
2482
2539
|
slate.Editor.withoutNormalizing(editor, function () {
|
|
2483
|
-
|
|
2484
|
-
slate.Transforms.
|
|
2485
|
-
slate.Transforms.select(editor, slate.Editor.start(editor, slate.Path.next(containerPathFirstPath)));
|
|
2540
|
+
slate.Transforms.insertNodes(editor, elements, { at: insertNodePath });
|
|
2541
|
+
slate.Transforms.select(editor, slate.Editor.start(editor, insertNodePath));
|
|
2486
2542
|
if (isEmpty) {
|
|
2487
2543
|
slate.Transforms.removeNodes(editor, { at: anchorBlockPath });
|
|
2488
2544
|
}
|
|
@@ -2490,7 +2546,7 @@
|
|
|
2490
2546
|
return;
|
|
2491
2547
|
}
|
|
2492
2548
|
var nextPath = slate.Path.next([anchorBlockPath[0]]);
|
|
2493
|
-
slate.Transforms.insertNodes(editor,
|
|
2549
|
+
slate.Transforms.insertNodes(editor, elements, { at: nextPath });
|
|
2494
2550
|
if (isEmpty && anchorBlockPath.length === 1) {
|
|
2495
2551
|
slate.Transforms.delete(editor, { at: anchorBlockPath });
|
|
2496
2552
|
slate.Transforms.select(editor, slate.Editor.start(editor, anchorBlockPath));
|
|
@@ -3063,12 +3119,7 @@
|
|
|
3063
3119
|
finally { if (e_1) throw e_1.error; }
|
|
3064
3120
|
}
|
|
3065
3121
|
if (imageNodes.length > 0) {
|
|
3066
|
-
|
|
3067
|
-
slate.Transforms.insertNodes(editor, imageNodes, { at: at });
|
|
3068
|
-
if (isCollapsed(editor.selection) && isEmptyParagraph(editor)) {
|
|
3069
|
-
slate.Transforms.removeNodes(editor, { at: at });
|
|
3070
|
-
slate.Transforms.select(editor, at);
|
|
3071
|
-
}
|
|
3122
|
+
insertElements(editor, imageNodes);
|
|
3072
3123
|
}
|
|
3073
3124
|
},
|
|
3074
3125
|
verifyImage: function (editor, image) {
|
|
@@ -4708,8 +4759,8 @@
|
|
|
4708
4759
|
}
|
|
4709
4760
|
],
|
|
4710
4761
|
nestedStructureByKey: (_c = {},
|
|
4711
|
-
_c[exports.ElementKinds.bulletedList] =
|
|
4712
|
-
_c[exports.ElementKinds.numberedList] =
|
|
4762
|
+
_c[exports.ElementKinds.bulletedList] = exports.ElementKinds.listItem,
|
|
4763
|
+
_c[exports.ElementKinds.numberedList] = exports.ElementKinds.listItem,
|
|
4713
4764
|
_c),
|
|
4714
4765
|
toolbarItems: [
|
|
4715
4766
|
{
|
|
@@ -4749,18 +4800,21 @@
|
|
|
4749
4800
|
enumerable: false,
|
|
4750
4801
|
configurable: true
|
|
4751
4802
|
});
|
|
4803
|
+
Object.defineProperty(TheTodoItemComponent.prototype, "editableWithReadonly", {
|
|
4804
|
+
get: function () {
|
|
4805
|
+
var _a;
|
|
4806
|
+
return (_a = getPluginOptions(this.editor, exports.PluginKeys.checkItem)) === null || _a === void 0 ? void 0 : _a.editableWithReadonly;
|
|
4807
|
+
},
|
|
4808
|
+
enumerable: false,
|
|
4809
|
+
configurable: true
|
|
4810
|
+
});
|
|
4752
4811
|
TheTodoItemComponent.prototype.ngOnInit = function () {
|
|
4753
4812
|
_super.prototype.ngOnInit.call(this);
|
|
4754
4813
|
};
|
|
4755
4814
|
TheTodoItemComponent.prototype.onCheck = function (checked) {
|
|
4756
|
-
|
|
4757
|
-
var noBindReadonly = options.noBindReadonlyPlugins && options.noBindReadonlyPlugins.includes(exports.ElementKinds.checkItem);
|
|
4758
|
-
if (!noBindReadonly && this.readonly) {
|
|
4815
|
+
if (this.readonly && !this.editableWithReadonly) {
|
|
4759
4816
|
return false;
|
|
4760
4817
|
}
|
|
4761
|
-
else {
|
|
4762
|
-
setNode(this.editor, { checked: checked }, this.element);
|
|
4763
|
-
}
|
|
4764
4818
|
setNode(this.editor, { checked: checked }, this.element);
|
|
4765
4819
|
};
|
|
4766
4820
|
return TheTodoItemComponent;
|
|
@@ -4876,7 +4930,8 @@
|
|
|
4876
4930
|
}
|
|
4877
4931
|
],
|
|
4878
4932
|
options: {
|
|
4879
|
-
allowParentTypes: [exports.ElementKinds.tableCell, exports.ElementKinds.blockquote]
|
|
4933
|
+
allowParentTypes: [exports.ElementKinds.tableCell, exports.ElementKinds.blockquote],
|
|
4934
|
+
editableWithReadonly: false
|
|
4880
4935
|
}
|
|
4881
4936
|
});
|
|
4882
4937
|
|
|
@@ -6651,10 +6706,9 @@
|
|
|
6651
6706
|
}
|
|
6652
6707
|
];
|
|
6653
6708
|
|
|
6654
|
-
var mergAutoFormateRules = function (
|
|
6655
|
-
var combinationData = __spreadArray(__spreadArray([], __read(defaultAutoFormatRules)), __read(extraAutoFormatRules));
|
|
6709
|
+
var mergAutoFormateRules = function (rules) {
|
|
6656
6710
|
var dataInfo = {};
|
|
6657
|
-
|
|
6711
|
+
rules.forEach(function (item) {
|
|
6658
6712
|
if (!dataInfo[item.type + item.key]) {
|
|
6659
6713
|
dataInfo[item.type + item.key] = Object.assign({}, item);
|
|
6660
6714
|
}
|
|
@@ -6667,11 +6721,9 @@
|
|
|
6667
6721
|
editor.insertText = function (text) {
|
|
6668
6722
|
var e_1, _d;
|
|
6669
6723
|
var _a, _b;
|
|
6670
|
-
var autoFormatRules =
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
autoFormatRules = Object.values(extraRules);
|
|
6674
|
-
}
|
|
6724
|
+
var autoFormatRules = (_a = getPluginOptions(editor, exports.PluginKeys.autoFormat)) === null || _a === void 0 ? void 0 : _a.autoFormatRules;
|
|
6725
|
+
var extraRules = mergAutoFormateRules(autoFormatRules);
|
|
6726
|
+
autoFormatRules = Object.values(extraRules);
|
|
6675
6727
|
if (!isCollapsed(editor.selection)) {
|
|
6676
6728
|
return insertText(text);
|
|
6677
6729
|
}
|
|
@@ -6765,7 +6817,10 @@
|
|
|
6765
6817
|
};
|
|
6766
6818
|
var createAutoFormatPlugin = createPluginFactory({
|
|
6767
6819
|
key: exports.PluginKeys.autoFormat,
|
|
6768
|
-
withOverrides: withAutoFormat
|
|
6820
|
+
withOverrides: withAutoFormat,
|
|
6821
|
+
options: {
|
|
6822
|
+
autoFormatRules: defaultAutoFormatRules
|
|
6823
|
+
}
|
|
6769
6824
|
});
|
|
6770
6825
|
|
|
6771
6826
|
var withTransforms = function (editor) {
|
|
@@ -12042,8 +12097,8 @@
|
|
|
12042
12097
|
key: exports.PluginKeys.table,
|
|
12043
12098
|
withOverrides: withTable,
|
|
12044
12099
|
nestedStructureByKey: (_a = {},
|
|
12045
|
-
_a[exports.ElementKinds.table] =
|
|
12046
|
-
_a[exports.ElementKinds.tableRow] =
|
|
12100
|
+
_a[exports.ElementKinds.table] = exports.ElementKinds.tableRow,
|
|
12101
|
+
_a[exports.ElementKinds.tableRow] = exports.ElementKinds.tableCell,
|
|
12047
12102
|
_a),
|
|
12048
12103
|
toolbarItems: [
|
|
12049
12104
|
{
|
|
@@ -12318,10 +12373,10 @@
|
|
|
12318
12373
|
var onKeydown = editor.onKeydown, deleteBackward = editor.deleteBackward, onChange = editor.onChange;
|
|
12319
12374
|
var presseingQuickInsertHotkey = false;
|
|
12320
12375
|
editor.onKeydown = function (event) {
|
|
12321
|
-
var
|
|
12322
|
-
var hotkey =
|
|
12376
|
+
var options = getPluginOptions(editor, exports.PluginKeys.quickInsert);
|
|
12377
|
+
var hotkey = options.hotkey, allowHotkeyInTypes = options.allowHotkeyInTypes;
|
|
12323
12378
|
if (event.key === hotkey) {
|
|
12324
|
-
var types = __spreadArray([], __read((
|
|
12379
|
+
var types = __spreadArray([], __read((allowHotkeyInTypes || [])));
|
|
12325
12380
|
var _c = __read(getBlockAbove(editor), 1), block = _c[0];
|
|
12326
12381
|
if (isPureEmptyParagraph(editor, block) && allowOpenQuickToolbar(editor, types)) {
|
|
12327
12382
|
presseingQuickInsertHotkey = true;
|
|
@@ -14167,13 +14222,12 @@
|
|
|
14167
14222
|
};
|
|
14168
14223
|
TheEditorComponent.prototype.initialize = function () {
|
|
14169
14224
|
var _this = this;
|
|
14170
|
-
var _a, _b
|
|
14225
|
+
var _a, _b;
|
|
14171
14226
|
var plugins = __spreadArray(__spreadArray([], __read(internalPlugins)), __read(this.thePlugins));
|
|
14172
14227
|
this.editor = withTheia(slateHistory.withHistory(i1.withAngular(slate.createEditor(), CLIPBOARD_FORMAT_KEY)), plugins);
|
|
14173
14228
|
this.generateDecorate();
|
|
14174
14229
|
this.editor.disabled = (_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.disabled;
|
|
14175
14230
|
this.editor.extraElementOptions = (_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.extraElementOptions;
|
|
14176
|
-
this.editor.extraAutoFormatRules = (_c = this.theOptions) === null || _c === void 0 ? void 0 : _c.extraAutoFormatRules;
|
|
14177
14231
|
this.editor.options = this.theOptions;
|
|
14178
14232
|
setEditorUUID(this.editor, idCreator());
|
|
14179
14233
|
this.theContextService.initialize({
|