@worktile/theia 15.0.1 → 15.0.2

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 (46) hide show
  1. package/editor.component.d.ts +1 -1
  2. package/esm2020/components/color-select/color-select.component.mjs +3 -3
  3. package/esm2020/components/contextmenu/contextmenu.component.mjs +3 -3
  4. package/esm2020/components/conversion-hint/conversion-hint.component.mjs +3 -3
  5. package/esm2020/components/listbox/listbox.mjs +4 -4
  6. package/esm2020/components/plugin-menu/plugin-menu.component.mjs +3 -3
  7. package/esm2020/components/table-select/table-select.component.mjs +3 -3
  8. package/esm2020/components/template/template.component.mjs +3 -3
  9. package/esm2020/components/toolbar-dropdown/toolbar-dropdown.component.mjs +3 -3
  10. package/esm2020/components/toolbar-group/toolbar-group.component.mjs +3 -3
  11. package/esm2020/editor.component.mjs +17 -17
  12. package/esm2020/interfaces/editor.mjs +1 -1
  13. package/esm2020/plugins/code/code.component.mjs +3 -3
  14. package/esm2020/plugins/image/image.component.mjs +3 -3
  15. package/esm2020/plugins/link/edit/link-edit.component.mjs +3 -3
  16. package/esm2020/plugins/link/hover/link-hover.component.mjs +3 -3
  17. package/esm2020/plugins/quick-insert/components/quick-insert.component.mjs +3 -3
  18. package/esm2020/plugins/table/components/insert-mark/insert-mark.component.mjs +4 -4
  19. package/esm2020/plugins/table/components/table.component.mjs +35 -22
  20. package/esm2020/plugins/table/components/td/td.component.mjs +27 -9
  21. package/esm2020/plugins/table/components/toolbar/table-toolbar.component.mjs +9 -9
  22. package/esm2020/plugins/table/table.editor.mjs +4 -4
  23. package/esm2020/plugins/table/table.plugin.mjs +6 -6
  24. package/esm2020/plugins/table/table.store.mjs +66 -47
  25. package/esm2020/plugins/table/table.types.mjs +2 -1
  26. package/esm2020/plugins/table/utils/is-selection-in-table.mjs +7 -5
  27. package/esm2020/plugins/table/utils/set-menu-cell-invisibility.mjs +4 -4
  28. package/esm2020/plugins/vertical-align/toolbar-item.component.mjs +3 -3
  29. package/esm2020/services/table-contextmenu.service.mjs +7 -7
  30. package/esm2020/utils/index.mjs +2 -2
  31. package/esm2020/utils/scroll-into-view.mjs +38 -0
  32. package/fesm2015/worktile-theia.mjs +233 -167
  33. package/fesm2015/worktile-theia.mjs.map +1 -1
  34. package/fesm2020/worktile-theia.mjs +228 -164
  35. package/fesm2020/worktile-theia.mjs.map +1 -1
  36. package/interfaces/editor.d.ts +2 -1
  37. package/package.json +1 -1
  38. package/plugins/table/components/table.component.d.ts +1 -1
  39. package/plugins/table/components/table.component.scss +30 -15
  40. package/plugins/table/components/td/td.component.d.ts +1 -0
  41. package/plugins/table/table.store.d.ts +9 -5
  42. package/plugins/table/table.types.d.ts +1 -0
  43. package/plugins/table/utils/set-menu-cell-invisibility.d.ts +1 -1
  44. package/utils/index.d.ts +1 -1
  45. package/utils/{auto-scroll-view.d.ts → scroll-into-view.d.ts} +1 -1
  46. package/esm2020/utils/auto-scroll-view.mjs +0 -24
@@ -91,7 +91,6 @@ export interface TheOptions {
91
91
  disabled?: boolean;
92
92
  autoFocus?: boolean;
93
93
  placeholder?: string;
94
- placeholderDecorate?: (editor: Editor) => SlatePlaceholder[];
95
94
  inlineToolbarVisible?: boolean;
96
95
  scrollContainer?: string;
97
96
  maxHeight?: number;
@@ -101,6 +100,8 @@ export interface TheOptions {
101
100
  menu?: ThePluginMenuItemConfig[];
102
101
  disablePlugins?: string[];
103
102
  extraElementOptions?: ElementOptionsInfo[];
103
+ neededScrollIntoView?: (e: Editor) => boolean;
104
+ placeholderDecorate?: (e: Editor) => SlatePlaceholder[];
104
105
  }
105
106
  export type NodeMatch<T = Node> = Predicate<T>;
106
107
  export interface MatchOptions<T = Node> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@worktile/theia",
3
- "version": "15.0.1",
3
+ "version": "15.0.2",
4
4
  "description": "theia editor",
5
5
  "author": "YanDong <nanianqiumo@foxmail.com>",
6
6
  "homepage": "https://github.com/atinc/theia#readme",
@@ -35,7 +35,6 @@ export declare class TheTableComponent extends TheBaseElementComponent<TableElem
35
35
  tablePluginOptions: ThePluginOption<ThePluginTableOption>;
36
36
  isStickyTop: boolean;
37
37
  scrollContainerTop: number;
38
- tableWrapperMarginTop: number;
39
38
  previousScrollContainer: string;
40
39
  get columns(): TheTableColumn[];
41
40
  get nativeElement(): HTMLElement;
@@ -45,6 +44,7 @@ export declare class TheTableComponent extends TheBaseElementComponent<TableElem
45
44
  tbodyElement: ElementRef;
46
45
  columnControlsWrapper: ElementRef<HTMLElement>;
47
46
  cornerControl: ElementRef<HTMLElement>;
47
+ rowControlsInner: ElementRef<HTMLElement>;
48
48
  rowControlsButtonWrapper: QueryList<ElementRef<HTMLElement>>;
49
49
  handleMousedown(event: MouseEvent): void;
50
50
  onContextChange(): void;
@@ -41,9 +41,16 @@ $top-cell-z-index: 13;
41
41
  cursor: text;
42
42
 
43
43
  &.the-sticky-cell {
44
- &:after {
45
- @include mixins.cellInset;
46
- border: $controls-border;
44
+ &:not(.focused-cell):not(.selected-cell):after {
45
+ content: '';
46
+ width: 1px;
47
+ height: 100%;
48
+ right: -1px;
49
+ background: variables.$gray-300;
50
+ top: 0;
51
+ display: block;
52
+ position: absolute;
53
+ z-index: $top-cell-z-index;
47
54
  }
48
55
  &.the-table-left-shadow {
49
56
  z-index: 12;
@@ -67,6 +74,9 @@ $top-cell-z-index: 13;
67
74
  @include mixins.cellInset;
68
75
  z-index: -1;
69
76
  border: 1px solid variables.$primary;
77
+ width: unset;
78
+ height: unset;
79
+ background: unset;
70
80
  }
71
81
  }
72
82
 
@@ -172,9 +182,6 @@ $top-cell-z-index: 13;
172
182
  }
173
183
 
174
184
  &:not(.the-table-with-controls) {
175
- .the-table {
176
- margin-top: 0;
177
- }
178
185
  .the-table-numbered {
179
186
  .the-table {
180
187
  margin-top: 13px;
@@ -284,7 +291,7 @@ $top-cell-z-index: 13;
284
291
  }
285
292
  }
286
293
 
287
- &.active,
294
+ &.control-active,
288
295
  &.dangerous {
289
296
  &::before,
290
297
  &::after {
@@ -305,7 +312,7 @@ $top-cell-z-index: 13;
305
312
  }
306
313
  }
307
314
 
308
- &.active {
315
+ &.control-active {
309
316
  @include mixins.controlSelected;
310
317
  z-index: 11;
311
318
  }
@@ -320,11 +327,19 @@ $top-cell-z-index: 13;
320
327
  }
321
328
  }
322
329
 
323
- &.the-sticky-cell {
324
- &:after {
325
- @include mixins.cellInset;
326
- left: -2px;
327
- border-right: $controls-border;
330
+ &.the-sticky-cell:not(.avtive) {
331
+ &:not(.active):not(.danger){
332
+ &:after{
333
+ content: '';
334
+ width: 1px;
335
+ height: 100%;
336
+ right: -1px;
337
+ background: variables.$gray-300;
338
+ top: 0;
339
+ display: block;
340
+ position: absolute;
341
+ z-index: $top-cell-z-index;
342
+ }
328
343
  }
329
344
  &.the-table-left-shadow {
330
345
  z-index: $top-cell-z-index;
@@ -450,7 +465,7 @@ $top-cell-z-index: 13;
450
465
  top: -$dot-size;
451
466
  }
452
467
 
453
- &.active {
468
+ &.control-active {
454
469
  .the-table-corner-button {
455
470
  @include mixins.controlSelected;
456
471
  }
@@ -565,7 +580,7 @@ $top-cell-z-index: 13;
565
580
  cursor: pointer;
566
581
  }
567
582
 
568
- &.active {
583
+ &.control-active {
569
584
  z-index: 1;
570
585
 
571
586
  .the-table-controls-button,
@@ -77,6 +77,7 @@ export declare class TheTdComponent extends TheBaseElementComponent<TableCellEle
77
77
  private _showHandleOverlay;
78
78
  private updateOverlayHandleSizeAndOffset;
79
79
  private updateOverlayHandleColumnSize;
80
+ private getIsStickyTopRow;
80
81
  private updateOverlayHandleRowSize;
81
82
  private applySize;
82
83
  private _createOverlayForHandle;
@@ -3,7 +3,7 @@ import { Editor } from 'slate';
3
3
  import { TablePosition } from './utils';
4
4
  import { ColorType } from '../../constants/color-select';
5
5
  import { CellPosition, TheTableOptions } from './table.types';
6
- import { TableElement } from '../../custom-types';
6
+ import { TableCellElement, TableElement } from '../../custom-types';
7
7
  import * as i0 from "@angular/core";
8
8
  export declare class TableStore {
9
9
  private selectedCells$;
@@ -27,13 +27,17 @@ export declare class TableStore {
27
27
  isRightClicking: boolean;
28
28
  pointerSelection: boolean;
29
29
  maxCol: number;
30
- get selectedCells(): CellPosition[];
30
+ get selectedCellPositions(): CellPosition[];
31
31
  get dangerousCells(): CellPosition[];
32
32
  constructor();
33
33
  isSelectedAllCell: () => boolean;
34
34
  getTableEntry(): import("slate").NodeEntry<TableElement>;
35
35
  getTablePath(): import("slate").Path;
36
- updateCellPositionRefs(row?: number, col?: number): void;
36
+ getSelectedCellPositions(): {
37
+ row: number;
38
+ col: number;
39
+ }[];
40
+ calculateSelectedColumnsAndRowIndex(): void;
37
41
  setSelectedCells(cells: CellPosition[], pos: TablePosition): void;
38
42
  initEditor(editor: Editor): void;
39
43
  /**
@@ -53,7 +57,7 @@ export declare class TableStore {
53
57
  getMinAndMaxCellIndex(maxRow: number, maxCol: number, minRow: number, minCol: number, table: TableElement): any;
54
58
  selectCell(cell: HTMLTableCellElement, editor: Editor): void;
55
59
  getCellPositionsBeforeMerge({ row, col }: CellPosition): CellPosition[];
56
- selectedCellsChange(): Observable<CellPosition[]>;
60
+ selectedCellsChange(): Observable<TableCellElement[]>;
57
61
  cellsPositionChange(): Observable<void>;
58
62
  changeCells(): void;
59
63
  emitTableChange(): void;
@@ -67,7 +71,7 @@ export declare class TableStore {
67
71
  dangerousCellsChange(): Observable<CellPosition[]>;
68
72
  setDangerousCells(): void;
69
73
  clearDangerousCells(): void;
70
- dangerousOrSelectedCellsChange(): Observable<CellPosition[]>;
74
+ dangerousOrSelectedCellsChange(): Observable<TableCellElement[] | CellPosition[]>;
71
75
  setDangerousRows(): void;
72
76
  setDangerousColumns(): void;
73
77
  setDangerousTable(): void;
@@ -22,6 +22,7 @@ export interface TheTableComponentBase extends TheBaseElementComponent {
22
22
  export declare const BASE_CELL_HEIGHT = 41;
23
23
  export declare const BASE_FILL_HEIGHT: number;
24
24
  export declare const BASE_CELL_INNER_HEIGHT: number;
25
+ export declare const TableWithStickyRowClass = "the-table-with-sticky-row";
25
26
  export interface TheTableColumn {
26
27
  width: number;
27
28
  }
@@ -1,7 +1,7 @@
1
1
  import { Editor } from 'slate';
2
2
  import { MenuEntity, CellPosition } from '../table.types';
3
3
  export declare function setCellMenuVisibility(editor: Editor, menuList: MenuEntity[], tableInfo: {
4
- selectedCells: CellPosition[];
4
+ selectedCellPositions: CellPosition[];
5
5
  isFullscreen?: boolean;
6
6
  isSelectedTable?: boolean;
7
7
  selectedRowsIndex?: number[];
package/utils/index.d.ts CHANGED
@@ -8,7 +8,7 @@ export * from './merge-element-options';
8
8
  export * from './dom';
9
9
  export * from './fragment';
10
10
  export * from './auto-focus';
11
- export * from './auto-scroll-view';
11
+ export * from './scroll-into-view';
12
12
  export * from './id-creator';
13
13
  export * from './editor-uuid';
14
14
  export * from './blob';
@@ -3,4 +3,4 @@ import { Editor } from 'slate';
3
3
  * reset the sliding distance when the viewport position of the sliding
4
4
  * container coincides with the viewport position of the focus element
5
5
  */
6
- export declare const autoScrollViewHandle: (editor: Editor, scrollContainer: string) => void;
6
+ export declare const scrollIntoView: (editor: Editor, scrollContainer?: string) => void;
@@ -1,24 +0,0 @@
1
- import { getEditableElementHeight } from './get-editable-element-height';
2
- let previousHeight = 0;
3
- /**
4
- * reset the sliding distance when the viewport position of the sliding
5
- * container coincides with the viewport position of the focus element
6
- */
7
- export const autoScrollViewHandle = (editor, scrollContainer) => {
8
- const currentHeight = getEditableElementHeight(editor);
9
- const currentNodeElement = window.getSelection().focusNode.parentElement;
10
- const scrollContainerElement = currentNodeElement.closest(scrollContainer);
11
- // the added sliding distance is the height of the
12
- // current editing area minus the height of the last editing area
13
- const scrollHeight = currentHeight - previousHeight;
14
- if (scrollContainerElement && previousHeight !== 0 && scrollHeight > 0) {
15
- const focusBlockRect = currentNodeElement.getBoundingClientRect();
16
- const scrollContainerRect = scrollContainerElement.getBoundingClientRect();
17
- const bottom = scrollContainerRect.bottom - focusBlockRect.bottom;
18
- if (bottom < 30) {
19
- scrollContainerElement.scrollTop = scrollContainerElement.scrollTop + scrollHeight;
20
- }
21
- }
22
- previousHeight = currentHeight;
23
- };
24
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0by1zY3JvbGwtdmlldy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3BhY2thZ2VzL3NyYy91dGlscy9hdXRvLXNjcm9sbC12aWV3LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sRUFBRSx3QkFBd0IsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBRXpFLElBQUksY0FBYyxHQUFHLENBQUMsQ0FBQztBQUV2Qjs7O0dBR0c7QUFDSCxNQUFNLENBQUMsTUFBTSxvQkFBb0IsR0FBRyxDQUFDLE1BQWMsRUFBRSxlQUF1QixFQUFFLEVBQUU7SUFDNUUsTUFBTSxhQUFhLEdBQUcsd0JBQXdCLENBQUMsTUFBTSxDQUFDLENBQUM7SUFDdkQsTUFBTSxrQkFBa0IsR0FBRyxNQUFNLENBQUMsWUFBWSxFQUFFLENBQUMsU0FBUyxDQUFDLGFBQWEsQ0FBQztJQUN6RSxNQUFNLHNCQUFzQixHQUFHLGtCQUFrQixDQUFDLE9BQU8sQ0FBQyxlQUFlLENBQUMsQ0FBQztJQUUzRSxrREFBa0Q7SUFDbEQsaUVBQWlFO0lBQ2pFLE1BQU0sWUFBWSxHQUFHLGFBQWEsR0FBRyxjQUFjLENBQUM7SUFFcEQsSUFBSSxzQkFBc0IsSUFBSSxjQUFjLEtBQUssQ0FBQyxJQUFJLFlBQVksR0FBRyxDQUFDLEVBQUU7UUFDcEUsTUFBTSxjQUFjLEdBQUcsa0JBQWtCLENBQUMscUJBQXFCLEVBQUUsQ0FBQztRQUNsRSxNQUFNLG1CQUFtQixHQUFHLHNCQUFzQixDQUFDLHFCQUFxQixFQUF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