@worktile/theia 1.2.11 → 1.2.15
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/bundles/worktile-theia.umd.js +230 -135
- package/bundles/worktile-theia.umd.js.map +1 -1
- package/components/column-resize/column-resize.directive.d.ts +3 -3
- package/components/inline-toolbar/inline-toolbar.component.d.ts +3 -1
- package/components/inline-toolbar/inline-toolbar.component.scss +6 -5
- package/components/toolbar/toolbar.component.d.ts +2 -1
- package/constants/default.d.ts +0 -1
- package/custom-types.d.ts +2 -0
- package/editor.component.d.ts +2 -0
- package/esm2015/components/column-resize/column-resize.directive.js +1 -1
- package/esm2015/components/inline-toolbar/inline-toolbar.component.js +10 -7
- package/esm2015/components/toolbar/toolbar.component.js +7 -6
- package/esm2015/components/toolbar-group/toolbar-group.component.js +1 -1
- package/esm2015/components/toolbar-item/toolbar-item.component.js +7 -3
- package/esm2015/constants/default.js +1 -2
- package/esm2015/custom-types.js +1 -1
- package/esm2015/editor.component.js +28 -14
- package/esm2015/interfaces/editor.js +1 -1
- package/esm2015/interfaces/toolbar.js +1 -1
- package/esm2015/plugins/deserializers/deserialize-html.plugin.js +12 -4
- package/esm2015/plugins/deserializers/deserialize-md.plugin.js +8 -3
- package/esm2015/plugins/index.js +14 -2
- package/esm2015/plugins/mark/options.js +6 -1
- package/esm2015/plugins/paint-format/options.js +4 -1
- package/esm2015/plugins/placeholder/placeholder.component.js +21 -14
- package/esm2015/plugins/quick-insert/components/quick-insert.component.js +7 -6
- package/esm2015/plugins/quick-insert/quick-insert.plugint.js +3 -2
- package/esm2015/plugins/soft-break/soft-break.plugin.js +18 -0
- package/esm2015/plugins/soft-break/soft-break.types.js +2 -0
- package/esm2015/plugins/table/table.plugin.js +34 -55
- package/esm2015/plugins/table/table.types.js +1 -1
- package/esm2015/plugins/table/utils/normalize-table.js +31 -0
- package/esm2015/queries/is-container-type.js +2 -2
- package/esm2015/services/context.service.js +10 -2
- package/esm2015/transforms/index.js +2 -3
- package/esm2015/utils/auto-focus.js +2 -2
- package/esm2015/utils/common.js +3 -0
- package/esm2015/utils/fragment.js +24 -2
- package/esm2015/utils/index.js +2 -1
- package/fesm2015/worktile-theia.js +221 -127
- package/fesm2015/worktile-theia.js.map +1 -1
- package/interfaces/editor.d.ts +2 -0
- package/interfaces/toolbar.d.ts +1 -0
- package/package.json +1 -1
- package/plugins/image/image.component.scss +172 -168
- package/plugins/placeholder/placeholder.component.d.ts +4 -2
- package/plugins/soft-break/soft-break.plugin.d.ts +4 -0
- package/plugins/soft-break/soft-break.types.d.ts +8 -0
- package/plugins/table/table.types.d.ts +7 -0
- package/plugins/table/utils/normalize-table.d.ts +2 -0
- package/services/context.service.d.ts +2 -0
- package/styles/editor.scss +3 -3
- package/styles/typo.scss +5 -2
- package/transforms/index.d.ts +1 -2
- package/utils/common.d.ts +2 -0
- package/utils/fragment.d.ts +5 -0
- package/utils/index.d.ts +1 -0
- package/esm2015/transforms/insert-elements.js +0 -22
- package/transforms/insert-elements.d.ts +0 -2
package/interfaces/editor.d.ts
CHANGED
package/interfaces/toolbar.d.ts
CHANGED
|
@@ -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,190 +1,194 @@
|
|
|
1
|
-
.image
|
|
2
|
-
|
|
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
|
-
.
|
|
10
|
-
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
.
|
|
55
|
-
|
|
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
|
-
.
|
|
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
|
-
|
|
123
|
-
left:
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
height:
|
|
136
|
-
|
|
137
|
-
|
|
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
|
-
.
|
|
140
|
-
|
|
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
|
-
.
|
|
148
|
+
.layer {
|
|
149
|
+
display: none;
|
|
154
150
|
position: absolute;
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
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
|
-
|
|
186
|
-
}
|
|
187
|
+
.image-container:hover .layer {
|
|
188
|
+
display: block;
|
|
189
|
+
}
|
|
187
190
|
|
|
188
|
-
.image-container:hover .layer.readonly {
|
|
189
|
-
|
|
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 {
|
|
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;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { InjectionToken } from '@angular/core';
|
|
2
2
|
import { ComponentType } from 'slate-angular';
|
|
3
|
+
import { TheBaseElementComponent } from '../../interfaces/view-base';
|
|
3
4
|
import { ElementKinds } from '../../constants/node-types';
|
|
4
5
|
import type { TheTableComponent } from './components/table.component';
|
|
5
6
|
export declare const TheTableToken: InjectionToken<ComponentType<TheTableComponent>>;
|
|
7
|
+
export interface TheTableComponentBase extends TheBaseElementComponent {
|
|
8
|
+
initializeColumns: () => void;
|
|
9
|
+
transformColumnsWidth: () => void;
|
|
10
|
+
initializeRows: () => void;
|
|
11
|
+
transformRowHeight: () => void;
|
|
12
|
+
}
|
|
6
13
|
export declare const BASE_CELL_HEIGHT = 41;
|
|
7
14
|
export declare const BASE_FILL_HEIGHT: number;
|
|
8
15
|
export declare const BASE_CELL_INNER_HEIGHT: number;
|
|
@@ -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;
|
package/styles/editor.scss
CHANGED
|
@@ -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
|
|
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
|
|
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} {
|
package/transforms/index.d.ts
CHANGED
|
@@ -13,8 +13,7 @@ import { unWrap } from './un-wrap';
|
|
|
13
13
|
import { splitNode } from './split-node';
|
|
14
14
|
import { deleteElement } from './delete-element';
|
|
15
15
|
import { setEndSelection } from './set-end-selection';
|
|
16
|
-
import { insertTheElements } from './insert-elements';
|
|
17
16
|
import { closeConversionHint } from './close-conversion-hint';
|
|
18
17
|
import { handleContinualDeleteBackward } from './handle-continual-delete-backward';
|
|
19
18
|
import { handleContinualInsertBreak } from './handle-continual-insert-break';
|
|
20
|
-
export { setMarks, clearMarks, insertElement, insertElementNext, insertParagraph, setNode, unwrapNodesByType, onKeyDownResetBlockType, moveChildren, applyDeepToNodes, mergeDeepToNodes, unWrap, splitNode, deleteElement, setEndSelection,
|
|
19
|
+
export { setMarks, clearMarks, insertElement, insertElementNext, insertParagraph, setNode, unwrapNodesByType, onKeyDownResetBlockType, moveChildren, applyDeepToNodes, mergeDeepToNodes, unWrap, splitNode, deleteElement, setEndSelection, closeConversionHint, handleContinualDeleteBackward, handleContinualInsertBreak };
|
package/utils/fragment.d.ts
CHANGED
|
@@ -3,3 +3,8 @@ export declare const getStartBlock: (editor: Editor, fragment: Element) => any;
|
|
|
3
3
|
export declare const getEndBlock: (editor: Editor, fragment: Element) => any;
|
|
4
4
|
export declare const extractFragment: (data: DataTransfer, deleteKey?: string) => import("@worktile/theia").CustomElement[];
|
|
5
5
|
export declare function deleteElementKey(nodes: Node[], key: string): Node[];
|
|
6
|
+
/**
|
|
7
|
+
* 删除 text 节点的 颜色/背景色
|
|
8
|
+
* @param node
|
|
9
|
+
*/
|
|
10
|
+
export declare function deleteColorAndBackgroundColorOfText(node: Element): void;
|
package/utils/index.d.ts
CHANGED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Editor, Range, Path, Transforms } from 'slate';
|
|
2
|
-
import * as TheQueries from '../queries';
|
|
3
|
-
export const insertTheElements = (editor, nodes) => {
|
|
4
|
-
if (Range.isExpanded(editor.selection)) {
|
|
5
|
-
Editor.deleteFragment(editor);
|
|
6
|
-
}
|
|
7
|
-
const isEmptyParagraph = TheQueries.isEmptyParagraph(editor, editor.selection.anchor);
|
|
8
|
-
const parentPath = Path.parent(editor.selection.anchor.path);
|
|
9
|
-
Editor.withoutNormalizing(editor, () => {
|
|
10
|
-
Transforms.insertNodes(editor, nodes);
|
|
11
|
-
if (parentPath.length && isEmptyParagraph) {
|
|
12
|
-
Transforms.delete(editor, { at: parentPath });
|
|
13
|
-
const lastPath = parentPath.pop();
|
|
14
|
-
Transforms.select(editor, Editor.end(editor, [...parentPath, lastPath + nodes.length - 1]));
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
const lastPath = parentPath.pop();
|
|
18
|
-
Transforms.select(editor, Editor.end(editor, [...parentPath, lastPath + nodes.length]));
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5zZXJ0LWVsZW1lbnRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcGFja2FnZXMvc3JjL3RyYW5zZm9ybXMvaW5zZXJ0LWVsZW1lbnRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxNQUFNLEVBQVcsS0FBSyxFQUFFLElBQUksRUFBRSxVQUFVLEVBQUUsTUFBTSxPQUFPLENBQUM7QUFDakUsT0FBTyxLQUFLLFVBQVUsTUFBTSxZQUFZLENBQUM7QUFFekMsTUFBTSxDQUFDLE1BQU0saUJBQWlCLEdBQUcsQ0FBQyxNQUFjLEVBQUUsS0FBZ0IsRUFBRSxFQUFFO0lBQ2xFLElBQUksS0FBSyxDQUFDLFVBQVUsQ0FBQyxNQUFNLENBQUMsU0FBUyxDQUFDLEVBQUU7UUFDcEMsTUFBTSxDQUFDLGNBQWMsQ0FBQyxNQUFNLENBQUMsQ0FBQztLQUNqQztJQUNELE1BQU0sZ0JBQWdCLEdBQUcsVUFBVSxDQUFDLGdCQUFnQixDQUFDLE1BQU0sRUFBRSxNQUFNLENBQUMsU0FBUyxDQUFDLE1BQU0sQ0FBQyxDQUFDO0lBQ3RGLE1BQU0sVUFBVSxHQUFHLElBQUksQ0FBQyxNQUFNLENBQUMsTUFBTSxDQUFDLFNBQVMsQ0FBQyxNQ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