@worktile/theia 1.2.7 → 1.2.11
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 +802 -162
- package/bundles/worktile-theia.umd.js.map +1 -1
- package/components/inline-toolbar/inline-toolbar.component.d.ts +24 -0
- package/components/inline-toolbar/inline-toolbar.component.scss +18 -0
- package/components/nav-split-line/nav-split-line.component.d.ts +6 -1
- package/components/toolbar-dropdown/toolbar-dropdown.component.scss +3 -0
- package/components/toolbar-item/toolbar-item.component.d.ts +14 -5
- package/constants/code.d.ts +7 -7
- package/constants/node-types.d.ts +0 -1
- package/constants/toolbar.d.ts +6 -2
- package/custom-types.d.ts +1 -0
- package/editor.component.d.ts +6 -4
- package/editor.module.d.ts +59 -52
- package/esm2015/components/color-select/color-select.component.js +3 -2
- package/esm2015/components/inline-toolbar/inline-toolbar.component.js +136 -0
- package/esm2015/components/nav-split-line/nav-split-line.component.js +26 -5
- package/esm2015/components/toolbar-base-item/toolbar-base-item.component.js +3 -2
- package/esm2015/components/toolbar-item/toolbar-item.component.js +70 -24
- package/esm2015/constants/code.js +7 -7
- package/esm2015/constants/node-types.js +1 -2
- package/esm2015/constants/toolbar.js +37 -5
- package/esm2015/custom-types.js +1 -1
- package/esm2015/editor.component.js +24 -19
- package/esm2015/editor.module.js +20 -8
- package/esm2015/interfaces/toolbar.js +1 -1
- package/esm2015/plugins/code/code.component.js +13 -8
- package/esm2015/plugins/common/auto-insert-data..js +2 -3
- package/esm2015/plugins/common/get-fragment.plugin.js +4 -4
- package/esm2015/plugins/deserializers/deserialize-html.plugin.js +8 -1
- package/esm2015/plugins/image/image.plugin.js +1 -2
- package/esm2015/plugins/index.js +8 -4
- package/esm2015/plugins/link/link.plugin.js +7 -2
- package/esm2015/plugins/list/list.plugin.js +9 -9
- package/esm2015/plugins/list/queries/get-start-list-item.js +9 -2
- package/esm2015/plugins/list/queries/is-selection-in-same-list-item.js +17 -0
- package/esm2015/plugins/node-id/node-id.plugin.js +7 -2
- package/esm2015/plugins/paint-format/options.js +54 -0
- package/esm2015/plugins/paint-format/paint-format.editor.js +67 -0
- package/esm2015/plugins/placeholder/placeholder.component.js +75 -0
- package/esm2015/plugins/public-api.js +2 -1
- package/esm2015/plugins/quick-insert/components/quick-insert.component.js +76 -0
- package/esm2015/plugins/quick-insert/components/quick-toolbar/quick-toolbar.component.js +75 -0
- package/esm2015/plugins/quick-insert/quick-insert.editor.js +61 -0
- package/esm2015/plugins/quick-insert/quick-insert.plugint.js +37 -0
- package/esm2015/plugins/table/components/row/row.component.js +3 -1
- package/esm2015/plugins/table/components/table.component.js +6 -3
- package/esm2015/plugins/table/components/td/td.component.js +2 -1
- package/esm2015/plugins/table/components/toolbar/table-toolbar.component.js +1 -1
- package/esm2015/plugins/table/table.plugin.js +3 -3
- package/esm2015/plugins/vertical-align/toolbar-item.component.js +11 -6
- package/esm2015/public-api.js +2 -1
- package/esm2015/services/context.service.js +2 -2
- package/esm2015/services/toolbar.service.js +5 -5
- package/esm2015/utils/auto-focus.js +2 -2
- package/esm2015/utils/fragment.js +3 -3
- package/esm2015/utils/is-clean-empty-paragraph.js +32 -0
- package/esm2015/utils/weak-maps.js +2 -1
- package/fesm2015/worktile-theia.js +778 -160
- package/fesm2015/worktile-theia.js.map +1 -1
- package/interfaces/toolbar.d.ts +3 -2
- package/package.json +1 -1
- package/plugins/code/code.component.d.ts +3 -2
- package/plugins/list/queries/get-start-list-item.d.ts +8 -2
- package/plugins/list/queries/is-selection-in-same-list-item.d.ts +5 -0
- package/plugins/paint-format/options.d.ts +2 -0
- package/plugins/paint-format/paint-format.editor.d.ts +7 -0
- package/{components → plugins}/placeholder/placeholder.component.d.ts +5 -6
- package/{components → plugins}/placeholder/placeholder.component.scss +0 -0
- package/plugins/public-api.d.ts +1 -0
- package/plugins/quick-insert/components/quick-insert.component.d.ts +25 -0
- package/plugins/quick-insert/components/quick-insert.component.scss +21 -0
- package/plugins/quick-insert/components/quick-toolbar/quick-toolbar.component.d.ts +29 -0
- package/plugins/quick-insert/components/quick-toolbar/quick-toolbar.component.scss +21 -0
- package/plugins/quick-insert/quick-insert.editor.d.ts +8 -0
- package/plugins/quick-insert/quick-insert.plugint.d.ts +2 -0
- package/plugins/table/components/table.component.d.ts +1 -0
- package/plugins/vertical-align/toolbar-item.component.d.ts +1 -0
- package/public-api.d.ts +1 -0
- package/services/toolbar.service.d.ts +1 -1
- package/styles/editor.scss +41 -15
- package/styles/index.scss +5 -2
- package/utils/is-clean-empty-paragraph.d.ts +8 -0
- package/utils/weak-maps.d.ts +1 -0
- package/esm2015/components/placeholder/placeholder.component.js +0 -88
|
@@ -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('lodash'), require('marked'), require('@atinc/selene'), require('ngx-tethys/popover'), require('@angular/cdk/overlay'), require('ngx-tethys/alert'), require('rxjs/operators'), require('ngx-tethys/uploader'), require('@angular/platform-browser'), require('rxjs'), require('ngx-tethys/progress'), require('ngx-tethys/icon'), require('ngx-tethys/input'), require('ngx-tethys/nav'), require('ngx-tethys/tooltip'), require('ng-codemirror'), require('ngx-tethys/notify'), require('ngx-tethys/action-menu'), 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/
|
|
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', 'lodash', 'marked', '@atinc/selene', 'ngx-tethys/popover', '@angular/cdk/overlay', 'ngx-tethys/alert', 'rxjs/operators', 'ngx-tethys/uploader', '@angular/platform-browser', 'rxjs', 'ngx-tethys/progress', 'ngx-tethys/icon', 'ngx-tethys/input', 'ngx-tethys/nav', 'ngx-tethys/tooltip', 'ng-codemirror', 'ngx-tethys/notify', 'ngx-tethys/action-menu', 'is-url', 'ngx-tethys/button', 'ngx-tethys/form', 'ngx-tethys/shared', 'ngx-tethys', '@angular/cdk/coercion', '@angular/cdk/portal', 'ngx-tethys/
|
|
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._lodash, global.marked, global.selene, global.i1$2, global.ng.cdk.overlay, global.i1$1, global.rxjs.operators, global.uploader, global.ng.platformBrowser, global.rxjs, global.i4, global.i4$1, global.i5, global.i2$1, global.i7, global.i5$2, global.i1$4, global.i5$1, global.isUrl, global.i1$5, global.i2$2, global.i5$3, global.i1$6, global.ng.cdk.coercion, global.ng.cdk.portal, global.
|
|
5
|
-
})(this, (function (exports, i0, i6, i4$2, i1, core, isHotkey, slate, slateHistory, _lodash, marked, selene, i1$2, i2, i1$1, operators, uploader, i1$3, rxjs, i4, i4$1, i5, i2$1, i7, i5$2, i1$4, i5$1, isUrl, i1$5, i2$2, i5$3, i1$6, coercion, portal, autocomplete, avatar,
|
|
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('lodash'), require('marked'), require('@atinc/selene'), require('ngx-tethys/popover'), require('@angular/cdk/overlay'), require('ngx-tethys/alert'), require('rxjs/operators'), require('ngx-tethys/uploader'), require('@angular/platform-browser'), require('rxjs'), require('ngx-tethys/progress'), require('ngx-tethys/icon'), require('ngx-tethys/input'), require('ngx-tethys/nav'), require('ngx-tethys/tooltip'), require('ng-codemirror'), require('ngx-tethys/notify'), require('ngx-tethys/action-menu'), 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', 'lodash', 'marked', '@atinc/selene', 'ngx-tethys/popover', '@angular/cdk/overlay', 'ngx-tethys/alert', 'rxjs/operators', 'ngx-tethys/uploader', '@angular/platform-browser', 'rxjs', 'ngx-tethys/progress', 'ngx-tethys/icon', 'ngx-tethys/input', 'ngx-tethys/nav', 'ngx-tethys/tooltip', 'ng-codemirror', 'ngx-tethys/notify', 'ngx-tethys/action-menu', '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._lodash, global.marked, global.selene, global.i1$2, global.ng.cdk.overlay, global.i1$1, global.rxjs.operators, global.uploader, global.ng.platformBrowser, global.rxjs, global.i4, global.i4$1, global.i5, global.i2$1, global.i7, global.i5$2, global.i1$4, global.i5$1, global.isUrl, global.i1$5, global.i2$2, global.i5$3, global.i1$6, global.ng.cdk.coercion, global.ng.cdk.portal, global.i2$3, global.autocomplete, global.avatar, global.select));
|
|
5
|
+
})(this, (function (exports, i0, i6, i4$2, i1, core, isHotkey, slate, slateHistory, _lodash, marked, selene, i1$2, i2, i1$1, operators, uploader, i1$3, rxjs, i4, i4$1, i5, i2$1, i7, i5$2, i1$4, i5$1, isUrl, i1$5, i2$2, i5$3, i1$6, coercion, portal, i2$3, 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
|
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
var i2__namespace$2 = /*#__PURE__*/_interopNamespace(i2$2);
|
|
49
49
|
var i5__namespace$3 = /*#__PURE__*/_interopNamespace(i5$3);
|
|
50
50
|
var i1__namespace$6 = /*#__PURE__*/_interopNamespace(i1$6);
|
|
51
|
+
var i2__namespace$3 = /*#__PURE__*/_interopNamespace(i2$3);
|
|
51
52
|
|
|
52
53
|
/*! *****************************************************************************
|
|
53
54
|
Copyright (c) Microsoft Corporation.
|
|
@@ -433,7 +434,6 @@
|
|
|
433
434
|
exports.ToolbarActionTypes = void 0;
|
|
434
435
|
(function (ToolbarActionTypes) {
|
|
435
436
|
ToolbarActionTypes["split"] = "split";
|
|
436
|
-
ToolbarActionTypes["save"] = "save";
|
|
437
437
|
ToolbarActionTypes["undo"] = "undo";
|
|
438
438
|
ToolbarActionTypes["redo"] = "redo";
|
|
439
439
|
ToolbarActionTypes["paintformat"] = "paintformat";
|
|
@@ -475,12 +475,17 @@
|
|
|
475
475
|
var BLOCK_DELETEBACKWARD_TYPES = [exports.ElementKinds.tableCell];
|
|
476
476
|
|
|
477
477
|
var TheToolbarGroupToken = new i0.InjectionToken('the-toolbar-group-token');
|
|
478
|
-
var
|
|
478
|
+
var QUICK_TOOLBAR_HOTKEY = '/';
|
|
479
479
|
exports.DropdownMode = void 0;
|
|
480
480
|
(function (DropdownMode) {
|
|
481
481
|
DropdownMode["icon"] = "icon-mode";
|
|
482
482
|
DropdownMode["text"] = "text-mode";
|
|
483
483
|
})(exports.DropdownMode || (exports.DropdownMode = {}));
|
|
484
|
+
exports.ToolbarItemMode = void 0;
|
|
485
|
+
(function (ToolbarItemMode) {
|
|
486
|
+
ToolbarItemMode[ToolbarItemMode["horizontal"] = 0] = "horizontal";
|
|
487
|
+
ToolbarItemMode[ToolbarItemMode["vertical"] = 1] = "vertical";
|
|
488
|
+
})(exports.ToolbarItemMode || (exports.ToolbarItemMode = {}));
|
|
484
489
|
var DefaultGlobalToolbarDefinition = [
|
|
485
490
|
exports.ElementKinds.headingList,
|
|
486
491
|
exports.ToolbarActionTypes.split,
|
|
@@ -505,8 +510,34 @@
|
|
|
505
510
|
exports.ElementKinds.blockquote,
|
|
506
511
|
exports.ElementKinds.code
|
|
507
512
|
];
|
|
508
|
-
var DefaultInlineToolbarDefinition = [
|
|
509
|
-
|
|
513
|
+
var DefaultInlineToolbarDefinition = [
|
|
514
|
+
exports.ToolbarActionTypes.clean,
|
|
515
|
+
exports.ToolbarActionTypes.split,
|
|
516
|
+
exports.MarkTypes.bold,
|
|
517
|
+
exports.MarkTypes.italic,
|
|
518
|
+
exports.MarkTypes.underline,
|
|
519
|
+
exports.MarkTypes.strike,
|
|
520
|
+
exports.MarkTypes.codeLine,
|
|
521
|
+
exports.MarkTypes.color,
|
|
522
|
+
exports.MarkTypes.backgroundColor,
|
|
523
|
+
exports.ToolbarActionTypes.split,
|
|
524
|
+
exports.ToolbarActionTypes.alignType,
|
|
525
|
+
exports.ToolbarActionTypes.split,
|
|
526
|
+
exports.ElementKinds.link
|
|
527
|
+
];
|
|
528
|
+
var DefaultQuickToolbarDefinition = __spreadArray(__spreadArray([], __read(STANDARD_HEADING_TYPES)), [
|
|
529
|
+
exports.ToolbarActionTypes.split,
|
|
530
|
+
exports.ElementKinds.numberedList,
|
|
531
|
+
exports.ElementKinds.bulletedList,
|
|
532
|
+
exports.ElementKinds.checkItem,
|
|
533
|
+
exports.ToolbarActionTypes.split,
|
|
534
|
+
exports.ElementKinds.link,
|
|
535
|
+
exports.ElementKinds.image,
|
|
536
|
+
exports.ElementKinds.table,
|
|
537
|
+
exports.ElementKinds.blockquote,
|
|
538
|
+
exports.ElementKinds.hr,
|
|
539
|
+
exports.ElementKinds.code
|
|
540
|
+
]);
|
|
510
541
|
var ToolbarMoreGroup = {
|
|
511
542
|
key: 'more',
|
|
512
543
|
icon: 'more'
|
|
@@ -586,20 +617,20 @@
|
|
|
586
617
|
value: 'htmlmixed'
|
|
587
618
|
}
|
|
588
619
|
];
|
|
589
|
-
var
|
|
620
|
+
var CodeMode = {
|
|
590
621
|
default: 'default',
|
|
591
622
|
print: 'print'
|
|
592
623
|
};
|
|
593
|
-
var
|
|
594
|
-
function
|
|
624
|
+
var TheCodeMode = /** @class */ (function () {
|
|
625
|
+
function TheCodeMode() {
|
|
595
626
|
}
|
|
596
|
-
return
|
|
627
|
+
return TheCodeMode;
|
|
597
628
|
}());
|
|
598
|
-
var
|
|
599
|
-
var
|
|
600
|
-
provide:
|
|
629
|
+
var THE_CODE_MODE_TOKEN = new i0.InjectionToken('the-code-mode');
|
|
630
|
+
var THE_CODE_MODE_PROVIDER = {
|
|
631
|
+
provide: THE_CODE_MODE_TOKEN,
|
|
601
632
|
useValue: {
|
|
602
|
-
mode:
|
|
633
|
+
mode: CodeMode.default
|
|
603
634
|
}
|
|
604
635
|
};
|
|
605
636
|
var CODEMIRROR_PADDING_TOP = 10;
|
|
@@ -1385,6 +1416,7 @@
|
|
|
1385
1416
|
return fragment;
|
|
1386
1417
|
};
|
|
1387
1418
|
var extractFragment = function (data, deleteKey) {
|
|
1419
|
+
if (deleteKey === void 0) { deleteKey = ELEMENT_UNIQUE_ID; }
|
|
1388
1420
|
var fragment = data.getData("application/" + CLIPBOARD_FORMAT_KEY);
|
|
1389
1421
|
if (fragment) {
|
|
1390
1422
|
var decoded = decodeURIComponent(window.atob(fragment));
|
|
@@ -1835,6 +1867,7 @@
|
|
|
1835
1867
|
|
|
1836
1868
|
var THE_EDITOR_UUID = new WeakMap();
|
|
1837
1869
|
var THE_EDITOR_CONVERSION_HINT_REF = new WeakMap();
|
|
1870
|
+
var THE_EDITOR_QUICK_TOOLBAR_REF = new WeakMap();
|
|
1838
1871
|
|
|
1839
1872
|
var closeConversionHint = function (editor) {
|
|
1840
1873
|
var hintRef = THE_EDITOR_CONVERSION_HINT_REF.get(editor);
|
|
@@ -2457,7 +2490,7 @@
|
|
|
2457
2490
|
allElementOptions = Object.values(extraInfo);
|
|
2458
2491
|
}
|
|
2459
2492
|
var indivisibleTypes = allElementOptions.filter(function (item) { return item.isIndivisible; }).map(function (item) { return item.type; });
|
|
2460
|
-
var fragment = extractFragment(data
|
|
2493
|
+
var fragment = extractFragment(data);
|
|
2461
2494
|
if (fragment) {
|
|
2462
2495
|
if (isAcrossBlocks(editor, fragment) || slate.Editor.isVoid(editor, fragment[0])) {
|
|
2463
2496
|
var selection = editor.selection;
|
|
@@ -2621,7 +2654,7 @@
|
|
|
2621
2654
|
};
|
|
2622
2655
|
TheContextService.prototype.getOptions = function () {
|
|
2623
2656
|
if (!this.options.width) {
|
|
2624
|
-
this.options.width = this.options.nativeElement.querySelector('.slate-editable-container').offsetWidth
|
|
2657
|
+
this.options.width = this.options.nativeElement.querySelector('.slate-editable-container').firstElementChild.offsetWidth;
|
|
2625
2658
|
}
|
|
2626
2659
|
return this.options;
|
|
2627
2660
|
};
|
|
@@ -2922,7 +2955,6 @@
|
|
|
2922
2955
|
};
|
|
2923
2956
|
editor.insertData = function (data) {
|
|
2924
2957
|
var e_1, _a;
|
|
2925
|
-
// TODO:: 底层有点问题,粘贴多张图片时只能识别一张
|
|
2926
2958
|
if (data.files.length) {
|
|
2927
2959
|
var imageFiles = [];
|
|
2928
2960
|
try {
|
|
@@ -3062,13 +3094,19 @@
|
|
|
3062
3094
|
return [exports.ElementKinds.bulletedList, exports.ElementKinds.numberedList];
|
|
3063
3095
|
};
|
|
3064
3096
|
|
|
3097
|
+
/**
|
|
3098
|
+
* 获取 List 中 ListItems,过滤掉空列表嵌套
|
|
3099
|
+
* @param node
|
|
3100
|
+
* @param initialValue
|
|
3101
|
+
* @returns
|
|
3102
|
+
*/
|
|
3065
3103
|
var getStartListItem = function (node, initialValue) {
|
|
3066
3104
|
if (!initialValue) {
|
|
3067
3105
|
initialValue = [];
|
|
3068
3106
|
}
|
|
3069
3107
|
if (node) {
|
|
3070
3108
|
return node.reduce(function (result, current) {
|
|
3071
|
-
if (current.type
|
|
3109
|
+
if ((current.type === exports.ElementKinds.listItem && !getListTypes().includes(current.children[0].type))) {
|
|
3072
3110
|
result.push(current);
|
|
3073
3111
|
}
|
|
3074
3112
|
else {
|
|
@@ -3758,6 +3796,20 @@
|
|
|
3758
3796
|
}]
|
|
3759
3797
|
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }]; } });
|
|
3760
3798
|
|
|
3799
|
+
/**
|
|
3800
|
+
* Is the selection in same li
|
|
3801
|
+
*/
|
|
3802
|
+
var isSelectionInSameListItem = function (editor) {
|
|
3803
|
+
var selection = editor.selection;
|
|
3804
|
+
if (!selection) {
|
|
3805
|
+
return false;
|
|
3806
|
+
}
|
|
3807
|
+
var _a = __read(slate.Range.edges(selection), 2), start = _a[0], end = _a[1];
|
|
3808
|
+
var startListItemEntry = getAboveByType(editor, exports.ElementKinds.listItem, { at: start.path });
|
|
3809
|
+
var endListItemEntry = getAboveByType(editor, exports.ElementKinds.listItem, { at: end.path });
|
|
3810
|
+
return startListItemEntry && endListItemEntry && slate.Path.equals(startListItemEntry[1], endListItemEntry[1]);
|
|
3811
|
+
};
|
|
3812
|
+
|
|
3761
3813
|
var withList = function (_a) {
|
|
3762
3814
|
var _b = _a === void 0 ? {} : _a, validLiChildrenTypes = _b.validLiChildrenTypes;
|
|
3763
3815
|
return function (editor) {
|
|
@@ -3842,15 +3894,14 @@
|
|
|
3842
3894
|
var fragmentElement = fragmentData[0];
|
|
3843
3895
|
if (getListTypes().includes(fragmentElement.type)) {
|
|
3844
3896
|
var startNodes = getStartListItem([fragmentElement.children[0]]);
|
|
3845
|
-
// 复制列表中的图片时startNodes长度为零
|
|
3846
|
-
if (startNodes.length === 0) {
|
|
3847
|
-
setFragmentData(unit);
|
|
3848
|
-
return;
|
|
3849
|
-
}
|
|
3850
3897
|
var children = startNodes.concat(fragmentElement.children.slice(1));
|
|
3851
3898
|
var fragmentNodes = [
|
|
3852
3899
|
Object.assign(Object.assign({}, fragmentElement), { children: children })
|
|
3853
3900
|
];
|
|
3901
|
+
if (isSelectionInSameListItem(editor)) {
|
|
3902
|
+
// 仅仅复制列表中的内容
|
|
3903
|
+
fragmentNodes = children[0].children;
|
|
3904
|
+
}
|
|
3854
3905
|
var fragment = fragmentNodes.concat(fragmentData.slice(1));
|
|
3855
3906
|
var domRange = i1.AngularEditor.toDOMRange(editor, selection);
|
|
3856
3907
|
var contents = domRange.cloneContents();
|
|
@@ -3934,7 +3985,7 @@
|
|
|
3934
3985
|
};
|
|
3935
3986
|
editor.insertData = function (data) {
|
|
3936
3987
|
var text = data.getData('text/plain');
|
|
3937
|
-
var fragment = extractFragment(data
|
|
3988
|
+
var fragment = extractFragment(data);
|
|
3938
3989
|
var aboveEntry = slate.Editor.above(editor, {
|
|
3939
3990
|
match: function (n) { return slate.Editor.isBlock(editor, n) && n.type === exports.ElementKinds.listItem; }
|
|
3940
3991
|
});
|
|
@@ -4280,7 +4331,7 @@
|
|
|
4280
4331
|
var _b = _a === void 0 ? {} : _a, _c = _b.idKey, idKey = _c === void 0 ? 'id' : _c, _d = _b.idCreator, idCreator = _d === void 0 ? function () { return Date.now(); } : _d, _e = _b.filterText, filterText = _e === void 0 ? true : _e, _f = _b.filter, filter = _f === void 0 ? function () { return true; } : _f;
|
|
4281
4332
|
return function (e) {
|
|
4282
4333
|
var editor = e;
|
|
4283
|
-
var apply = editor.apply;
|
|
4334
|
+
var apply = editor.apply, getFragment = editor.getFragment;
|
|
4284
4335
|
var idPropsCreator = function () {
|
|
4285
4336
|
var _a;
|
|
4286
4337
|
return (_a = {}, _a[idKey] = idCreator(), _a);
|
|
@@ -4323,6 +4374,10 @@
|
|
|
4323
4374
|
}
|
|
4324
4375
|
return apply(operation);
|
|
4325
4376
|
};
|
|
4377
|
+
editor.getFragment = function () {
|
|
4378
|
+
var fragment = _.cloneDeep(getFragment());
|
|
4379
|
+
return deleteElementKey(fragment, idKey);
|
|
4380
|
+
};
|
|
4326
4381
|
return editor;
|
|
4327
4382
|
};
|
|
4328
4383
|
};
|
|
@@ -4809,9 +4864,9 @@
|
|
|
4809
4864
|
var selection = editor.selection;
|
|
4810
4865
|
var containerBlocks = __spreadArray(__spreadArray([], __read(elementKinds)), __read(getContainerBlocks(editor)));
|
|
4811
4866
|
if (selection && selection.anchor.path[0] === selection.focus.path[0]) {
|
|
4812
|
-
var fragmentData =
|
|
4867
|
+
var fragmentData = getFragment();
|
|
4813
4868
|
var nodes = getSelectionNodesByType(editor, fragmentData, containerBlocks);
|
|
4814
|
-
return nodes && slate.Element.isElement(nodes) ? nodes.children :
|
|
4869
|
+
return nodes && slate.Element.isElement(nodes) ? nodes.children : fragmentData;
|
|
4815
4870
|
}
|
|
4816
4871
|
return getFragment();
|
|
4817
4872
|
};
|
|
@@ -6194,6 +6249,7 @@
|
|
|
6194
6249
|
}
|
|
6195
6250
|
};
|
|
6196
6251
|
TheColorSelectComponent.prototype._selectColor = function (event, color) {
|
|
6252
|
+
event.preventDefault();
|
|
6197
6253
|
event.stopPropagation();
|
|
6198
6254
|
if (this.option.specialColor && color === this.option.specialColor) {
|
|
6199
6255
|
color = '';
|
|
@@ -6225,7 +6281,7 @@
|
|
|
6225
6281
|
return TheColorSelectComponent;
|
|
6226
6282
|
}());
|
|
6227
6283
|
TheColorSelectComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheColorSelectComponent, deps: [{ token: i1__namespace$3.ThyPopoverRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
6228
|
-
TheColorSelectComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheColorSelectComponent, selector: "the-color-select", inputs: { selectedColor: "selectedColor", selectAction: "selectAction", showCustom: "showCustom", colors: "colors", option: "option" }, host: { listeners: { "document: mousedown": "handleDocumentMouseDown($event)", "mousedown": "handleMouseDown($event)", "keydown": "handleKeydown($event)" } }, ngImport: i0__namespace, template: "<div class=\"color-container\">\n <div class=\"colors\">\n <div *ngFor=\"let row of selectColors; let rowIndex = index\">\n <span\n class=\"color-item\"\n *ngFor=\"let _color of row.rowValue; let i = index\"\n [ngClass]=\"_color.classMaps\"\n (mousedown)=\"_selectColor($event, _color.value)\"\n >\n <span [ngStyle]=\"{ background: _color.value }\">\n <thy-icon
|
|
6284
|
+
TheColorSelectComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheColorSelectComponent, selector: "the-color-select", inputs: { selectedColor: "selectedColor", selectAction: "selectAction", showCustom: "showCustom", colors: "colors", option: "option" }, host: { listeners: { "document: mousedown": "handleDocumentMouseDown($event)", "mousedown": "handleMouseDown($event)", "keydown": "handleKeydown($event)" } }, ngImport: i0__namespace, template: "<div class=\"color-container\">\n <div class=\"colors\">\n <div *ngFor=\"let row of selectColors; let rowIndex = index\">\n <span\n class=\"color-item\"\n *ngFor=\"let _color of row.rowValue; let i = index\"\n [ngClass]=\"_color.classMaps\"\n (mousedown)=\"_selectColor($event, _color.value)\"\n >\n <span [ngStyle]=\"{ background: _color.value }\">\n <thy-icon thyIconName=\"check\" [ngStyle]=\"{ color: row.tickColor }\"></thy-icon>\n </span>\n </span>\n </div>\n </div>\n <div *ngIf=\"option.showCustom\" class=\"select-color\">\n <span class=\"color\" [ngStyle]=\"{ background: selectedColor }\"></span>\n #\n <input\n thyInput\n maxlength=\"6\"\n (keydown.enter)=\"customInputColorEnter($event)\"\n onkeyup=\"value=value.replace(/[^0-9A-Fa-f]/g,'')\"\n class=\"value\"\n [(ngModel)]=\"customColor\"\n (ngModelChange)=\"colorChange(false)\"\n />\n </div>\n</div>\n", components: [{ type: i4__namespace$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], directives: [{ type: i6__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4__namespace$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i5__namespace.ThyInputDirective, selector: "[thyInput]", inputs: ["thySize", "thyAutocomplete"] }, { type: i4__namespace$2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { type: i4__namespace$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4__namespace$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
6229
6285
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheColorSelectComponent, decorators: [{
|
|
6230
6286
|
type: i0.Component,
|
|
6231
6287
|
args: [{
|
|
@@ -6348,9 +6404,10 @@
|
|
|
6348
6404
|
function TheToolbarBaseItemComponent() {
|
|
6349
6405
|
}
|
|
6350
6406
|
TheToolbarBaseItemComponent.prototype.execute = function (event) {
|
|
6407
|
+
var _a;
|
|
6351
6408
|
event.preventDefault();
|
|
6352
6409
|
event.stopPropagation();
|
|
6353
|
-
if (!this.itemMousedownHandle && !this.editor.selection) {
|
|
6410
|
+
if (!this.itemMousedownHandle && !((_a = this.editor) === null || _a === void 0 ? void 0 : _a.selection)) {
|
|
6354
6411
|
var lastNode = getLastNode(this.editor, 1);
|
|
6355
6412
|
var end = slate.Editor.end(this.editor, lastNode[1]);
|
|
6356
6413
|
slate.Transforms.select(this.editor, end);
|
|
@@ -6738,15 +6795,16 @@
|
|
|
6738
6795
|
|
|
6739
6796
|
var TheCodeComponent = /** @class */ (function (_super) {
|
|
6740
6797
|
__extends(TheCodeComponent, _super);
|
|
6741
|
-
function TheCodeComponent(elementRef, cdr, thyNotifyService, ngZone) {
|
|
6798
|
+
function TheCodeComponent(elementRef, cdr, thyNotifyService, ngZone, mode) {
|
|
6742
6799
|
var _this = _super.call(this, elementRef, cdr) || this;
|
|
6743
6800
|
_this.elementRef = elementRef;
|
|
6744
6801
|
_this.cdr = cdr;
|
|
6745
6802
|
_this.thyNotifyService = thyNotifyService;
|
|
6746
6803
|
_this.ngZone = ngZone;
|
|
6804
|
+
_this.mode = mode;
|
|
6747
6805
|
_this.startRenderCodemirror = false;
|
|
6748
6806
|
_this.dropdownMode = exports.DropdownMode;
|
|
6749
|
-
_this.maxHeight = 350 - CODEMIRROR_PADDING_TOP * 2;
|
|
6807
|
+
_this.maxHeight = _this.mode === CodeMode.default ? 350 - CODEMIRROR_PADDING_TOP * 2 : 0;
|
|
6750
6808
|
_this.codeMirrorFocused = false;
|
|
6751
6809
|
_this.menus = CODE_MODES.map(function (item) {
|
|
6752
6810
|
return { key: item.value, name: item.showName };
|
|
@@ -6757,7 +6815,7 @@
|
|
|
6757
6815
|
readOnly: false,
|
|
6758
6816
|
autofocus: false,
|
|
6759
6817
|
lineWiseCopyCut: true,
|
|
6760
|
-
lineWrapping: false,
|
|
6818
|
+
lineWrapping: _this.mode === CodeMode.default ? false : true,
|
|
6761
6819
|
cursorBlinkRate: 500
|
|
6762
6820
|
};
|
|
6763
6821
|
_this.actives = _this.menus[0];
|
|
@@ -6865,7 +6923,7 @@
|
|
|
6865
6923
|
};
|
|
6866
6924
|
return TheCodeComponent;
|
|
6867
6925
|
}(TheBaseElementComponent));
|
|
6868
|
-
TheCodeComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheCodeComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }, { token: i1__namespace$4.ThyNotifyService }, { token: i0__namespace.NgZone }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
6926
|
+
TheCodeComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheCodeComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }, { token: i1__namespace$4.ThyNotifyService }, { token: i0__namespace.NgZone }, { token: THE_CODE_MODE_TOKEN }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
6869
6927
|
TheCodeComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheCodeComponent, selector: "div[theCode]", viewQueries: [{ propertyName: "codemirror", first: true, predicate: ["codemirror"], descendants: true, read: i5$2.CodeMirrorComponent }], usesInheritance: true, ngImport: i0__namespace, template: "<div contenteditable=\"false\" class=\"the-block-operation\" *ngIf=\"codeMirrorFocused && !options.readOnly\">\n <thy-icon-nav>\n <the-toolbar-dropdown [menus]=\"menus\" [item]=\"actives\" [itemMousedownHandle]=\"onChangeLangulage\"></the-toolbar-dropdown>\n <a\n href=\"javascript:;\"\n thyIconNavLink\n thyIconNavLinkIcon=\"copy\"\n thyTooltip=\"\u590D\u5236\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"onCopy($event)\"\n ></a>\n <a\n href=\"javascript:;\"\n thyIconNavLink\n thyIconNavLinkIcon=\"trash\"\n thyTooltip=\"\u5220\u9664\"\n class=\"remove-link\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"onDelete($event)\"\n ></a>\n </thy-icon-nav>\n</div>\n\n<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n<ng-codemirror\n *ngIf=\"startRenderCodemirror\"\n #codemirror\n contenteditable=\"false\"\n class=\"ng-codemirror-wrapper\"\n [ngStyle]=\"{ maxHeight: maxHeight > 0 ? maxHeight + 'px' : 'auto' }\"\n [options]=\"options\"\n [ngModel]=\"code\"\n [delayRefreshTime]=\"300\"\n (ngModelChange)=\"codeChange($event)\"\n (focusChange)=\"focusChange($event)\"\n [autoMaxHeight]=\"maxHeight\"\n></ng-codemirror>\n", components: [{ type: i2__namespace.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }, { type: TheToolbarDropdownComponent, selector: "the-toolbar-dropdown", inputs: ["toolbarItem", "menus", "mode", "item", "itemMousedownHandle"] }, { type: i2__namespace.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i1__namespace.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }, { type: i5__namespace$2.CodeMirrorComponent, selector: "ng-codemirror, [ngCodeMirror]", inputs: ["autoMaxHeight", "delayRefreshTime", "options"], outputs: ["focusChange"] }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7__namespace.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i6__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i4__namespace$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4__namespace$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
6870
6928
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheCodeComponent, decorators: [{
|
|
6871
6929
|
type: i0.Component,
|
|
@@ -6874,7 +6932,12 @@
|
|
|
6874
6932
|
templateUrl: './code.component.html',
|
|
6875
6933
|
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
6876
6934
|
}]
|
|
6877
|
-
}], ctorParameters: function () {
|
|
6935
|
+
}], ctorParameters: function () {
|
|
6936
|
+
return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }, { type: i1__namespace$4.ThyNotifyService }, { type: i0__namespace.NgZone }, { type: CodeMode, decorators: [{
|
|
6937
|
+
type: i0.Inject,
|
|
6938
|
+
args: [THE_CODE_MODE_TOKEN]
|
|
6939
|
+
}] }];
|
|
6940
|
+
}, propDecorators: { codemirror: [{
|
|
6878
6941
|
type: i0.ViewChild,
|
|
6879
6942
|
args: ['codemirror', { read: i5$2.CodeMirrorComponent, static: false }]
|
|
6880
6943
|
}] } });
|
|
@@ -7317,6 +7380,7 @@
|
|
|
7317
7380
|
editor.insertText = function (text) {
|
|
7318
7381
|
if (text && isUrl__default["default"](text)) {
|
|
7319
7382
|
LinkEditor.wrapLink(editor, text, text);
|
|
7383
|
+
slate.Transforms.move(editor, { distance: 1, unit: "offset" });
|
|
7320
7384
|
}
|
|
7321
7385
|
else {
|
|
7322
7386
|
insertText(text);
|
|
@@ -7324,8 +7388,10 @@
|
|
|
7324
7388
|
};
|
|
7325
7389
|
editor.insertData = function (data) {
|
|
7326
7390
|
var text = data.getData('text/plain');
|
|
7327
|
-
|
|
7391
|
+
var fragment = data.getData("application/" + CLIPBOARD_FORMAT_KEY);
|
|
7392
|
+
if (text && isUrl__default["default"](text) && !fragment) {
|
|
7328
7393
|
LinkEditor.wrapLink(editor, text, text);
|
|
7394
|
+
slate.Transforms.move(editor, { distance: 1, unit: "offset" });
|
|
7329
7395
|
}
|
|
7330
7396
|
else {
|
|
7331
7397
|
insertData(data);
|
|
@@ -8215,19 +8281,46 @@
|
|
|
8215
8281
|
|
|
8216
8282
|
var NavSplitLineComponent = /** @class */ (function () {
|
|
8217
8283
|
function NavSplitLineComponent() {
|
|
8284
|
+
this.mode = exports.ToolbarItemMode.vertical;
|
|
8285
|
+
this.theNavSplitLine = true;
|
|
8218
8286
|
}
|
|
8287
|
+
Object.defineProperty(NavSplitLineComponent.prototype, "horizontal", {
|
|
8288
|
+
get: function () {
|
|
8289
|
+
return this.mode === exports.ToolbarItemMode.horizontal;
|
|
8290
|
+
},
|
|
8291
|
+
enumerable: false,
|
|
8292
|
+
configurable: true
|
|
8293
|
+
});
|
|
8294
|
+
Object.defineProperty(NavSplitLineComponent.prototype, "vertical", {
|
|
8295
|
+
get: function () {
|
|
8296
|
+
return this.mode === exports.ToolbarItemMode.vertical;
|
|
8297
|
+
},
|
|
8298
|
+
enumerable: false,
|
|
8299
|
+
configurable: true
|
|
8300
|
+
});
|
|
8219
8301
|
NavSplitLineComponent.prototype.ngOnInit = function () { };
|
|
8220
8302
|
return NavSplitLineComponent;
|
|
8221
8303
|
}());
|
|
8222
8304
|
NavSplitLineComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: NavSplitLineComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
8223
|
-
NavSplitLineComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: NavSplitLineComponent, selector: "nav-split-line", ngImport: i0__namespace, template: '', isInline: true });
|
|
8305
|
+
NavSplitLineComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: NavSplitLineComponent, selector: "nav-split-line", inputs: { mode: "mode" }, host: { properties: { "class.the-nav-split-line": "this.theNavSplitLine", "class.horizontal": "this.horizontal", "class.vertical": "this.vertical" } }, ngImport: i0__namespace, template: '', isInline: true });
|
|
8224
8306
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: NavSplitLineComponent, decorators: [{
|
|
8225
8307
|
type: i0.Component,
|
|
8226
8308
|
args: [{
|
|
8227
8309
|
selector: 'nav-split-line',
|
|
8228
8310
|
template: ''
|
|
8229
8311
|
}]
|
|
8230
|
-
}], ctorParameters: function () { return []; }
|
|
8312
|
+
}], ctorParameters: function () { return []; }, propDecorators: { mode: [{
|
|
8313
|
+
type: i0.Input
|
|
8314
|
+
}], theNavSplitLine: [{
|
|
8315
|
+
type: i0.HostBinding,
|
|
8316
|
+
args: ['class.the-nav-split-line']
|
|
8317
|
+
}], horizontal: [{
|
|
8318
|
+
type: i0.HostBinding,
|
|
8319
|
+
args: ['class.horizontal']
|
|
8320
|
+
}], vertical: [{
|
|
8321
|
+
type: i0.HostBinding,
|
|
8322
|
+
args: ['class.vertical']
|
|
8323
|
+
}] } });
|
|
8231
8324
|
|
|
8232
8325
|
var TheTableToolbarComponent = /** @class */ (function () {
|
|
8233
8326
|
function TheTableToolbarComponent(ngZone, colorSelectService, popoverRef) {
|
|
@@ -8350,7 +8443,7 @@
|
|
|
8350
8443
|
return TheTableToolbarComponent;
|
|
8351
8444
|
}());
|
|
8352
8445
|
TheTableToolbarComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheTableToolbarComponent, deps: [{ token: i0__namespace.NgZone }, { token: TheColorSelectService }, { token: i1__namespace$3.ThyPopoverRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
8353
|
-
TheTableToolbarComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheTableToolbarComponent, selector: "the-table-toolbar", inputs: { tableStore: "tableStore", isActiveSelect: "isActiveSelect" }, ngImport: i0__namespace, template: "<thy-icon-nav>\n <ng-container *ngFor=\"let item of cellMenuList\">\n <a href=\"javascript:;\" thyIconNavLink *ngIf=\"!item.invisibility\" [thyTooltip]=\"item.name\" (mousedown)=\"item.actionHandle()\">\n <thy-icon [thyIconName]=\"item.icon\"></thy-icon>\n </a>\n </ng-container>\n <nav-split-line *ngIf=\"!isActiveSelect && isShowSplitLine\"></nav-split-line>\n <a href=\"javascript:;\" thyIconNavLink thyTooltip=\"\u5355\u5143\u683C\u80CC\u666F\" (mousedown)=\"openSelectColor($event)\">\n <thy-icon thyIconName=\"background-tt\" thyIconType=\"twotone\" [thyTwotoneColor]=\"selectedColor\"></thy-icon>\n </a>\n <nav-split-line *ngIf=\"deleteIcon\"></nav-split-line>\n <a\n *ngIf=\"deleteIcon\"\n href=\"javascript:;\"\n thyIconNavLink\n [thyTooltip]=\"iconName\"\n class=\"danger\"\n [thyIconNavLinkIcon]=\"deleteIcon\"\n (mousedown)=\"onDelete($event)\"\n (mouseenter)=\"onEnterDelete($event)\"\n (mouseleave)=\"onLeaveDelete($event)\"\n ></a>\n</thy-icon-nav>\n", components: [{ type: i2__namespace.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }, { type: i2__namespace.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i4__namespace$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: NavSplitLineComponent, selector: "nav-split-line" }], directives: [{ type: i6__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7__namespace.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
|
|
8446
|
+
TheTableToolbarComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheTableToolbarComponent, selector: "the-table-toolbar", inputs: { tableStore: "tableStore", isActiveSelect: "isActiveSelect" }, ngImport: i0__namespace, template: "<thy-icon-nav>\n <ng-container *ngFor=\"let item of cellMenuList\">\n <a href=\"javascript:;\" thyIconNavLink *ngIf=\"!item.invisibility\" [thyTooltip]=\"item.name\" (mousedown)=\"item.actionHandle()\">\n <thy-icon [thyIconName]=\"item.icon\"></thy-icon>\n </a>\n </ng-container>\n <nav-split-line *ngIf=\"!isActiveSelect && isShowSplitLine\"></nav-split-line>\n <a href=\"javascript:;\" thyIconNavLink thyTooltip=\"\u5355\u5143\u683C\u80CC\u666F\" (mousedown)=\"openSelectColor($event)\">\n <thy-icon thyIconName=\"background-tt\" thyIconType=\"twotone\" [thyTwotoneColor]=\"selectedColor\"></thy-icon>\n </a>\n <nav-split-line *ngIf=\"deleteIcon\"></nav-split-line>\n <a\n *ngIf=\"deleteIcon\"\n href=\"javascript:;\"\n thyIconNavLink\n [thyTooltip]=\"iconName\"\n class=\"danger\"\n [thyIconNavLinkIcon]=\"deleteIcon\"\n (mousedown)=\"onDelete($event)\"\n (mouseenter)=\"onEnterDelete($event)\"\n (mouseleave)=\"onLeaveDelete($event)\"\n ></a>\n</thy-icon-nav>\n", components: [{ type: i2__namespace.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }, { type: i2__namespace.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i4__namespace$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: NavSplitLineComponent, selector: "nav-split-line", inputs: ["mode"] }], directives: [{ type: i6__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7__namespace.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
|
|
8354
8447
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheTableToolbarComponent, decorators: [{
|
|
8355
8448
|
type: i0.Component,
|
|
8356
8449
|
args: [{
|
|
@@ -9059,9 +9152,12 @@
|
|
|
9059
9152
|
TheTableComponent.prototype.useRowControls = function () {
|
|
9060
9153
|
if (this.selection) {
|
|
9061
9154
|
this.rowControls = this.calculateRowControls();
|
|
9062
|
-
this.cdr.
|
|
9155
|
+
this.cdr.markForCheck();
|
|
9063
9156
|
}
|
|
9064
9157
|
};
|
|
9158
|
+
TheTableComponent.prototype.detectChanges = function () {
|
|
9159
|
+
this.cdr.detectChanges();
|
|
9160
|
+
};
|
|
9065
9161
|
TheTableComponent.prototype.calculateMinRowSpanCellForRows = function () {
|
|
9066
9162
|
var table = this.element;
|
|
9067
9163
|
var cells = table.children.map(function (row, index) {
|
|
@@ -9330,7 +9426,7 @@
|
|
|
9330
9426
|
provide: TheTableToken,
|
|
9331
9427
|
useExisting: TheTableComponent
|
|
9332
9428
|
}
|
|
9333
|
-
], viewQueries: [{ propertyName: "tableWrapper", first: true, predicate: ["tableWrapper"], descendants: true, read: i0.ElementRef, static: true }, { propertyName: "theTableElement", first: true, predicate: ["theTable"], descendants: true, read: i0.ElementRef, static: true }, { propertyName: "tbodyElement", first: true, predicate: ["tbody"], descendants: true, read: i0.ElementRef, static: true }], usesInheritance: true, ngImport: i0__namespace, template: "<div\n class=\"the-table-container\"\n theColumnResize\n [ngClass]=\"{\n 'the-table-with-controls': isInTable,\n 'the-table-selection-hide': tableStore.isCellSelecting || tableStore.isRightClicking\n }\"\n>\n <div class=\"the-table-row-controls-wrapper\" *ngIf=\"!readonly\">\n <div>\n <div\n class=\"the-table-corner-controls\"\n [ngClass]=\"{ active: isSelectedAllCell, dangerous: tableStore.isSelectedTable && tableStore.dangerousCells.length > 0 }\"\n >\n <button type=\"button\" class=\"the-table-corner-button\" (mousedown)=\"onSelectTable($event)\"></button>\n <div class=\"the-table-corner-controls-insert-row-marker\">\n <the-table-insert-mark type=\"row\" [at]=\"0\" [tableStore]=\"tableStore\"></the-table-insert-mark>\n </div>\n <div class=\"the-table-corner-controls-insert-column-marker\">\n <the-table-insert-mark type=\"column\" [at]=\"0\" [tableStore]=\"tableStore\"></the-table-insert-mark>\n </div>\n </div>\n <div class=\"the-table-row-controls\">\n <div class=\"the-table-row-controls-inner\">\n <div\n class=\"the-table-row-controls-button-wrap\"\n *ngFor=\"let control of rowControls; let i = index; trackBy: trackByFnRowCotrols\"\n [ngClass]=\"{\n active: tableStore.selectedRowsIndex.includes(control.rowIndex),\n dangerous: tableStore.dangerousRowsIndex.includes(control.rowIndex) && tableStore.dangerousCells.length > 0\n }\"\n >\n <button\n (mousedown)=\"onRowMouseDown($event, control.rowIndex)\"\n type=\"button\"\n [ngStyle]=\"{ height: control.height + 1 + 'px' }\"\n class=\"the-table-row-controls-button the-table-controls-button\"\n ></button>\n <the-table-insert-mark type=\"row\" [at]=\"control.rowIndex + 1\" [tableStore]=\"tableStore\"></the-table-insert-mark>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"the-table-wrapper\" #tableWrapper>\n <table class=\"the-table\" #theTable [ngClass]=\"{ 'the-table-with-controls': isInTable }\">\n <colgroup *ngIf=\"columns\">\n <col *ngFor=\"let col of columns\" [ngStyle]=\"{ width: col.width + 'px' }\" />\n </colgroup>\n <thead>\n <tr class=\"the-table-col-controls-wrapper\">\n <th\n class=\"the-table-col-controls\"\n (mousedown)=\"onColMouseDown($event, i)\"\n *ngFor=\"let control of colControls; let i = index; trackBy: trackByFnColCotrols\"\n >\n <the-table-insert-mark\n *ngIf=\"isInTable\"\n type=\"column\"\n [at]=\"i + 1\"\n [tableStore]=\"tableStore\"\n ></the-table-insert-mark>\n <div\n class=\"the-table-col-controls-inner\"\n [ngClass]=\"{\n active: tableStore.selectedColumnsIndex.includes(i),\n dangerous: tableStore.dangerousColumnsIndex.includes(i) && tableStore.dangerousCells.length > 0\n }\"\n ></div>\n </th>\n </tr>\n </thead>\n <tbody #tbody>\n <slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"> </slate-children>\n </tbody>\n </table>\n </div>\n</div>\n", components: [{ type: TheInsertMarkComponent, selector: "the-table-insert-mark", inputs: ["type", "at", "tableStore"] }, { type: i1__namespace.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }], directives: [{ type: TheColumnResizeDirective, selector: "div[theColumnResize]" }, { type: i6__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
|
9429
|
+
], viewQueries: [{ propertyName: "tableWrapper", first: true, predicate: ["tableWrapper"], descendants: true, read: i0.ElementRef, static: true }, { propertyName: "theTableElement", first: true, predicate: ["theTable"], descendants: true, read: i0.ElementRef, static: true }, { propertyName: "tbodyElement", first: true, predicate: ["tbody"], descendants: true, read: i0.ElementRef, static: true }], usesInheritance: true, ngImport: i0__namespace, template: "<div\n class=\"the-table-container\"\n theColumnResize\n [ngClass]=\"{\n 'the-table-with-controls': isInTable,\n 'the-table-selection-hide': tableStore.isCellSelecting || tableStore.isRightClicking\n }\"\n>\n <div class=\"the-table-row-controls-wrapper\" *ngIf=\"!readonly && isInTable\">\n <div>\n <div\n class=\"the-table-corner-controls\"\n [ngClass]=\"{ active: isSelectedAllCell, dangerous: tableStore.isSelectedTable && tableStore.dangerousCells.length > 0 }\"\n >\n <button type=\"button\" class=\"the-table-corner-button\" (mousedown)=\"onSelectTable($event)\"></button>\n <div class=\"the-table-corner-controls-insert-row-marker\">\n <the-table-insert-mark type=\"row\" [at]=\"0\" [tableStore]=\"tableStore\"></the-table-insert-mark>\n </div>\n <div class=\"the-table-corner-controls-insert-column-marker\">\n <the-table-insert-mark type=\"column\" [at]=\"0\" [tableStore]=\"tableStore\"></the-table-insert-mark>\n </div>\n </div>\n <div class=\"the-table-row-controls\">\n <div class=\"the-table-row-controls-inner\">\n <div\n class=\"the-table-row-controls-button-wrap\"\n *ngFor=\"let control of rowControls; let i = index; trackBy: trackByFnRowCotrols\"\n [ngClass]=\"{\n active: tableStore.selectedRowsIndex.includes(control.rowIndex),\n dangerous: tableStore.dangerousRowsIndex.includes(control.rowIndex) && tableStore.dangerousCells.length > 0\n }\"\n >\n <button\n (mousedown)=\"onRowMouseDown($event, control.rowIndex)\"\n type=\"button\"\n [ngStyle]=\"{ height: control.height + 1 + 'px' }\"\n class=\"the-table-row-controls-button the-table-controls-button\"\n ></button>\n <the-table-insert-mark type=\"row\" [at]=\"control.rowIndex + 1\" [tableStore]=\"tableStore\"></the-table-insert-mark>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"the-table-wrapper\" #tableWrapper>\n <table class=\"the-table\" #theTable [ngClass]=\"{ 'the-table-with-controls': isInTable }\">\n <colgroup *ngIf=\"columns\">\n <col *ngFor=\"let col of columns\" [ngStyle]=\"{ width: col.width + 'px' }\" />\n </colgroup>\n <thead>\n <tr class=\"the-table-col-controls-wrapper\">\n <th\n class=\"the-table-col-controls\"\n (mousedown)=\"onColMouseDown($event, i)\"\n *ngFor=\"let control of colControls; let i = index; trackBy: trackByFnColCotrols\"\n >\n <the-table-insert-mark\n *ngIf=\"isInTable\"\n type=\"column\"\n [at]=\"i + 1\"\n [tableStore]=\"tableStore\"\n ></the-table-insert-mark>\n <div\n class=\"the-table-col-controls-inner\"\n [ngClass]=\"{\n active: tableStore.selectedColumnsIndex.includes(i),\n dangerous: tableStore.dangerousColumnsIndex.includes(i) && tableStore.dangerousCells.length > 0\n }\"\n ></div>\n </th>\n </tr>\n </thead>\n <tbody #tbody>\n <slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"> </slate-children>\n </tbody>\n </table>\n </div>\n</div>\n", components: [{ type: TheInsertMarkComponent, selector: "the-table-insert-mark", inputs: ["type", "at", "tableStore"] }, { type: i1__namespace.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }], directives: [{ type: TheColumnResizeDirective, selector: "div[theColumnResize]" }, { type: i6__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
|
9334
9430
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheTableComponent, decorators: [{
|
|
9335
9431
|
type: i0.Component,
|
|
9336
9432
|
args: [{
|
|
@@ -9418,11 +9514,13 @@
|
|
|
9418
9514
|
_super.prototype.onContextChange.call(this);
|
|
9419
9515
|
if (this.initialized) {
|
|
9420
9516
|
this.useBackground();
|
|
9517
|
+
this.useHeight();
|
|
9421
9518
|
}
|
|
9422
9519
|
};
|
|
9423
9520
|
TheTableRowComponent.prototype.ngOnInit = function () {
|
|
9424
9521
|
_super.prototype.ngOnInit.call(this);
|
|
9425
9522
|
this.useBackground();
|
|
9523
|
+
this.useHeight();
|
|
9426
9524
|
};
|
|
9427
9525
|
TheTableRowComponent.prototype.useBackground = function () {
|
|
9428
9526
|
if (this.element.header && !this.backgroundColor) {
|
|
@@ -10245,6 +10343,7 @@
|
|
|
10245
10343
|
this.applyRowSize(deltaSize);
|
|
10246
10344
|
}
|
|
10247
10345
|
this.tableComponent.useRowControls();
|
|
10346
|
+
this.tableComponent.detectChanges();
|
|
10248
10347
|
this.updateOverlayHandleSizeAndOffset();
|
|
10249
10348
|
};
|
|
10250
10349
|
TheTdComponent.prototype._createOverlayForHandle = function () {
|
|
@@ -10759,7 +10858,7 @@
|
|
|
10759
10858
|
setFragmentData(unit);
|
|
10760
10859
|
};
|
|
10761
10860
|
editor.insertData = function (data) {
|
|
10762
|
-
var fragment = extractFragment(data
|
|
10861
|
+
var fragment = extractFragment(data);
|
|
10763
10862
|
if (fragment) {
|
|
10764
10863
|
var opts = new TableOptions$1();
|
|
10765
10864
|
var selection = editor.selection;
|
|
@@ -10916,6 +11015,11 @@
|
|
|
10916
11015
|
if (html && !slateFragment) {
|
|
10917
11016
|
var htmlDom = new DOMParser().parseFromString(html, 'text/html');
|
|
10918
11017
|
var fragment = selene.TheiaConverter.convertToTheia(Array.from(htmlDom.body.children));
|
|
11018
|
+
// 无法识别HTML内容时后退一下:识别纯文本
|
|
11019
|
+
if (fragment.length === 1 && slate.Editor.isEmpty(editor, fragment[0]) && fragment[0].type === exports.ElementKinds.paragraph) {
|
|
11020
|
+
insertData(data);
|
|
11021
|
+
return;
|
|
11022
|
+
}
|
|
10919
11023
|
insertTheElements(editor, fragment);
|
|
10920
11024
|
return;
|
|
10921
11025
|
}
|
|
@@ -10957,14 +11061,16 @@
|
|
|
10957
11061
|
enumerable: false,
|
|
10958
11062
|
configurable: true
|
|
10959
11063
|
});
|
|
11064
|
+
TheVerticalToolbarItemComponent.prototype.handleDocumentMouseDown = function (event) {
|
|
11065
|
+
if (!this.elementRef.nativeElement.contains(event.target)) {
|
|
11066
|
+
this.close();
|
|
11067
|
+
}
|
|
11068
|
+
};
|
|
10960
11069
|
TheVerticalToolbarItemComponent.prototype.ngOnInit = function () { };
|
|
10961
11070
|
TheVerticalToolbarItemComponent.prototype.statusChange = function (editor) {
|
|
10962
11071
|
var _a, _b;
|
|
10963
11072
|
this.active = ((_a = this.toolbarItem) === null || _a === void 0 ? void 0 : _a.active) ? (_b = this.toolbarItem) === null || _b === void 0 ? void 0 : _b.active(editor) : false;
|
|
10964
11073
|
this.activeMenu = this.menusActive(editor);
|
|
10965
|
-
if (!this.active) {
|
|
10966
|
-
this.close();
|
|
10967
|
-
}
|
|
10968
11074
|
};
|
|
10969
11075
|
TheVerticalToolbarItemComponent.prototype.menusActive = function (editor) {
|
|
10970
11076
|
var _this = this;
|
|
@@ -11012,7 +11118,7 @@
|
|
|
11012
11118
|
return TheVerticalToolbarItemComponent;
|
|
11013
11119
|
}(TheToolbarBaseItemComponent));
|
|
11014
11120
|
TheVerticalToolbarItemComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheVerticalToolbarItemComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i1__namespace$6.ThyPopover }, { token: i0__namespace.ViewContainerRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
11015
|
-
TheVerticalToolbarItemComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheVerticalToolbarItemComponent, selector: "the-toolbar-vertical-align-item", inputs: { item: "item", menus: "menus", editor: "editor", toolbarItem: "toolbarItem" }, host: { properties: { "class.hide": "!active" }, classAttribute: "the-toolbar-dropdown-container verticalAlign" }, viewQueries: [{ propertyName: "template", first: true, predicate: ["VerticalAlignItems"], descendants: true, read: i0.TemplateRef, static: true }], usesInheritance: true, ngImport: i0__namespace, template: "<a\n thyIconNavLink\n class=\"icon-mode link-with-down\"\n [thyTooltip]=\"toolbarItem?.name\"\n [thyIconNavLinkActive]=\"isOpened\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"execute($event)\"\n>\n <thy-icon [thyIconName]=\"activeMenu?.icon\"></thy-icon>\n <thy-icon class=\"caret-down-icon font-size-sm text-desc\" thyIconName=\"caret-down\"></thy-icon>\n</a>\n\n<ng-template #VerticalAlignItems>\n <thy-action-menu class=\"dropdown\">\n <ng-container *ngFor=\"let menu of toolbarItem?.includes\">\n <a\n thyActionMenuItem\n href=\"javascript:;\"\n [thyActionMenuItemActive]=\"menu.key === activeMenu?.key\"\n [ngStyle]=\"menu?.styles\"\n (mousedown)=\"itemMousedown($event, menu)\"\n >\n <span *ngIf=\"menu.icon\" thyActionMenuItemIcon>\n <thy-icon [thyIconName]=\"menu?.icon\"></thy-icon>\n </span>\n <span thyActionMenuItemName>{{ menu.name }}</span>\n </a>\n </ng-container>\n </thy-action-menu>\n</ng-template>\n", components: [{ type: i2__namespace.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i4__namespace$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: i5__namespace$1.ThyActionMenuComponent, selector: "thy-action-menu", inputs: ["thyTheme", "thyWidth"] }], directives: [{ type: i7__namespace.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i6__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5__namespace$1.ThyActionMenuItemDirective, selector: "[thyActionMenuItem]", inputs: ["thyDisabled", "thyType"] }, { type: i5__namespace$1.ThyActionMenuItemActiveDirective, selector: "[thyActionMenuItemActive]", inputs: ["thyActionMenuItemActive"] }, { type: i6__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5__namespace$1.ThyActionMenuItemIconDirective, selector: "[thyActionMenuItemIcon]" }, { type: i5__namespace$1.ThyActionMenuItemNameDirective, selector: "[thyActionMenuItemName]" }] });
|
|
11121
|
+
TheVerticalToolbarItemComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheVerticalToolbarItemComponent, selector: "the-toolbar-vertical-align-item", inputs: { item: "item", menus: "menus", editor: "editor", toolbarItem: "toolbarItem" }, host: { listeners: { "document: mousedown": "handleDocumentMouseDown($event)" }, properties: { "class.hide": "!active" }, classAttribute: "the-toolbar-dropdown-container verticalAlign" }, viewQueries: [{ propertyName: "template", first: true, predicate: ["VerticalAlignItems"], descendants: true, read: i0.TemplateRef, static: true }], usesInheritance: true, ngImport: i0__namespace, template: "<a\n thyIconNavLink\n class=\"icon-mode link-with-down\"\n [thyTooltip]=\"toolbarItem?.name\"\n [thyIconNavLinkActive]=\"isOpened\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"execute($event)\"\n>\n <thy-icon [thyIconName]=\"activeMenu?.icon\"></thy-icon>\n <thy-icon class=\"caret-down-icon font-size-sm text-desc\" thyIconName=\"caret-down\"></thy-icon>\n</a>\n\n<ng-template #VerticalAlignItems>\n <thy-action-menu class=\"dropdown\">\n <ng-container *ngFor=\"let menu of toolbarItem?.includes\">\n <a\n thyActionMenuItem\n href=\"javascript:;\"\n [thyActionMenuItemActive]=\"menu.key === activeMenu?.key\"\n [ngStyle]=\"menu?.styles\"\n (mousedown)=\"itemMousedown($event, menu)\"\n >\n <span *ngIf=\"menu.icon\" thyActionMenuItemIcon>\n <thy-icon [thyIconName]=\"menu?.icon\"></thy-icon>\n </span>\n <span thyActionMenuItemName>{{ menu.name }}</span>\n </a>\n </ng-container>\n </thy-action-menu>\n</ng-template>\n", components: [{ type: i2__namespace.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i4__namespace$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: i5__namespace$1.ThyActionMenuComponent, selector: "thy-action-menu", inputs: ["thyTheme", "thyWidth"] }], directives: [{ type: i7__namespace.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i6__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5__namespace$1.ThyActionMenuItemDirective, selector: "[thyActionMenuItem]", inputs: ["thyDisabled", "thyType"] }, { type: i5__namespace$1.ThyActionMenuItemActiveDirective, selector: "[thyActionMenuItemActive]", inputs: ["thyActionMenuItemActive"] }, { type: i6__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5__namespace$1.ThyActionMenuItemIconDirective, selector: "[thyActionMenuItemIcon]" }, { type: i5__namespace$1.ThyActionMenuItemNameDirective, selector: "[thyActionMenuItemName]" }] });
|
|
11016
11122
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheVerticalToolbarItemComponent, decorators: [{
|
|
11017
11123
|
type: i0.Component,
|
|
11018
11124
|
args: [{
|
|
@@ -11034,6 +11140,9 @@
|
|
|
11034
11140
|
}], template: [{
|
|
11035
11141
|
type: i0.ViewChild,
|
|
11036
11142
|
args: ['VerticalAlignItems', { read: i0.TemplateRef, static: true }]
|
|
11143
|
+
}], handleDocumentMouseDown: [{
|
|
11144
|
+
type: i0.HostListener,
|
|
11145
|
+
args: ['document: mousedown', ['$event']]
|
|
11037
11146
|
}] } });
|
|
11038
11147
|
|
|
11039
11148
|
var VerticalAlignOptions = [
|
|
@@ -11069,6 +11178,376 @@
|
|
|
11069
11178
|
}
|
|
11070
11179
|
];
|
|
11071
11180
|
|
|
11181
|
+
var PaintFormatEditor = {
|
|
11182
|
+
formatBrush: function (editor) {
|
|
11183
|
+
var e_1, _a;
|
|
11184
|
+
var contextService = editor.injector.get(TheContextService);
|
|
11185
|
+
var obj = {};
|
|
11186
|
+
try {
|
|
11187
|
+
for (var MarkProps_1 = __values(MarkProps), MarkProps_1_1 = MarkProps_1.next(); !MarkProps_1_1.done; MarkProps_1_1 = MarkProps_1.next()) {
|
|
11188
|
+
var key = MarkProps_1_1.value;
|
|
11189
|
+
var k = contextService.paintFormatStatus.marks[key];
|
|
11190
|
+
obj[key] = k || null;
|
|
11191
|
+
}
|
|
11192
|
+
}
|
|
11193
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
11194
|
+
finally {
|
|
11195
|
+
try {
|
|
11196
|
+
if (MarkProps_1_1 && !MarkProps_1_1.done && (_a = MarkProps_1.return)) _a.call(MarkProps_1);
|
|
11197
|
+
}
|
|
11198
|
+
finally { if (e_1) throw e_1.error; }
|
|
11199
|
+
}
|
|
11200
|
+
var block = anchorBlock(editor);
|
|
11201
|
+
if (block && slate.Range.isCollapsed(editor.selection)) {
|
|
11202
|
+
// TODO:: 在撤销时有bug, 临时使用withoutSaving处理
|
|
11203
|
+
slateHistory.HistoryEditor.withoutSaving(editor, function () {
|
|
11204
|
+
var path = TheEditor.findPath(editor, block);
|
|
11205
|
+
setMarks(editor, obj, path);
|
|
11206
|
+
});
|
|
11207
|
+
}
|
|
11208
|
+
else {
|
|
11209
|
+
setMarks(editor, obj);
|
|
11210
|
+
}
|
|
11211
|
+
PaintFormatEditor.cancelFormatBrushStatus(editor);
|
|
11212
|
+
},
|
|
11213
|
+
isActive: function (editor) {
|
|
11214
|
+
var contextService = editor.injector.get(TheContextService);
|
|
11215
|
+
var res = contextService.paintFormatStatus.isActive;
|
|
11216
|
+
return res;
|
|
11217
|
+
},
|
|
11218
|
+
enableFormatBrush: function (editor) {
|
|
11219
|
+
var contextService = editor.injector.get(TheContextService);
|
|
11220
|
+
if (contextService.paintFormatStatus.isActive) {
|
|
11221
|
+
return PaintFormatEditor.cancelFormatBrushStatus(editor);
|
|
11222
|
+
}
|
|
11223
|
+
contextService.paintFormatStatus = {
|
|
11224
|
+
isActive: true,
|
|
11225
|
+
marks: getSelectionMarks(editor)
|
|
11226
|
+
};
|
|
11227
|
+
var element = i1.EDITOR_TO_ELEMENT.get(editor);
|
|
11228
|
+
element.classList.add('pointer-paint');
|
|
11229
|
+
contextService.onMouseUp$
|
|
11230
|
+
.pipe(operators.skip(1), operators.filter(function (event) { return element.contains(event.target); }), operators.take(1))
|
|
11231
|
+
.subscribe(function (event) {
|
|
11232
|
+
if (contextService.paintFormatStatus.isActive) {
|
|
11233
|
+
PaintFormatEditor.formatBrush(editor);
|
|
11234
|
+
}
|
|
11235
|
+
});
|
|
11236
|
+
editor.onChange();
|
|
11237
|
+
},
|
|
11238
|
+
cancelFormatBrushStatus: function (editor) {
|
|
11239
|
+
var contextService = editor.injector.get(TheContextService);
|
|
11240
|
+
contextService.paintFormatStatus = {
|
|
11241
|
+
isActive: false,
|
|
11242
|
+
marks: {}
|
|
11243
|
+
};
|
|
11244
|
+
var element = i1.EDITOR_TO_ELEMENT.get(editor);
|
|
11245
|
+
element.classList.remove('pointer-paint');
|
|
11246
|
+
editor.onChange();
|
|
11247
|
+
}
|
|
11248
|
+
};
|
|
11249
|
+
|
|
11250
|
+
var PaintFormatOptions = [
|
|
11251
|
+
{
|
|
11252
|
+
key: exports.ToolbarActionTypes.undo,
|
|
11253
|
+
icon: 'undo',
|
|
11254
|
+
name: '撤销',
|
|
11255
|
+
execute: function (editor) { return editor.undo(); }
|
|
11256
|
+
},
|
|
11257
|
+
{
|
|
11258
|
+
key: exports.ToolbarActionTypes.redo,
|
|
11259
|
+
icon: 'redo',
|
|
11260
|
+
name: '重做',
|
|
11261
|
+
execute: function (editor) { return editor.redo(); }
|
|
11262
|
+
},
|
|
11263
|
+
{
|
|
11264
|
+
key: exports.ToolbarActionTypes.paintformat,
|
|
11265
|
+
icon: 'paintformat',
|
|
11266
|
+
name: '格式刷',
|
|
11267
|
+
execute: PaintFormatEditor.enableFormatBrush,
|
|
11268
|
+
active: PaintFormatEditor.isActive
|
|
11269
|
+
},
|
|
11270
|
+
{
|
|
11271
|
+
key: exports.ToolbarActionTypes.clean,
|
|
11272
|
+
icon: 'clean',
|
|
11273
|
+
name: '清除格式',
|
|
11274
|
+
execute: function (editor) {
|
|
11275
|
+
var e_1, _a;
|
|
11276
|
+
var selection = editor.selection;
|
|
11277
|
+
if (!selection) {
|
|
11278
|
+
return;
|
|
11279
|
+
}
|
|
11280
|
+
if (TableEditor.clearMark(editor)) {
|
|
11281
|
+
return;
|
|
11282
|
+
}
|
|
11283
|
+
if (slate.Range.isCollapsed(selection)) {
|
|
11284
|
+
var marks = slate.Editor.marks(editor);
|
|
11285
|
+
try {
|
|
11286
|
+
for (var _b = __values(Object.keys(marks)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
11287
|
+
var key = _c.value;
|
|
11288
|
+
slate.Editor.removeMark(editor, key);
|
|
11289
|
+
}
|
|
11290
|
+
}
|
|
11291
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
11292
|
+
finally {
|
|
11293
|
+
try {
|
|
11294
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
11295
|
+
}
|
|
11296
|
+
finally { if (e_1) throw e_1.error; }
|
|
11297
|
+
}
|
|
11298
|
+
}
|
|
11299
|
+
else {
|
|
11300
|
+
var unsetMarks_1 = {};
|
|
11301
|
+
MarkProps.forEach(function (key) {
|
|
11302
|
+
unsetMarks_1[key] = null;
|
|
11303
|
+
});
|
|
11304
|
+
setMarks(editor, unsetMarks_1);
|
|
11305
|
+
}
|
|
11306
|
+
}
|
|
11307
|
+
}
|
|
11308
|
+
];
|
|
11309
|
+
|
|
11310
|
+
/**
|
|
11311
|
+
* whether the current node is a clean paragraph
|
|
11312
|
+
* @param editor
|
|
11313
|
+
* @param text
|
|
11314
|
+
* @returns boolean
|
|
11315
|
+
*/
|
|
11316
|
+
var isCleanEmptyParagraph = function (editor) {
|
|
11317
|
+
var isCollapsedCursor = TheEditor.isFocused(editor) && editor.selection && slate.Range.isCollapsed(editor.selection);
|
|
11318
|
+
if (!isCollapsedCursor) {
|
|
11319
|
+
return false;
|
|
11320
|
+
}
|
|
11321
|
+
var block = slate.Node.ancestor(editor, [editor.selection.anchor.path[0]]);
|
|
11322
|
+
var textIndent = 'textIndent';
|
|
11323
|
+
var align = 'align';
|
|
11324
|
+
var hasTextIndent = block[textIndent];
|
|
11325
|
+
var hasAlign = block[align];
|
|
11326
|
+
if (slate.Node.string(block) === '' &&
|
|
11327
|
+
slate.Element.isElement(block) &&
|
|
11328
|
+
block.type === exports.ElementKinds.paragraph &&
|
|
11329
|
+
block.children.length === 1 &&
|
|
11330
|
+
slate.Text.isText(block.children[0]) &&
|
|
11331
|
+
!slate.Editor.isVoid(editor, block) &&
|
|
11332
|
+
!hasTextIndent &&
|
|
11333
|
+
!hasAlign) {
|
|
11334
|
+
return true;
|
|
11335
|
+
}
|
|
11336
|
+
return false;
|
|
11337
|
+
};
|
|
11338
|
+
|
|
11339
|
+
var TheToolbarItemComponent = /** @class */ (function (_super) {
|
|
11340
|
+
__extends(TheToolbarItemComponent, _super);
|
|
11341
|
+
function TheToolbarItemComponent(ngZone, cfr) {
|
|
11342
|
+
var _this = _super.call(this) || this;
|
|
11343
|
+
_this.ngZone = ngZone;
|
|
11344
|
+
_this.cfr = cfr;
|
|
11345
|
+
_this.itemMode = exports.ToolbarItemMode.horizontal;
|
|
11346
|
+
_this.ToolbarItemMode = exports.ToolbarItemMode;
|
|
11347
|
+
_this.active = false;
|
|
11348
|
+
return _this;
|
|
11349
|
+
}
|
|
11350
|
+
TheToolbarItemComponent.prototype.ngOnInit = function () {
|
|
11351
|
+
var _a, _b;
|
|
11352
|
+
if (((_a = this.item) === null || _a === void 0 ? void 0 : _a.quickItemComponent) && i1.isComponentType((_b = this.item) === null || _b === void 0 ? void 0 : _b.quickItemComponent)) {
|
|
11353
|
+
this.renderToolbarItem();
|
|
11354
|
+
}
|
|
11355
|
+
};
|
|
11356
|
+
TheToolbarItemComponent.prototype.statusChange = function (editor) {
|
|
11357
|
+
var _a, _b;
|
|
11358
|
+
this.active = ((_a = this.item) === null || _a === void 0 ? void 0 : _a.active) ? (_b = this.item) === null || _b === void 0 ? void 0 : _b.active(editor) : false;
|
|
11359
|
+
};
|
|
11360
|
+
TheToolbarItemComponent.prototype.execute = function (event) {
|
|
11361
|
+
var _a, _b, _c;
|
|
11362
|
+
_super.prototype.execute.call(this, event);
|
|
11363
|
+
if (!((_a = this.item) === null || _a === void 0 ? void 0 : _a.execute) || ((_b = this.editor) === null || _b === void 0 ? void 0 : _b.disabled)) {
|
|
11364
|
+
return;
|
|
11365
|
+
}
|
|
11366
|
+
(_c = this.item) === null || _c === void 0 ? void 0 : _c.execute(this.editor);
|
|
11367
|
+
};
|
|
11368
|
+
TheToolbarItemComponent.prototype.renderToolbarItem = function () {
|
|
11369
|
+
var _this = this;
|
|
11370
|
+
this.ngZone.run(function () {
|
|
11371
|
+
var toolbarItemFactory = _this.cfr.resolveComponentFactory(_this.item.quickItemComponent);
|
|
11372
|
+
var tollbarItemRef = _this.toolbarContainer.createComponent(toolbarItemFactory);
|
|
11373
|
+
tollbarItemRef.instance.editor = _this.editor;
|
|
11374
|
+
tollbarItemRef.instance.item = _this.item;
|
|
11375
|
+
tollbarItemRef.instance.itemMode = exports.ToolbarItemMode.vertical;
|
|
11376
|
+
});
|
|
11377
|
+
};
|
|
11378
|
+
return TheToolbarItemComponent;
|
|
11379
|
+
}(TheToolbarBaseItemComponent));
|
|
11380
|
+
TheToolbarItemComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheToolbarItemComponent, deps: [{ token: i0__namespace.NgZone }, { token: i0__namespace.ComponentFactoryResolver }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
11381
|
+
TheToolbarItemComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheToolbarItemComponent, selector: "the-toolbar-item", inputs: { item: "item", editor: "editor", itemMode: "itemMode" }, host: { classAttribute: "the-toolbar-item" }, viewQueries: [{ propertyName: "toolbarContainer", first: true, predicate: ["toolbarContainer"], descendants: true, read: i0.ViewContainerRef, static: true }], usesInheritance: true, ngImport: i0__namespace, template: "\n <ng-container *ngIf=\"itemMode === ToolbarItemMode.horizontal; else selectionItem\">\n <a\n thyIconNavLink\n [thyIconNavLinkIcon]=\"item.icon\"\n [thyTooltip]=\"item.name\"\n thyTooltipPlacement=\"top\"\n [thyIconNavLinkActive]=\"active\"\n (mousedown)=\"execute($event)\"\n ></a>\n </ng-container>\n <ng-template #selectionItem>\n <ng-container *ngIf=\"!item?.quickItemComponent\">\n <thy-icon [thyIconName]=\"item?.icon\" [thyIconRotate]=\"0\" class=\"quick-toolbar-icon\"></thy-icon>\n <span class=\"quick-toolbar-name\">{{ item?.name }}</span>\n </ng-container>\n </ng-template>\n <ng-container #toolbarContainer></ng-container>\n ", isInline: true, components: [{ type: i2__namespace.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i4__namespace$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7__namespace.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
|
|
11382
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheToolbarItemComponent, decorators: [{
|
|
11383
|
+
type: i0.Component,
|
|
11384
|
+
args: [{
|
|
11385
|
+
selector: 'the-toolbar-item',
|
|
11386
|
+
template: "\n <ng-container *ngIf=\"itemMode === ToolbarItemMode.horizontal; else selectionItem\">\n <a\n thyIconNavLink\n [thyIconNavLinkIcon]=\"item.icon\"\n [thyTooltip]=\"item.name\"\n thyTooltipPlacement=\"top\"\n [thyIconNavLinkActive]=\"active\"\n (mousedown)=\"execute($event)\"\n ></a>\n </ng-container>\n <ng-template #selectionItem>\n <ng-container *ngIf=\"!item?.quickItemComponent\">\n <thy-icon [thyIconName]=\"item?.icon\" [thyIconRotate]=\"0\" class=\"quick-toolbar-icon\"></thy-icon>\n <span class=\"quick-toolbar-name\">{{ item?.name }}</span>\n </ng-container>\n </ng-template>\n <ng-container #toolbarContainer></ng-container>\n ",
|
|
11387
|
+
host: {
|
|
11388
|
+
class: 'the-toolbar-item'
|
|
11389
|
+
}
|
|
11390
|
+
}]
|
|
11391
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.NgZone }, { type: i0__namespace.ComponentFactoryResolver }]; }, propDecorators: { item: [{
|
|
11392
|
+
type: i0.Input
|
|
11393
|
+
}], editor: [{
|
|
11394
|
+
type: i0.Input
|
|
11395
|
+
}], itemMode: [{
|
|
11396
|
+
type: i0.Input
|
|
11397
|
+
}], toolbarContainer: [{
|
|
11398
|
+
type: i0.ViewChild,
|
|
11399
|
+
args: ['toolbarContainer', { read: i0.ViewContainerRef, static: true }]
|
|
11400
|
+
}] } });
|
|
11401
|
+
|
|
11402
|
+
var TheQuickToolbarComponent = /** @class */ (function (_super) {
|
|
11403
|
+
__extends(TheQuickToolbarComponent, _super);
|
|
11404
|
+
function TheQuickToolbarComponent(popoverRef, elementRef) {
|
|
11405
|
+
var _this = _super.call(this) || this;
|
|
11406
|
+
_this.popoverRef = popoverRef;
|
|
11407
|
+
_this.elementRef = elementRef;
|
|
11408
|
+
_this.ToolbarItemMode = exports.ToolbarItemMode;
|
|
11409
|
+
_this.ToolbarActionTypes = exports.ToolbarActionTypes;
|
|
11410
|
+
return _this;
|
|
11411
|
+
}
|
|
11412
|
+
TheQuickToolbarComponent.prototype.handleMouseDown = function (event) {
|
|
11413
|
+
if (!this.elementRef.nativeElement.contains(event.target)) {
|
|
11414
|
+
this.popoverRef.close();
|
|
11415
|
+
}
|
|
11416
|
+
else {
|
|
11417
|
+
event.preventDefault();
|
|
11418
|
+
}
|
|
11419
|
+
};
|
|
11420
|
+
TheQuickToolbarComponent.prototype.handleEnter = function () {
|
|
11421
|
+
this.popoverRef.close();
|
|
11422
|
+
};
|
|
11423
|
+
TheQuickToolbarComponent.prototype.ngOnInit = function () {
|
|
11424
|
+
this.editorElement = i1.AngularEditor.toDOMNode(this.editor, this.editor);
|
|
11425
|
+
};
|
|
11426
|
+
TheQuickToolbarComponent.prototype.stopPropagation = function (event) {
|
|
11427
|
+
event.preventDefault();
|
|
11428
|
+
};
|
|
11429
|
+
TheQuickToolbarComponent.prototype.selectionChange = function (event) {
|
|
11430
|
+
this.removeHotKey();
|
|
11431
|
+
var toolbarItem = this.quickToolbarItems.find(function (item) { return item.key === event.value; });
|
|
11432
|
+
if (toolbarItem === null || toolbarItem === void 0 ? void 0 : toolbarItem.execute) {
|
|
11433
|
+
toolbarItem.execute(this.editor);
|
|
11434
|
+
}
|
|
11435
|
+
};
|
|
11436
|
+
TheQuickToolbarComponent.prototype.removeHotKey = function () {
|
|
11437
|
+
var node = slate.Node.get(this.editor, this.editor.selection.anchor.path);
|
|
11438
|
+
if (node && slate.Text.equals({ text: QUICK_TOOLBAR_HOTKEY }, node)) {
|
|
11439
|
+
slate.Editor.deleteBackward(this.editor);
|
|
11440
|
+
}
|
|
11441
|
+
};
|
|
11442
|
+
TheQuickToolbarComponent.prototype.ngOnDestroy = function () {
|
|
11443
|
+
_super.prototype.ngOnDestroy.call(this);
|
|
11444
|
+
};
|
|
11445
|
+
return TheQuickToolbarComponent;
|
|
11446
|
+
}(core.mixinUnsubscribe(core.MixinBase)));
|
|
11447
|
+
TheQuickToolbarComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheQuickToolbarComponent, deps: [{ token: i1__namespace$3.ThyPopoverRef }, { token: i0__namespace.ElementRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
11448
|
+
TheQuickToolbarComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheQuickToolbarComponent, selector: "the-quick-toolbar", inputs: { editor: "editor", quickToolbarItems: "quickToolbarItems" }, host: { listeners: { "document: mousedown": "handleMouseDown($event)", "document: keydown.enter": "handleEnter()" } }, usesInheritance: true, ngImport: i0__namespace, template: "<thy-selection-list\n class=\"the-quick-toolbar\"\n [thyBindKeyEventContainer]=\"editorElement\"\n (thySelectionChange)=\"selectionChange($event)\"\n [thyMultiple]=\"false\"\n>\n <ng-container *ngFor=\"let item of quickToolbarItems\">\n <ng-container *ngIf=\"item.key !== ToolbarActionTypes.split; else splitLine\">\n <thy-list-option [thyValue]=\"item?.key\" (mousedown)=\"stopPropagation($event)\">\n <the-toolbar-item [editor]=\"editor\" [item]=\"item\" [itemMode]=\"ToolbarItemMode.vertical\"></the-toolbar-item>\n </thy-list-option>\n </ng-container>\n </ng-container>\n</thy-selection-list>\n\n<ng-template #splitLine>\n <nav-split-line [mode]=\"ToolbarItemMode.horizontal\"></nav-split-line>\n</ng-template>\n", components: [{ type: i2__namespace$3.ThySelectionListComponent, selector: "thy-selection-list,[thy-selection-list]", inputs: ["thyMultiple", "thyBindKeyEventContainer", "thyScrollContainer", "thyBeforeKeydown", "thyUniqueKey", "thyCompareWith", "thyLayout", "thyAutoActiveFirstItem", "thySize", "thySpaceKeyEnabled"], outputs: ["thySelectionChange"] }, { type: i5__namespace$3.ThyListOptionComponent, selector: "thy-list-option,[thy-list-option]", inputs: ["id", "thyValue", "thyDisabled"] }, { type: TheToolbarItemComponent, selector: "the-toolbar-item", inputs: ["item", "editor", "itemMode"] }, { type: NavSplitLineComponent, selector: "nav-split-line", inputs: ["mode"] }], directives: [{ type: i6__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
11449
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheQuickToolbarComponent, decorators: [{
|
|
11450
|
+
type: i0.Component,
|
|
11451
|
+
args: [{
|
|
11452
|
+
selector: 'the-quick-toolbar',
|
|
11453
|
+
templateUrl: 'quick-toolbar.component.html'
|
|
11454
|
+
}]
|
|
11455
|
+
}], ctorParameters: function () { return [{ type: i1__namespace$3.ThyPopoverRef }, { type: i0__namespace.ElementRef }]; }, propDecorators: { editor: [{
|
|
11456
|
+
type: i0.Input
|
|
11457
|
+
}], quickToolbarItems: [{
|
|
11458
|
+
type: i0.Input
|
|
11459
|
+
}], handleMouseDown: [{
|
|
11460
|
+
type: i0.HostListener,
|
|
11461
|
+
args: ['document: mousedown', ['$event']]
|
|
11462
|
+
}], handleEnter: [{
|
|
11463
|
+
type: i0.HostListener,
|
|
11464
|
+
args: ['document: keydown.enter']
|
|
11465
|
+
}] } });
|
|
11466
|
+
|
|
11467
|
+
var OperationTypes = ['insert_text', 'remove_node', 'merge_node'];
|
|
11468
|
+
var QuickInsertEditor = {
|
|
11469
|
+
openQuickToolbar: function (editor, toolbarItems, origin) {
|
|
11470
|
+
var overlay = editor.injector.get(i2.Overlay);
|
|
11471
|
+
var viewContainerRef = editor.injector.get(i0.ViewContainerRef);
|
|
11472
|
+
var thyPopover = editor.injector.get(i1$2.ThyPopover);
|
|
11473
|
+
var quickToolbarRef = thyPopover.open(TheQuickToolbarComponent, {
|
|
11474
|
+
initialState: {
|
|
11475
|
+
editor: editor,
|
|
11476
|
+
quickToolbarItems: toolbarItems
|
|
11477
|
+
},
|
|
11478
|
+
origin: origin,
|
|
11479
|
+
viewContainerRef: viewContainerRef,
|
|
11480
|
+
backdropClosable: true,
|
|
11481
|
+
placement: 'bottomLeft',
|
|
11482
|
+
offset: 4,
|
|
11483
|
+
hasBackdrop: false,
|
|
11484
|
+
insideClosable: true,
|
|
11485
|
+
panelClass: 'the-quick-toolbar-container',
|
|
11486
|
+
scrollStrategy: overlay.scrollStrategies.reposition(),
|
|
11487
|
+
manualClosure: true
|
|
11488
|
+
});
|
|
11489
|
+
THE_EDITOR_QUICK_TOOLBAR_REF.set(editor, quickToolbarRef);
|
|
11490
|
+
},
|
|
11491
|
+
closeQuickToolbar: function (editor) {
|
|
11492
|
+
var quickToolbarRef = THE_EDITOR_QUICK_TOOLBAR_REF.get(editor);
|
|
11493
|
+
if (quickToolbarRef) {
|
|
11494
|
+
quickToolbarRef.close();
|
|
11495
|
+
THE_EDITOR_QUICK_TOOLBAR_REF.set(editor, null);
|
|
11496
|
+
}
|
|
11497
|
+
},
|
|
11498
|
+
isOpenToolbar: function (editor, opTypes) {
|
|
11499
|
+
if (opTypes === void 0) { opTypes = OperationTypes; }
|
|
11500
|
+
var isCollapsedCursor = TheEditor.isFocused(editor) && editor.selection && slate.Range.isCollapsed(editor.selection);
|
|
11501
|
+
if (!isCollapsedCursor) {
|
|
11502
|
+
return false;
|
|
11503
|
+
}
|
|
11504
|
+
var block = slate.Node.ancestor(editor, [editor.selection.anchor.path[0]]);
|
|
11505
|
+
var undos = editor.history.undos;
|
|
11506
|
+
var lastBatch = undos[undos.length - 1];
|
|
11507
|
+
var lastOp = lastBatch && lastBatch[lastBatch.length - 1];
|
|
11508
|
+
if (lastOp &&
|
|
11509
|
+
block.children.length === 1 &&
|
|
11510
|
+
block.type === exports.ElementKinds.paragraph &&
|
|
11511
|
+
slate.Node.string(block) === QUICK_TOOLBAR_HOTKEY &&
|
|
11512
|
+
opTypes.includes(lastOp.type) &&
|
|
11513
|
+
(lastOp.text === QUICK_TOOLBAR_HOTKEY || lastOp.text === undefined)) {
|
|
11514
|
+
return true;
|
|
11515
|
+
}
|
|
11516
|
+
return false;
|
|
11517
|
+
}
|
|
11518
|
+
};
|
|
11519
|
+
|
|
11520
|
+
var withQuickInsert = function (editor) {
|
|
11521
|
+
var onKeydown = editor.onKeydown, deleteBackward = editor.deleteBackward, onChange = editor.onChange;
|
|
11522
|
+
editor.onKeydown = function (event) {
|
|
11523
|
+
if (event.key === QUICK_TOOLBAR_HOTKEY && isCleanEmptyParagraph(editor)) {
|
|
11524
|
+
var rootNode = i1.AngularEditor.toDOMNode(editor, slate.Node.ancestor(editor, [editor.selection.anchor.path[0]]));
|
|
11525
|
+
var theEditorComponent = editor.injector.get(TheEditorComponent);
|
|
11526
|
+
var quickToolbars = theEditorComponent.quickToolbarItems;
|
|
11527
|
+
QuickInsertEditor.openQuickToolbar(editor, quickToolbars, rootNode);
|
|
11528
|
+
}
|
|
11529
|
+
onKeydown(event);
|
|
11530
|
+
};
|
|
11531
|
+
editor.deleteBackward = function (unit) {
|
|
11532
|
+
if (!QuickInsertEditor.isOpenToolbar(editor, ['remove_text'])) {
|
|
11533
|
+
QuickInsertEditor.closeQuickToolbar(editor);
|
|
11534
|
+
}
|
|
11535
|
+
deleteBackward(unit);
|
|
11536
|
+
};
|
|
11537
|
+
editor.onChange = function () {
|
|
11538
|
+
onChange();
|
|
11539
|
+
if (editor.selection) {
|
|
11540
|
+
var editorComponent = editor.injector.get(TheEditorComponent);
|
|
11541
|
+
editorComponent.quickInsertInstance.checkStatus();
|
|
11542
|
+
var block = slate.Node.ancestor(editor, [editor.selection.anchor.path[0]]);
|
|
11543
|
+
if (!isCleanEmptyParagraph(editor) && slate.Node.string(block) !== QUICK_TOOLBAR_HOTKEY) {
|
|
11544
|
+
QuickInsertEditor.closeQuickToolbar(editor);
|
|
11545
|
+
}
|
|
11546
|
+
}
|
|
11547
|
+
};
|
|
11548
|
+
return editor;
|
|
11549
|
+
};
|
|
11550
|
+
|
|
11072
11551
|
var internalPlugins = [
|
|
11073
11552
|
withTheHistory,
|
|
11074
11553
|
withAutoInsertData(),
|
|
@@ -11076,7 +11555,6 @@
|
|
|
11076
11555
|
withRemoveVoid,
|
|
11077
11556
|
withBlockCard,
|
|
11078
11557
|
withResetType,
|
|
11079
|
-
withImage,
|
|
11080
11558
|
withIndent(__spreadArray([exports.ElementKinds.checkItem, exports.ElementKinds.numberedList, exports.ElementKinds.bulletedList, exports.ElementKinds.paragraph], __read(HEADING_TYPES))),
|
|
11081
11559
|
withList({ validLiChildrenTypes: [exports.ElementKinds.image] }),
|
|
11082
11560
|
withLink,
|
|
@@ -11096,9 +11574,11 @@
|
|
|
11096
11574
|
withInsertParagraphNodes(),
|
|
11097
11575
|
withGetFragment(),
|
|
11098
11576
|
withDeserializeHMTL,
|
|
11099
|
-
withDeserializeMd()
|
|
11577
|
+
withDeserializeMd(),
|
|
11578
|
+
withImage,
|
|
11579
|
+
withQuickInsert
|
|
11100
11580
|
];
|
|
11101
|
-
var internalToolbarItems = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(AlignOptions)), __read(MarkOptions)), __read(ColorOptions)), __read(HeadingOptions)), __read(TodoItemOptions)), __read(ListOptions)), __read(ImageOptions)), __read(HrOptions)), __read(BlockquoteOptions)), __read(CodeOptions)), __read(LinkOptions)), __read(TableOptions)), __read(VerticalAlignOptions));
|
|
11581
|
+
var internalToolbarItems = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(AlignOptions)), __read(MarkOptions)), __read(ColorOptions)), __read(HeadingOptions)), __read(TodoItemOptions)), __read(ListOptions)), __read(ImageOptions)), __read(HrOptions)), __read(BlockquoteOptions)), __read(CodeOptions)), __read(LinkOptions)), __read(TableOptions)), __read(VerticalAlignOptions)), __read(PaintFormatOptions));
|
|
11102
11582
|
var toolbarCompose = function (toolbarItems) {
|
|
11103
11583
|
if (toolbarItems === void 0) { toolbarItems = []; }
|
|
11104
11584
|
return __spreadArray(__spreadArray([], __read(internalToolbarItems)), __read(toolbarItems));
|
|
@@ -11139,14 +11619,14 @@
|
|
|
11139
11619
|
var TheToolbarService = /** @class */ (function () {
|
|
11140
11620
|
function TheToolbarService() {
|
|
11141
11621
|
}
|
|
11142
|
-
TheToolbarService.prototype.initialize = function (toolbarItems, global, inline,
|
|
11622
|
+
TheToolbarService.prototype.initialize = function (toolbarItems, global, inline, quick) {
|
|
11143
11623
|
if (global === void 0) { global = DefaultGlobalToolbarDefinition; }
|
|
11144
11624
|
if (inline === void 0) { inline = DefaultInlineToolbarDefinition; }
|
|
11145
|
-
if (
|
|
11625
|
+
if (quick === void 0) { quick = DefaultQuickToolbarDefinition; }
|
|
11146
11626
|
var toolbarDefinition = {
|
|
11147
11627
|
global: global,
|
|
11148
|
-
|
|
11149
|
-
|
|
11628
|
+
inline: inline,
|
|
11629
|
+
quick: quick
|
|
11150
11630
|
};
|
|
11151
11631
|
var toolbarOperations = new Map();
|
|
11152
11632
|
toolbarItems.forEach(function (i) { return toolbarOperations.set(i.key, i); });
|
|
@@ -11190,7 +11670,7 @@
|
|
|
11190
11670
|
|
|
11191
11671
|
var autoFocus = function (editor, isFocus) {
|
|
11192
11672
|
setTimeout(function () {
|
|
11193
|
-
if (editor && isFocus) {
|
|
11673
|
+
if (editor && editor.children.length > 0 && isFocus) {
|
|
11194
11674
|
slateHistory.HistoryEditor.withoutMerging(editor, function () {
|
|
11195
11675
|
i1.AngularEditor.focus(editor);
|
|
11196
11676
|
slate.Transforms.select(editor, slate.Editor.start(editor, [0]));
|
|
@@ -11227,44 +11707,6 @@
|
|
|
11227
11707
|
previousHeight = currentHeight;
|
|
11228
11708
|
};
|
|
11229
11709
|
|
|
11230
|
-
var TheToolbarItemComponent = /** @class */ (function (_super) {
|
|
11231
|
-
__extends(TheToolbarItemComponent, _super);
|
|
11232
|
-
function TheToolbarItemComponent() {
|
|
11233
|
-
var _this = _super.call(this) || this;
|
|
11234
|
-
_this.active = false;
|
|
11235
|
-
return _this;
|
|
11236
|
-
}
|
|
11237
|
-
TheToolbarItemComponent.prototype.statusChange = function (editor) {
|
|
11238
|
-
var _a, _b;
|
|
11239
|
-
this.active = ((_a = this.item) === null || _a === void 0 ? void 0 : _a.active) ? (_b = this.item) === null || _b === void 0 ? void 0 : _b.active(editor) : false;
|
|
11240
|
-
};
|
|
11241
|
-
TheToolbarItemComponent.prototype.execute = function (event) {
|
|
11242
|
-
var _a, _b, _c;
|
|
11243
|
-
_super.prototype.execute.call(this, event);
|
|
11244
|
-
if (!((_a = this.item) === null || _a === void 0 ? void 0 : _a.execute) || ((_b = this.editor) === null || _b === void 0 ? void 0 : _b.disabled)) {
|
|
11245
|
-
return;
|
|
11246
|
-
}
|
|
11247
|
-
(_c = this.item) === null || _c === void 0 ? void 0 : _c.execute(this.editor);
|
|
11248
|
-
};
|
|
11249
|
-
return TheToolbarItemComponent;
|
|
11250
|
-
}(TheToolbarBaseItemComponent));
|
|
11251
|
-
TheToolbarItemComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheToolbarItemComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
11252
|
-
TheToolbarItemComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheToolbarItemComponent, selector: "the-toolbar-item", inputs: { item: "item", editor: "editor" }, host: { classAttribute: "the-toolbar-item" }, usesInheritance: true, ngImport: i0__namespace, template: "\n <a\n thyIconNavLink\n [thyIconNavLinkIcon]=\"item.icon\"\n [thyTooltip]=\"item.name\"\n thyTooltipPlacement=\"top\"\n [thyIconNavLinkActive]=\"active\"\n (mousedown)=\"execute($event)\"\n ></a>\n ", isInline: true, components: [{ type: i2__namespace.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }], directives: [{ type: i7__namespace.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
|
|
11253
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheToolbarItemComponent, decorators: [{
|
|
11254
|
-
type: i0.Component,
|
|
11255
|
-
args: [{
|
|
11256
|
-
selector: 'the-toolbar-item',
|
|
11257
|
-
template: "\n <a\n thyIconNavLink\n [thyIconNavLinkIcon]=\"item.icon\"\n [thyTooltip]=\"item.name\"\n thyTooltipPlacement=\"top\"\n [thyIconNavLinkActive]=\"active\"\n (mousedown)=\"execute($event)\"\n ></a>\n ",
|
|
11258
|
-
host: {
|
|
11259
|
-
class: 'the-toolbar-item'
|
|
11260
|
-
}
|
|
11261
|
-
}]
|
|
11262
|
-
}], ctorParameters: function () { return []; }, propDecorators: { item: [{
|
|
11263
|
-
type: i0.Input
|
|
11264
|
-
}], editor: [{
|
|
11265
|
-
type: i0.Input
|
|
11266
|
-
}] } });
|
|
11267
|
-
|
|
11268
11710
|
var TheToolbarComponent = /** @class */ (function () {
|
|
11269
11711
|
function TheToolbarComponent(cfr, elementRef, ngZone, toolbarGroupComponent) {
|
|
11270
11712
|
this.cfr = cfr;
|
|
@@ -11557,56 +11999,238 @@
|
|
|
11557
11999
|
args: ['toolbarContainer', { read: i0.ViewContainerRef, static: true }]
|
|
11558
12000
|
}] } });
|
|
11559
12001
|
|
|
12002
|
+
var TheInlineToolbarComponent = /** @class */ (function () {
|
|
12003
|
+
function TheInlineToolbarComponent(elementRef, scrollDispatcher, cdr, ngZone) {
|
|
12004
|
+
this.elementRef = elementRef;
|
|
12005
|
+
this.scrollDispatcher = scrollDispatcher;
|
|
12006
|
+
this.cdr = cdr;
|
|
12007
|
+
this.ngZone = ngZone;
|
|
12008
|
+
this.destroy$ = new rxjs.Subject();
|
|
12009
|
+
}
|
|
12010
|
+
TheInlineToolbarComponent.prototype.ngOnInit = function () {
|
|
12011
|
+
var _this = this;
|
|
12012
|
+
this.scrollDispatcher
|
|
12013
|
+
.scrolled()
|
|
12014
|
+
.pipe(operators.takeUntil(this.destroy$))
|
|
12015
|
+
.subscribe(function () {
|
|
12016
|
+
_this.updateInlineToolbar();
|
|
12017
|
+
_this.cdr.detectChanges();
|
|
12018
|
+
});
|
|
12019
|
+
this.ngZone.runOutsideAngular(function () {
|
|
12020
|
+
rxjs.merge(rxjs.fromEvent(document, 'mouseup').pipe(operators.filter(function (e) { return e.button !== 2; })), rxjs.fromEvent(document, 'keyup').pipe(operators.filter(function (e) { return !e.shiftKey; })))
|
|
12021
|
+
.pipe(operators.debounceTime(200), operators.takeUntil(_this.destroy$))
|
|
12022
|
+
.subscribe(function () {
|
|
12023
|
+
var _a;
|
|
12024
|
+
_this.updateInlineToolbar();
|
|
12025
|
+
(_a = _this.inlineToolbar) === null || _a === void 0 ? void 0 : _a.statusChange(_this.editor);
|
|
12026
|
+
_this.cdr.detectChanges();
|
|
12027
|
+
});
|
|
12028
|
+
});
|
|
12029
|
+
};
|
|
12030
|
+
TheInlineToolbarComponent.prototype.updateInlineToolbar = function () {
|
|
12031
|
+
var inlineToolbar = this.elementRef.nativeElement.firstElementChild;
|
|
12032
|
+
if (!this.editor.selection) {
|
|
12033
|
+
inlineToolbar.removeAttribute('style');
|
|
12034
|
+
return;
|
|
12035
|
+
}
|
|
12036
|
+
var anchorBlock$1 = anchorBlock(this.editor);
|
|
12037
|
+
if (!inlineToolbar || !anchorBlock$1) {
|
|
12038
|
+
return;
|
|
12039
|
+
}
|
|
12040
|
+
var editor = this.editor;
|
|
12041
|
+
var selection = editor.selection;
|
|
12042
|
+
if (!selection ||
|
|
12043
|
+
!i1.AngularEditor.isFocused(editor) ||
|
|
12044
|
+
slate.Range.isCollapsed(selection) ||
|
|
12045
|
+
slate.Editor.string(editor, selection) === '') {
|
|
12046
|
+
inlineToolbar.removeAttribute('style');
|
|
12047
|
+
return;
|
|
12048
|
+
}
|
|
12049
|
+
if (!THE_INLINE_TOOLBAR_TYPES.includes(anchorBlock$1.type)) {
|
|
12050
|
+
return;
|
|
12051
|
+
}
|
|
12052
|
+
var native = window.getSelection();
|
|
12053
|
+
if (native.type !== 'None') {
|
|
12054
|
+
var range = native.getRangeAt(0);
|
|
12055
|
+
this.updatePosition(inlineToolbar, range);
|
|
12056
|
+
}
|
|
12057
|
+
};
|
|
12058
|
+
TheInlineToolbarComponent.prototype.updatePosition = function (toolbarElement, range) {
|
|
12059
|
+
var e_1, _b;
|
|
12060
|
+
var boundary = range.getBoundingClientRect();
|
|
12061
|
+
if (!boundary || (boundary.height === 0 && boundary.width === 0 && range.startContainer === range.endContainer)) {
|
|
12062
|
+
if (range.startContainer.nodeType === 1 && range.startContainer.querySelector('img')) {
|
|
12063
|
+
boundary = range.startContainer.querySelector('img').getBoundingClientRect();
|
|
12064
|
+
}
|
|
12065
|
+
else {
|
|
12066
|
+
boundary = range.startContainer.getBoundingClientRect();
|
|
12067
|
+
}
|
|
12068
|
+
}
|
|
12069
|
+
var editableRect = document.querySelector('.the-editor-typo').getBoundingClientRect();
|
|
12070
|
+
var toolbarHeight = toolbarElement.offsetHeight;
|
|
12071
|
+
var toolbarWidth = toolbarElement.offsetWidth;
|
|
12072
|
+
var halfOffsetWidth = toolbarWidth / 2;
|
|
12073
|
+
var defaultLeft = -halfOffsetWidth;
|
|
12074
|
+
var offsetLeft = boundary.left - editableRect.left;
|
|
12075
|
+
var isTopLeft = offsetLeft - 30 > halfOffsetWidth; // 30: editable padding left
|
|
12076
|
+
var isTopRight = editableRect.width - offsetLeft - boundary.width / 2 < halfOffsetWidth;
|
|
12077
|
+
var positions = {};
|
|
12078
|
+
positions.top = boundary.top - toolbarHeight;
|
|
12079
|
+
positions.right = 'initial';
|
|
12080
|
+
positions.left = boundary.left;
|
|
12081
|
+
if (isTopLeft) {
|
|
12082
|
+
positions.left = boundary.left + boundary.width / 2 + defaultLeft;
|
|
12083
|
+
}
|
|
12084
|
+
if (isTopRight) {
|
|
12085
|
+
positions.left = boundary.right - toolbarWidth;
|
|
12086
|
+
}
|
|
12087
|
+
try {
|
|
12088
|
+
for (var _c = __values(Object.keys(positions)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
12089
|
+
var key = _d.value;
|
|
12090
|
+
toolbarElement.style[key] = positions[key] + (isNaN(positions[key]) ? '' : 'px');
|
|
12091
|
+
}
|
|
12092
|
+
}
|
|
12093
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
12094
|
+
finally {
|
|
12095
|
+
try {
|
|
12096
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
12097
|
+
}
|
|
12098
|
+
finally { if (e_1) throw e_1.error; }
|
|
12099
|
+
}
|
|
12100
|
+
toolbarElement.style.opacity = '1';
|
|
12101
|
+
};
|
|
12102
|
+
TheInlineToolbarComponent.prototype.ngOnDestroy = function () {
|
|
12103
|
+
this.destroy$.next();
|
|
12104
|
+
this.destroy$.complete();
|
|
12105
|
+
};
|
|
12106
|
+
return TheInlineToolbarComponent;
|
|
12107
|
+
}());
|
|
12108
|
+
TheInlineToolbarComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheInlineToolbarComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i2__namespace$1.ScrollDispatcher }, { token: i0__namespace.ChangeDetectorRef }, { token: i0__namespace.NgZone }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
12109
|
+
TheInlineToolbarComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheInlineToolbarComponent, selector: "the-inline-toolbar", inputs: { editor: "editor", toolbarItems: "toolbarItems" }, host: { properties: { "class.hide": "toolbarItems.length === 0" } }, viewQueries: [{ propertyName: "inlineToolbar", first: true, predicate: ["inlineToolbar"], descendants: true }], ngImport: i0__namespace, template: "<the-toolbar\n #inlineToolbar\n class=\"the-inline-toolbar\"\n [editor]=\"editor\"\n [toolbarItems]=\"toolbarItems\"\n [isMore]=\"false\"\n ></the-toolbar> ", isInline: true, components: [{ type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "isMore", "afterTemplate"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
12110
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheInlineToolbarComponent, decorators: [{
|
|
12111
|
+
type: i0.Component,
|
|
12112
|
+
args: [{
|
|
12113
|
+
selector: 'the-inline-toolbar',
|
|
12114
|
+
template: "<the-toolbar\n #inlineToolbar\n class=\"the-inline-toolbar\"\n [editor]=\"editor\"\n [toolbarItems]=\"toolbarItems\"\n [isMore]=\"false\"\n ></the-toolbar> ",
|
|
12115
|
+
host: {
|
|
12116
|
+
'[class.hide]': 'toolbarItems.length === 0'
|
|
12117
|
+
},
|
|
12118
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
12119
|
+
}]
|
|
12120
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i2__namespace$1.ScrollDispatcher }, { type: i0__namespace.ChangeDetectorRef }, { type: i0__namespace.NgZone }]; }, propDecorators: { editor: [{
|
|
12121
|
+
type: i0.Input
|
|
12122
|
+
}], toolbarItems: [{
|
|
12123
|
+
type: i0.Input
|
|
12124
|
+
}], inlineToolbar: [{
|
|
12125
|
+
type: i0.ViewChild,
|
|
12126
|
+
args: ['inlineToolbar']
|
|
12127
|
+
}] } });
|
|
12128
|
+
|
|
12129
|
+
var TheQuickInsertComponent = /** @class */ (function () {
|
|
12130
|
+
function TheQuickInsertComponent(renderer, elementRef, cdr) {
|
|
12131
|
+
this.renderer = renderer;
|
|
12132
|
+
this.elementRef = elementRef;
|
|
12133
|
+
this.cdr = cdr;
|
|
12134
|
+
this.isHide = true;
|
|
12135
|
+
this.defaultIconName = 'plus-circle-thin';
|
|
12136
|
+
this.iconNameFill = 'plus-circle-thin-fill';
|
|
12137
|
+
this.displayIconName = this.defaultIconName;
|
|
12138
|
+
}
|
|
12139
|
+
TheQuickInsertComponent.prototype.handleMousedownNativeElement = function (event) {
|
|
12140
|
+
event.preventDefault();
|
|
12141
|
+
event.stopPropagation();
|
|
12142
|
+
};
|
|
12143
|
+
TheQuickInsertComponent.prototype.checkStatus = function () {
|
|
12144
|
+
var _a;
|
|
12145
|
+
var editor = this.editor;
|
|
12146
|
+
if (isCleanEmptyParagraph(editor)) {
|
|
12147
|
+
var block = slate.Node.ancestor(editor, [(_a = editor === null || editor === void 0 ? void 0 : editor.selection) === null || _a === void 0 ? void 0 : _a.anchor.path[0]]);
|
|
12148
|
+
var rootNode = i1.AngularEditor.toDOMNode(editor, block);
|
|
12149
|
+
this.isHide = false;
|
|
12150
|
+
this.updatePosition(rootNode.offsetLeft, rootNode.offsetTop);
|
|
12151
|
+
return;
|
|
12152
|
+
}
|
|
12153
|
+
this.isHide = true;
|
|
12154
|
+
};
|
|
12155
|
+
TheQuickInsertComponent.prototype.updatePosition = function (left, top) {
|
|
12156
|
+
this.isHide = false;
|
|
12157
|
+
this.renderer.setStyle(this.elementRef.nativeElement, 'top', top + "px");
|
|
12158
|
+
this.renderer.setStyle(this.elementRef.nativeElement, 'left', left + "px");
|
|
12159
|
+
};
|
|
12160
|
+
TheQuickInsertComponent.prototype.mouseEnter = function (event) {
|
|
12161
|
+
this.displayIconName = this.iconNameFill;
|
|
12162
|
+
this.cdr.markForCheck();
|
|
12163
|
+
};
|
|
12164
|
+
TheQuickInsertComponent.prototype.mouseLeave = function (event) {
|
|
12165
|
+
this.displayIconName = this.defaultIconName;
|
|
12166
|
+
this.cdr.markForCheck();
|
|
12167
|
+
};
|
|
12168
|
+
TheQuickInsertComponent.prototype.handleClick = function (event) {
|
|
12169
|
+
event.stopPropagation();
|
|
12170
|
+
event.preventDefault();
|
|
12171
|
+
QuickInsertEditor.openQuickToolbar(this.editor, this.quickToolbarItems, this.iconElement.nativeElement);
|
|
12172
|
+
};
|
|
12173
|
+
return TheQuickInsertComponent;
|
|
12174
|
+
}());
|
|
12175
|
+
TheQuickInsertComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheQuickInsertComponent, deps: [{ token: i0__namespace.Renderer2 }, { token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
12176
|
+
TheQuickInsertComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheQuickInsertComponent, selector: "[theQuickInsert]", inputs: { editor: "editor", quickToolbarItems: "quickToolbarItems" }, host: { listeners: { "mousedown": "handleMousedownNativeElement($event)" }, properties: { "class.hide": "isHide" }, classAttribute: "the-quick-insert" }, viewQueries: [{ propertyName: "iconElement", first: true, predicate: ["iconElement"], descendants: true, read: i0.ElementRef }], ngImport: i0__namespace, template: "<thy-icon\n #iconElement\n [thyIconName]=\"displayIconName\"\n class=\"quick-insert-icon text-desc font-size-xlg\"\n (mouseenter)=\"mouseEnter($event)\"\n (mouseleave)=\"mouseLeave($event)\"\n (mousedown)=\"handleClick($event)\"\n></thy-icon>\n", components: [{ type: i4__namespace$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }] });
|
|
12177
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheQuickInsertComponent, decorators: [{
|
|
12178
|
+
type: i0.Component,
|
|
12179
|
+
args: [{
|
|
12180
|
+
selector: '[theQuickInsert]',
|
|
12181
|
+
templateUrl: './quick-insert.component.html',
|
|
12182
|
+
host: {
|
|
12183
|
+
class: 'the-quick-insert',
|
|
12184
|
+
'[class.hide]': 'isHide'
|
|
12185
|
+
}
|
|
12186
|
+
}]
|
|
12187
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.Renderer2 }, { type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { editor: [{
|
|
12188
|
+
type: i0.Input
|
|
12189
|
+
}], quickToolbarItems: [{
|
|
12190
|
+
type: i0.Input
|
|
12191
|
+
}], iconElement: [{
|
|
12192
|
+
type: i0.ViewChild,
|
|
12193
|
+
args: ['iconElement', { read: i0.ElementRef, static: false }]
|
|
12194
|
+
}], handleMousedownNativeElement: [{
|
|
12195
|
+
type: i0.HostListener,
|
|
12196
|
+
args: ['mousedown', ['$event']]
|
|
12197
|
+
}] } });
|
|
12198
|
+
|
|
11560
12199
|
var ThePlaceholderComponent = /** @class */ (function () {
|
|
11561
12200
|
function ThePlaceholderComponent(renderer, elementRef) {
|
|
11562
12201
|
this.renderer = renderer;
|
|
11563
12202
|
this.elementRef = elementRef;
|
|
11564
12203
|
this.isHide = true;
|
|
11565
12204
|
}
|
|
11566
|
-
Object.defineProperty(ThePlaceholderComponent.prototype, "selection", {
|
|
11567
|
-
get: function () {
|
|
11568
|
-
return this.editor.selection;
|
|
11569
|
-
},
|
|
11570
|
-
enumerable: false,
|
|
11571
|
-
configurable: true
|
|
11572
|
-
});
|
|
11573
12205
|
ThePlaceholderComponent.prototype.handleCompositionStart = function () {
|
|
11574
|
-
|
|
12206
|
+
var _a;
|
|
12207
|
+
if ((_a = this.editor) === null || _a === void 0 ? void 0 : _a.selection) {
|
|
12208
|
+
this.hide();
|
|
12209
|
+
}
|
|
11575
12210
|
};
|
|
11576
12211
|
ThePlaceholderComponent.prototype.handleCompositionEnd = function (event) {
|
|
11577
12212
|
if (!event.data) {
|
|
11578
12213
|
this.checkStatus();
|
|
11579
12214
|
}
|
|
11580
12215
|
};
|
|
11581
|
-
ThePlaceholderComponent.prototype.checkStatus = function (
|
|
12216
|
+
ThePlaceholderComponent.prototype.checkStatus = function () {
|
|
12217
|
+
var _a, _b, _c;
|
|
11582
12218
|
var editor = this.editor;
|
|
11583
|
-
var children = value ? value : editor.children;
|
|
11584
12219
|
// empty content and no selection processing
|
|
11585
|
-
if (this.autoFocus && !
|
|
11586
|
-
|
|
11587
|
-
this.
|
|
12220
|
+
if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.autoFocus) && !(editor === null || editor === void 0 ? void 0 : editor.selection) && isEmptyContent(editor.children)) {
|
|
12221
|
+
// normal top is 28, but margin-top: -41px is set when maxHeight is set, so top is 69
|
|
12222
|
+
var firstTop = ((_b = this.options) === null || _b === void 0 ? void 0 : _b.maxHeight) ? 69 : 28;
|
|
12223
|
+
this.updatePosition(30, firstTop);
|
|
11588
12224
|
return;
|
|
11589
12225
|
}
|
|
11590
|
-
if (
|
|
11591
|
-
var block = slate.Node.ancestor(editor, [
|
|
11592
|
-
var
|
|
11593
|
-
|
|
11594
|
-
|
|
11595
|
-
|
|
11596
|
-
if (slate.Node.string(block) === '' &&
|
|
11597
|
-
slate.Element.isElement(block) &&
|
|
11598
|
-
block.type === exports.ElementKinds.paragraph &&
|
|
11599
|
-
block.children.length === 1 &&
|
|
11600
|
-
slate.Text.isText(block.children[0]) &&
|
|
11601
|
-
!slate.Editor.isVoid(editor, block) &&
|
|
11602
|
-
!hasTextIndent &&
|
|
11603
|
-
!hasAlign) {
|
|
11604
|
-
var rootNode = i1.AngularEditor.toDOMNode(this.editor, block);
|
|
11605
|
-
this.updatePosition(rootNode.offsetLeft, rootNode.offsetTop);
|
|
11606
|
-
return;
|
|
11607
|
-
}
|
|
12226
|
+
if (isCleanEmptyParagraph(editor)) {
|
|
12227
|
+
var block = slate.Node.ancestor(editor, [(_c = editor === null || editor === void 0 ? void 0 : editor.selection) === null || _c === void 0 ? void 0 : _c.anchor.path[0]]);
|
|
12228
|
+
var rootNode = i1.AngularEditor.toDOMNode(editor, block);
|
|
12229
|
+
this.isHide = false;
|
|
12230
|
+
this.updatePosition(rootNode.offsetLeft, rootNode.offsetTop);
|
|
12231
|
+
return;
|
|
11608
12232
|
}
|
|
11609
|
-
this.
|
|
12233
|
+
this.isHide = true;
|
|
11610
12234
|
};
|
|
11611
12235
|
ThePlaceholderComponent.prototype.updatePosition = function (left, top) {
|
|
11612
12236
|
this.isHide = false;
|
|
@@ -11619,12 +12243,12 @@
|
|
|
11619
12243
|
return ThePlaceholderComponent;
|
|
11620
12244
|
}());
|
|
11621
12245
|
ThePlaceholderComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: ThePlaceholderComponent, deps: [{ token: i0__namespace.Renderer2 }, { token: i0__namespace.ElementRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
11622
|
-
ThePlaceholderComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: ThePlaceholderComponent, selector: "div[thePlaceholder]", inputs: { editor: "editor",
|
|
12246
|
+
ThePlaceholderComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: ThePlaceholderComponent, selector: "div[thePlaceholder]", inputs: { editor: "editor", options: "options" }, host: { listeners: { "document:compositionstart": "handleCompositionStart()", "document:compositionend": "handleCompositionEnd($event)" }, properties: { "class.hide": "isHide" }, classAttribute: "the-placeholder" }, ngImport: i0__namespace, template: "{{ options?.placeholder }}", isInline: true });
|
|
11623
12247
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: ThePlaceholderComponent, decorators: [{
|
|
11624
12248
|
type: i0.Component,
|
|
11625
12249
|
args: [{
|
|
11626
12250
|
selector: 'div[thePlaceholder]',
|
|
11627
|
-
template: "{{ placeholder }}",
|
|
12251
|
+
template: "{{ options?.placeholder }}",
|
|
11628
12252
|
host: {
|
|
11629
12253
|
class: 'the-placeholder',
|
|
11630
12254
|
'[class.hide]': 'isHide'
|
|
@@ -11632,9 +12256,7 @@
|
|
|
11632
12256
|
}]
|
|
11633
12257
|
}], ctorParameters: function () { return [{ type: i0__namespace.Renderer2 }, { type: i0__namespace.ElementRef }]; }, propDecorators: { editor: [{
|
|
11634
12258
|
type: i0.Input
|
|
11635
|
-
}],
|
|
11636
|
-
type: i0.Input
|
|
11637
|
-
}], placeholder: [{
|
|
12259
|
+
}], options: [{
|
|
11638
12260
|
type: i0.Input
|
|
11639
12261
|
}], handleCompositionStart: [{
|
|
11640
12262
|
type: i0.HostListener,
|
|
@@ -11720,7 +12342,6 @@
|
|
|
11720
12342
|
_this.theOnDOMEvent = new i0.EventEmitter();
|
|
11721
12343
|
_this.theEditorCreated = new i0.EventEmitter();
|
|
11722
12344
|
_this._plugins = [];
|
|
11723
|
-
_this.globalToolbarItems = [];
|
|
11724
12345
|
_this.autoScrollView = _.debounce(function (editor, scrollContainer) {
|
|
11725
12346
|
return autoScrollViewHandle(editor, scrollContainer);
|
|
11726
12347
|
}, 80);
|
|
@@ -11811,9 +12432,6 @@
|
|
|
11811
12432
|
_this.onSlaCompositionEnd = function (event) { };
|
|
11812
12433
|
_this.onSlaDragStart = function (event) { };
|
|
11813
12434
|
_this.onSlaDragOver = function (event) { };
|
|
11814
|
-
_this.trackBy = function (element) {
|
|
11815
|
-
return element.key;
|
|
11816
|
-
};
|
|
11817
12435
|
return _this;
|
|
11818
12436
|
}
|
|
11819
12437
|
Object.defineProperty(TheEditorComponent.prototype, "theGlobalToolbarInstance", {
|
|
@@ -11831,6 +12449,14 @@
|
|
|
11831
12449
|
enumerable: false,
|
|
11832
12450
|
configurable: true
|
|
11833
12451
|
});
|
|
12452
|
+
Object.defineProperty(TheEditorComponent.prototype, "quickToolbarItems", {
|
|
12453
|
+
get: function () {
|
|
12454
|
+
var _a;
|
|
12455
|
+
return (_a = this.toolbarEntity) === null || _a === void 0 ? void 0 : _a.quick;
|
|
12456
|
+
},
|
|
12457
|
+
enumerable: false,
|
|
12458
|
+
configurable: true
|
|
12459
|
+
});
|
|
11834
12460
|
TheEditorComponent.prototype.ngOnInit = function () {
|
|
11835
12461
|
this.initialize();
|
|
11836
12462
|
this.onErrorHandler();
|
|
@@ -11887,8 +12513,8 @@
|
|
|
11887
12513
|
var _a;
|
|
11888
12514
|
var toolbar = (_a = this === null || this === void 0 ? void 0 : this.theOptions) === null || _a === void 0 ? void 0 : _a.toolbar;
|
|
11889
12515
|
var toolbarItems = toolbarCompose(toolbar === null || toolbar === void 0 ? void 0 : toolbar.toolbarItems);
|
|
11890
|
-
var toolbarOption = this.toolbarService.initialize(toolbarItems, toolbar === null || toolbar === void 0 ? void 0 : toolbar.global, toolbar === null || toolbar === void 0 ? void 0 : toolbar.
|
|
11891
|
-
this.
|
|
12516
|
+
var toolbarOption = this.toolbarService.initialize(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);
|
|
12517
|
+
this.toolbarEntity = toolbarOption.toolbarEntity;
|
|
11892
12518
|
if (this.theGlobalToolbar) {
|
|
11893
12519
|
this.theGlobalToolbarInstance.editor = this.editor;
|
|
11894
12520
|
this.theGlobalToolbarInstance.toolbarItems = toolbarOption.toolbarEntity.global;
|
|
@@ -11898,11 +12524,10 @@
|
|
|
11898
12524
|
}
|
|
11899
12525
|
};
|
|
11900
12526
|
TheEditorComponent.prototype.writeValue = function (value) {
|
|
11901
|
-
var _a
|
|
12527
|
+
var _a;
|
|
11902
12528
|
var data = dataDeserialize((_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.mode, value);
|
|
11903
12529
|
// data-deserialize
|
|
11904
12530
|
this.editorValue = data;
|
|
11905
|
-
(_b = this.placeholderInstance) === null || _b === void 0 ? void 0 : _b.checkStatus(data);
|
|
11906
12531
|
};
|
|
11907
12532
|
TheEditorComponent.prototype.registerOnChange = function (fn) {
|
|
11908
12533
|
this.onChangeCallback = fn;
|
|
@@ -11911,13 +12536,14 @@
|
|
|
11911
12536
|
this.onTouchedCallback = fn;
|
|
11912
12537
|
};
|
|
11913
12538
|
TheEditorComponent.prototype.valueChange = function (value) {
|
|
11914
|
-
var _a, _b, _c, _d
|
|
12539
|
+
var _a, _b, _c, _d;
|
|
11915
12540
|
(_a = this.theGlobalToolbarInstance) === null || _a === void 0 ? void 0 : _a.statusChange(this.editor);
|
|
11916
|
-
|
|
12541
|
+
this.quickInsertInstance.checkStatus();
|
|
12542
|
+
this.placeholderInstance.checkStatus();
|
|
11917
12543
|
// auto scroll view
|
|
11918
|
-
var scrollContainer = (
|
|
11919
|
-
var maxHeight = (
|
|
11920
|
-
if (!((
|
|
12544
|
+
var scrollContainer = (_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.scrollContainer;
|
|
12545
|
+
var maxHeight = (_c = this.theOptions) === null || _c === void 0 ? void 0 : _c.maxHeight;
|
|
12546
|
+
if (!((_d = this.theOptions) === null || _d === void 0 ? void 0 : _d.readonly) && (scrollContainer || maxHeight)) {
|
|
11921
12547
|
var container = maxHeight ? DEFAULT_SCROLL_CONTAINER : scrollContainer;
|
|
11922
12548
|
this.autoScrollView(this.editor, container);
|
|
11923
12549
|
}
|
|
@@ -11993,18 +12619,18 @@
|
|
|
11993
12619
|
}
|
|
11994
12620
|
};
|
|
11995
12621
|
TheEditorComponent.prototype.handleSelectAll = function () {
|
|
11996
|
-
var
|
|
12622
|
+
var _e;
|
|
11997
12623
|
var node;
|
|
11998
12624
|
if (!this.editor.selection) {
|
|
11999
12625
|
setEndSelection(this.editor);
|
|
12000
12626
|
}
|
|
12001
|
-
var
|
|
12627
|
+
var _f = __read(slate.Range.edges(this.editor.selection), 2), start = _f[0], end = _f[1];
|
|
12002
12628
|
var selectionRange = slate.Editor.range(this.editor, start, end);
|
|
12003
12629
|
var containerBlocks = getContainerBlocks(this.editor);
|
|
12004
12630
|
for (var i = 0; i < containerBlocks.length; i++) {
|
|
12005
|
-
|
|
12631
|
+
_e = __read(getNodesByType(this.editor, containerBlocks[i]), 1), node = _e[0];
|
|
12006
12632
|
if (node) {
|
|
12007
|
-
var
|
|
12633
|
+
var _g = __read(node, 2), path = _g[1];
|
|
12008
12634
|
var isStartParent = slate.Path.equals(path, start.path.slice(0, path.length));
|
|
12009
12635
|
var isEndParent = slate.Path.equals(path, end.path.slice(0, path.length));
|
|
12010
12636
|
if (isStartParent && isEndParent) {
|
|
@@ -12047,7 +12673,7 @@
|
|
|
12047
12673
|
useExisting: i0.forwardRef(function () { return TheEditorComponent; }),
|
|
12048
12674
|
multi: true
|
|
12049
12675
|
}
|
|
12050
|
-
], viewQueries: [{ propertyName: "templateInstance", first: true, predicate: ["templateInstance"], descendants: true, static: true }, { propertyName: "globalToolbarInstance", first: true, predicate: ["globalToolbar"], descendants: true }, { propertyName: "placeholderInstance", first: true, predicate: ["placeholder"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace, template: "<the-toolbar\n *ngIf=\"!theOptions?.readonly && !theGlobalToolbar\"\n [ngClass]=\"{\n 'the-toolbar-disabled': theOptions?.disabled\n }\"\n #globalToolbar\n [editor]=\"editor\"\n [toolbarItems]=\"
|
|
12676
|
+
], viewQueries: [{ propertyName: "templateInstance", first: true, predicate: ["templateInstance"], descendants: true, static: true }, { propertyName: "globalToolbarInstance", first: true, predicate: ["globalToolbar"], descendants: true }, { propertyName: "quickInsertInstance", first: true, predicate: ["quickInsert"], descendants: true }, { propertyName: "placeholderInstance", first: true, predicate: ["placeholder"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace, template: "<the-toolbar\n *ngIf=\"!theOptions?.readonly && !theGlobalToolbar\"\n class=\"the-global-toolbar\"\n [ngClass]=\"{\n 'the-toolbar-disabled': theOptions?.disabled\n }\"\n #globalToolbar\n [editor]=\"editor\"\n [toolbarItems]=\"toolbarEntity.global\"\n [align]=\"theOptions?.toolbar?.align\"\n></the-toolbar>\n\n<div\n class=\"the-editable-container\"\n [ngClass]=\"{\n 'the-editor-disabled': theOptions?.disabled,\n 'max-height': maxHeight\n }\"\n [ngStyle]=\"{ 'max-height': maxHeight }\"\n>\n <slate-editable\n class=\"the-editor-typo\"\n [editor]=\"editor\"\n [ngModel]=\"editorValue\"\n (ngModelChange)=\"valueChange($event)\"\n [decorate]=\"decorate\"\n [renderElement]=\"renderElement\"\n [renderText]=\"renderText\"\n [renderLeaf]=\"renderLeaf\"\n [readonly]=\"theOptions?.readonly || theOptions?.disabled\"\n [keydown]=\"onKeyDown\"\n [click]=\"onClick\"\n [paste]=\"onSlaPaste\"\n [beforeInput]=\"onSlaBeforeInput\"\n [blur]=\"onSlaBlur\"\n [focus]=\"onSlaFocus\"\n [copy]=\"onSlaCopy\"\n [cut]=\"onSlaCut\"\n [isStrictDecorate]=\"false\"\n [compositionStart]=\"onSlaCompositionStart\"\n [compositionEnd]=\"onSlaCompositionEnd\"\n [dragStart]=\"onSlaDragStart\"\n [dragOver]=\"onSlaDragOver\"\n (mousedown)=\"mousedown($event)\"\n ></slate-editable>\n <the-inline-toolbar *ngIf=\"!theOptions.readonly\" [editor]=\"editor\" [toolbarItems]=\"toolbarEntity.inline\"></the-inline-toolbar>\n <div #quickInsert theQuickInsert [editor]=\"editor\" [quickToolbarItems]=\"quickToolbarItems\"></div>\n <div #placeholder thePlaceholder [editor]=\"editor\" [options]=\"theOptions\"></div>\n <the-template #templateInstance></the-template>\n</div>\n", components: [{ type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "isMore", "afterTemplate"] }, { type: i1__namespace.SlateEditableComponent, selector: "slate-editable", inputs: ["editor", "renderElement", "renderLeaf", "renderText", "decorate", "isStrictDecorate", "trackBy", "readonly", "beforeInput", "blur", "click", "compositionEnd", "compositionStart", "copy", "cut", "dragOver", "dragStart", "dragEnd", "drop", "focus", "keydown", "paste", "spellCheck", "autoCorrect", "autoCapitalize"] }, { type: TheInlineToolbarComponent, selector: "the-inline-toolbar", inputs: ["editor", "toolbarItems"] }, { type: TheQuickInsertComponent, selector: "[theQuickInsert]", inputs: ["editor", "quickToolbarItems"] }, { type: ThePlaceholderComponent, selector: "div[thePlaceholder]", inputs: ["editor", "options"] }, { type: TheTemplateComponent, selector: "the-template,[theTemplate]" }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i4__namespace$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4__namespace$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
12051
12677
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheEditorComponent, decorators: [{
|
|
12052
12678
|
type: i0.Component,
|
|
12053
12679
|
args: [{
|
|
@@ -12090,6 +12716,9 @@
|
|
|
12090
12716
|
}], globalToolbarInstance: [{
|
|
12091
12717
|
type: i0.ViewChild,
|
|
12092
12718
|
args: ['globalToolbar']
|
|
12719
|
+
}], quickInsertInstance: [{
|
|
12720
|
+
type: i0.ViewChild,
|
|
12721
|
+
args: ['quickInsert']
|
|
12093
12722
|
}], placeholderInstance: [{
|
|
12094
12723
|
type: i0.ViewChild,
|
|
12095
12724
|
args: ['placeholder']
|
|
@@ -12256,7 +12885,7 @@
|
|
|
12256
12885
|
i2$1.ThyNavModule,
|
|
12257
12886
|
i2$2.ThyFormModule,
|
|
12258
12887
|
i5$3.ThySharedModule,
|
|
12259
|
-
|
|
12888
|
+
i2$3.ThyListModule,
|
|
12260
12889
|
i7.ThyTooltipModule,
|
|
12261
12890
|
i4.ThyProgressModule,
|
|
12262
12891
|
autocomplete.ThyAutocompleteModule,
|
|
@@ -12272,10 +12901,12 @@
|
|
|
12272
12901
|
TheToolbarDropdownComponent,
|
|
12273
12902
|
TheToolbarGroupComponent,
|
|
12274
12903
|
TheToolbarItemComponent,
|
|
12904
|
+
TheInlineToolbarComponent,
|
|
12275
12905
|
NavSplitLineComponent,
|
|
12276
12906
|
TheTextComponent,
|
|
12277
12907
|
TheDefaultElementComponent,
|
|
12278
|
-
|
|
12908
|
+
TheQuickInsertComponent,
|
|
12909
|
+
TheQuickToolbarComponent,
|
|
12279
12910
|
TheColorSelectComponent,
|
|
12280
12911
|
TheColorToolbarItemComponent,
|
|
12281
12912
|
TheContextMenuComponent,
|
|
@@ -12302,7 +12933,8 @@
|
|
|
12302
12933
|
TheTableToolbarComponent,
|
|
12303
12934
|
TheTableComponent,
|
|
12304
12935
|
TheTableRowComponent,
|
|
12305
|
-
TheTdComponent
|
|
12936
|
+
TheTdComponent,
|
|
12937
|
+
ThePlaceholderComponent
|
|
12306
12938
|
];
|
|
12307
12939
|
var PIPES = [ElementStylePipe, ElementClassPipe];
|
|
12308
12940
|
var TheEditorModule = /** @class */ (function () {
|
|
@@ -12315,10 +12947,12 @@
|
|
|
12315
12947
|
TheToolbarDropdownComponent,
|
|
12316
12948
|
TheToolbarGroupComponent,
|
|
12317
12949
|
TheToolbarItemComponent,
|
|
12950
|
+
TheInlineToolbarComponent,
|
|
12318
12951
|
NavSplitLineComponent,
|
|
12319
12952
|
TheTextComponent,
|
|
12320
12953
|
TheDefaultElementComponent,
|
|
12321
|
-
|
|
12954
|
+
TheQuickInsertComponent,
|
|
12955
|
+
TheQuickToolbarComponent,
|
|
12322
12956
|
TheColorSelectComponent,
|
|
12323
12957
|
TheColorToolbarItemComponent,
|
|
12324
12958
|
TheContextMenuComponent,
|
|
@@ -12342,12 +12976,13 @@
|
|
|
12342
12976
|
TheTableToolbarComponent,
|
|
12343
12977
|
TheTableComponent,
|
|
12344
12978
|
TheTableRowComponent,
|
|
12345
|
-
TheTdComponent
|
|
12979
|
+
TheTdComponent,
|
|
12980
|
+
ThePlaceholderComponent], imports: [i6.CommonModule, i1.SlateModule, i4$2.FormsModule, i4$1.ThyIconModule,
|
|
12346
12981
|
avatar.ThyAvatarModule,
|
|
12347
12982
|
i2$1.ThyNavModule,
|
|
12348
12983
|
i2$2.ThyFormModule,
|
|
12349
12984
|
i5$3.ThySharedModule,
|
|
12350
|
-
|
|
12985
|
+
i2$3.ThyListModule,
|
|
12351
12986
|
i7.ThyTooltipModule,
|
|
12352
12987
|
i4.ThyProgressModule,
|
|
12353
12988
|
autocomplete.ThyAutocompleteModule,
|
|
@@ -12361,7 +12996,8 @@
|
|
|
12361
12996
|
{
|
|
12362
12997
|
provide: TheToolbarGroupToken,
|
|
12363
12998
|
useValue: TheToolbarGroupComponent
|
|
12364
|
-
}
|
|
12999
|
+
},
|
|
13000
|
+
THE_CODE_MODE_PROVIDER
|
|
12365
13001
|
], imports: [__spreadArray(__spreadArray([i6.CommonModule, i1.SlateModule, i4$2.FormsModule], __read(TETHYS)), [i5$2.CodemirrorModule, TheColumnSizeModule])] });
|
|
12366
13002
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheEditorModule, decorators: [{
|
|
12367
13003
|
type: i0.NgModule,
|
|
@@ -12374,7 +13010,8 @@
|
|
|
12374
13010
|
{
|
|
12375
13011
|
provide: TheToolbarGroupToken,
|
|
12376
13012
|
useValue: TheToolbarGroupComponent
|
|
12377
|
-
}
|
|
13013
|
+
},
|
|
13014
|
+
THE_CODE_MODE_PROVIDER
|
|
12378
13015
|
]
|
|
12379
13016
|
}]
|
|
12380
13017
|
}] });
|
|
@@ -12392,7 +13029,6 @@
|
|
|
12392
13029
|
exports.AlignEditor = AlignEditor;
|
|
12393
13030
|
exports.BLOCK_DELETEBACKWARD_TYPES = BLOCK_DELETEBACKWARD_TYPES;
|
|
12394
13031
|
exports.BLOCK_INSERT_ORIGIN = BLOCK_INSERT_ORIGIN;
|
|
12395
|
-
exports.BLOCK_TOOLBAR_HOTKEY = BLOCK_TOOLBAR_HOTKEY;
|
|
12396
13032
|
exports.BlockquoteEditor = BlockquoteEditor;
|
|
12397
13033
|
exports.CLIPBOARD_FORMAT_KEY = CLIPBOARD_FORMAT_KEY;
|
|
12398
13034
|
exports.CODEMIRROR_PADDING_TOP = CODEMIRROR_PADDING_TOP;
|
|
@@ -12400,15 +13036,15 @@
|
|
|
12400
13036
|
exports.COMPONENTS = COMPONENTS;
|
|
12401
13037
|
exports.CONTAINER_BLOCKS = CONTAINER_BLOCKS;
|
|
12402
13038
|
exports.CodeEditor = CodeEditor;
|
|
13039
|
+
exports.CodeMode = CodeMode;
|
|
12403
13040
|
exports.ColorEditor = ColorEditor;
|
|
12404
13041
|
exports.DEFAULT_LANGUAGE = DEFAULT_LANGUAGE;
|
|
12405
13042
|
exports.DEFAULT_SCROLL_CONTAINER = DEFAULT_SCROLL_CONTAINER;
|
|
12406
|
-
exports.DefaultBlockToolbarDefinition = DefaultBlockToolbarDefinition;
|
|
12407
13043
|
exports.DefaultElementOptions = DefaultElementOptions;
|
|
12408
13044
|
exports.DefaultGlobalToolbarDefinition = DefaultGlobalToolbarDefinition;
|
|
12409
13045
|
exports.DefaultInlineToolbarDefinition = DefaultInlineToolbarDefinition;
|
|
13046
|
+
exports.DefaultQuickToolbarDefinition = DefaultQuickToolbarDefinition;
|
|
12410
13047
|
exports.ELEMENT_UNIQUE_ID = ELEMENT_UNIQUE_ID;
|
|
12411
|
-
exports.EditorMode = EditorMode;
|
|
12412
13048
|
exports.HEADING_TYPES = HEADING_TYPES;
|
|
12413
13049
|
exports.HeadingEditor = HeadingEditor;
|
|
12414
13050
|
exports.HrEditor = HrEditor;
|
|
@@ -12422,24 +13058,28 @@
|
|
|
12422
13058
|
exports.PICTURE_ACCEPTED_UPLOAD_MIME = PICTURE_ACCEPTED_UPLOAD_MIME;
|
|
12423
13059
|
exports.PICTURE_ACCEPTED_UPLOAD_SIZE = PICTURE_ACCEPTED_UPLOAD_SIZE;
|
|
12424
13060
|
exports.PLUGIN_COMPONENTS = PLUGIN_COMPONENTS;
|
|
13061
|
+
exports.QUICK_TOOLBAR_HOTKEY = QUICK_TOOLBAR_HOTKEY;
|
|
13062
|
+
exports.QuickInsertEditor = QuickInsertEditor;
|
|
12425
13063
|
exports.STANDARD_HEADING_TYPES = STANDARD_HEADING_TYPES;
|
|
12426
13064
|
exports.TAB_SPACE = TAB_SPACE;
|
|
12427
|
-
exports.
|
|
12428
|
-
exports.
|
|
13065
|
+
exports.THE_CODE_MODE_PROVIDER = THE_CODE_MODE_PROVIDER;
|
|
13066
|
+
exports.THE_CODE_MODE_TOKEN = THE_CODE_MODE_TOKEN;
|
|
12429
13067
|
exports.THE_EDITOR_CONVERSION_HINT_REF = THE_EDITOR_CONVERSION_HINT_REF;
|
|
13068
|
+
exports.THE_EDITOR_QUICK_TOOLBAR_REF = THE_EDITOR_QUICK_TOOLBAR_REF;
|
|
12430
13069
|
exports.THE_EDITOR_UUID = THE_EDITOR_UUID;
|
|
12431
13070
|
exports.THE_INLINE_TOOLBAR_TYPES = THE_INLINE_TOOLBAR_TYPES;
|
|
12432
13071
|
exports.THE_UPLOAD_SERVICE_TOKEN = THE_UPLOAD_SERVICE_TOKEN;
|
|
12433
13072
|
exports.TableEditor = TableEditor;
|
|
12434
13073
|
exports.TheBaseElementComponent = TheBaseElementComponent;
|
|
13074
|
+
exports.TheCodeMode = TheCodeMode;
|
|
12435
13075
|
exports.TheContextService = TheContextService;
|
|
12436
13076
|
exports.TheDefaultElementComponent = TheDefaultElementComponent;
|
|
12437
13077
|
exports.TheEditor = TheEditor;
|
|
12438
13078
|
exports.TheEditorComponent = TheEditorComponent;
|
|
12439
|
-
exports.TheEditorConfig = TheEditorConfig;
|
|
12440
13079
|
exports.TheEditorModule = TheEditorModule;
|
|
12441
13080
|
exports.TheImageComponent = TheImageComponent;
|
|
12442
13081
|
exports.TheQueries = index$1;
|
|
13082
|
+
exports.TheToolbarBaseItemComponent = TheToolbarBaseItemComponent;
|
|
12443
13083
|
exports.TheToolbarComponent = TheToolbarComponent;
|
|
12444
13084
|
exports.TheToolbarDropdownComponent = TheToolbarDropdownComponent;
|
|
12445
13085
|
exports.TheToolbarGroupComponent = TheToolbarGroupComponent;
|