@worktile/theia 2.4.0 → 2.4.3

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 (33) hide show
  1. package/bundles/worktile-theia.umd.js +979 -921
  2. package/bundles/worktile-theia.umd.js.map +1 -1
  3. package/constants/auto-format-rules.d.ts +1 -1
  4. package/esm2015/constants/auto-format-rules.js +3 -2
  5. package/esm2015/editor.component.js +4 -2
  6. package/esm2015/interfaces/auto-format.js +1 -1
  7. package/esm2015/interfaces/editor.js +1 -1
  8. package/esm2015/plugins/autoformat/autoformat.plugin.js +23 -6
  9. package/esm2015/plugins/indent/indent.editor.js +11 -13
  10. package/esm2015/plugins/indent/indent.plugin.js +15 -2
  11. package/esm2015/plugins/indent/on-keydown-indent.js +3 -5
  12. package/esm2015/plugins/index.js +2 -3
  13. package/esm2015/plugins/quick-insert/components/quick-insert.component.js +6 -2
  14. package/esm2015/plugins/quick-insert/components/quick-toolbar/quick-toolbar.component.js +14 -15
  15. package/esm2015/plugins/quick-insert/quick-insert.editor.js +17 -27
  16. package/esm2015/plugins/quick-insert/quick-insert.plugin.js +14 -13
  17. package/esm2015/plugins/table/components/table.component.js +3 -2
  18. package/esm2015/transforms/index.js +3 -2
  19. package/esm2015/transforms/insert-element-next.js +1 -1
  20. package/esm2015/transforms/insert-element-node.js +36 -0
  21. package/fesm2015/worktile-theia.js +1014 -953
  22. package/fesm2015/worktile-theia.js.map +1 -1
  23. package/interfaces/auto-format.d.ts +1 -0
  24. package/interfaces/editor.d.ts +10 -0
  25. package/package.json +1 -1
  26. package/plugins/autoformat/autoformat.plugin.d.ts +1 -2
  27. package/plugins/indent/indent.plugin.d.ts +1 -0
  28. package/plugins/indent/on-keydown-indent.d.ts +1 -1
  29. package/plugins/quick-insert/components/quick-toolbar/quick-toolbar.component.d.ts +3 -4
  30. package/plugins/quick-insert/quick-insert.editor.d.ts +3 -4
  31. package/plugins/table/components/table.component.scss +20 -17
  32. package/transforms/index.d.ts +2 -1
  33. package/transforms/insert-element-node.d.ts +2 -0
@@ -31,6 +31,7 @@ export interface AutoFormatRule {
31
31
  * - inline – insert mark between markups. Should be used with `between`.
32
32
  */
33
33
  mode?: 'block' | 'inline';
34
+ key?: string;
34
35
  /**
35
36
  * When using `inline` mode – if false, do not format when the string can be trimmed.
36
37
  */
@@ -5,12 +5,16 @@ import { ElementOptionsInfo } from './valid-children-types';
5
5
  import { Predicate } from '../utils/match';
6
6
  import { ToolbarOption } from './toolbar';
7
7
  import { FontSizes } from '../constants/node-types';
8
+ import { AutoFormatRule } from './auto-format';
9
+ import { CustomElementKinds } from '../custom-types';
8
10
  export interface TheEditor extends AngularEditor, HistoryEditor {
9
11
  renderElement: (element: Element) => ViewType;
10
12
  renderLeaf: (text: Text) => ViewType;
11
13
  insertElement: (element: Element) => void;
12
14
  isContainer: (element: Element) => boolean;
13
15
  extraElementOptions: ElementOptionsInfo[];
16
+ extraAutoFormatRules: AutoFormatRule[];
17
+ extraIndentOptions: IndentOptions;
14
18
  disabled: boolean;
15
19
  [key: string]: any;
16
20
  }
@@ -81,12 +85,18 @@ export interface TheOptions {
81
85
  toolbar?: ToolbarOption;
82
86
  disablePlugins?: string[];
83
87
  extraElementOptions?: ElementOptionsInfo[];
88
+ extraAutoFormatRules?: AutoFormatRule[];
89
+ extraIndentOptions?: IndentOptions;
84
90
  }
85
91
  export declare type NodeMatch<T = Node> = Predicate<T>;
86
92
  export interface MatchOptions<T = Node> {
87
93
  match?: NodeMatch<T>;
88
94
  block?: boolean;
89
95
  }
96
+ export interface IndentOptions {
97
+ indentTypes?: CustomElementKinds[];
98
+ disabledIndentTypes?: CustomElementKinds[];
99
+ }
90
100
  export interface EditorAboveOptions<T = Ancestor> extends MatchOptions<T> {
91
101
  at?: Range | Path | Point;
92
102
  mode?: 'highest' | 'lowest';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@worktile/theia",
3
- "version": "2.4.0",
3
+ "version": "2.4.3",
4
4
  "description": "theia editor",
5
5
  "author": "YanDong <nanianqiumo@foxmail.com>",
6
6
  "homepage": "https://github.com/atinc/theia#readme",
@@ -1,2 +1 @@
1
- import { WithAutoFormatOptions } from '../../interfaces/auto-format';
2
- export declare const withAutoFormat: ({ rules }: WithAutoFormatOptions) => <T extends import("@worktile/theia").TheEditor>(editor: T) => T;
1
+ export declare const withAutoFormat: () => <T extends import("@worktile/theia").TheEditor>(editor: T) => T;
@@ -1,3 +1,4 @@
1
1
  import { CustomElementKinds } from '../../custom-types';
2
2
  import { TheEditor } from '../../interfaces/editor';
3
3
  export declare const withIndent: (kinds: CustomElementKinds[]) => <T extends TheEditor>(editor: T) => T;
4
+ export declare const mergIndentTypes: (defaultTypes: CustomElementKinds[], indentTypes: CustomElementKinds[]) => CustomElementKinds[];
@@ -1,3 +1,3 @@
1
1
  import { Editor } from 'slate';
2
2
  import { CustomElementKinds } from '../../custom-types';
3
- export declare const onKeydownTextIndent: (editor: Editor, event: KeyboardEvent, kinds: CustomElementKinds[]) => boolean;
3
+ export declare const onKeydownTextIndent: (editor: Editor, event: KeyboardEvent, kinds: CustomElementKinds[], textIndentDisabled: CustomElementKinds[]) => boolean;
@@ -1,6 +1,5 @@
1
- import { OnInit, OnDestroy, ElementRef } from '@angular/core';
1
+ import { OnInit, OnDestroy, ElementRef, ChangeDetectorRef } from '@angular/core';
2
2
  import { MixinBase } from 'ngx-tethys/core';
3
- import { ThyPopoverRef } from 'ngx-tethys/popover';
4
3
  import { Editor } from 'slate';
5
4
  import { ToolbarItem } from '../../../../interfaces/toolbar';
6
5
  import { ToolbarActionTypes } from '../../../../constants/node-types';
@@ -8,8 +7,8 @@ import { ToolbarItemMode } from '../../../../constants/toolbar';
8
7
  import * as i0 from "@angular/core";
9
8
  declare const TheQuickToolbarComponent_base: import("ngx-tethys/core").Constructor<import("ngx-tethys/core").ThyUnsubscribe> & typeof MixinBase;
10
9
  export declare class TheQuickToolbarComponent extends TheQuickToolbarComponent_base implements OnInit, OnDestroy {
11
- private popoverRef;
12
10
  elementRef: ElementRef;
11
+ cdr: ChangeDetectorRef;
13
12
  editor: Editor;
14
13
  quickToolbarItems: ToolbarItem[];
15
14
  editorElement: HTMLElement;
@@ -18,7 +17,7 @@ export declare class TheQuickToolbarComponent extends TheQuickToolbarComponent_b
18
17
  handleMouseDown(event: MouseEvent): void;
19
18
  handleEnter(): void;
20
19
  handleEsc(): void;
21
- constructor(popoverRef: ThyPopoverRef<TheQuickToolbarComponent>, elementRef: ElementRef);
20
+ constructor(elementRef: ElementRef, cdr: ChangeDetectorRef);
22
21
  ngOnInit(): void;
23
22
  stopPropagation(event: any): void;
24
23
  selectionChange(event: any): void;
@@ -1,8 +1,7 @@
1
- import { ElementRef } from '@angular/core';
2
1
  import { Editor } from 'slate';
3
2
  import { ToolbarItem } from '../../interfaces/toolbar';
4
3
  export declare const QuickInsertEditor: {
5
- openQuickToolbar(editor: Editor, toolbarItems: ToolbarItem[], origin: HTMLElement | ElementRef): void;
6
- closeQuickToolbar(editor: Editor): void;
7
- isOpenToolbar(editor: Editor, opTypes?: string[]): boolean;
4
+ openQuickInsertToolbar(editor: Editor, quickToolbarItems: ToolbarItem[], origin?: HTMLElement): void;
5
+ closeQuickInsertToolbar(editor: Editor): void;
6
+ isOpenedToolbar(editor: Editor): boolean;
8
7
  };
@@ -128,6 +128,7 @@ $control-corner-width: 12px;
128
128
  border-right: $controls-border;
129
129
  border-top: $controls-border;
130
130
  background-clip: padding-box;
131
+ cursor: pointer;
131
132
  &:first-child{
132
133
  border-left: $controls-border;
133
134
  }
@@ -181,7 +182,8 @@ $control-corner-width: 12px;
181
182
  .the-table-corner-controls {
182
183
  width: 100%;
183
184
  height: $control-corner-width;
184
-
185
+ position: relative;
186
+ visibility: hidden;
185
187
  .the-table-corner-button {
186
188
  position: absolute;
187
189
  top: 0;
@@ -197,6 +199,16 @@ $control-corner-width: 12px;
197
199
  cursor: pointer;
198
200
  }
199
201
 
202
+ .the-table-corner-controls-insert-row-marker .the-table-controls-insert-wrapper {
203
+ left: -$dot-size;
204
+ top: 2px;
205
+ }
206
+
207
+ .the-table-corner-controls-insert-column-marker .the-table-controls-insert-wrapper {
208
+ left: 2px;
209
+ top: -$dot-size;
210
+ }
211
+
200
212
  &.active {
201
213
  z-index: 1;
202
214
  .the-table-corner-button {
@@ -285,21 +297,6 @@ $control-corner-width: 12px;
285
297
  }
286
298
  }
287
299
 
288
- .the-table-corner-controls {
289
- position: relative;
290
- visibility: hidden;
291
-
292
- .the-table-corner-controls-insert-row-marker .the-table-controls-insert-wrapper {
293
- left: -$dot-size;
294
- top: 2px;
295
- }
296
-
297
- .the-table-corner-controls-insert-column-marker .the-table-controls-insert-wrapper {
298
- left: 2px;
299
- top: -$dot-size;
300
- }
301
- }
302
-
303
300
  .the-table-row-controls {
304
301
  width: $control-width;
305
302
  box-sizing: border-box;
@@ -385,7 +382,6 @@ $control-corner-width: 12px;
385
382
  margin: 0;
386
383
  border: 0;
387
384
  position: relative;
388
- cursor: pointer;
389
385
  border-top: 1px solid transparent;
390
386
  }
391
387
  }
@@ -449,3 +445,10 @@ $control-corner-width: 12px;
449
445
  top: 1px;
450
446
  }
451
447
  }
448
+
449
+
450
+ .the-editor-readonly{
451
+ .the-table-row-controls, .the-table-col-controls{
452
+ cursor: default;
453
+ }
454
+ }
@@ -16,4 +16,5 @@ import { setEndSelection } from './set-end-selection';
16
16
  import { closeConversionHint } from './close-conversion-hint';
17
17
  import { handleContinualDeleteBackward } from './handle-continual-delete-backward';
18
18
  import { handleContinualInsertBreak } from './handle-continual-insert-break';
19
- export { setMarks, clearMarks, insertElement, insertElementNext, insertParagraph, setNode, unwrapNodesByType, onKeyDownResetBlockType, moveChildren, applyDeepToNodes, mergeDeepToNodes, unWrap, splitNode, deleteElement, setEndSelection, closeConversionHint, handleContinualDeleteBackward, handleContinualInsertBreak };
19
+ import { insertElementNode } from './insert-element-node';
20
+ export { setMarks, clearMarks, insertElement, insertElementNext, insertParagraph, setNode, unwrapNodesByType, onKeyDownResetBlockType, moveChildren, applyDeepToNodes, mergeDeepToNodes, unWrap, splitNode, deleteElement, setEndSelection, closeConversionHint, handleContinualDeleteBackward, handleContinualInsertBreak, insertElementNode };
@@ -0,0 +1,2 @@
1
+ import { Editor, Element } from 'slate';
2
+ export declare const insertElementNode: (editor: Editor, node: Element) => void;