@worktile/theia 2.4.2 → 2.4.5
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 +231 -143
- package/bundles/worktile-theia.umd.js.map +1 -1
- package/editor.module.d.ts +2 -1
- package/esm2015/editor.component.js +4 -2
- package/esm2015/interfaces/editor.js +1 -1
- package/esm2015/plugins/indent/indent.editor.js +11 -13
- package/esm2015/plugins/indent/indent.plugin.js +15 -2
- package/esm2015/plugins/indent/on-keydown-indent.js +3 -5
- package/esm2015/plugins/index.js +1 -1
- package/esm2015/plugins/quick-insert/components/quick-insert.component.js +6 -2
- package/esm2015/plugins/quick-insert/components/quick-toolbar/quick-toolbar.component.js +14 -15
- package/esm2015/plugins/quick-insert/quick-insert.editor.js +18 -27
- package/esm2015/plugins/quick-insert/quick-insert.plugin.js +43 -15
- package/esm2015/plugins/table/components/insert-mark/insert-mark.component.js +4 -4
- package/esm2015/plugins/table/components/table.component.js +2 -2
- package/esm2015/plugins/table/components/td/td.component.js +5 -7
- package/esm2015/plugins/table/table.service.js +6 -6
- package/esm2015/plugins/todo-item/todo-item.component.js +15 -7
- package/esm2015/queries/get-directly-parent.js +12 -0
- package/esm2015/queries/index.js +4 -2
- package/esm2015/queries/is-types-in-parent.js +16 -0
- package/esm2015/transforms/insert-element-next.js +24 -3
- package/esm2015/utils/is-clean-empty-paragraph.js +4 -1
- package/fesm2015/worktile-theia.js +227 -140
- package/fesm2015/worktile-theia.js.map +1 -1
- package/interfaces/editor.d.ts +11 -1
- package/package.json +1 -1
- package/plugins/indent/indent.plugin.d.ts +1 -0
- package/plugins/indent/on-keydown-indent.d.ts +1 -1
- package/plugins/quick-insert/components/quick-toolbar/quick-toolbar.component.d.ts +3 -4
- package/plugins/quick-insert/quick-insert.editor.d.ts +3 -4
- package/plugins/quick-insert/quick-insert.plugin.d.ts +2 -0
- package/plugins/table/components/table.component.scss +43 -42
- package/plugins/todo-item/todo-item.component.d.ts +3 -1
- package/queries/get-directly-parent.d.ts +2 -0
- package/queries/index.d.ts +3 -1
- package/queries/is-types-in-parent.d.ts +2 -0
- package/utils/is-clean-empty-paragraph.d.ts +2 -1
|
@@ -54,7 +54,7 @@ import { ThySharedModule } from 'ngx-tethys/shared';
|
|
|
54
54
|
import * as i1$6 from 'ngx-tethys';
|
|
55
55
|
import { coerceCssPixelValue } from '@angular/cdk/coercion';
|
|
56
56
|
import { PortalInjector, ComponentPortal } from '@angular/cdk/portal';
|
|
57
|
-
import * as
|
|
57
|
+
import * as i1$7 from 'ngx-tethys/list';
|
|
58
58
|
import { ThyListModule } from 'ngx-tethys/list';
|
|
59
59
|
import { ThyAutocompleteModule } from 'ngx-tethys/autocomplete';
|
|
60
60
|
import { ThyAvatarModule } from 'ngx-tethys/avatar';
|
|
@@ -1317,6 +1317,30 @@ const getContainerBlocks = (editor) => {
|
|
|
1317
1317
|
return !containerNode ? CONTAINER_BLOCKS : [...CONTAINER_BLOCKS, containerNode[0].type];
|
|
1318
1318
|
};
|
|
1319
1319
|
|
|
1320
|
+
const getDirectlyParent = (editor) => {
|
|
1321
|
+
const [, anchorPath] = getBlockAbove(editor);
|
|
1322
|
+
if (!anchorPath)
|
|
1323
|
+
return;
|
|
1324
|
+
const parentEntry = getParent(editor, anchorPath);
|
|
1325
|
+
if (!parentEntry)
|
|
1326
|
+
return;
|
|
1327
|
+
return parentEntry;
|
|
1328
|
+
};
|
|
1329
|
+
|
|
1330
|
+
const isTypesInParent = (editor, types) => {
|
|
1331
|
+
if (!Array.isArray(types)) {
|
|
1332
|
+
types = [types];
|
|
1333
|
+
}
|
|
1334
|
+
const [, anchorPath] = getBlockAbove(editor);
|
|
1335
|
+
if (!anchorPath)
|
|
1336
|
+
return false;
|
|
1337
|
+
const parentEntry = Editor.above(editor, { match: n => types.includes(n.type) });
|
|
1338
|
+
if (!parentEntry)
|
|
1339
|
+
return false;
|
|
1340
|
+
const [parentNode] = parentEntry;
|
|
1341
|
+
return types.includes(parentNode.type);
|
|
1342
|
+
};
|
|
1343
|
+
|
|
1320
1344
|
var index$1 = /*#__PURE__*/Object.freeze({
|
|
1321
1345
|
__proto__: null,
|
|
1322
1346
|
getLastNode: getLastNode,
|
|
@@ -1344,6 +1368,7 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
1344
1368
|
getPlainText: getPlainText,
|
|
1345
1369
|
getSelectionMarks: getSelectionMarks,
|
|
1346
1370
|
getContainerBlocks: getContainerBlocks,
|
|
1371
|
+
getDirectlyParent: getDirectlyParent,
|
|
1347
1372
|
isAncestor: isAncestor,
|
|
1348
1373
|
isCollapsed: isCollapsed,
|
|
1349
1374
|
isEmptyParagraph: isEmptyParagraph,
|
|
@@ -1366,6 +1391,7 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
1366
1391
|
isEmptyContent: isEmptyContent,
|
|
1367
1392
|
isEmptyParagraphByPath: isEmptyParagraphByPath,
|
|
1368
1393
|
isContainer: isContainer,
|
|
1394
|
+
isTypesInParent: isTypesInParent,
|
|
1369
1395
|
anchorBlock: anchorBlock,
|
|
1370
1396
|
anchorBlockEntry: anchorBlockEntry,
|
|
1371
1397
|
anchorInlineEntry: anchorInlineEntry,
|
|
@@ -1377,11 +1403,32 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
1377
1403
|
});
|
|
1378
1404
|
|
|
1379
1405
|
const insertElementNext = (editor, node) => {
|
|
1406
|
+
var _a;
|
|
1380
1407
|
if (Range.isExpanded(editor.selection)) {
|
|
1381
1408
|
Editor.deleteFragment(editor);
|
|
1382
1409
|
}
|
|
1383
|
-
const
|
|
1384
|
-
const
|
|
1410
|
+
const allowContainerOperateTypes = ((_a = editor.options) === null || _a === void 0 ? void 0 : _a.allowContainerOperateTypes) || [];
|
|
1411
|
+
const isAllowContainerInsert = isTypesInParent(editor, allowContainerOperateTypes);
|
|
1412
|
+
const isBlockCardCursor$1 = isBlockCardCursor(editor);
|
|
1413
|
+
const containerBlocks = getContainerBlocks(editor);
|
|
1414
|
+
const isContainer = isNodeTypeIn(editor, containerBlocks, { at: editor.selection });
|
|
1415
|
+
const [anchorBlock, anchorBlockPath] = anchorBlockEntry(editor);
|
|
1416
|
+
const isEmpty = Editor.isEmpty(editor, anchorBlock);
|
|
1417
|
+
if (isAllowContainerInsert && isContainer && !isBlockCardCursor$1) {
|
|
1418
|
+
const [, containerPath] = Editor.above(editor, {
|
|
1419
|
+
match: n => Editor.isBlock(editor, n) && allowContainerOperateTypes.includes(n.type),
|
|
1420
|
+
at: editor.selection
|
|
1421
|
+
});
|
|
1422
|
+
Editor.withoutNormalizing(editor, () => {
|
|
1423
|
+
const containerPathFirstPath = anchorBlockPath.slice(0, containerPath.length + 1);
|
|
1424
|
+
Transforms.insertNodes(editor, node, { at: Path.next(containerPathFirstPath) });
|
|
1425
|
+
Transforms.select(editor, Editor.start(editor, Path.next(containerPathFirstPath)));
|
|
1426
|
+
if (isEmpty) {
|
|
1427
|
+
Transforms.removeNodes(editor, { at: anchorBlockPath });
|
|
1428
|
+
}
|
|
1429
|
+
});
|
|
1430
|
+
return;
|
|
1431
|
+
}
|
|
1385
1432
|
const nextPath = Path.next([anchorBlockPath[0]]);
|
|
1386
1433
|
Transforms.insertNodes(editor, node, { at: nextPath });
|
|
1387
1434
|
if (isEmpty && anchorBlockPath.length === 1) {
|
|
@@ -1737,6 +1784,9 @@ const isCleanEmptyParagraph = (editor) => {
|
|
|
1737
1784
|
return false;
|
|
1738
1785
|
}
|
|
1739
1786
|
const block = Node.ancestor(editor, [editor.selection.anchor.path[0]]);
|
|
1787
|
+
return isPureEmptyParagraph(editor, block);
|
|
1788
|
+
};
|
|
1789
|
+
const isPureEmptyParagraph = (editor, block) => {
|
|
1740
1790
|
const textIndent = 'textIndent';
|
|
1741
1791
|
const align = 'align';
|
|
1742
1792
|
const hasTextIndent = block[textIndent];
|
|
@@ -3532,10 +3582,11 @@ const withList = ({ validLiChildrenTypes } = {}) => (editor) => {
|
|
|
3532
3582
|
};
|
|
3533
3583
|
|
|
3534
3584
|
class TheTodoItemComponent extends TheBaseElementComponent {
|
|
3535
|
-
constructor(elementRef, cdr) {
|
|
3585
|
+
constructor(elementRef, cdr, ctxService) {
|
|
3536
3586
|
super(elementRef, cdr);
|
|
3537
3587
|
this.elementRef = elementRef;
|
|
3538
3588
|
this.cdr = cdr;
|
|
3589
|
+
this.ctxService = ctxService;
|
|
3539
3590
|
this.checkItemClass = true;
|
|
3540
3591
|
}
|
|
3541
3592
|
get level() {
|
|
@@ -3546,13 +3597,18 @@ class TheTodoItemComponent extends TheBaseElementComponent {
|
|
|
3546
3597
|
super.ngOnInit();
|
|
3547
3598
|
}
|
|
3548
3599
|
onCheck(checked) {
|
|
3549
|
-
|
|
3600
|
+
const options = this.ctxService.getTheOptions();
|
|
3601
|
+
const noBindReadonly = options.noBindReadonlyPlugins && options.noBindReadonlyPlugins.includes(ElementKinds.checkItem);
|
|
3602
|
+
if (!noBindReadonly && this.readonly) {
|
|
3550
3603
|
return false;
|
|
3551
3604
|
}
|
|
3605
|
+
else {
|
|
3606
|
+
setNode(this.editor, { checked }, this.element);
|
|
3607
|
+
}
|
|
3552
3608
|
setNode(this.editor, { checked }, this.element);
|
|
3553
3609
|
}
|
|
3554
3610
|
}
|
|
3555
|
-
TheTodoItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheTodoItemComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
3611
|
+
TheTodoItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheTodoItemComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: TheContextService }], target: i0.ɵɵFactoryTarget.Component });
|
|
3556
3612
|
TheTodoItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheTodoItemComponent, selector: "div[theTodoItem]", host: { properties: { "class.the-check-item": "this.checkItemClass", "attr.the-level": "this.level" } }, usesInheritance: true, ngImport: i0, template: `
|
|
3557
3613
|
<span contenteditable="false" class="todo-item-status">
|
|
3558
3614
|
<input #checkbox type="checkbox" [checked]="element.checked" (click)="onCheck(checkbox.checked)" />
|
|
@@ -3570,7 +3626,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
3570
3626
|
<span><slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children></span>
|
|
3571
3627
|
`
|
|
3572
3628
|
}]
|
|
3573
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { checkItemClass: [{
|
|
3629
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: TheContextService }]; }, propDecorators: { checkItemClass: [{
|
|
3574
3630
|
type: HostBinding,
|
|
3575
3631
|
args: ['class.the-check-item']
|
|
3576
3632
|
}], level: [{
|
|
@@ -8700,7 +8756,7 @@ class TableService {
|
|
|
8700
8756
|
offset: this.offset,
|
|
8701
8757
|
hasBackdrop: this.hasBackdrop,
|
|
8702
8758
|
insideClosable: this.insideClosable,
|
|
8703
|
-
panelClass: 'the-table-toolbar-wrap',
|
|
8759
|
+
panelClass: 'the-temp-table-toolbar-wrap',
|
|
8704
8760
|
scrollStrategy: this.overlay.scrollStrategies.reposition(),
|
|
8705
8761
|
manualClosure: true
|
|
8706
8762
|
});
|
|
@@ -8710,15 +8766,15 @@ class TableService {
|
|
|
8710
8766
|
if (origin instanceof HTMLTableCellElement && origin.tagName !== 'TH') {
|
|
8711
8767
|
const { selectedRowsIndex, selectedColumnsIndex, focusCellPath, isSelectedTable, focusCellElement } = this.tableStore;
|
|
8712
8768
|
const [row, col] = focusCellPath.slice(-2);
|
|
8713
|
-
const tableElement = focusCellElement.closest('.the-table-container');
|
|
8769
|
+
const tableElement = focusCellElement.closest('.the-temp-table-container');
|
|
8714
8770
|
if (isSelectedTable && col === 0 && row === 0) {
|
|
8715
|
-
return tableElement.querySelector('.the-table-corner-controls');
|
|
8771
|
+
return tableElement.querySelector('.the-temp-table-corner-controls');
|
|
8716
8772
|
}
|
|
8717
8773
|
if (selectedColumnsIndex.length > 0 && row === 0) {
|
|
8718
|
-
return tableElement.querySelectorAll('.the-table-col-controls')[col];
|
|
8774
|
+
return tableElement.querySelectorAll('.the-temp-table-col-controls')[col];
|
|
8719
8775
|
}
|
|
8720
8776
|
if (selectedRowsIndex.length > 0 && col === 0) {
|
|
8721
|
-
return tableElement.querySelectorAll('.the-table-row-controls-button-wrap')[row];
|
|
8777
|
+
return tableElement.querySelectorAll('.the-temp-table-row-controls-button-wrap')[row];
|
|
8722
8778
|
}
|
|
8723
8779
|
}
|
|
8724
8780
|
return origin;
|
|
@@ -8819,13 +8875,13 @@ class TheInsertMarkComponent {
|
|
|
8819
8875
|
const tableWrapper = tableComponent.tableWrapper.nativeElement;
|
|
8820
8876
|
const tableElement = tableComponent.theTableElement.nativeElement;
|
|
8821
8877
|
let result = 0;
|
|
8822
|
-
const rowControl = tableComponent.nativeElement.querySelector('.the-table-row-controls');
|
|
8878
|
+
const rowControl = tableComponent.nativeElement.querySelector('.the-temp-table-row-controls');
|
|
8823
8879
|
let rowControlWidth = 11;
|
|
8824
8880
|
if (rowControl) {
|
|
8825
8881
|
rowControlWidth = rowControl.getBoundingClientRect().width;
|
|
8826
8882
|
}
|
|
8827
8883
|
if (this.type === 'row') {
|
|
8828
|
-
result = tableWrapper.offsetWidth + rowControlWidth;
|
|
8884
|
+
result = tableWrapper.offsetWidth + rowControlWidth - 2;
|
|
8829
8885
|
}
|
|
8830
8886
|
else {
|
|
8831
8887
|
result = tableElement.offsetHeight - 1;
|
|
@@ -8836,7 +8892,7 @@ class TheInsertMarkComponent {
|
|
|
8836
8892
|
ngOnDestroy() { }
|
|
8837
8893
|
}
|
|
8838
8894
|
TheInsertMarkComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheInsertMarkComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
8839
|
-
TheInsertMarkComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheInsertMarkComponent, selector: "the-table-insert-mark", inputs: { type: "type", at: "at", tableStore: "tableStore" }, ngImport: i0, template: "<div\n [thyTooltip]=\"!disabled && tooltipContent\"\n class=\"the-table-controls-insert-wrapper\"\n [ngClass]=\"{ disabled: disabled }\"\n contenteditable=\"false\"\n (mousedown)=\"onMouseDown($event)\"\n (mouseenter)=\"onMouseEnter($event)\"\n (mouseleave)=\"onMouseLeave($event)\"\n>\n <div\n class=\"the-table-controls-insert-line\"\n *ngIf=\"dotWrapperHovered\"\n [attr.data-dot-type]=\"type\"\n [ngStyle]=\"{ height: type === 'column' && insertLength, width: type === 'row' && insertLength }\"\n ></div>\n</div>\n", directives: [{ type: i5.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i10.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i10.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
|
8895
|
+
TheInsertMarkComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheInsertMarkComponent, selector: "the-table-insert-mark", inputs: { type: "type", at: "at", tableStore: "tableStore" }, ngImport: i0, template: "<div\n [thyTooltip]=\"!disabled && tooltipContent\"\n class=\"the-temp-table-controls-insert-wrapper\"\n [ngClass]=\"{ disabled: disabled }\"\n contenteditable=\"false\"\n (mousedown)=\"onMouseDown($event)\"\n (mouseenter)=\"onMouseEnter($event)\"\n (mouseleave)=\"onMouseLeave($event)\"\n>\n <div\n class=\"the-temp-table-controls-insert-line\"\n *ngIf=\"dotWrapperHovered\"\n [attr.data-dot-type]=\"type\"\n [ngStyle]=\"{ height: type === 'column' && insertLength, width: type === 'row' && insertLength }\"\n ></div>\n</div>\n", directives: [{ type: i5.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i10.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i10.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
|
8840
8896
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheInsertMarkComponent, decorators: [{
|
|
8841
8897
|
type: Component,
|
|
8842
8898
|
args: [{
|
|
@@ -9315,7 +9371,7 @@ TheTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", vers
|
|
|
9315
9371
|
provide: TheTableToken,
|
|
9316
9372
|
useExisting: TheTableComponent
|
|
9317
9373
|
}
|
|
9318
|
-
], viewQueries: [{ propertyName: "tableWrapper", first: true, predicate: ["tableWrapper"], descendants: true, read: ElementRef, static: true }, { propertyName: "theTableElement", first: true, predicate: ["theTable"], descendants: true, read: ElementRef, static: true }, { propertyName: "tbodyElement", first: true, predicate: ["tbody"], descendants: true, read: ElementRef, static: true }], usesInheritance: true, ngImport: i0, template: "<div\n class=\"the-table-container\"\n theColumnResize\n [ngClass]=\"{\n 'the-table-with-controls': isInTable,\n 'the-numbered-column-container': element?.options?.numberedColumn,\n 'the-table-selection-hide': tableStore.isCellSelecting || tableStore.isRightClicking\n }\"\n>\n <div\n class=\"the-table-row-controls-wrapper\"\n [ngClass]=\"{\n 'the-table-focus': isInTable\n }\"\n >\n <div\n class=\"the-table-corner-controls\"\n [ngClass]=\"{\n visible: !readonly && isInTable,\n active: isSelectedAllCell,\n dangerous: tableStore.isSelectedTable && tableStore.dangerousCells.length > 0\n }\"\n >\n <div class=\"the-table-corner-button\" (mousedown)=\"onSelectTable($event)\"></div>\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 <ng-container *ngIf=\"!readonly && isInTable && !element?.options?.numberedColumn\">\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 </ng-container>\n <ng-container *ngIf=\"element?.options?.numberedColumn\">\n <div\n [contentEditable]=\"false\"\n contenteditable=\"false\"\n (mousedown)=\"onRowMouseDown($event, control.rowIndex)\"\n class=\"the-table-numbered-controls-button\"\n [ngStyle]=\"{ height: control.height + 1 + 'px' }\"\n >\n <p class=\"row-number d-flex align-items-center\">{{ i + 1 }}</p>\n </div>\n </ng-container>\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 class=\"the-table-wrapper\" #tableWrapper [ngClass]=\"{ 'the-table-numbered': element?.options?.numberedColumn }\">\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 [ngClass]=\"{\n active: tableStore.selectedColumnsIndex.includes(i),\n dangerous: tableStore.dangerousColumnsIndex.includes(i) && tableStore.dangerousCells.length > 0\n }\"\n (mousedown)=\"onColMouseDown($event, i)\"\n *ngFor=\"let control of colControls; let i = index; trackBy: trackByFnColCotrols\"\n >\n <the-table-insert-mark *ngIf=\"isInTable\" type=\"column\" [at]=\"i + 1\" [tableStore]=\"tableStore\">\n </the-table-insert-mark>\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.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }], directives: [{ type: TheColumnResizeDirective, selector: "div[theColumnResize]" }, { type: i10.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i10.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i10.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
|
9374
|
+
], viewQueries: [{ propertyName: "tableWrapper", first: true, predicate: ["tableWrapper"], descendants: true, read: ElementRef, static: true }, { propertyName: "theTableElement", first: true, predicate: ["theTable"], descendants: true, read: ElementRef, static: true }, { propertyName: "tbodyElement", first: true, predicate: ["tbody"], descendants: true, read: ElementRef, static: true }], usesInheritance: true, ngImport: i0, template: "<!-- \u7C7B\u540D the-temp-*: \u4E34\u65F6\u89E3\u51B3\u56E0\u53D7portal\u5F71\u54CD\u8868\u683C\u6837\u5F0F\u95EE\u9898\uFF0C\u540E\u671F\u6539\u56DEthe-* -->\n<div\n class=\"the-temp-table-container\"\n theColumnResize\n [ngClass]=\"{\n 'the-temp-table-with-controls': isInTable,\n 'the-temp-numbered-column-container': element?.options?.numberedColumn,\n 'the-temp-table-selection-hide': tableStore.isCellSelecting || tableStore.isRightClicking\n }\"\n>\n <div\n class=\"the-temp-table-row-controls-wrapper\"\n [ngClass]=\"{\n 'the-temp-table-focus': isInTable\n }\"\n >\n <div\n class=\"the-temp-table-corner-controls\"\n [ngClass]=\"{\n visible: !readonly && isInTable,\n active: isSelectedAllCell,\n dangerous: tableStore.isSelectedTable && tableStore.dangerousCells.length > 0\n }\"\n >\n <div class=\"the-temp-table-corner-button\" (mousedown)=\"onSelectTable($event)\"></div>\n <div class=\"the-temp-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-temp-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-temp-table-row-controls\">\n <div class=\"the-temp-table-row-controls-inner\">\n <div\n class=\"the-temp-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 <ng-container *ngIf=\"!readonly && isInTable && !element?.options?.numberedColumn\">\n <button\n (mousedown)=\"onRowMouseDown($event, control.rowIndex)\"\n type=\"button\"\n [ngStyle]=\"{ height: control.height + 1 + 'px' }\"\n class=\"the-temp-table-row-controls-button the-temp-table-controls-button\"\n ></button>\n </ng-container>\n <ng-container *ngIf=\"element?.options?.numberedColumn\">\n <div\n [contentEditable]=\"false\"\n contenteditable=\"false\"\n (mousedown)=\"onRowMouseDown($event, control.rowIndex)\"\n class=\"the-temp-table-numbered-controls-button\"\n [ngStyle]=\"{ height: control.height + 1 + 'px' }\"\n >\n <p class=\"row-number d-flex align-items-center\">{{ i + 1 }}</p>\n </div>\n </ng-container>\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 class=\"the-temp-table-wrapper\" #tableWrapper [ngClass]=\"{ 'the-temp-table-numbered': element?.options?.numberedColumn }\">\n <table class=\"the-temp-table\" #theTable [ngClass]=\"{ 'the-temp-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-temp-table-col-controls-wrapper\">\n <th\n class=\"the-temp-table-col-controls\"\n [ngClass]=\"{\n active: tableStore.selectedColumnsIndex.includes(i),\n dangerous: tableStore.dangerousColumnsIndex.includes(i) && tableStore.dangerousCells.length > 0\n }\"\n (mousedown)=\"onColMouseDown($event, i)\"\n *ngFor=\"let control of colControls; let i = index; trackBy: trackByFnColCotrols\"\n >\n <the-table-insert-mark *ngIf=\"isInTable\" type=\"column\" [at]=\"i + 1\" [tableStore]=\"tableStore\">\n </the-table-insert-mark>\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.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }], directives: [{ type: TheColumnResizeDirective, selector: "div[theColumnResize]" }, { type: i10.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i10.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i10.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
|
9319
9375
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheTableComponent, decorators: [{
|
|
9320
9376
|
type: Component,
|
|
9321
9377
|
args: [{
|
|
@@ -10172,12 +10228,12 @@ class TheTdComponent extends TheBaseElementComponent {
|
|
|
10172
10228
|
}
|
|
10173
10229
|
updateOverlayHandleRowSize() {
|
|
10174
10230
|
const tableElement = this.tableComponent.nativeElement;
|
|
10175
|
-
const rowControl = tableElement.querySelector('.the-table-row-controls');
|
|
10231
|
+
const rowControl = tableElement.querySelector('.the-temp-table-row-controls');
|
|
10176
10232
|
let rowControlWidth = 11;
|
|
10177
10233
|
if (rowControl) {
|
|
10178
10234
|
rowControlWidth = rowControl.getBoundingClientRect().width;
|
|
10179
10235
|
}
|
|
10180
|
-
const width = this.tableComponent.tableWrapper.nativeElement.offsetWidth + rowControlWidth;
|
|
10236
|
+
const width = this.tableComponent.tableWrapper.nativeElement.offsetWidth + rowControlWidth - 2;
|
|
10181
10237
|
this.overlayRef.addPanelClass(this.rowResizeClass);
|
|
10182
10238
|
this.overlayRef.updateSize({ width, height: OVERLAY_INIT_SIZE });
|
|
10183
10239
|
}
|
|
@@ -10369,8 +10425,7 @@ class TheTdComponent extends TheBaseElementComponent {
|
|
|
10369
10425
|
applyTopRows(rows, deltaY, rowIndex) {
|
|
10370
10426
|
while (deltaY < 0 && rows[rowIndex]) {
|
|
10371
10427
|
const rowOffsetHeight = getElementHeight(rows[rowIndex]);
|
|
10372
|
-
|
|
10373
|
-
if (rowOffsetHeight > this.tableOptions.minHeightPx && rowOffsetHeight === rowStyleHeight) {
|
|
10428
|
+
if (rowOffsetHeight > this.tableOptions.minHeightPx) {
|
|
10374
10429
|
if (this.resizingStore.isResizing(deltaY, this.isXAxisHover)) {
|
|
10375
10430
|
this.resizingStore.storeResizingRow(rows[rowIndex]);
|
|
10376
10431
|
}
|
|
@@ -10390,8 +10445,7 @@ class TheTdComponent extends TheBaseElementComponent {
|
|
|
10390
10445
|
applyBottomRows(rows, deltaY, rowIndex) {
|
|
10391
10446
|
while (rows[rowIndex] && deltaY > 0) {
|
|
10392
10447
|
const rowOffsetHeight = getElementHeight(rows[rowIndex]);
|
|
10393
|
-
|
|
10394
|
-
if (rowOffsetHeight > this.tableOptions.minHeightPx && rowOffsetHeight === rowStyleHeight) {
|
|
10448
|
+
if (rowOffsetHeight > this.tableOptions.minHeightPx) {
|
|
10395
10449
|
if (this.resizingStore.isResizing(deltaY, this.isXAxisHover)) {
|
|
10396
10450
|
this.resizingStore.storeResizingRow(rows[rowIndex]);
|
|
10397
10451
|
}
|
|
@@ -11268,26 +11322,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
11268
11322
|
}] } });
|
|
11269
11323
|
|
|
11270
11324
|
class TheQuickToolbarComponent extends mixinUnsubscribe(MixinBase) {
|
|
11271
|
-
constructor(
|
|
11325
|
+
constructor(elementRef, cdr) {
|
|
11272
11326
|
super();
|
|
11273
|
-
this.popoverRef = popoverRef;
|
|
11274
11327
|
this.elementRef = elementRef;
|
|
11328
|
+
this.cdr = cdr;
|
|
11275
11329
|
this.ToolbarItemMode = ToolbarItemMode;
|
|
11276
11330
|
this.ToolbarActionTypes = ToolbarActionTypes;
|
|
11277
11331
|
}
|
|
11278
11332
|
handleMouseDown(event) {
|
|
11279
11333
|
if (!this.elementRef.nativeElement.contains(event.target)) {
|
|
11280
|
-
QuickInsertEditor.
|
|
11334
|
+
QuickInsertEditor.closeQuickInsertToolbar(this.editor);
|
|
11281
11335
|
}
|
|
11282
11336
|
else {
|
|
11283
11337
|
event.preventDefault();
|
|
11284
11338
|
}
|
|
11285
11339
|
}
|
|
11286
11340
|
handleEnter() {
|
|
11287
|
-
QuickInsertEditor.
|
|
11341
|
+
QuickInsertEditor.closeQuickInsertToolbar(this.editor);
|
|
11288
11342
|
}
|
|
11289
11343
|
handleEsc() {
|
|
11290
|
-
QuickInsertEditor.
|
|
11344
|
+
QuickInsertEditor.closeQuickInsertToolbar(this.editor);
|
|
11291
11345
|
}
|
|
11292
11346
|
ngOnInit() {
|
|
11293
11347
|
this.editorElement = AngularEditor.toDOMNode(this.editor, this.editor);
|
|
@@ -11312,15 +11366,15 @@ class TheQuickToolbarComponent extends mixinUnsubscribe(MixinBase) {
|
|
|
11312
11366
|
super.ngOnDestroy();
|
|
11313
11367
|
}
|
|
11314
11368
|
}
|
|
11315
|
-
TheQuickToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheQuickToolbarComponent, deps: [{ token:
|
|
11316
|
-
TheQuickToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheQuickToolbarComponent, selector: "the-quick-toolbar", inputs: { editor: "editor", quickToolbarItems: "quickToolbarItems" }, host: { listeners: { "document: mousedown": "handleMouseDown($event)", "document: keydown.enter": "handleEnter()", "document: keydown.escape": "handleEsc()" } }, usesInheritance: true, ngImport: i0, 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:
|
|
11369
|
+
TheQuickToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheQuickToolbarComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
11370
|
+
TheQuickToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheQuickToolbarComponent, selector: "the-quick-toolbar", inputs: { editor: "editor", quickToolbarItems: "quickToolbarItems" }, host: { listeners: { "document: mousedown": "handleMouseDown($event)", "document: keydown.enter": "handleEnter()", "document: keydown.escape": "handleEsc()" } }, usesInheritance: true, ngImport: i0, 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: i1$7.ThySelectionListComponent, selector: "thy-selection-list,[thy-selection-list]", inputs: ["thyMultiple", "thyBindKeyEventContainer", "thyScrollContainer", "thyBeforeKeydown", "thyUniqueKey", "thyCompareWith", "thyLayout", "thyAutoActiveFirstItem", "thySize", "thySpaceKeyEnabled"], outputs: ["thySelectionChange"] }, { type: i5$2.ThyListOptionComponent, selector: "thy-list-option,[thy-list-option]", inputs: ["id", "thyValue", "thyDisabled"] }, { type: TheToolbarItemComponent, selector: "the-toolbar-item", inputs: ["editor", "item", "itemMode"] }, { type: NavSplitLineComponent, selector: "nav-split-line", inputs: ["mode"] }], directives: [{ type: i10.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
11317
11371
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheQuickToolbarComponent, decorators: [{
|
|
11318
11372
|
type: Component,
|
|
11319
11373
|
args: [{
|
|
11320
11374
|
selector: 'the-quick-toolbar',
|
|
11321
11375
|
templateUrl: 'quick-toolbar.component.html'
|
|
11322
11376
|
}]
|
|
11323
|
-
}], ctorParameters: function () { return [{ type:
|
|
11377
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { editor: [{
|
|
11324
11378
|
type: Input
|
|
11325
11379
|
}], quickToolbarItems: [{
|
|
11326
11380
|
type: Input
|
|
@@ -11335,16 +11389,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
11335
11389
|
args: ['document: keydown.escape']
|
|
11336
11390
|
}] } });
|
|
11337
11391
|
|
|
11338
|
-
const OperationTypes = ['insert_text', 'remove_node', 'merge_node'];
|
|
11339
11392
|
const QuickInsertEditor = {
|
|
11340
|
-
|
|
11393
|
+
openQuickInsertToolbar(editor, quickToolbarItems, origin) {
|
|
11394
|
+
if (QuickInsertEditor.isOpenedToolbar(editor)) {
|
|
11395
|
+
return;
|
|
11396
|
+
}
|
|
11397
|
+
if (!origin) {
|
|
11398
|
+
const [block,] = getBlockAbove(editor);
|
|
11399
|
+
const rootNode = AngularEditor.toDOMNode(editor, block);
|
|
11400
|
+
origin = rootNode.querySelector('[data-slate-leaf="true"]');
|
|
11401
|
+
}
|
|
11341
11402
|
const overlay = editor.injector.get(Overlay);
|
|
11342
11403
|
const viewContainerRef = editor.injector.get(ViewContainerRef);
|
|
11343
11404
|
const thyPopover = editor.injector.get(ThyPopover);
|
|
11344
11405
|
const quickToolbarRef = thyPopover.open(TheQuickToolbarComponent, {
|
|
11345
11406
|
initialState: {
|
|
11346
11407
|
editor,
|
|
11347
|
-
quickToolbarItems
|
|
11408
|
+
quickToolbarItems
|
|
11348
11409
|
},
|
|
11349
11410
|
origin,
|
|
11350
11411
|
viewContainerRef: viewContainerRef,
|
|
@@ -11357,52 +11418,45 @@ const QuickInsertEditor = {
|
|
|
11357
11418
|
scrollStrategy: overlay.scrollStrategies.reposition(),
|
|
11358
11419
|
manualClosure: true
|
|
11359
11420
|
});
|
|
11421
|
+
quickToolbarRef.componentInstance.cdr.markForCheck();
|
|
11360
11422
|
THE_EDITOR_QUICK_TOOLBAR_REF.set(editor, quickToolbarRef);
|
|
11361
11423
|
},
|
|
11362
|
-
|
|
11424
|
+
closeQuickInsertToolbar(editor) {
|
|
11363
11425
|
const quickToolbarRef = THE_EDITOR_QUICK_TOOLBAR_REF.get(editor);
|
|
11364
11426
|
if (quickToolbarRef) {
|
|
11365
11427
|
quickToolbarRef.close();
|
|
11366
11428
|
THE_EDITOR_QUICK_TOOLBAR_REF.set(editor, null);
|
|
11367
11429
|
}
|
|
11368
11430
|
},
|
|
11369
|
-
|
|
11370
|
-
const
|
|
11371
|
-
|
|
11372
|
-
return false;
|
|
11373
|
-
}
|
|
11374
|
-
const block = Node.ancestor(editor, [editor.selection.anchor.path[0]]);
|
|
11375
|
-
const { undos } = editor.history;
|
|
11376
|
-
const lastBatch = undos[undos.length - 1];
|
|
11377
|
-
const lastOp = lastBatch && lastBatch[lastBatch.length - 1];
|
|
11378
|
-
if (lastOp &&
|
|
11379
|
-
block.children.length === 1 &&
|
|
11380
|
-
block.type === ElementKinds.paragraph &&
|
|
11381
|
-
Node.string(block) === QUICK_TOOLBAR_HOTKEY &&
|
|
11382
|
-
opTypes.includes(lastOp.type) &&
|
|
11383
|
-
(lastOp.text === QUICK_TOOLBAR_HOTKEY || lastOp.text === undefined)) {
|
|
11384
|
-
return true;
|
|
11385
|
-
}
|
|
11386
|
-
return false;
|
|
11431
|
+
isOpenedToolbar(editor) {
|
|
11432
|
+
const quickToolbarRef = THE_EDITOR_QUICK_TOOLBAR_REF.get(editor);
|
|
11433
|
+
return !!quickToolbarRef;
|
|
11387
11434
|
}
|
|
11388
11435
|
};
|
|
11389
11436
|
|
|
11390
11437
|
const withQuickInsert = (editor) => {
|
|
11391
11438
|
const { onKeydown, deleteBackward, onChange } = editor;
|
|
11439
|
+
let presseingQuickInsertHotkey = false;
|
|
11392
11440
|
editor.onKeydown = (event) => {
|
|
11393
|
-
|
|
11394
|
-
|
|
11395
|
-
const
|
|
11396
|
-
const
|
|
11397
|
-
|
|
11398
|
-
|
|
11399
|
-
|
|
11441
|
+
var _a;
|
|
11442
|
+
if (event.key === QUICK_TOOLBAR_HOTKEY) {
|
|
11443
|
+
const types = [...(((_a = editor.options) === null || _a === void 0 ? void 0 : _a.allowContainerOperateTypes) || [])];
|
|
11444
|
+
const [block] = getBlockAbove(editor);
|
|
11445
|
+
if (isPureEmptyParagraph(editor, block) && allowOpenQuickToolbar(editor, types)) {
|
|
11446
|
+
presseingQuickInsertHotkey = true;
|
|
11447
|
+
}
|
|
11448
|
+
}
|
|
11449
|
+
const quickToolbarRef = THE_EDITOR_QUICK_TOOLBAR_REF.get(editor);
|
|
11450
|
+
const isMoveUp = hotkeys.isMoveUp(event);
|
|
11451
|
+
const isMoveDown = hotkeys.isMoveDown(event);
|
|
11452
|
+
if (quickToolbarRef && (isMoveUp || isMoveDown)) {
|
|
11453
|
+
return;
|
|
11400
11454
|
}
|
|
11401
11455
|
onKeydown(event);
|
|
11402
11456
|
};
|
|
11403
11457
|
editor.deleteBackward = unit => {
|
|
11404
|
-
if (
|
|
11405
|
-
QuickInsertEditor.
|
|
11458
|
+
if (QuickInsertEditor.isOpenedToolbar(editor)) {
|
|
11459
|
+
QuickInsertEditor.closeQuickInsertToolbar(editor);
|
|
11406
11460
|
}
|
|
11407
11461
|
deleteBackward(unit);
|
|
11408
11462
|
};
|
|
@@ -11410,16 +11464,35 @@ const withQuickInsert = (editor) => {
|
|
|
11410
11464
|
var _a;
|
|
11411
11465
|
onChange();
|
|
11412
11466
|
if (editor.selection) {
|
|
11467
|
+
const [block, path] = getBlockAbove(editor);
|
|
11468
|
+
// quick insert plus
|
|
11413
11469
|
const editorComponent = editor.injector.get(TheEditorComponent);
|
|
11414
11470
|
(_a = editorComponent.quickInsertInstance) === null || _a === void 0 ? void 0 : _a.checkStatus();
|
|
11415
|
-
|
|
11416
|
-
|
|
11417
|
-
|
|
11471
|
+
if (presseingQuickInsertHotkey && Node.string(block) === QUICK_TOOLBAR_HOTKEY) {
|
|
11472
|
+
QuickInsertEditor.openQuickInsertToolbar(editor, editorComponent.quickToolbarItems);
|
|
11473
|
+
presseingQuickInsertHotkey = false;
|
|
11474
|
+
return;
|
|
11475
|
+
}
|
|
11476
|
+
else {
|
|
11477
|
+
presseingQuickInsertHotkey = false;
|
|
11478
|
+
}
|
|
11479
|
+
if (QuickInsertEditor.isOpenedToolbar(editor) &&
|
|
11480
|
+
!isPureEmptyParagraph(editor, block) &&
|
|
11481
|
+
Node.string(block) !== QUICK_TOOLBAR_HOTKEY) {
|
|
11482
|
+
QuickInsertEditor.closeQuickInsertToolbar(editor);
|
|
11418
11483
|
}
|
|
11419
11484
|
}
|
|
11420
11485
|
};
|
|
11421
11486
|
return editor;
|
|
11422
11487
|
};
|
|
11488
|
+
const allowOpenQuickToolbar = (editor, allowTypes) => {
|
|
11489
|
+
const [block, path] = getBlockAbove(editor);
|
|
11490
|
+
const parentNode = Node.parent(editor, path);
|
|
11491
|
+
if (path.length === 1 || (parentNode && allowTypes.includes(parentNode.type))) {
|
|
11492
|
+
return true;
|
|
11493
|
+
}
|
|
11494
|
+
return false;
|
|
11495
|
+
};
|
|
11423
11496
|
|
|
11424
11497
|
const withSoftBreak = (options = { rules: [{ hotkey: 'shift+enter' }] }) => (editor) => {
|
|
11425
11498
|
const { onKeydown } = editor;
|
|
@@ -11709,6 +11782,78 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
11709
11782
|
args: ['class.disabled']
|
|
11710
11783
|
}] } });
|
|
11711
11784
|
|
|
11785
|
+
const onKeydownTextIndent = (editor, event, kinds, textIndentDisabled) => {
|
|
11786
|
+
const { selection } = editor;
|
|
11787
|
+
const isExpanded = Range.isExpanded(selection);
|
|
11788
|
+
const nodes = Array.from(Editor.nodes(editor, {
|
|
11789
|
+
mode: 'highest',
|
|
11790
|
+
match: node => Element$1.isElement(node) && kinds.includes(node.type)
|
|
11791
|
+
}));
|
|
11792
|
+
const [startBlock] = nodes;
|
|
11793
|
+
if (!startBlock) {
|
|
11794
|
+
return false;
|
|
11795
|
+
}
|
|
11796
|
+
const [block, path] = startBlock;
|
|
11797
|
+
const isStart = Editor.isStart(editor, selection.anchor, path);
|
|
11798
|
+
if (isKeyHotkey('Tab', event)) {
|
|
11799
|
+
event.preventDefault();
|
|
11800
|
+
if (startBlock && (isExpanded || isStart)) {
|
|
11801
|
+
if (!editor.isVoid(block)) {
|
|
11802
|
+
let { textIndent, type } = block;
|
|
11803
|
+
// do not apply first-line indentation for lists
|
|
11804
|
+
if (!textIndent && !textIndentDisabled.includes(type)) {
|
|
11805
|
+
IndentEditor.setTextIndent(editor, kinds, 2);
|
|
11806
|
+
return true;
|
|
11807
|
+
}
|
|
11808
|
+
else {
|
|
11809
|
+
IndentEditor.setIndent(editor);
|
|
11810
|
+
return true;
|
|
11811
|
+
}
|
|
11812
|
+
}
|
|
11813
|
+
}
|
|
11814
|
+
else {
|
|
11815
|
+
editor.insertText(TAB_SPACE);
|
|
11816
|
+
return true;
|
|
11817
|
+
}
|
|
11818
|
+
}
|
|
11819
|
+
if (isKeyHotkey('shift+Tab', event)) {
|
|
11820
|
+
if (startBlock && (isExpanded || isStart)) {
|
|
11821
|
+
if (!editor.isVoid(block)) {
|
|
11822
|
+
return IndentEditor.cancelTextIntent(editor, event, block, kinds);
|
|
11823
|
+
}
|
|
11824
|
+
}
|
|
11825
|
+
}
|
|
11826
|
+
if (selection && Range.isCollapsed(selection) && hotkeys.isDeleteBackward(event)) {
|
|
11827
|
+
if (startBlock && isStart) {
|
|
11828
|
+
return IndentEditor.cancelTextIntent(editor, event, block, kinds);
|
|
11829
|
+
}
|
|
11830
|
+
}
|
|
11831
|
+
return false;
|
|
11832
|
+
};
|
|
11833
|
+
|
|
11834
|
+
const withIndent = (kinds) => (editor) => {
|
|
11835
|
+
const { onKeydown } = editor;
|
|
11836
|
+
editor.onKeydown = (event) => {
|
|
11837
|
+
var _a, _b, _c, _d;
|
|
11838
|
+
let indentTypes = kinds;
|
|
11839
|
+
let disableIndentTypes = [ElementKinds.bulletedList, ElementKinds.numberedList, ElementKinds.checkItem];
|
|
11840
|
+
if ((_b = (_a = editor.extraIndentOptions) === null || _a === void 0 ? void 0 : _a.indentTypes) === null || _b === void 0 ? void 0 : _b.length) {
|
|
11841
|
+
indentTypes = mergIndentTypes(kinds, editor.extraIndentOptions.indentTypes);
|
|
11842
|
+
}
|
|
11843
|
+
if ((_d = (_c = editor.extraIndentOptions) === null || _c === void 0 ? void 0 : _c.disabledIndentTypes) === null || _d === void 0 ? void 0 : _d.length) {
|
|
11844
|
+
disableIndentTypes = mergIndentTypes(disableIndentTypes, editor.extraIndentOptions.disabledIndentTypes);
|
|
11845
|
+
}
|
|
11846
|
+
const isContinue = !onKeydownTextIndent(editor, event, indentTypes, disableIndentTypes);
|
|
11847
|
+
if (isContinue) {
|
|
11848
|
+
onKeydown(event);
|
|
11849
|
+
}
|
|
11850
|
+
};
|
|
11851
|
+
return editor;
|
|
11852
|
+
};
|
|
11853
|
+
const mergIndentTypes = (defaultTypes, indentTypes) => {
|
|
11854
|
+
return Array.from(new Set([...defaultTypes, ...indentTypes]));
|
|
11855
|
+
};
|
|
11856
|
+
|
|
11712
11857
|
const MaxIndent = 11;
|
|
11713
11858
|
const includesIndentTypes = [
|
|
11714
11859
|
ElementKinds.checkItem,
|
|
@@ -11717,11 +11862,15 @@ const includesIndentTypes = [
|
|
|
11717
11862
|
ElementKinds.paragraph,
|
|
11718
11863
|
...HEADING_TYPES
|
|
11719
11864
|
];
|
|
11865
|
+
const getIndentTypes = editor => {
|
|
11866
|
+
let indentTypes = editor.extraIndentOptions ? editor.extraIndentOptions.indentTypes : [];
|
|
11867
|
+
return mergIndentTypes(includesIndentTypes, indentTypes);
|
|
11868
|
+
};
|
|
11720
11869
|
const IndentEditor = {
|
|
11721
11870
|
setIndent(editor) {
|
|
11722
11871
|
const nodes = Array.from(Editor.nodes(editor, {
|
|
11723
11872
|
mode: 'highest',
|
|
11724
|
-
match: n => Element$1.isElement(n) &&
|
|
11873
|
+
match: n => Element$1.isElement(n) && getIndentTypes(editor).includes(n.type)
|
|
11725
11874
|
}));
|
|
11726
11875
|
const [startBlock] = nodes;
|
|
11727
11876
|
if (startBlock) {
|
|
@@ -11731,7 +11880,7 @@ const IndentEditor = {
|
|
|
11731
11880
|
if (indent <= MaxIndent) {
|
|
11732
11881
|
Transforms.setNodes(editor, { indent }, {
|
|
11733
11882
|
mode: 'highest',
|
|
11734
|
-
match: n => Element$1.isElement(n) &&
|
|
11883
|
+
match: n => Element$1.isElement(n) && getIndentTypes(editor).includes(n.type)
|
|
11735
11884
|
});
|
|
11736
11885
|
}
|
|
11737
11886
|
}
|
|
@@ -11739,7 +11888,7 @@ const IndentEditor = {
|
|
|
11739
11888
|
cancelIndent(editor) {
|
|
11740
11889
|
const nodes = Array.from(Editor.nodes(editor, {
|
|
11741
11890
|
mode: 'highest',
|
|
11742
|
-
match: n => Element$1.isElement(n) &&
|
|
11891
|
+
match: n => Element$1.isElement(n) && getIndentTypes(editor).includes(n.type)
|
|
11743
11892
|
}));
|
|
11744
11893
|
const [startBlock] = nodes;
|
|
11745
11894
|
if (startBlock) {
|
|
@@ -11747,7 +11896,7 @@ const IndentEditor = {
|
|
|
11747
11896
|
indent = indent === 1 ? null : (indent -= 1);
|
|
11748
11897
|
Transforms.setNodes(editor, { indent }, {
|
|
11749
11898
|
mode: 'highest',
|
|
11750
|
-
match: n => Element$1.isElement(n) &&
|
|
11899
|
+
match: n => Element$1.isElement(n) && getIndentTypes(editor).includes(n.type)
|
|
11751
11900
|
});
|
|
11752
11901
|
}
|
|
11753
11902
|
},
|
|
@@ -11779,15 +11928,8 @@ const IndentEditor = {
|
|
|
11779
11928
|
},
|
|
11780
11929
|
isDisabled(editor) {
|
|
11781
11930
|
if (editor.selection) {
|
|
11782
|
-
const allowGroup = [
|
|
11783
|
-
ElementKinds.paragraph,
|
|
11784
|
-
ElementKinds.numberedList,
|
|
11785
|
-
ElementKinds.bulletedList,
|
|
11786
|
-
ElementKinds.checkItem,
|
|
11787
|
-
...HEADING_TYPES
|
|
11788
|
-
];
|
|
11789
11931
|
const anchorBlock$1 = anchorBlock(editor);
|
|
11790
|
-
return anchorBlock$1 && !
|
|
11932
|
+
return anchorBlock$1 && !getIndentTypes(editor).includes(anchorBlock$1 === null || anchorBlock$1 === void 0 ? void 0 : anchorBlock$1.type);
|
|
11791
11933
|
}
|
|
11792
11934
|
return false;
|
|
11793
11935
|
}
|
|
@@ -11817,67 +11959,6 @@ const IndentOptions = [
|
|
|
11817
11959
|
}
|
|
11818
11960
|
];
|
|
11819
11961
|
|
|
11820
|
-
const onKeydownTextIndent = (editor, event, kinds) => {
|
|
11821
|
-
const { selection } = editor;
|
|
11822
|
-
const isExpanded = Range.isExpanded(selection);
|
|
11823
|
-
const nodes = Array.from(Editor.nodes(editor, {
|
|
11824
|
-
mode: 'highest',
|
|
11825
|
-
match: node => Element$1.isElement(node) && kinds.includes(node.type)
|
|
11826
|
-
}));
|
|
11827
|
-
const [startBlock] = nodes;
|
|
11828
|
-
if (!startBlock) {
|
|
11829
|
-
return false;
|
|
11830
|
-
}
|
|
11831
|
-
const [block, path] = startBlock;
|
|
11832
|
-
const isStart = Editor.isStart(editor, selection.anchor, path);
|
|
11833
|
-
const textIndentDisable = [ElementKinds.bulletedList, ElementKinds.numberedList, ElementKinds.checkItem];
|
|
11834
|
-
if (isKeyHotkey('Tab', event)) {
|
|
11835
|
-
event.preventDefault();
|
|
11836
|
-
if (startBlock && (isExpanded || isStart)) {
|
|
11837
|
-
if (!editor.isVoid(block)) {
|
|
11838
|
-
let { textIndent, type } = block;
|
|
11839
|
-
// do not apply first-line indentation for lists
|
|
11840
|
-
if (!textIndent && !textIndentDisable.includes(type)) {
|
|
11841
|
-
IndentEditor.setTextIndent(editor, kinds, 2);
|
|
11842
|
-
return true;
|
|
11843
|
-
}
|
|
11844
|
-
else {
|
|
11845
|
-
IndentEditor.setIndent(editor);
|
|
11846
|
-
return true;
|
|
11847
|
-
}
|
|
11848
|
-
}
|
|
11849
|
-
}
|
|
11850
|
-
else {
|
|
11851
|
-
editor.insertText(TAB_SPACE);
|
|
11852
|
-
return true;
|
|
11853
|
-
}
|
|
11854
|
-
}
|
|
11855
|
-
if (isKeyHotkey('shift+Tab', event)) {
|
|
11856
|
-
if (startBlock && (isExpanded || isStart)) {
|
|
11857
|
-
if (!editor.isVoid(block)) {
|
|
11858
|
-
return IndentEditor.cancelTextIntent(editor, event, block, kinds);
|
|
11859
|
-
}
|
|
11860
|
-
}
|
|
11861
|
-
}
|
|
11862
|
-
if (selection && Range.isCollapsed(selection) && hotkeys.isDeleteBackward(event)) {
|
|
11863
|
-
if (startBlock && isStart) {
|
|
11864
|
-
return IndentEditor.cancelTextIntent(editor, event, block, kinds);
|
|
11865
|
-
}
|
|
11866
|
-
}
|
|
11867
|
-
return false;
|
|
11868
|
-
};
|
|
11869
|
-
|
|
11870
|
-
const withIndent = (kinds) => (editor) => {
|
|
11871
|
-
const { onKeydown } = editor;
|
|
11872
|
-
editor.onKeydown = (event) => {
|
|
11873
|
-
const isContinue = !onKeydownTextIndent(editor, event, kinds);
|
|
11874
|
-
if (isContinue) {
|
|
11875
|
-
onKeydown(event);
|
|
11876
|
-
}
|
|
11877
|
-
};
|
|
11878
|
-
return editor;
|
|
11879
|
-
};
|
|
11880
|
-
|
|
11881
11962
|
const internalPlugins = [
|
|
11882
11963
|
withTheHistory,
|
|
11883
11964
|
withAutoInsertData(),
|
|
@@ -12500,7 +12581,11 @@ class TheQuickInsertComponent {
|
|
|
12500
12581
|
handleClick(event) {
|
|
12501
12582
|
event.stopPropagation();
|
|
12502
12583
|
event.preventDefault();
|
|
12503
|
-
QuickInsertEditor.
|
|
12584
|
+
if (QuickInsertEditor.isOpenedToolbar(this.editor)) {
|
|
12585
|
+
QuickInsertEditor.closeQuickInsertToolbar(this.editor);
|
|
12586
|
+
return;
|
|
12587
|
+
}
|
|
12588
|
+
QuickInsertEditor.openQuickInsertToolbar(this.editor, this.quickToolbarItems, this.iconElement.nativeElement);
|
|
12504
12589
|
}
|
|
12505
12590
|
}
|
|
12506
12591
|
TheQuickInsertComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheQuickInsertComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -12773,12 +12858,14 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
|
|
|
12773
12858
|
super.ngOnDestroy();
|
|
12774
12859
|
}
|
|
12775
12860
|
initialize() {
|
|
12776
|
-
var _a, _b, _c;
|
|
12861
|
+
var _a, _b, _c, _d;
|
|
12777
12862
|
this.editor = withTheEditor(this.thePlugins, withHistory(withAngular(createEditor(), CLIPBOARD_FORMAT_KEY)));
|
|
12778
12863
|
this.generateDecorate();
|
|
12779
12864
|
this.editor.disabled = (_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.disabled;
|
|
12780
12865
|
this.editor.extraElementOptions = (_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.extraElementOptions;
|
|
12781
12866
|
this.editor.extraAutoFormatRules = (_c = this.theOptions) === null || _c === void 0 ? void 0 : _c.extraAutoFormatRules;
|
|
12867
|
+
this.editor.extraIndentOptions = (_d = this.theOptions) === null || _d === void 0 ? void 0 : _d.extraIndentOptions;
|
|
12868
|
+
this.editor.options = this.theOptions;
|
|
12782
12869
|
setEditorUUID(this.editor, idCreator());
|
|
12783
12870
|
this.theContextService.initialize({
|
|
12784
12871
|
theOptions: this.theOptions,
|
|
@@ -13323,5 +13410,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
13323
13410
|
* Generated bundle index. Do not edit.
|
|
13324
13411
|
*/
|
|
13325
13412
|
|
|
13326
|
-
export { ALIGN_BLOCK_TYPES, A_TAG_REL_ATTR, AlignEditor, Alignment, BLOCK_DELETEBACKWARD_TYPES, BlockquoteEditor, CLIPBOARD_FORMAT_KEY, CODEMIRROR_PADDING_TOP, CODE_MODES, COMPONENTS, CONTAINER_BLOCKS, CONTROL_KEY, CodeEditor, CodeMode, ColorEditor, DEFAULT_LANGUAGE, DEFAULT_SCROLL_CONTAINER, DefaultElementOptions, DefaultGlobalToolbarDefinition, DefaultInlineToolbarDefinition, DefaultQuickToolbarDefinition, DropdownMode, ELEMENT_UNIQUE_ID, ElementKinds, ErrorCodes, FontSizeTypes, FontSizes, HEADING_TYPES, HeadingEditor, HrEditor, IS_MAC, ImageEditor, Indents, LINK_DEFAULT_TEXT, LIST_BLOCK_TYPES, LayoutTypes, LinkEditor, ListEditor, MarkEditor, MarkProps, MarkTypes, PICTURE_ACCEPTED_UPLOAD_MIME, PICTURE_ACCEPTED_UPLOAD_SIZE, PLUGIN_COMPONENTS, QUICK_TOOLBAR_HOTKEY, QuickInsertEditor, STANDARD_HEADING_TYPES, TAB_SPACE, THE_CODE_MODE_PROVIDER, THE_CODE_MODE_TOKEN, THE_EDITOR_CONVERSION_HINT_REF, THE_EDITOR_QUICK_TOOLBAR_REF, THE_EDITOR_UUID, THE_INLINE_TOOLBAR_TYPES, THE_UPLOAD_SERVICE_TOKEN, TableEditor, TheBaseElementComponent, TheCodeConfig, TheContextService, TheDataMode, TheDefaultElementComponent, TheEditor, TheEditorComponent, TheEditorModule, TheImageComponent, TheMode, index$1 as TheQueries, TheToolbarBaseItemComponent, TheToolbarComponent, TheToolbarDropdownComponent, TheToolbarGroupComponent, TheToolbarGroupToken, TheToolbarItemComponent, TheToolbarService, index as TheTransforms, TodoItemEditor, ToolbarActionTypes, ToolbarAlignment, ToolbarItemMode, ToolbarItemType, ToolbarMoreGroup, VOID_BLOCK_TYPES, VerticalAlignEditor, VerticalAlignment, ZERO_WIDTH_CHAR, coercePixelsFromCssValue, createEmptyParagraph, dataDeserialize, dataSerializing, getColsTotalWidth, getElementClassByPrefix, getElementHeight, getElementWidth, getRowsTotalHeight, getToolbarClass, htmlToTheia, inValidTypes, isCleanEmptyParagraph, mergeElementOptions, plainToTheia, toolbarCompose, useElementStyle, withTheEditor };
|
|
13413
|
+
export { ALIGN_BLOCK_TYPES, A_TAG_REL_ATTR, AlignEditor, Alignment, BLOCK_DELETEBACKWARD_TYPES, BlockquoteEditor, CLIPBOARD_FORMAT_KEY, CODEMIRROR_PADDING_TOP, CODE_MODES, COMPONENTS, CONTAINER_BLOCKS, CONTROL_KEY, CodeEditor, CodeMode, ColorEditor, DEFAULT_LANGUAGE, DEFAULT_SCROLL_CONTAINER, DefaultElementOptions, DefaultGlobalToolbarDefinition, DefaultInlineToolbarDefinition, DefaultQuickToolbarDefinition, DropdownMode, ELEMENT_UNIQUE_ID, ElementKinds, ErrorCodes, FontSizeTypes, FontSizes, HEADING_TYPES, HeadingEditor, HrEditor, IS_MAC, ImageEditor, Indents, LINK_DEFAULT_TEXT, LIST_BLOCK_TYPES, LayoutTypes, LinkEditor, ListEditor, MarkEditor, MarkProps, MarkTypes, PICTURE_ACCEPTED_UPLOAD_MIME, PICTURE_ACCEPTED_UPLOAD_SIZE, PLUGIN_COMPONENTS, QUICK_TOOLBAR_HOTKEY, QuickInsertEditor, STANDARD_HEADING_TYPES, TAB_SPACE, THE_CODE_MODE_PROVIDER, THE_CODE_MODE_TOKEN, THE_EDITOR_CONVERSION_HINT_REF, THE_EDITOR_QUICK_TOOLBAR_REF, THE_EDITOR_UUID, THE_INLINE_TOOLBAR_TYPES, THE_UPLOAD_SERVICE_TOKEN, TableEditor, TheBaseElementComponent, TheCodeConfig, TheContextService, TheDataMode, TheDefaultElementComponent, TheEditor, TheEditorComponent, TheEditorModule, TheImageComponent, TheMode, index$1 as TheQueries, TheToolbarBaseItemComponent, TheToolbarComponent, TheToolbarDropdownComponent, TheToolbarGroupComponent, TheToolbarGroupToken, TheToolbarItemComponent, TheToolbarService, index as TheTransforms, TodoItemEditor, ToolbarActionTypes, ToolbarAlignment, ToolbarItemMode, ToolbarItemType, ToolbarMoreGroup, VOID_BLOCK_TYPES, VerticalAlignEditor, VerticalAlignment, ZERO_WIDTH_CHAR, coercePixelsFromCssValue, createEmptyParagraph, dataDeserialize, dataSerializing, getColsTotalWidth, getElementClassByPrefix, getElementHeight, getElementWidth, getRowsTotalHeight, getToolbarClass, htmlToTheia, inValidTypes, isCleanEmptyParagraph, isPureEmptyParagraph, mergeElementOptions, plainToTheia, toolbarCompose, useElementStyle, withTheEditor };
|
|
13327
13414
|
//# sourceMappingURL=worktile-theia.js.map
|