@worktile/theia 2.4.3 → 2.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/bundles/worktile-theia.umd.js +111 -64
  2. package/bundles/worktile-theia.umd.js.map +1 -1
  3. package/editor.module.d.ts +2 -1
  4. package/esm2015/editor.component.js +2 -1
  5. package/esm2015/interfaces/editor.js +1 -1
  6. package/esm2015/plugins/index.js +1 -1
  7. package/esm2015/plugins/quick-insert/quick-insert.editor.js +4 -3
  8. package/esm2015/plugins/quick-insert/quick-insert.plugin.js +33 -6
  9. package/esm2015/plugins/table/components/insert-mark/insert-mark.component.js +4 -4
  10. package/esm2015/plugins/table/components/table.component.js +2 -2
  11. package/esm2015/plugins/table/components/td/td.component.js +5 -7
  12. package/esm2015/plugins/table/table.service.js +6 -6
  13. package/esm2015/plugins/todo-item/todo-item.component.js +18 -9
  14. package/esm2015/queries/get-directly-parent.js +12 -0
  15. package/esm2015/queries/index.js +4 -2
  16. package/esm2015/queries/is-types-in-parent.js +16 -0
  17. package/esm2015/transforms/index.js +2 -3
  18. package/esm2015/transforms/insert-element-next.js +24 -3
  19. package/esm2015/utils/is-clean-empty-paragraph.js +4 -1
  20. package/fesm2015/worktile-theia.js +111 -65
  21. package/fesm2015/worktile-theia.js.map +1 -1
  22. package/interfaces/editor.d.ts +4 -1
  23. package/package.json +1 -1
  24. package/plugins/quick-insert/quick-insert.plugin.d.ts +2 -0
  25. package/plugins/table/components/table.component.scss +43 -42
  26. package/plugins/todo-item/todo-item.component.d.ts +3 -1
  27. package/plugins/todo-item/todo-item.component.scss +1 -1
  28. package/queries/get-directly-parent.d.ts +2 -0
  29. package/queries/index.d.ts +3 -1
  30. package/queries/is-types-in-parent.d.ts +2 -0
  31. package/styles/editor.scss +3 -3
  32. package/transforms/index.d.ts +1 -2
  33. package/utils/is-clean-empty-paragraph.d.ts +2 -1
  34. package/esm2015/transforms/insert-element-node.js +0 -36
  35. package/transforms/insert-element-node.d.ts +0 -2
@@ -1716,6 +1716,30 @@
1716
1716
  return !containerNode ? CONTAINER_BLOCKS : __spreadArray(__spreadArray([], __read(CONTAINER_BLOCKS)), [containerNode[0].type]);
1717
1717
  };
1718
1718
 
1719
+ var getDirectlyParent = function (editor) {
1720
+ var _a = __read(getBlockAbove(editor), 2), anchorPath = _a[1];
1721
+ if (!anchorPath)
1722
+ return;
1723
+ var parentEntry = getParent(editor, anchorPath);
1724
+ if (!parentEntry)
1725
+ return;
1726
+ return parentEntry;
1727
+ };
1728
+
1729
+ var isTypesInParent = function (editor, types) {
1730
+ if (!Array.isArray(types)) {
1731
+ types = [types];
1732
+ }
1733
+ var _a = __read(getBlockAbove(editor), 2), anchorPath = _a[1];
1734
+ if (!anchorPath)
1735
+ return false;
1736
+ var parentEntry = slate.Editor.above(editor, { match: function (n) { return types.includes(n.type); } });
1737
+ if (!parentEntry)
1738
+ return false;
1739
+ var _b = __read(parentEntry, 1), parentNode = _b[0];
1740
+ return types.includes(parentNode.type);
1741
+ };
1742
+
1719
1743
  var index$1 = /*#__PURE__*/Object.freeze({
1720
1744
  __proto__: null,
1721
1745
  getLastNode: getLastNode,
@@ -1743,6 +1767,7 @@
1743
1767
  getPlainText: getPlainText,
1744
1768
  getSelectionMarks: getSelectionMarks,
1745
1769
  getContainerBlocks: getContainerBlocks,
1770
+ getDirectlyParent: getDirectlyParent,
1746
1771
  isAncestor: isAncestor,
1747
1772
  isCollapsed: isCollapsed,
1748
1773
  isEmptyParagraph: isEmptyParagraph,
@@ -1765,6 +1790,7 @@
1765
1790
  isEmptyContent: isEmptyContent,
1766
1791
  isEmptyParagraphByPath: isEmptyParagraphByPath,
1767
1792
  isContainer: isContainer,
1793
+ isTypesInParent: isTypesInParent,
1768
1794
  anchorBlock: anchorBlock,
1769
1795
  anchorBlockEntry: anchorBlockEntry,
1770
1796
  anchorInlineEntry: anchorInlineEntry,
@@ -1776,11 +1802,32 @@
1776
1802
  });
1777
1803
 
1778
1804
  var insertElementNext = function (editor, node) {
1805
+ var _a;
1779
1806
  if (slate.Range.isExpanded(editor.selection)) {
1780
1807
  slate.Editor.deleteFragment(editor);
1781
1808
  }
1782
- var anchorBlockPath = anchorBlockEntry(editor)[1];
1783
- var isEmpty = isEmptyParagraph(editor);
1809
+ var allowContainerOperateTypes = ((_a = editor.options) === null || _a === void 0 ? void 0 : _a.allowContainerOperateTypes) || [];
1810
+ var isAllowContainerInsert = isTypesInParent(editor, allowContainerOperateTypes);
1811
+ var isBlockCardCursor$1 = isBlockCardCursor(editor);
1812
+ var containerBlocks = getContainerBlocks(editor);
1813
+ var isContainer = isNodeTypeIn(editor, containerBlocks, { at: editor.selection });
1814
+ var _b = __read(anchorBlockEntry(editor), 2), anchorBlock = _b[0], anchorBlockPath = _b[1];
1815
+ var isEmpty = slate.Editor.isEmpty(editor, anchorBlock);
1816
+ if (isAllowContainerInsert && isContainer && !isBlockCardCursor$1) {
1817
+ var _c = __read(slate.Editor.above(editor, {
1818
+ match: function (n) { return slate.Editor.isBlock(editor, n) && allowContainerOperateTypes.includes(n.type); },
1819
+ at: editor.selection
1820
+ }), 2), containerPath_1 = _c[1];
1821
+ slate.Editor.withoutNormalizing(editor, function () {
1822
+ var containerPathFirstPath = anchorBlockPath.slice(0, containerPath_1.length + 1);
1823
+ slate.Transforms.insertNodes(editor, node, { at: slate.Path.next(containerPathFirstPath) });
1824
+ slate.Transforms.select(editor, slate.Editor.start(editor, slate.Path.next(containerPathFirstPath)));
1825
+ if (isEmpty) {
1826
+ slate.Transforms.removeNodes(editor, { at: anchorBlockPath });
1827
+ }
1828
+ });
1829
+ return;
1830
+ }
1784
1831
  var nextPath = slate.Path.next([anchorBlockPath[0]]);
1785
1832
  slate.Transforms.insertNodes(editor, node, { at: nextPath });
1786
1833
  if (isEmpty && anchorBlockPath.length === 1) {
@@ -1995,40 +2042,6 @@
1995
2042
  return false;
1996
2043
  }
1997
2044
 
1998
- var insertElementNode = function (editor, node) {
1999
- if (slate.Range.isExpanded(editor.selection)) {
2000
- slate.Editor.deleteFragment(editor);
2001
- }
2002
- var isBlockCardCursor$1 = isBlockCardCursor(editor);
2003
- var containerBlocks = getContainerBlocks(editor);
2004
- var isContainer = isNodeTypeIn(editor, containerBlocks, { at: editor.selection });
2005
- var _a = __read(anchorBlockEntry(editor), 2), anchorBlock = _a[0], anchorBlockPath = _a[1];
2006
- var isEmpty = slate.Editor.isEmpty(editor, anchorBlock);
2007
- if (isContainer && !isBlockCardCursor$1) {
2008
- var _b = __read(slate.Editor.above(editor, {
2009
- match: function (n) { return slate.Editor.isBlock(editor, n) && containerBlocks.includes(n.type); },
2010
- at: editor.selection
2011
- }), 2), containerPath_1 = _b[1];
2012
- slate.Editor.withoutNormalizing(editor, function () {
2013
- var containerPathFirstPath = anchorBlockPath.slice(0, containerPath_1.length + 1);
2014
- slate.Transforms.insertNodes(editor, node, { at: slate.Path.next(containerPathFirstPath), select: true });
2015
- if (isEmpty) {
2016
- slate.Transforms.removeNodes(editor, { at: anchorBlockPath });
2017
- }
2018
- });
2019
- return;
2020
- }
2021
- var nextPath = slate.Path.next([anchorBlockPath[0]]);
2022
- slate.Transforms.insertNodes(editor, node, { at: nextPath });
2023
- if (isEmpty && anchorBlockPath.length === 1) {
2024
- slate.Transforms.delete(editor, { at: anchorBlockPath });
2025
- slate.Transforms.select(editor, slate.Editor.start(editor, anchorBlockPath));
2026
- }
2027
- else {
2028
- slate.Transforms.select(editor, slate.Editor.start(editor, nextPath));
2029
- }
2030
- };
2031
-
2032
2045
  var index = /*#__PURE__*/Object.freeze({
2033
2046
  __proto__: null,
2034
2047
  setMarks: setMarks,
@@ -2048,8 +2061,7 @@
2048
2061
  setEndSelection: setEndSelection,
2049
2062
  closeConversionHint: closeConversionHint,
2050
2063
  handleContinualDeleteBackward: handleContinualDeleteBackward,
2051
- handleContinualInsertBreak: handleContinualInsertBreak,
2052
- insertElementNode: insertElementNode
2064
+ handleContinualInsertBreak: handleContinualInsertBreak
2053
2065
  });
2054
2066
 
2055
2067
  var TheConversionHintComponent = /** @class */ (function () {
@@ -2180,6 +2192,9 @@
2180
2192
  return false;
2181
2193
  }
2182
2194
  var block = slate.Node.ancestor(editor, [editor.selection.anchor.path[0]]);
2195
+ return isPureEmptyParagraph(editor, block);
2196
+ };
2197
+ var isPureEmptyParagraph = function (editor, block) {
2183
2198
  var textIndent = 'textIndent';
2184
2199
  var align = 'align';
2185
2200
  var hasTextIndent = block[textIndent];
@@ -4079,10 +4094,12 @@
4079
4094
 
4080
4095
  var TheTodoItemComponent = /** @class */ (function (_super) {
4081
4096
  __extends(TheTodoItemComponent, _super);
4082
- function TheTodoItemComponent(elementRef, cdr) {
4097
+ function TheTodoItemComponent(elementRef, cdr, ctxService) {
4083
4098
  var _this = _super.call(this, elementRef, cdr) || this;
4084
4099
  _this.elementRef = elementRef;
4085
4100
  _this.cdr = cdr;
4101
+ _this.ctxService = ctxService;
4102
+ // 类名 the-temp-*: 临时解决因受portal影响样式问题,后期改回the-
4086
4103
  _this.checkItemClass = true;
4087
4104
  return _this;
4088
4105
  }
@@ -4098,24 +4115,29 @@
4098
4115
  _super.prototype.ngOnInit.call(this);
4099
4116
  };
4100
4117
  TheTodoItemComponent.prototype.onCheck = function (checked) {
4101
- if (this.readonly) {
4118
+ var options = this.ctxService.getTheOptions();
4119
+ var noBindReadonly = options.noBindReadonlyPlugins && options.noBindReadonlyPlugins.includes(exports.ElementKinds.checkItem);
4120
+ if (!noBindReadonly && this.readonly) {
4102
4121
  return false;
4103
4122
  }
4123
+ else {
4124
+ setNode(this.editor, { checked: checked }, this.element);
4125
+ }
4104
4126
  setNode(this.editor, { checked: checked }, this.element);
4105
4127
  };
4106
4128
  return TheTodoItemComponent;
4107
4129
  }(TheBaseElementComponent));
4108
- TheTodoItemComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheTodoItemComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
4109
- TheTodoItemComponent.ɵcmp = i0__namespace.ɵɵ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__namespace, template: "\n <span contenteditable=\"false\" class=\"todo-item-status\">\n <input #checkbox type=\"checkbox\" [checked]=\"element.checked\" (click)=\"onCheck(checkbox.checked)\" />\n </span>\n <span><slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children></span>\n ", isInline: true, components: [{ type: i1__namespace.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
4130
+ TheTodoItemComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheTodoItemComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }, { token: TheContextService }], target: i0__namespace.ɵɵFactoryTarget.Component });
4131
+ TheTodoItemComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheTodoItemComponent, selector: "div[theTodoItem]", host: { properties: { "class.the-temp-check-item": "this.checkItemClass", "attr.the-level": "this.level" } }, usesInheritance: true, ngImport: i0__namespace, template: "\n <span contenteditable=\"false\" class=\"todo-item-status\">\n <input #checkbox type=\"checkbox\" [checked]=\"element.checked\" (click)=\"onCheck(checkbox.checked)\" />\n </span>\n <span><slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children></span>\n ", isInline: true, components: [{ type: i1__namespace.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
4110
4132
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheTodoItemComponent, decorators: [{
4111
4133
  type: i0.Component,
4112
4134
  args: [{
4113
4135
  selector: 'div[theTodoItem]',
4114
4136
  template: "\n <span contenteditable=\"false\" class=\"todo-item-status\">\n <input #checkbox type=\"checkbox\" [checked]=\"element.checked\" (click)=\"onCheck(checkbox.checked)\" />\n </span>\n <span><slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children></span>\n "
4115
4137
  }]
4116
- }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { checkItemClass: [{
4138
+ }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }, { type: TheContextService }]; }, propDecorators: { checkItemClass: [{
4117
4139
  type: i0.HostBinding,
4118
- args: ['class.the-check-item']
4140
+ args: ['class.the-temp-check-item']
4119
4141
  }], level: [{
4120
4142
  type: i0.HostBinding,
4121
4143
  args: ['attr.the-level']
@@ -9436,7 +9458,7 @@
9436
9458
  offset: this.offset,
9437
9459
  hasBackdrop: this.hasBackdrop,
9438
9460
  insideClosable: this.insideClosable,
9439
- panelClass: 'the-table-toolbar-wrap',
9461
+ panelClass: 'the-temp-table-toolbar-wrap',
9440
9462
  scrollStrategy: this.overlay.scrollStrategies.reposition(),
9441
9463
  manualClosure: true
9442
9464
  });
@@ -9446,15 +9468,15 @@
9446
9468
  if (origin instanceof HTMLTableCellElement && origin.tagName !== 'TH') {
9447
9469
  var _a = this.tableStore, selectedRowsIndex = _a.selectedRowsIndex, selectedColumnsIndex = _a.selectedColumnsIndex, focusCellPath = _a.focusCellPath, isSelectedTable = _a.isSelectedTable, focusCellElement = _a.focusCellElement;
9448
9470
  var _b = __read(focusCellPath.slice(-2), 2), row = _b[0], col = _b[1];
9449
- var tableElement = focusCellElement.closest('.the-table-container');
9471
+ var tableElement = focusCellElement.closest('.the-temp-table-container');
9450
9472
  if (isSelectedTable && col === 0 && row === 0) {
9451
- return tableElement.querySelector('.the-table-corner-controls');
9473
+ return tableElement.querySelector('.the-temp-table-corner-controls');
9452
9474
  }
9453
9475
  if (selectedColumnsIndex.length > 0 && row === 0) {
9454
- return tableElement.querySelectorAll('.the-table-col-controls')[col];
9476
+ return tableElement.querySelectorAll('.the-temp-table-col-controls')[col];
9455
9477
  }
9456
9478
  if (selectedRowsIndex.length > 0 && col === 0) {
9457
- return tableElement.querySelectorAll('.the-table-row-controls-button-wrap')[row];
9479
+ return tableElement.querySelectorAll('.the-temp-table-row-controls-button-wrap')[row];
9458
9480
  }
9459
9481
  }
9460
9482
  return origin;
@@ -9566,13 +9588,13 @@
9566
9588
  var tableWrapper = tableComponent.tableWrapper.nativeElement;
9567
9589
  var tableElement = tableComponent.theTableElement.nativeElement;
9568
9590
  var result = 0;
9569
- var rowControl = tableComponent.nativeElement.querySelector('.the-table-row-controls');
9591
+ var rowControl = tableComponent.nativeElement.querySelector('.the-temp-table-row-controls');
9570
9592
  var rowControlWidth = 11;
9571
9593
  if (rowControl) {
9572
9594
  rowControlWidth = rowControl.getBoundingClientRect().width;
9573
9595
  }
9574
9596
  if (this.type === 'row') {
9575
- result = tableWrapper.offsetWidth + rowControlWidth;
9597
+ result = tableWrapper.offsetWidth + rowControlWidth - 2;
9576
9598
  }
9577
9599
  else {
9578
9600
  result = tableElement.offsetHeight - 1;
@@ -9584,7 +9606,7 @@
9584
9606
  return TheInsertMarkComponent;
9585
9607
  }());
9586
9608
  TheInsertMarkComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheInsertMarkComponent, deps: [{ token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
9587
- TheInsertMarkComponent.ɵcmp = i0__namespace.ɵɵ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__namespace, 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__namespace.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i10__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i10__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i10__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
9609
+ TheInsertMarkComponent.ɵcmp = i0__namespace.ɵɵ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__namespace, 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__namespace.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i10__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i10__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i10__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
9588
9610
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheInsertMarkComponent, decorators: [{
9589
9611
  type: i0.Component,
9590
9612
  args: [{
@@ -10098,7 +10120,7 @@
10098
10120
  provide: TheTableToken,
10099
10121
  useExisting: TheTableComponent
10100
10122
  }
10101
- ], 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-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__namespace.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }], directives: [{ type: TheColumnResizeDirective, selector: "div[theColumnResize]" }, { type: i10__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i10__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i10__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i10__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
10123
+ ], 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: "<!-- \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__namespace.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }], directives: [{ type: TheColumnResizeDirective, selector: "div[theColumnResize]" }, { type: i10__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i10__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i10__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i10__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
10102
10124
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheTableComponent, decorators: [{
10103
10125
  type: i0.Component,
10104
10126
  args: [{
@@ -11041,12 +11063,12 @@
11041
11063
  };
11042
11064
  TheTdComponent.prototype.updateOverlayHandleRowSize = function () {
11043
11065
  var tableElement = this.tableComponent.nativeElement;
11044
- var rowControl = tableElement.querySelector('.the-table-row-controls');
11066
+ var rowControl = tableElement.querySelector('.the-temp-table-row-controls');
11045
11067
  var rowControlWidth = 11;
11046
11068
  if (rowControl) {
11047
11069
  rowControlWidth = rowControl.getBoundingClientRect().width;
11048
11070
  }
11049
- var width = this.tableComponent.tableWrapper.nativeElement.offsetWidth + rowControlWidth;
11071
+ var width = this.tableComponent.tableWrapper.nativeElement.offsetWidth + rowControlWidth - 2;
11050
11072
  this.overlayRef.addPanelClass(this.rowResizeClass);
11051
11073
  this.overlayRef.updateSize({ width: width, height: OVERLAY_INIT_SIZE });
11052
11074
  };
@@ -11239,8 +11261,7 @@
11239
11261
  TheTdComponent.prototype.applyTopRows = function (rows, deltaY, rowIndex) {
11240
11262
  while (deltaY < 0 && rows[rowIndex]) {
11241
11263
  var rowOffsetHeight = getElementHeight(rows[rowIndex]);
11242
- var rowStyleHeight = coercePixelsFromCssValue(rows[rowIndex].style.height);
11243
- if (rowOffsetHeight > this.tableOptions.minHeightPx && rowOffsetHeight === rowStyleHeight) {
11264
+ if (rowOffsetHeight > this.tableOptions.minHeightPx) {
11244
11265
  if (this.resizingStore.isResizing(deltaY, this.isXAxisHover)) {
11245
11266
  this.resizingStore.storeResizingRow(rows[rowIndex]);
11246
11267
  }
@@ -11260,8 +11281,7 @@
11260
11281
  TheTdComponent.prototype.applyBottomRows = function (rows, deltaY, rowIndex) {
11261
11282
  while (rows[rowIndex] && deltaY > 0) {
11262
11283
  var rowOffsetHeight = getElementHeight(rows[rowIndex]);
11263
- var rowStyleHeight = coercePixelsFromCssValue(rows[rowIndex].style.height);
11264
- if (rowOffsetHeight > this.tableOptions.minHeightPx && rowOffsetHeight === rowStyleHeight) {
11284
+ if (rowOffsetHeight > this.tableOptions.minHeightPx) {
11265
11285
  if (this.resizingStore.isResizing(deltaY, this.isXAxisHover)) {
11266
11286
  this.resizingStore.storeResizingRow(rows[rowIndex]);
11267
11287
  }
@@ -12228,7 +12248,8 @@
12228
12248
  return;
12229
12249
  }
12230
12250
  if (!origin) {
12231
- var rootNode = i1.AngularEditor.toDOMNode(editor, slate.Node.ancestor(editor, [editor.selection.anchor.path[0]]));
12251
+ var _a = __read(getBlockAbove(editor), 1), block = _a[0];
12252
+ var rootNode = i1.AngularEditor.toDOMNode(editor, block);
12232
12253
  origin = rootNode.querySelector('[data-slate-leaf="true"]');
12233
12254
  }
12234
12255
  var overlay = editor.injector.get(i2.Overlay);
@@ -12270,8 +12291,19 @@
12270
12291
  var onKeydown = editor.onKeydown, deleteBackward = editor.deleteBackward, onChange = editor.onChange;
12271
12292
  var presseingQuickInsertHotkey = false;
12272
12293
  editor.onKeydown = function (event) {
12273
- if (event.key === QUICK_TOOLBAR_HOTKEY && isCleanEmptyParagraph(editor)) {
12274
- presseingQuickInsertHotkey = true;
12294
+ var _a;
12295
+ if (event.key === QUICK_TOOLBAR_HOTKEY) {
12296
+ var types = __spreadArray([], __read((((_a = editor.options) === null || _a === void 0 ? void 0 : _a.allowContainerOperateTypes) || [])));
12297
+ var _b = __read(getBlockAbove(editor), 1), block = _b[0];
12298
+ if (isPureEmptyParagraph(editor, block) && allowOpenQuickToolbar(editor, types)) {
12299
+ presseingQuickInsertHotkey = true;
12300
+ }
12301
+ }
12302
+ var quickToolbarRef = THE_EDITOR_QUICK_TOOLBAR_REF.get(editor);
12303
+ var isMoveUp = i1.hotkeys.isMoveUp(event);
12304
+ var isMoveDown = i1.hotkeys.isMoveDown(event);
12305
+ if (quickToolbarRef && (isMoveUp || isMoveDown)) {
12306
+ return;
12275
12307
  }
12276
12308
  onKeydown(event);
12277
12309
  };
@@ -12285,7 +12317,7 @@
12285
12317
  var _a;
12286
12318
  onChange();
12287
12319
  if (editor.selection) {
12288
- var block = slate.Node.get(editor, [editor.selection.anchor.path[0]]);
12320
+ var _b = __read(getBlockAbove(editor), 2), block = _b[0], path = _b[1];
12289
12321
  // quick insert plus
12290
12322
  var editorComponent = editor.injector.get(TheEditorComponent);
12291
12323
  (_a = editorComponent.quickInsertInstance) === null || _a === void 0 ? void 0 : _a.checkStatus();
@@ -12294,13 +12326,26 @@
12294
12326
  presseingQuickInsertHotkey = false;
12295
12327
  return;
12296
12328
  }
12297
- if (QuickInsertEditor.isOpenedToolbar(editor) && !isCleanEmptyParagraph(editor) && slate.Node.string(block) !== QUICK_TOOLBAR_HOTKEY) {
12329
+ else {
12330
+ presseingQuickInsertHotkey = false;
12331
+ }
12332
+ if (QuickInsertEditor.isOpenedToolbar(editor) &&
12333
+ !isPureEmptyParagraph(editor, block) &&
12334
+ slate.Node.string(block) !== QUICK_TOOLBAR_HOTKEY) {
12298
12335
  QuickInsertEditor.closeQuickInsertToolbar(editor);
12299
12336
  }
12300
12337
  }
12301
12338
  };
12302
12339
  return editor;
12303
12340
  };
12341
+ var allowOpenQuickToolbar = function (editor, allowTypes) {
12342
+ var _b = __read(getBlockAbove(editor), 2), block = _b[0], path = _b[1];
12343
+ var parentNode = slate.Node.parent(editor, path);
12344
+ if (path.length === 1 || (parentNode && allowTypes.includes(parentNode.type))) {
12345
+ return true;
12346
+ }
12347
+ return false;
12348
+ };
12304
12349
 
12305
12350
  var withSoftBreak = function (options) {
12306
12351
  if (options === void 0) { options = { rules: [{ hotkey: 'shift+enter' }] }; }
@@ -13762,6 +13807,7 @@
13762
13807
  this.editor.extraElementOptions = (_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.extraElementOptions;
13763
13808
  this.editor.extraAutoFormatRules = (_c = this.theOptions) === null || _c === void 0 ? void 0 : _c.extraAutoFormatRules;
13764
13809
  this.editor.extraIndentOptions = (_d = this.theOptions) === null || _d === void 0 ? void 0 : _d.extraIndentOptions;
13810
+ this.editor.options = this.theOptions;
13765
13811
  setEditorUUID(this.editor, idCreator());
13766
13812
  this.theContextService.initialize({
13767
13813
  theOptions: this.theOptions,
@@ -14414,6 +14460,7 @@
14414
14460
  exports.htmlToTheia = htmlToTheia;
14415
14461
  exports.inValidTypes = inValidTypes;
14416
14462
  exports.isCleanEmptyParagraph = isCleanEmptyParagraph;
14463
+ exports.isPureEmptyParagraph = isPureEmptyParagraph;
14417
14464
  exports.mergeElementOptions = mergeElementOptions;
14418
14465
  exports.plainToTheia = plainToTheia;
14419
14466
  exports.toolbarCompose = toolbarCompose;