@worktile/theia 16.2.9 → 16.3.1
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/editor.module.d.ts +2 -2
- package/esm2022/components/plugin-menu/plugin-menu.component.mjs +3 -2
- package/esm2022/plugins/deserialize/deserialize-md.plugin.mjs +2 -2
- package/esm2022/services/table-contextmenu.service.mjs +9 -8
- package/fesm2022/worktile-theia.mjs +158 -156
- package/fesm2022/worktile-theia.mjs.map +1 -1
- package/interfaces/editor.d.ts +1 -1
- package/package.json +4 -3
- package/plugins/table/table.store.d.ts +1 -1
- package/services/table-contextmenu.service.d.ts +2 -2
- package/styles/editor.scss +9 -0
|
@@ -44,7 +44,7 @@ import * as i10$1 from 'ngx-tethys/switch';
|
|
|
44
44
|
import { ThySwitchModule } from 'ngx-tethys/switch';
|
|
45
45
|
import * as i5 from 'ngx-tethys/color-picker';
|
|
46
46
|
import { ThyColorPickerModule } from 'ngx-tethys/color-picker';
|
|
47
|
-
import marked from 'marked';
|
|
47
|
+
import { marked } from 'marked';
|
|
48
48
|
import * as i1$3 from 'ngx-tethys/alert';
|
|
49
49
|
import { ThyAlertModule } from 'ngx-tethys/alert';
|
|
50
50
|
import * as i4$1 from 'ngx-tethys/image';
|
|
@@ -6017,7 +6017,8 @@ class ThePluginMenuComponent extends mixinUnsubscribe(MixinBase) {
|
|
|
6017
6017
|
this.autoActiveFirstItem = true;
|
|
6018
6018
|
this.removeKeywords = () => {
|
|
6019
6019
|
const node = Node.get(this.editor, this.editor.selection.anchor.path);
|
|
6020
|
-
|
|
6020
|
+
const nodeString = Node.string(node);
|
|
6021
|
+
if (node && nodeString.length > 0 && this.keyWords && nodeString.toLocaleLowerCase().trim().includes(this.keyWords)) {
|
|
6021
6022
|
Editor.deleteBackward(this.editor, { unit: 'block' });
|
|
6022
6023
|
}
|
|
6023
6024
|
};
|
|
@@ -11460,31 +11461,76 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImpor
|
|
|
11460
11461
|
const SLA_TABLE_SELECTOR = '.slate-element-table';
|
|
11461
11462
|
const SLA_TABLE_CELL_SELECTOR = '.slate-element-table-cell';
|
|
11462
11463
|
|
|
11463
|
-
|
|
11464
|
-
|
|
11465
|
-
|
|
11466
|
-
|
|
11467
|
-
|
|
11468
|
-
|
|
11469
|
-
|
|
11470
|
-
|
|
11471
|
-
|
|
11472
|
-
|
|
11473
|
-
|
|
11474
|
-
|
|
11475
|
-
|
|
11476
|
-
|
|
11477
|
-
|
|
11478
|
-
|
|
11479
|
-
|
|
11480
|
-
|
|
11481
|
-
|
|
11482
|
-
|
|
11483
|
-
|
|
11484
|
-
|
|
11485
|
-
|
|
11486
|
-
|
|
11464
|
+
class TheContextMenuComponent {
|
|
11465
|
+
handleDocumentMouseDown(event) {
|
|
11466
|
+
if (isColorPanel(event.target)) {
|
|
11467
|
+
return;
|
|
11468
|
+
}
|
|
11469
|
+
if (!this.elementRef.nativeElement.contains(event.target) && event.button !== 2) {
|
|
11470
|
+
this.thyPopoverRef.close();
|
|
11471
|
+
}
|
|
11472
|
+
}
|
|
11473
|
+
handleMouseDown(event) {
|
|
11474
|
+
event.preventDefault();
|
|
11475
|
+
event.stopPropagation();
|
|
11476
|
+
}
|
|
11477
|
+
itemMousedown(event, entity) {
|
|
11478
|
+
event.preventDefault();
|
|
11479
|
+
this.actionHandle(entity);
|
|
11480
|
+
this.thyPopoverRef.close();
|
|
11481
|
+
}
|
|
11482
|
+
itemMouseleave(event, entity) {
|
|
11483
|
+
event.preventDefault();
|
|
11484
|
+
this.deactivateHandle(event, entity);
|
|
11485
|
+
}
|
|
11486
|
+
itemMouseenter(event, entity) {
|
|
11487
|
+
event.preventDefault();
|
|
11488
|
+
this.activeHandle(event, entity);
|
|
11489
|
+
}
|
|
11490
|
+
inputNumberFocus(e) {
|
|
11491
|
+
e.target.focus();
|
|
11492
|
+
}
|
|
11493
|
+
itemEnterHandle(e, entity) {
|
|
11494
|
+
e.preventDefault();
|
|
11495
|
+
e.stopPropagation();
|
|
11496
|
+
this.actionHandle(entity);
|
|
11497
|
+
this.thyPopoverRef.close();
|
|
11498
|
+
}
|
|
11499
|
+
changeColor(color, item) {
|
|
11500
|
+
item.backgroundColor = color;
|
|
11501
|
+
item.activeHandle(undefined, item);
|
|
11502
|
+
}
|
|
11503
|
+
constructor(elementRef, thyPopoverRef) {
|
|
11504
|
+
this.elementRef = elementRef;
|
|
11505
|
+
this.thyPopoverRef = thyPopoverRef;
|
|
11506
|
+
this.menuEntities = [];
|
|
11507
|
+
this.wrap = true;
|
|
11508
|
+
}
|
|
11509
|
+
ngOnInit() { }
|
|
11510
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: TheContextMenuComponent, deps: [{ token: i0.ElementRef }, { token: i1$1.ThyPopoverRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
11511
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.4", type: TheContextMenuComponent, selector: "the-contextmenu", inputs: { menuEntities: "menuEntities", actionHandle: "actionHandle", activeHandle: "activeHandle", deactivateHandle: "deactivateHandle" }, host: { listeners: { "document: mousedown": "handleDocumentMouseDown($event)", "mousedown": "handleMouseDown($event)" }, properties: { "class.the-overlay-menu-wrap": "this.wrap" } }, ngImport: i0, template: "<div class=\"thy-dropdown-menu\">\n <ng-container *ngFor=\"let menuItem of menuEntities\">\n <ng-container *ngIf=\"menuItem.visibility && !menuItem?.isInputNumber && menuItem.key !== 'background-color'\">\n <ng-template [ngTemplateOutlet]=\"defaultMenuTemplate\" [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"></ng-template>\n </ng-container>\n <ng-container *ngIf=\"menuItem.visibility && menuItem.key === 'background-color'\">\n <ng-template [ngTemplateOutlet]=\"backgroundColorTemplate\" [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"></ng-template>\n </ng-container>\n <ng-container *ngIf=\"menuItem.visibility && menuItem?.isInputNumber\">\n <ng-template [ngTemplateOutlet]=\"inputNumberMenuTemplate\" [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"></ng-template>\n </ng-container>\n <thy-dropdown-menu-divider *ngIf=\"menuItem.divider && menuItem.visibility\"></thy-dropdown-menu-divider>\n </ng-container>\n</div>\n\n<ng-template #defaultMenuTemplate let-item>\n <a\n href=\"javascript:;\"\n thyDropdownMenuItem\n (mousedown)=\"itemMousedown($event, item)\"\n (mouseenter)=\"itemMouseenter($event, item)\"\n (mouseleave)=\"itemMouseleave($event, item)\"\n >\n <span thyDropdownMenuItemIcon>\n <thy-icon [thyIconName]=\"item.icon\"></thy-icon>\n </span>\n <span thyDropdownMenuItemName>{{ item.name }}</span>\n <span *ngIf=\"item.extendIcon\" thyDropdownMenuItemExtendIcon>\n <thy-icon thyIconName=\"{{ item.extendIcon }}\"></thy-icon>\n </span>\n </a>\n</ng-template>\n\n<ng-template #backgroundColorTemplate let-item>\n <a\n href=\"javascript:;\"\n thyDropdownMenuItem\n thyColorPicker\n thyTrigger=\"hover\"\n thyPlacement=\"rightTop\"\n [(ngModel)]=\"item.backgroundColor\"\n (ngModelChange)=\"changeColor($event, item)\"\n [thyHasBackdrop]=\"false\"\n >\n <span thyDropdownMenuItemIcon>\n <thy-icon [thyIconName]=\"item.icon\" thyIconType=\"twotone\" [thyTwotoneColor]=\"item.backgroundColor\"></thy-icon>\n </span>\n <span thyDropdownMenuItemName>{{ item.name }}</span>\n <span *ngIf=\"item.extendIcon\" thyDropdownMenuItemExtendIcon>\n <thy-icon thyIconName=\"{{ item.extendIcon }}\"></thy-icon>\n </span>\n </a>\n</ng-template>\n\n<ng-template #inputNumberMenuTemplate let-item>\n <a href=\"javascript:;\" class=\"the-input-number-menu\" thyDropdownMenuItem (click)=\"itemMousedown($event, item)\">\n <span thyDropdownMenuItemIcon>\n <thy-icon [thyIconName]=\"item.icon\"></thy-icon>\n </span>\n <span thyDropdownMenuItemName class=\"d-flex align-items-center\">\n {{ item.name }}\n <thy-input-number\n #inputNumber\n class=\"mx-2\"\n thySize=\"sm\"\n [(ngModel)]=\"item.count\"\n [thyStep]=\"1\"\n [thyMin]=\"1\"\n (click)=\"inputNumberFocus($event)\"\n (thyEnter)=\"itemEnterHandle($event, item)\"\n thyStopPropagation\n ></thy-input-number>\n {{ item.nameSuffix }}\n </span>\n </a>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i4.ThyIconComponent, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { kind: "directive", type: i5$1.ThyEnterDirective, selector: "[thyEnter]", outputs: ["thyEnter"] }, { kind: "directive", type: i5$1.ThyStopPropagationDirective, selector: "[thyStopPropagation]", inputs: ["thyStopPropagation"] }, { kind: "component", type: i6.ThyDropdownMenuDividerComponent, selector: "thy-dropdown-menu-divider" }, { kind: "directive", type: i6.ThyDropdownMenuItemDirective, selector: "[thyDropdownMenuItem]", inputs: ["thyType", "thyDisabled"] }, { kind: "directive", type: i6.ThyDropdownMenuItemNameDirective, selector: "[thyDropdownMenuItemName]" }, { kind: "directive", type: i6.ThyDropdownMenuItemIconDirective, selector: "[thyDropdownMenuItemIcon]" }, { kind: "directive", type: i6.ThyDropdownMenuItemExtendIconDirective, selector: "[thyDropdownMenuItemExtendIcon]" }, { kind: "component", type: i7$1.ThyInputNumberComponent, selector: "thy-input-number", inputs: ["thyAutoFocus", "thyPlaceholder", "thyDisabled", "thyMax", "thyMin", "thyStep", "thySize", "thyPrecision", "thySuffix"], outputs: ["thyBlur", "thyFocus"] }, { kind: "directive", type: i5.ThyColorPickerDirective, selector: "[thyColorPicker]", inputs: ["thyOffset", "thyHasBackdrop", "thyDefaultColor", "thyTransparentColorSelectable", "thyPresetColors", "thyPlacement", "thyTrigger", "thyShowDelay", "thyHideDelay"], outputs: ["thyPanelOpen", "thyPanelClose"] }] }); }
|
|
11487
11512
|
}
|
|
11513
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: TheContextMenuComponent, decorators: [{
|
|
11514
|
+
type: Component,
|
|
11515
|
+
args: [{ selector: 'the-contextmenu', template: "<div class=\"thy-dropdown-menu\">\n <ng-container *ngFor=\"let menuItem of menuEntities\">\n <ng-container *ngIf=\"menuItem.visibility && !menuItem?.isInputNumber && menuItem.key !== 'background-color'\">\n <ng-template [ngTemplateOutlet]=\"defaultMenuTemplate\" [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"></ng-template>\n </ng-container>\n <ng-container *ngIf=\"menuItem.visibility && menuItem.key === 'background-color'\">\n <ng-template [ngTemplateOutlet]=\"backgroundColorTemplate\" [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"></ng-template>\n </ng-container>\n <ng-container *ngIf=\"menuItem.visibility && menuItem?.isInputNumber\">\n <ng-template [ngTemplateOutlet]=\"inputNumberMenuTemplate\" [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"></ng-template>\n </ng-container>\n <thy-dropdown-menu-divider *ngIf=\"menuItem.divider && menuItem.visibility\"></thy-dropdown-menu-divider>\n </ng-container>\n</div>\n\n<ng-template #defaultMenuTemplate let-item>\n <a\n href=\"javascript:;\"\n thyDropdownMenuItem\n (mousedown)=\"itemMousedown($event, item)\"\n (mouseenter)=\"itemMouseenter($event, item)\"\n (mouseleave)=\"itemMouseleave($event, item)\"\n >\n <span thyDropdownMenuItemIcon>\n <thy-icon [thyIconName]=\"item.icon\"></thy-icon>\n </span>\n <span thyDropdownMenuItemName>{{ item.name }}</span>\n <span *ngIf=\"item.extendIcon\" thyDropdownMenuItemExtendIcon>\n <thy-icon thyIconName=\"{{ item.extendIcon }}\"></thy-icon>\n </span>\n </a>\n</ng-template>\n\n<ng-template #backgroundColorTemplate let-item>\n <a\n href=\"javascript:;\"\n thyDropdownMenuItem\n thyColorPicker\n thyTrigger=\"hover\"\n thyPlacement=\"rightTop\"\n [(ngModel)]=\"item.backgroundColor\"\n (ngModelChange)=\"changeColor($event, item)\"\n [thyHasBackdrop]=\"false\"\n >\n <span thyDropdownMenuItemIcon>\n <thy-icon [thyIconName]=\"item.icon\" thyIconType=\"twotone\" [thyTwotoneColor]=\"item.backgroundColor\"></thy-icon>\n </span>\n <span thyDropdownMenuItemName>{{ item.name }}</span>\n <span *ngIf=\"item.extendIcon\" thyDropdownMenuItemExtendIcon>\n <thy-icon thyIconName=\"{{ item.extendIcon }}\"></thy-icon>\n </span>\n </a>\n</ng-template>\n\n<ng-template #inputNumberMenuTemplate let-item>\n <a href=\"javascript:;\" class=\"the-input-number-menu\" thyDropdownMenuItem (click)=\"itemMousedown($event, item)\">\n <span thyDropdownMenuItemIcon>\n <thy-icon [thyIconName]=\"item.icon\"></thy-icon>\n </span>\n <span thyDropdownMenuItemName class=\"d-flex align-items-center\">\n {{ item.name }}\n <thy-input-number\n #inputNumber\n class=\"mx-2\"\n thySize=\"sm\"\n [(ngModel)]=\"item.count\"\n [thyStep]=\"1\"\n [thyMin]=\"1\"\n (click)=\"inputNumberFocus($event)\"\n (thyEnter)=\"itemEnterHandle($event, item)\"\n thyStopPropagation\n ></thy-input-number>\n {{ item.nameSuffix }}\n </span>\n </a>\n</ng-template>\n" }]
|
|
11516
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$1.ThyPopoverRef }]; }, propDecorators: { menuEntities: [{
|
|
11517
|
+
type: Input
|
|
11518
|
+
}], actionHandle: [{
|
|
11519
|
+
type: Input
|
|
11520
|
+
}], activeHandle: [{
|
|
11521
|
+
type: Input
|
|
11522
|
+
}], deactivateHandle: [{
|
|
11523
|
+
type: Input
|
|
11524
|
+
}], wrap: [{
|
|
11525
|
+
type: HostBinding,
|
|
11526
|
+
args: ['class.the-overlay-menu-wrap']
|
|
11527
|
+
}], handleDocumentMouseDown: [{
|
|
11528
|
+
type: HostListener,
|
|
11529
|
+
args: ['document: mousedown', ['$event']]
|
|
11530
|
+
}], handleMouseDown: [{
|
|
11531
|
+
type: HostListener,
|
|
11532
|
+
args: ['mousedown', ['$event']]
|
|
11533
|
+
}] } });
|
|
11488
11534
|
|
|
11489
11535
|
function isSelectedCellMerged(editor) {
|
|
11490
11536
|
if (editor && editor.selection) {
|
|
@@ -11585,117 +11631,6 @@ function getCellPositionsBeforeMerge(editor, { row, col }) {
|
|
|
11585
11631
|
return [{ row, col }];
|
|
11586
11632
|
}
|
|
11587
11633
|
|
|
11588
|
-
function setCellMenuVisibility(editor, menuList, tableInfo) {
|
|
11589
|
-
const { selectedCellPositions, isFullscreen, isSelectedTable, selectedRowsIndex, selectedColumnsIndex } = tableInfo;
|
|
11590
|
-
const isCellMerged = isSelectedCellMerged(editor);
|
|
11591
|
-
const selectCellNodes = getSelectCellNode(editor, selectedCellPositions).filter(item => !item.node.hidden);
|
|
11592
|
-
const isRect = isRectangularInTableCells(editor, selectedCellPositions);
|
|
11593
|
-
menuList.forEach(item => {
|
|
11594
|
-
switch (item.key) {
|
|
11595
|
-
case 'merge-cells':
|
|
11596
|
-
item.visibility = selectCellNodes && selectCellNodes.length > 1 && !isSelectedTable && isRect;
|
|
11597
|
-
break;
|
|
11598
|
-
case 'split-cells':
|
|
11599
|
-
item.visibility = selectCellNodes && selectCellNodes.length === 1 && isCellMerged;
|
|
11600
|
-
break;
|
|
11601
|
-
case 'delete-selection-rows':
|
|
11602
|
-
item.visibility = !(isFullscreen && selectedColumnsIndex.length);
|
|
11603
|
-
break;
|
|
11604
|
-
case 'delete-selection-columns':
|
|
11605
|
-
item.visibility = !(isFullscreen && selectedRowsIndex.length);
|
|
11606
|
-
break;
|
|
11607
|
-
case 'delete-table':
|
|
11608
|
-
item.visibility = !isFullscreen;
|
|
11609
|
-
break;
|
|
11610
|
-
case TableInsertType.insertRowsUp:
|
|
11611
|
-
const hasHeaderRowCell = TableEditor.hasHeaderRowCell(editor);
|
|
11612
|
-
item.visibility = !hasHeaderRowCell && isRect;
|
|
11613
|
-
break;
|
|
11614
|
-
case TableInsertType.insertRowsDown:
|
|
11615
|
-
item.visibility = isRect;
|
|
11616
|
-
break;
|
|
11617
|
-
case TableInsertType.insertColumnsLeft:
|
|
11618
|
-
const hasHeaderColumnCell = TableEditor.hasHeaderColumnCell(editor);
|
|
11619
|
-
item.visibility = !hasHeaderColumnCell && isRect;
|
|
11620
|
-
break;
|
|
11621
|
-
case TableInsertType.insertColumnsRight:
|
|
11622
|
-
item.visibility = isRect;
|
|
11623
|
-
break;
|
|
11624
|
-
}
|
|
11625
|
-
});
|
|
11626
|
-
}
|
|
11627
|
-
|
|
11628
|
-
class TheContextMenuComponent {
|
|
11629
|
-
handleDocumentMouseDown(event) {
|
|
11630
|
-
if (isColorPanel(event.target)) {
|
|
11631
|
-
return;
|
|
11632
|
-
}
|
|
11633
|
-
if (!this.elementRef.nativeElement.contains(event.target) && event.button !== 2) {
|
|
11634
|
-
this.thyPopoverRef.close();
|
|
11635
|
-
}
|
|
11636
|
-
}
|
|
11637
|
-
handleMouseDown(event) {
|
|
11638
|
-
event.preventDefault();
|
|
11639
|
-
event.stopPropagation();
|
|
11640
|
-
}
|
|
11641
|
-
itemMousedown(event, entity) {
|
|
11642
|
-
event.preventDefault();
|
|
11643
|
-
this.actionHandle(entity);
|
|
11644
|
-
this.thyPopoverRef.close();
|
|
11645
|
-
}
|
|
11646
|
-
itemMouseleave(event, entity) {
|
|
11647
|
-
event.preventDefault();
|
|
11648
|
-
this.deactivateHandle(event, entity);
|
|
11649
|
-
}
|
|
11650
|
-
itemMouseenter(event, entity) {
|
|
11651
|
-
event.preventDefault();
|
|
11652
|
-
this.activeHandle(event, entity);
|
|
11653
|
-
}
|
|
11654
|
-
inputNumberFocus(e) {
|
|
11655
|
-
e.target.focus();
|
|
11656
|
-
}
|
|
11657
|
-
itemEnterHandle(e, entity) {
|
|
11658
|
-
e.preventDefault();
|
|
11659
|
-
e.stopPropagation();
|
|
11660
|
-
this.actionHandle(entity);
|
|
11661
|
-
this.thyPopoverRef.close();
|
|
11662
|
-
}
|
|
11663
|
-
changeColor(color, item) {
|
|
11664
|
-
item.backgroundColor = color;
|
|
11665
|
-
item.activeHandle(undefined, item);
|
|
11666
|
-
}
|
|
11667
|
-
constructor(elementRef, thyPopoverRef) {
|
|
11668
|
-
this.elementRef = elementRef;
|
|
11669
|
-
this.thyPopoverRef = thyPopoverRef;
|
|
11670
|
-
this.menuEntities = [];
|
|
11671
|
-
this.wrap = true;
|
|
11672
|
-
}
|
|
11673
|
-
ngOnInit() { }
|
|
11674
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: TheContextMenuComponent, deps: [{ token: i0.ElementRef }, { token: i1$1.ThyPopoverRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
11675
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.4", type: TheContextMenuComponent, selector: "the-contextmenu", inputs: { menuEntities: "menuEntities", actionHandle: "actionHandle", activeHandle: "activeHandle", deactivateHandle: "deactivateHandle" }, host: { listeners: { "document: mousedown": "handleDocumentMouseDown($event)", "mousedown": "handleMouseDown($event)" }, properties: { "class.the-overlay-menu-wrap": "this.wrap" } }, ngImport: i0, template: "<div class=\"thy-dropdown-menu\">\n <ng-container *ngFor=\"let menuItem of menuEntities\">\n <ng-container *ngIf=\"menuItem.visibility && !menuItem?.isInputNumber && menuItem.key !== 'background-color'\">\n <ng-template [ngTemplateOutlet]=\"defaultMenuTemplate\" [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"></ng-template>\n </ng-container>\n <ng-container *ngIf=\"menuItem.visibility && menuItem.key === 'background-color'\">\n <ng-template [ngTemplateOutlet]=\"backgroundColorTemplate\" [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"></ng-template>\n </ng-container>\n <ng-container *ngIf=\"menuItem.visibility && menuItem?.isInputNumber\">\n <ng-template [ngTemplateOutlet]=\"inputNumberMenuTemplate\" [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"></ng-template>\n </ng-container>\n <thy-dropdown-menu-divider *ngIf=\"menuItem.divider && menuItem.visibility\"></thy-dropdown-menu-divider>\n </ng-container>\n</div>\n\n<ng-template #defaultMenuTemplate let-item>\n <a\n href=\"javascript:;\"\n thyDropdownMenuItem\n (mousedown)=\"itemMousedown($event, item)\"\n (mouseenter)=\"itemMouseenter($event, item)\"\n (mouseleave)=\"itemMouseleave($event, item)\"\n >\n <span thyDropdownMenuItemIcon>\n <thy-icon [thyIconName]=\"item.icon\"></thy-icon>\n </span>\n <span thyDropdownMenuItemName>{{ item.name }}</span>\n <span *ngIf=\"item.extendIcon\" thyDropdownMenuItemExtendIcon>\n <thy-icon thyIconName=\"{{ item.extendIcon }}\"></thy-icon>\n </span>\n </a>\n</ng-template>\n\n<ng-template #backgroundColorTemplate let-item>\n <a\n href=\"javascript:;\"\n thyDropdownMenuItem\n thyColorPicker\n thyTrigger=\"hover\"\n thyPlacement=\"rightTop\"\n [(ngModel)]=\"item.backgroundColor\"\n (ngModelChange)=\"changeColor($event, item)\"\n [thyHasBackdrop]=\"false\"\n >\n <span thyDropdownMenuItemIcon>\n <thy-icon [thyIconName]=\"item.icon\" thyIconType=\"twotone\" [thyTwotoneColor]=\"item.backgroundColor\"></thy-icon>\n </span>\n <span thyDropdownMenuItemName>{{ item.name }}</span>\n <span *ngIf=\"item.extendIcon\" thyDropdownMenuItemExtendIcon>\n <thy-icon thyIconName=\"{{ item.extendIcon }}\"></thy-icon>\n </span>\n </a>\n</ng-template>\n\n<ng-template #inputNumberMenuTemplate let-item>\n <a href=\"javascript:;\" class=\"the-input-number-menu\" thyDropdownMenuItem (click)=\"itemMousedown($event, item)\">\n <span thyDropdownMenuItemIcon>\n <thy-icon [thyIconName]=\"item.icon\"></thy-icon>\n </span>\n <span thyDropdownMenuItemName class=\"d-flex align-items-center\">\n {{ item.name }}\n <thy-input-number\n #inputNumber\n class=\"mx-2\"\n thySize=\"sm\"\n [(ngModel)]=\"item.count\"\n [thyStep]=\"1\"\n [thyMin]=\"1\"\n (click)=\"inputNumberFocus($event)\"\n (thyEnter)=\"itemEnterHandle($event, item)\"\n thyStopPropagation\n ></thy-input-number>\n {{ item.nameSuffix }}\n </span>\n </a>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i4.ThyIconComponent, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { kind: "directive", type: i5$1.ThyEnterDirective, selector: "[thyEnter]", outputs: ["thyEnter"] }, { kind: "directive", type: i5$1.ThyStopPropagationDirective, selector: "[thyStopPropagation]", inputs: ["thyStopPropagation"] }, { kind: "component", type: i6.ThyDropdownMenuDividerComponent, selector: "thy-dropdown-menu-divider" }, { kind: "directive", type: i6.ThyDropdownMenuItemDirective, selector: "[thyDropdownMenuItem]", inputs: ["thyType", "thyDisabled"] }, { kind: "directive", type: i6.ThyDropdownMenuItemNameDirective, selector: "[thyDropdownMenuItemName]" }, { kind: "directive", type: i6.ThyDropdownMenuItemIconDirective, selector: "[thyDropdownMenuItemIcon]" }, { kind: "directive", type: i6.ThyDropdownMenuItemExtendIconDirective, selector: "[thyDropdownMenuItemExtendIcon]" }, { kind: "component", type: i7$1.ThyInputNumberComponent, selector: "thy-input-number", inputs: ["thyAutoFocus", "thyPlaceholder", "thyDisabled", "thyMax", "thyMin", "thyStep", "thySize", "thyPrecision", "thySuffix"], outputs: ["thyBlur", "thyFocus"] }, { kind: "directive", type: i5.ThyColorPickerDirective, selector: "[thyColorPicker]", inputs: ["thyOffset", "thyHasBackdrop", "thyDefaultColor", "thyTransparentColorSelectable", "thyPresetColors", "thyPlacement", "thyTrigger", "thyShowDelay", "thyHideDelay"], outputs: ["thyPanelOpen", "thyPanelClose"] }] }); }
|
|
11676
|
-
}
|
|
11677
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: TheContextMenuComponent, decorators: [{
|
|
11678
|
-
type: Component,
|
|
11679
|
-
args: [{ selector: 'the-contextmenu', template: "<div class=\"thy-dropdown-menu\">\n <ng-container *ngFor=\"let menuItem of menuEntities\">\n <ng-container *ngIf=\"menuItem.visibility && !menuItem?.isInputNumber && menuItem.key !== 'background-color'\">\n <ng-template [ngTemplateOutlet]=\"defaultMenuTemplate\" [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"></ng-template>\n </ng-container>\n <ng-container *ngIf=\"menuItem.visibility && menuItem.key === 'background-color'\">\n <ng-template [ngTemplateOutlet]=\"backgroundColorTemplate\" [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"></ng-template>\n </ng-container>\n <ng-container *ngIf=\"menuItem.visibility && menuItem?.isInputNumber\">\n <ng-template [ngTemplateOutlet]=\"inputNumberMenuTemplate\" [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"></ng-template>\n </ng-container>\n <thy-dropdown-menu-divider *ngIf=\"menuItem.divider && menuItem.visibility\"></thy-dropdown-menu-divider>\n </ng-container>\n</div>\n\n<ng-template #defaultMenuTemplate let-item>\n <a\n href=\"javascript:;\"\n thyDropdownMenuItem\n (mousedown)=\"itemMousedown($event, item)\"\n (mouseenter)=\"itemMouseenter($event, item)\"\n (mouseleave)=\"itemMouseleave($event, item)\"\n >\n <span thyDropdownMenuItemIcon>\n <thy-icon [thyIconName]=\"item.icon\"></thy-icon>\n </span>\n <span thyDropdownMenuItemName>{{ item.name }}</span>\n <span *ngIf=\"item.extendIcon\" thyDropdownMenuItemExtendIcon>\n <thy-icon thyIconName=\"{{ item.extendIcon }}\"></thy-icon>\n </span>\n </a>\n</ng-template>\n\n<ng-template #backgroundColorTemplate let-item>\n <a\n href=\"javascript:;\"\n thyDropdownMenuItem\n thyColorPicker\n thyTrigger=\"hover\"\n thyPlacement=\"rightTop\"\n [(ngModel)]=\"item.backgroundColor\"\n (ngModelChange)=\"changeColor($event, item)\"\n [thyHasBackdrop]=\"false\"\n >\n <span thyDropdownMenuItemIcon>\n <thy-icon [thyIconName]=\"item.icon\" thyIconType=\"twotone\" [thyTwotoneColor]=\"item.backgroundColor\"></thy-icon>\n </span>\n <span thyDropdownMenuItemName>{{ item.name }}</span>\n <span *ngIf=\"item.extendIcon\" thyDropdownMenuItemExtendIcon>\n <thy-icon thyIconName=\"{{ item.extendIcon }}\"></thy-icon>\n </span>\n </a>\n</ng-template>\n\n<ng-template #inputNumberMenuTemplate let-item>\n <a href=\"javascript:;\" class=\"the-input-number-menu\" thyDropdownMenuItem (click)=\"itemMousedown($event, item)\">\n <span thyDropdownMenuItemIcon>\n <thy-icon [thyIconName]=\"item.icon\"></thy-icon>\n </span>\n <span thyDropdownMenuItemName class=\"d-flex align-items-center\">\n {{ item.name }}\n <thy-input-number\n #inputNumber\n class=\"mx-2\"\n thySize=\"sm\"\n [(ngModel)]=\"item.count\"\n [thyStep]=\"1\"\n [thyMin]=\"1\"\n (click)=\"inputNumberFocus($event)\"\n (thyEnter)=\"itemEnterHandle($event, item)\"\n thyStopPropagation\n ></thy-input-number>\n {{ item.nameSuffix }}\n </span>\n </a>\n</ng-template>\n" }]
|
|
11680
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$1.ThyPopoverRef }]; }, propDecorators: { menuEntities: [{
|
|
11681
|
-
type: Input
|
|
11682
|
-
}], actionHandle: [{
|
|
11683
|
-
type: Input
|
|
11684
|
-
}], activeHandle: [{
|
|
11685
|
-
type: Input
|
|
11686
|
-
}], deactivateHandle: [{
|
|
11687
|
-
type: Input
|
|
11688
|
-
}], wrap: [{
|
|
11689
|
-
type: HostBinding,
|
|
11690
|
-
args: ['class.the-overlay-menu-wrap']
|
|
11691
|
-
}], handleDocumentMouseDown: [{
|
|
11692
|
-
type: HostListener,
|
|
11693
|
-
args: ['document: mousedown', ['$event']]
|
|
11694
|
-
}], handleMouseDown: [{
|
|
11695
|
-
type: HostListener,
|
|
11696
|
-
args: ['mousedown', ['$event']]
|
|
11697
|
-
}] } });
|
|
11698
|
-
|
|
11699
11634
|
const getTableEntry = (editor) => {
|
|
11700
11635
|
const { tableEntry } = createTablePosition(editor);
|
|
11701
11636
|
return tableEntry;
|
|
@@ -11716,25 +11651,6 @@ const getSelectedCell = (editor) => {
|
|
|
11716
11651
|
return null;
|
|
11717
11652
|
};
|
|
11718
11653
|
|
|
11719
|
-
const setSelectedCellsBackgroundColor = (editor, color, tableStore) => {
|
|
11720
|
-
// 点击自定义颜色面板输入框设置颜色值时,会丢失焦点和选区(目前无法做到焦点同时存在于编辑器和输入框)
|
|
11721
|
-
let location;
|
|
11722
|
-
if (!editor.selection) {
|
|
11723
|
-
const { rangeRef } = THE_EDITOR_PREVIOUS_SELECTION.get(editor);
|
|
11724
|
-
location = rangeRef.current.anchor;
|
|
11725
|
-
}
|
|
11726
|
-
const isHeader = TableEditor.isActiveHeader(editor, location);
|
|
11727
|
-
if (color === 'transparent') {
|
|
11728
|
-
color = null;
|
|
11729
|
-
}
|
|
11730
|
-
if ((color === TableHeaderBackgroundColor && isHeader) || (color === SpecialBackgroundColor && !isHeader)) {
|
|
11731
|
-
tableStore.setSelectedCellsBackgroundColor(null);
|
|
11732
|
-
}
|
|
11733
|
-
else {
|
|
11734
|
-
tableStore.setSelectedCellsBackgroundColor(color);
|
|
11735
|
-
}
|
|
11736
|
-
};
|
|
11737
|
-
|
|
11738
11654
|
function setTableOptions(editor, newOptions) {
|
|
11739
11655
|
const tablePosition = createTablePosition(editor);
|
|
11740
11656
|
const tablePath = getTablePath(editor);
|
|
@@ -11784,6 +11700,91 @@ function removeColumnOrRows(editor, tableStore, options) {
|
|
|
11784
11700
|
}
|
|
11785
11701
|
}
|
|
11786
11702
|
|
|
11703
|
+
const setSelectedCellsBackgroundColor = (editor, color, tableStore) => {
|
|
11704
|
+
// 点击自定义颜色面板输入框设置颜色值时,会丢失焦点和选区(目前无法做到焦点同时存在于编辑器和输入框)
|
|
11705
|
+
let location;
|
|
11706
|
+
if (!editor.selection) {
|
|
11707
|
+
const { rangeRef } = THE_EDITOR_PREVIOUS_SELECTION.get(editor);
|
|
11708
|
+
location = rangeRef.current.anchor;
|
|
11709
|
+
}
|
|
11710
|
+
const isHeader = TableEditor.isActiveHeader(editor, location);
|
|
11711
|
+
if (color === 'transparent') {
|
|
11712
|
+
color = null;
|
|
11713
|
+
}
|
|
11714
|
+
if ((color === TableHeaderBackgroundColor && isHeader) || (color === SpecialBackgroundColor && !isHeader)) {
|
|
11715
|
+
tableStore.setSelectedCellsBackgroundColor(null);
|
|
11716
|
+
}
|
|
11717
|
+
else {
|
|
11718
|
+
tableStore.setSelectedCellsBackgroundColor(color);
|
|
11719
|
+
}
|
|
11720
|
+
};
|
|
11721
|
+
|
|
11722
|
+
function setCellMenuVisibility(editor, menuList, tableInfo) {
|
|
11723
|
+
const { selectedCellPositions, isFullscreen, isSelectedTable, selectedRowsIndex, selectedColumnsIndex } = tableInfo;
|
|
11724
|
+
const isCellMerged = isSelectedCellMerged(editor);
|
|
11725
|
+
const selectCellNodes = getSelectCellNode(editor, selectedCellPositions).filter(item => !item.node.hidden);
|
|
11726
|
+
const isRect = isRectangularInTableCells(editor, selectedCellPositions);
|
|
11727
|
+
menuList.forEach(item => {
|
|
11728
|
+
switch (item.key) {
|
|
11729
|
+
case 'merge-cells':
|
|
11730
|
+
item.visibility = selectCellNodes && selectCellNodes.length > 1 && !isSelectedTable && isRect;
|
|
11731
|
+
break;
|
|
11732
|
+
case 'split-cells':
|
|
11733
|
+
item.visibility = selectCellNodes && selectCellNodes.length === 1 && isCellMerged;
|
|
11734
|
+
break;
|
|
11735
|
+
case 'delete-selection-rows':
|
|
11736
|
+
item.visibility = !(isFullscreen && selectedColumnsIndex.length);
|
|
11737
|
+
break;
|
|
11738
|
+
case 'delete-selection-columns':
|
|
11739
|
+
item.visibility = !(isFullscreen && selectedRowsIndex.length);
|
|
11740
|
+
break;
|
|
11741
|
+
case 'delete-table':
|
|
11742
|
+
item.visibility = !isFullscreen;
|
|
11743
|
+
break;
|
|
11744
|
+
case TableInsertType.insertRowsUp:
|
|
11745
|
+
const hasHeaderRowCell = TableEditor.hasHeaderRowCell(editor);
|
|
11746
|
+
item.visibility = !hasHeaderRowCell && isRect;
|
|
11747
|
+
break;
|
|
11748
|
+
case TableInsertType.insertRowsDown:
|
|
11749
|
+
item.visibility = isRect;
|
|
11750
|
+
break;
|
|
11751
|
+
case TableInsertType.insertColumnsLeft:
|
|
11752
|
+
const hasHeaderColumnCell = TableEditor.hasHeaderColumnCell(editor);
|
|
11753
|
+
item.visibility = !hasHeaderColumnCell && isRect;
|
|
11754
|
+
break;
|
|
11755
|
+
case TableInsertType.insertColumnsRight:
|
|
11756
|
+
item.visibility = isRect;
|
|
11757
|
+
break;
|
|
11758
|
+
}
|
|
11759
|
+
});
|
|
11760
|
+
}
|
|
11761
|
+
|
|
11762
|
+
function splitCell(editor) {
|
|
11763
|
+
const tablePosition = createTablePosition(editor);
|
|
11764
|
+
const { cell, table, cellEntry } = tablePosition;
|
|
11765
|
+
if ((!cell.rowspan && !cell.colspan) || (cell.rowspan === 1 && cell.colspan === 1))
|
|
11766
|
+
return editor;
|
|
11767
|
+
const cellRow = tablePosition.getRowIndex();
|
|
11768
|
+
const cellCol = tablePosition.getColumnIndex();
|
|
11769
|
+
resetTableCell(editor, table, cell, cellRow, cellCol);
|
|
11770
|
+
Transforms.select(editor, cellEntry[1]);
|
|
11771
|
+
Transforms.collapse(editor, { edge: 'end' });
|
|
11772
|
+
}
|
|
11773
|
+
function resetTableCell(editor, table, cell, cellRow, cellCol) {
|
|
11774
|
+
const rowSpanIndex = cellRow + (cell.rowspan || 1) - 1;
|
|
11775
|
+
const colSpanIndex = cellCol + (cell.colspan || 1) - 1;
|
|
11776
|
+
Editor.withoutNormalizing(editor, () => {
|
|
11777
|
+
table.children.map((row, rowIndex) => {
|
|
11778
|
+
row.children.map((col, colIndex) => {
|
|
11779
|
+
if (rowIndex >= cellRow && rowIndex <= rowSpanIndex && colIndex >= cellCol && colIndex <= colSpanIndex) {
|
|
11780
|
+
const path = findPath(editor, col);
|
|
11781
|
+
Transforms.setNodes(editor, { colspan: null, rowspan: null, hidden: null }, { at: path });
|
|
11782
|
+
}
|
|
11783
|
+
});
|
|
11784
|
+
});
|
|
11785
|
+
});
|
|
11786
|
+
}
|
|
11787
|
+
|
|
11787
11788
|
const getMinAndMaxCellIndex = (editor, selectedCellPositions, maxRow, maxCol, minRow, minCol, table) => {
|
|
11788
11789
|
const beforeCols = [];
|
|
11789
11790
|
const beforeRows = [];
|
|
@@ -12522,6 +12523,7 @@ class TheTableContextMenuService {
|
|
|
12522
12523
|
},
|
|
12523
12524
|
hasBackdrop: false,
|
|
12524
12525
|
placement: 'bottomLeft',
|
|
12526
|
+
panelClass: 'the-table-contextmenu-panel',
|
|
12525
12527
|
viewContainerRef: this.theContextService.getOptions().viewContainerRef,
|
|
12526
12528
|
manualClosure: true,
|
|
12527
12529
|
insideClosable: false,
|