@worktile/theia 14.2.30 → 14.2.32
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/esm2020/interfaces/view-base.mjs +2 -2
- package/esm2020/plugins/table/components/toolbar/table-toolbar.component.mjs +2 -2
- package/esm2020/plugins/table/table.plugin.mjs +11 -8
- package/esm2020/queries/index.mjs +3 -3
- package/esm2020/queries/is-empty-paragraph.mjs +9 -3
- package/esm2020/services/table-contextmenu.service.mjs +2 -2
- package/fesm2015/worktile-theia.mjs +22 -13
- package/fesm2015/worktile-theia.mjs.map +1 -1
- package/fesm2020/worktile-theia.mjs +22 -13
- package/fesm2020/worktile-theia.mjs.map +1 -1
- package/package.json +1 -1
- package/queries/index.d.ts +2 -2
- package/queries/is-empty-paragraph.d.ts +7 -1
|
@@ -76,7 +76,7 @@ const isGlobalCollapsed = (editor) => {
|
|
|
76
76
|
class TheBaseElementComponent extends BaseElementComponent {
|
|
77
77
|
onContextChange() {
|
|
78
78
|
super.onContextChange();
|
|
79
|
-
if (this.selection) {
|
|
79
|
+
if (this.selection && this.editor && this.editor.isVoid(this.element)) {
|
|
80
80
|
this.nativeElement.classList.add(`slate-selected-element`);
|
|
81
81
|
if (this.isCollapsed && isGlobalCollapsed(this.editor)) {
|
|
82
82
|
this.nativeElement.classList.add(`slate-focus-element`);
|
|
@@ -936,9 +936,15 @@ const isEmptyParagraphElement = (editor, element) => {
|
|
|
936
936
|
const isEmpty = isAncestorEmpty(editor, element);
|
|
937
937
|
return isParagraph && isEmpty;
|
|
938
938
|
};
|
|
939
|
-
|
|
939
|
+
/**
|
|
940
|
+
* 判断元素是否是空段落,仅仅包含空格或者\n算空段落
|
|
941
|
+
* @param editor
|
|
942
|
+
* @param element
|
|
943
|
+
* @returns
|
|
944
|
+
*/
|
|
945
|
+
const isLogicEmptyParagraphElement = (editor, element) => {
|
|
940
946
|
const text = Node.string(element).replace(/(\s|\n)*$/g, '');
|
|
941
|
-
return
|
|
947
|
+
return text.length === 0 && !element.children.some(n => Editor.isInline(editor, n));
|
|
942
948
|
};
|
|
943
949
|
|
|
944
950
|
const isParagraph = (editor) => {
|
|
@@ -2455,7 +2461,7 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
2455
2461
|
isCollapsed: isCollapsed,
|
|
2456
2462
|
isEmptyParagraph: isEmptyParagraph,
|
|
2457
2463
|
isEmptyParagraphElement: isEmptyParagraphElement,
|
|
2458
|
-
|
|
2464
|
+
isLogicEmptyParagraphElement: isLogicEmptyParagraphElement,
|
|
2459
2465
|
isParagraph: isParagraph,
|
|
2460
2466
|
isBlockActive: isBlockActive,
|
|
2461
2467
|
isIncludeTypes: isIncludeTypes,
|
|
@@ -11547,7 +11553,7 @@ class TheTableToolbarComponent {
|
|
|
11547
11553
|
this.tableStore.setSelectedCellsBackgroundColor(newColor);
|
|
11548
11554
|
}
|
|
11549
11555
|
this.selectedColor = newColor;
|
|
11550
|
-
});
|
|
11556
|
+
}, 'bottomLeft', 4);
|
|
11551
11557
|
});
|
|
11552
11558
|
}
|
|
11553
11559
|
setFullscreen(event) {
|
|
@@ -11687,7 +11693,7 @@ class TheTableContextMenuService {
|
|
|
11687
11693
|
},
|
|
11688
11694
|
deactiveHandle: (event) => {
|
|
11689
11695
|
if (event.relatedTarget instanceof HTMLElement) {
|
|
11690
|
-
if (event.relatedTarget.classList.contains('color-container')) {
|
|
11696
|
+
if (event.relatedTarget.classList.contains('color-select-container')) {
|
|
11691
11697
|
return;
|
|
11692
11698
|
}
|
|
11693
11699
|
}
|
|
@@ -14143,15 +14149,18 @@ const withTable = (editor) => {
|
|
|
14143
14149
|
onChange();
|
|
14144
14150
|
// adujst selection when selection is in hidden cell
|
|
14145
14151
|
// just hook set_selection
|
|
14146
|
-
|
|
14147
|
-
|
|
14148
|
-
|
|
14149
|
-
|
|
14150
|
-
|
|
14151
|
-
|
|
14152
|
-
|
|
14152
|
+
try {
|
|
14153
|
+
const isCollapsed = editor.selection && Range.isCollapsed(editor.selection);
|
|
14154
|
+
const isSelectionOperation = editor.operations.every(op => Operation.isSelectionOperation(op));
|
|
14155
|
+
if (isCollapsed && isSelectionOperation) {
|
|
14156
|
+
const opts = new TableOptions();
|
|
14157
|
+
const tablePosition = TablePosition.create(opts, editor, editor.selection.anchor.path);
|
|
14158
|
+
if (tablePosition.isInTable() && tablePosition.cell.hidden) {
|
|
14159
|
+
TableEditor.selectOriginCell(editor, tablePosition.table, tablePosition.getRowIndex(), tablePosition.getColumnIndex(), false);
|
|
14160
|
+
}
|
|
14153
14161
|
}
|
|
14154
14162
|
}
|
|
14163
|
+
catch (error) { }
|
|
14155
14164
|
};
|
|
14156
14165
|
return editor;
|
|
14157
14166
|
};
|