@worktile/theia 1.2.12 → 1.2.16

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 (50) hide show
  1. package/bundles/worktile-theia.umd.js +312 -127
  2. package/bundles/worktile-theia.umd.js.map +1 -1
  3. package/components/inline-toolbar/inline-toolbar.component.d.ts +3 -1
  4. package/constants/default.d.ts +0 -1
  5. package/editor.component.d.ts +1 -0
  6. package/esm2015/components/inline-toolbar/inline-toolbar.component.js +10 -7
  7. package/esm2015/components/toolbar-item/toolbar-item.component.js +7 -3
  8. package/esm2015/constants/default.js +1 -2
  9. package/esm2015/editor.component.js +23 -12
  10. package/esm2015/interfaces/editor.js +1 -1
  11. package/esm2015/interfaces/toolbar.js +1 -1
  12. package/esm2015/plugins/code/code.component.js +4 -1
  13. package/esm2015/plugins/common/block-card.plugin.js +51 -5
  14. package/esm2015/plugins/deserializers/deserialize-html.plugin.js +7 -1
  15. package/esm2015/plugins/deserializers/deserialize-md.plugin.js +7 -2
  16. package/esm2015/plugins/index.js +14 -2
  17. package/esm2015/plugins/mark/options.js +6 -1
  18. package/esm2015/plugins/paint-format/options.js +4 -1
  19. package/esm2015/plugins/placeholder/placeholder.component.js +19 -12
  20. package/esm2015/plugins/quick-insert/components/quick-insert.component.js +7 -6
  21. package/esm2015/plugins/soft-break/soft-break.plugin.js +18 -0
  22. package/esm2015/plugins/soft-break/soft-break.types.js +2 -0
  23. package/esm2015/plugins/table/table.editor.js +10 -2
  24. package/esm2015/plugins/table/table.plugin.js +84 -71
  25. package/esm2015/plugins/table/utils/calc-span.js +2 -2
  26. package/esm2015/plugins/table/utils/normalize-table.js +31 -0
  27. package/esm2015/plugins/table/utils/table-position.js +5 -2
  28. package/esm2015/queries/is-empty-paragraph.js +6 -2
  29. package/esm2015/services/context.service.js +10 -2
  30. package/esm2015/utils/auto-focus.js +2 -2
  31. package/esm2015/utils/common.js +3 -0
  32. package/esm2015/utils/fragment.js +5 -2
  33. package/esm2015/utils/index.js +2 -1
  34. package/fesm2015/worktile-theia.js +300 -114
  35. package/fesm2015/worktile-theia.js.map +1 -1
  36. package/interfaces/editor.d.ts +2 -0
  37. package/interfaces/toolbar.d.ts +1 -0
  38. package/package.json +1 -1
  39. package/plugins/image/image.component.scss +172 -168
  40. package/plugins/placeholder/placeholder.component.d.ts +4 -2
  41. package/plugins/soft-break/soft-break.plugin.d.ts +4 -0
  42. package/plugins/soft-break/soft-break.types.d.ts +8 -0
  43. package/plugins/table/table.editor.d.ts +2 -0
  44. package/plugins/table/utils/calc-span.d.ts +1 -1
  45. package/plugins/table/utils/normalize-table.d.ts +2 -0
  46. package/services/context.service.d.ts +2 -0
  47. package/styles/editor.scss +3 -3
  48. package/styles/typo.scss +5 -2
  49. package/utils/common.d.ts +2 -0
  50. package/utils/index.d.ts +1 -0
@@ -68,6 +68,8 @@ export interface TheOptions {
68
68
  disabled?: boolean;
69
69
  autoFocus?: boolean;
70
70
  placeholder?: string;
71
+ isEmptyShowPlaceholder?: boolean;
72
+ isMustShowPlaceholder?: boolean;
71
73
  scrollContainer?: string;
72
74
  maxHeight?: number;
73
75
  toolbar?: ToolbarOption;
@@ -36,6 +36,7 @@ export interface CustomizeToolbarItem extends ToolbarItemBase {
36
36
  export interface DefaultToolbarItem extends ToolbarItemBase {
37
37
  icon?: string;
38
38
  name?: string;
39
+ shortcutKey?: string;
39
40
  type?: ToolbarItemType;
40
41
  }
41
42
  export declare type ToolbarItem = CustomizeToolbarItem & DefaultToolbarItem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@worktile/theia",
3
- "version": "1.2.12",
3
+ "version": "1.2.16",
4
4
  "description": "theia editor",
5
5
  "author": "YanDong <nanianqiumo@foxmail.com>",
6
6
  "homepage": "https://github.com/atinc/theia#readme",
@@ -1,190 +1,194 @@
1
- .image-container {
2
- .image-content {
3
- display: inline-block;
4
- position: relative;
5
- height: auto;
6
- cursor: zoom-in;
7
- }
1
+ .slate-element-image {
2
+ display: block;
8
3
 
9
- .pointer {
10
- cursor: pointer;
11
- }
4
+ .image-container {
5
+ .image-content {
6
+ display: inline-block;
7
+ position: relative;
8
+ height: auto;
9
+ cursor: zoom-in;
10
+ }
12
11
 
13
- .main-image {
14
- position: relative;
15
- object-fit: fill;
16
- width: auto;
17
- max-width: 100%;
18
- max-height: 100%;
19
- width: 100%;
20
- height: 100%;
21
- margin: 0 auto;
22
- user-select: none;
23
- }
24
- .image-profile {
25
- position: absolute;
26
- display: block;
27
- bottom: -1px;
28
- left: -1px;
29
- right: -1px;
30
- top: -1px;
31
- .image-pointer {
12
+ .pointer {
13
+ cursor: pointer;
14
+ }
15
+
16
+ .main-image {
17
+ position: relative;
18
+ object-fit: fill;
19
+ width: auto;
20
+ max-width: 100%;
21
+ max-height: 100%;
22
+ width: 100%;
23
+ height: 100%;
24
+ margin: 0 auto;
25
+ user-select: none;
26
+ }
27
+ .image-profile {
32
28
  position: absolute;
33
- width: 12px;
34
- height: 12px;
35
- border-radius: 50%;
36
- background-color: $white;
37
- box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.13);
38
- border: 1px solid $gray-300;
39
- z-index: 2;
40
- &::before {
29
+ display: block;
30
+ bottom: -1px;
31
+ left: -1px;
32
+ right: -1px;
33
+ top: -1px;
34
+ .image-pointer {
41
35
  position: absolute;
36
+ width: 12px;
37
+ height: 12px;
38
+ border-radius: 50%;
39
+ background-color: $white;
40
+ box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.13);
41
+ border: 1px solid $gray-300;
42
+ z-index: 2;
43
+ &::before {
44
+ position: absolute;
45
+ left: 50%;
46
+ top: 50%;
47
+ display: inline-block;
48
+ content: '';
49
+ height: 8px;
50
+ width: 8px;
51
+ margin-left: -4px;
52
+ margin-top: -4px;
53
+ border-radius: 50%;
54
+ background-color: $primary;
55
+ }
56
+ }
57
+ .left {
58
+ left: -6px;
59
+ }
60
+ .top {
61
+ top: -6px;
62
+ }
63
+ .center {
42
64
  left: 50%;
65
+ margin-left: -5px;
66
+ }
67
+ .middle {
43
68
  top: 50%;
44
- display: inline-block;
45
- content: '';
46
- height: 8px;
47
- width: 8px;
48
- margin-left: -4px;
49
- margin-top: -4px;
50
- border-radius: 50%;
51
- background-color: $primary;
69
+ margin-top: -5px;
70
+ }
71
+ .right {
72
+ right: -6px;
73
+ }
74
+ .bottom {
75
+ bottom: -6px;
76
+ }
77
+ .left.top,
78
+ .right.bottom {
79
+ cursor: nwse-resize;
80
+ }
81
+ .top.center,
82
+ .bottom.center {
83
+ cursor: ns-resize;
84
+ }
85
+ .right.top,
86
+ .left.bottom {
87
+ cursor: nesw-resize;
88
+ }
89
+ .left.middle,
90
+ .right.middle {
91
+ cursor: ew-resize;
52
92
  }
53
93
  }
54
- .left {
55
- left: -6px;
56
- }
57
- .top {
58
- top: -6px;
59
- }
60
- .center {
61
- left: 50%;
62
- margin-left: -5px;
63
- }
64
- .middle {
65
- top: 50%;
66
- margin-top: -5px;
67
- }
68
- .right {
69
- right: -6px;
70
- }
71
- .bottom {
72
- bottom: -6px;
73
- }
74
- .left.top,
75
- .right.bottom {
76
- cursor: nwse-resize;
77
- }
78
- .top.center,
79
- .bottom.center {
80
- cursor: ns-resize;
81
- }
82
- .right.top,
83
- .left.bottom {
84
- cursor: nesw-resize;
85
- }
86
- .left.middle,
87
- .right.middle {
88
- cursor: ew-resize;
94
+ .image-profile.outline {
95
+ border: 1px dashed $primary;
89
96
  }
90
- }
91
- .image-profile.outline {
92
- border: 1px dashed $primary;
93
- }
94
-
95
- .uploading {
96
- position: absolute;
97
- bottom: 0;
98
- left: 0;
99
- right: 0;
100
- top: 0;
101
- display: block;
102
- background-color: rgba(255, 255, 255, 0.65);
103
97
 
104
- .percentage {
105
- position: absolute;
106
- top: 4px;
107
- right: 4px;
108
- width: 102px;
109
- height: 24px;
110
- line-height: 24px;
111
- border: 0.5px solid rgba(0, 0, 0, 0.05);
112
- border-radius: 3px;
113
- box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.05), 0 1px 4px 0 rgba(0, 0, 0, 0.1);
114
- background: $white;
115
- color: grey;
116
- font-weight: 500;
117
- text-align: center;
118
- transition: 0.3s ease;
119
- }
120
- .uploading-percentage {
98
+ .uploading {
121
99
  position: absolute;
122
- top: 50%;
123
- left: 50%;
124
- display: flex;
125
- flex-direction: row;
126
- justify-content: space-between;
127
- align-items: center;
128
- flex-wrap: nowrap;
129
- height: 18px;
130
- margin-left: -60px;
131
- margin-top: -9px;
132
- .progress {
133
- display: inline-block;
134
- width: 120px;
135
- height: 8px;
136
- margin-right: 8px;
137
- margin-top: 1px;
100
+ bottom: 0;
101
+ left: 0;
102
+ right: 0;
103
+ top: 0;
104
+ display: block;
105
+ background-color: rgba(255, 255, 255, 0.65);
106
+
107
+ .percentage {
108
+ position: absolute;
109
+ top: 4px;
110
+ right: 4px;
111
+ width: 102px;
112
+ height: 24px;
113
+ line-height: 24px;
114
+ border: 0.5px solid rgba(0, 0, 0, 0.05);
115
+ border-radius: 3px;
116
+ box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.05), 0 1px 4px 0 rgba(0, 0, 0, 0.1);
117
+ background: $white;
118
+ color: grey;
119
+ font-weight: 500;
120
+ text-align: center;
121
+ transition: 0.3s ease;
138
122
  }
139
- .thy-icon {
140
- color: #d8d8d8;
123
+ .uploading-percentage {
124
+ position: absolute;
125
+ top: 50%;
126
+ left: 50%;
127
+ display: flex;
128
+ flex-direction: row;
129
+ justify-content: space-between;
130
+ align-items: center;
131
+ flex-wrap: nowrap;
132
+ height: 18px;
133
+ margin-left: -60px;
134
+ margin-top: -9px;
135
+ .progress {
136
+ display: inline-block;
137
+ width: 120px;
138
+ height: 8px;
139
+ margin-right: 8px;
140
+ margin-top: 1px;
141
+ }
142
+ .thy-icon {
143
+ color: #d8d8d8;
144
+ }
141
145
  }
142
146
  }
143
- }
144
-
145
- .layer {
146
- display: none;
147
- position: absolute;
148
- bottom: 0;
149
- left: 0;
150
- right: 0;
151
- top: 0;
152
147
 
153
- .preview {
148
+ .layer {
149
+ display: none;
154
150
  position: absolute;
155
- top: 6px;
156
- right: 6px;
157
- width: auto;
158
- height: 24px;
159
- padding: 0 3px;
160
- line-height: 24px;
161
- border: 0.5px solid rgba(0, 0, 0, 0.05);
162
- border-radius: 3px;
163
- box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.05), 0 1px 4px 0 rgba(0, 0, 0, 0.1);
164
- background: $white;
165
- color: grey;
166
- font-weight: 500;
167
- text-align: center;
168
- transition: 0.3s ease;
169
- cursor: pointer;
151
+ bottom: 0;
152
+ left: 0;
153
+ right: 0;
154
+ top: 0;
155
+
156
+ .preview {
157
+ position: absolute;
158
+ top: 6px;
159
+ right: 6px;
160
+ width: auto;
161
+ height: 24px;
162
+ padding: 0 3px;
163
+ line-height: 24px;
164
+ border: 0.5px solid rgba(0, 0, 0, 0.05);
165
+ border-radius: 3px;
166
+ box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.05), 0 1px 4px 0 rgba(0, 0, 0, 0.1);
167
+ background: $white;
168
+ color: grey;
169
+ font-weight: 500;
170
+ text-align: center;
171
+ transition: 0.3s ease;
172
+ cursor: pointer;
173
+ }
170
174
  }
171
- }
172
175
 
173
- .image-loading {
174
- display: flex;
175
- align-items: center;
176
- justify-content: center;
177
- width: 100%;
178
- height: 280px;
179
- background: rgb(244, 245, 247);
180
- color: $gray-500;
176
+ .image-loading {
177
+ display: flex;
178
+ align-items: center;
179
+ justify-content: center;
180
+ width: 100%;
181
+ height: 280px;
182
+ background: rgb(244, 245, 247);
183
+ color: $gray-500;
184
+ }
181
185
  }
182
- }
183
186
 
184
- .image-container:hover .layer {
185
- display: block;
186
- }
187
+ .image-container:hover .layer {
188
+ display: block;
189
+ }
187
190
 
188
- .image-container:hover .layer.readonly {
189
- cursor: zoom-in;
191
+ .image-container:hover .layer.readonly {
192
+ cursor: zoom-in;
193
+ }
190
194
  }
@@ -1,16 +1,18 @@
1
1
  import { ElementRef, Renderer2 } from '@angular/core';
2
2
  import { Editor } from 'slate';
3
- import { TheOptions } from '../../interfaces';
3
+ import { TheContextService } from '../../services/context.service';
4
+ import { TheOptions } from '../../interfaces/editor';
4
5
  import * as i0 from "@angular/core";
5
6
  export declare class ThePlaceholderComponent {
6
7
  private renderer;
7
8
  private elementRef;
9
+ private contextService;
8
10
  editor: Editor;
9
11
  options: TheOptions;
10
12
  isHide: boolean;
11
13
  handleCompositionStart(): void;
12
14
  handleCompositionEnd(event: any): void;
13
- constructor(renderer: Renderer2, elementRef: ElementRef);
15
+ constructor(renderer: Renderer2, elementRef: ElementRef, contextService: TheContextService);
14
16
  checkStatus(): void;
15
17
  private updatePosition;
16
18
  private hide;
@@ -0,0 +1,4 @@
1
+ import { TransformEditor } from '../common/transforms.plugin';
2
+ import { SoftBreakOnKeyDownOptions } from './soft-break.types';
3
+ import { TheEditor } from '../../interfaces/editor';
4
+ export declare const withSoftBreak: (options?: SoftBreakOnKeyDownOptions) => <T extends TheEditor & TransformEditor>(editor: T) => T;
@@ -0,0 +1,8 @@
1
+ import { QueryOptions } from '../../interfaces/editor';
2
+ export interface SoftBreakRule {
3
+ hotkey: string;
4
+ query?: QueryOptions;
5
+ }
6
+ export interface SoftBreakOnKeyDownOptions {
7
+ rules?: SoftBreakRule[];
8
+ }
@@ -2,6 +2,7 @@ import { Editor, NodeEntry, Path, Range } from 'slate';
2
2
  import { TableOptions } from './table.types';
3
3
  import { Alignment, VerticalAlignment } from '../../constants/node-types';
4
4
  import { TheEditor } from '../../interfaces';
5
+ import { TableElement } from '../../custom-types';
5
6
  export declare const TableEditor: {
6
7
  insertTable(editor: Editor, optionsParam?: TableOptions): void;
7
8
  insertColumn(editor: Editor, count?: number, at?: number, optionsParam?: TableOptions): void;
@@ -20,4 +21,5 @@ export declare const TableEditor: {
20
21
  clearMark(editor: TheEditor): boolean;
21
22
  handleSelectedCells(editor: TheEditor, handle: (cellPath: Path, cellRange: Range) => void): boolean;
22
23
  isActiveHeader(editor: TheEditor): boolean;
24
+ selectOriginCell(editor: TheEditor, table: TableElement, rowIndex: number, columnIndex: number, isStart: boolean): void;
23
25
  };
@@ -7,5 +7,5 @@ export interface CellRect {
7
7
  }
8
8
  export declare function calcSpanForRow(table: TableElement, targetIndex: number): boolean[];
9
9
  export declare function calcSpanForColumn(table: TableElement, targetIndex: number): boolean[];
10
- export declare function calcOriginSpan(table: TableElement, targetRowIndex: number, targetColumnIndex: number): TableCellElement;
10
+ export declare function getOriginCell(table: TableElement, targetRowIndex: number, targetColumnIndex: number): TableCellElement;
11
11
  export declare function isInside(cellRect: CellRect, rowIndex: number, columnIndex: number): boolean;
@@ -0,0 +1,2 @@
1
+ import { TableElement } from "../../../custom-types";
2
+ export declare const normalizeTable: (table: TableElement) => TableElement;
@@ -27,6 +27,8 @@ export declare class TheContextService {
27
27
  constructor(ngZone: NgZone);
28
28
  initialize(options: TheContextOptions): void;
29
29
  getOptions(): TheContextOptions;
30
+ getEditableElement(): Element;
31
+ getFirstElementChild(): HTMLElement;
30
32
  setUploadFileList(file: {
31
33
  url: string;
32
34
  file: File;
@@ -12,9 +12,9 @@ $thy-icon-nav-link-margin-right: 5px;
12
12
 
13
13
  .the-editable-container {
14
14
  padding: 0;
15
+ margin: 0;
15
16
 
16
17
  &.max-height {
17
- padding: 0;
18
18
  overflow-y: auto;
19
19
  overflow-x: hidden;
20
20
  }
@@ -54,10 +54,10 @@ $thy-icon-nav-link-margin-right: 5px;
54
54
 
55
55
  .the-editable-container {
56
56
  position: relative;
57
+ padding-top: 41px;
58
+ margin-top: -41px;
57
59
 
58
60
  &.max-height {
59
- padding-top: 41px;
60
- margin-top: -41px;
61
61
  overflow-y: scroll;
62
62
  }
63
63
  }
package/styles/typo.scss CHANGED
@@ -77,7 +77,7 @@ $selection-background: rgba($color: $primary, $alpha: 0.3);
77
77
  margin-right: 0;
78
78
  color: $gray-600;
79
79
  padding-left: 10px !important;
80
- border-left: 4px solid #eee;
80
+ border-left: 4px solid $gray-200;
81
81
  }
82
82
 
83
83
  .the-hr {
@@ -88,7 +88,7 @@ $selection-background: rgba($color: $primary, $alpha: 0.3);
88
88
  hr {
89
89
  box-sizing: border-box;
90
90
  width: 100%;
91
- border-top: 1px solid #eee;
91
+ border-top: 1px solid $gray-200;
92
92
  padding: 0;
93
93
  margin: 0;
94
94
  }
@@ -177,6 +177,9 @@ $selection-background: rgba($color: $primary, $alpha: 0.3);
177
177
  margin-right: 0;
178
178
  }
179
179
  }
180
+ .remove-link.thy-icon-nav-link:hover {
181
+ color: $danger;
182
+ }
180
183
 
181
184
  @for $i from 1 through 24 {
182
185
  .indent-#{$i * 2} {
@@ -0,0 +1,2 @@
1
+ export declare const IS_MAC: boolean;
2
+ export declare const CONTROL_KEY: string;
package/utils/index.d.ts CHANGED
@@ -2,3 +2,4 @@ export * from './data-transform';
2
2
  export * from './weak-maps';
3
3
  export * from './get-toolbar-class';
4
4
  export * from './create-empty-paragraph';
5
+ export * from './common';