@worktile/theia 1.2.16 → 1.2.18
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 +324 -139
- package/bundles/worktile-theia.umd.js.map +1 -1
- package/constants/code.d.ts +3 -3
- package/constants/node-types.d.ts +2 -1
- package/custom-types.d.ts +3 -1
- package/editor.module.d.ts +43 -39
- package/esm2015/components/text/text.component.js +7 -2
- package/esm2015/constants/code.js +2 -2
- package/esm2015/constants/node-types.js +4 -2
- package/esm2015/constants/toolbar.js +2 -1
- package/esm2015/custom-types.js +1 -1
- package/esm2015/editor.component.js +1 -1
- package/esm2015/editor.module.js +14 -5
- package/esm2015/plugins/code/code.component.js +76 -33
- package/esm2015/plugins/code/code.editor.js +3 -9
- package/esm2015/plugins/font-size/options.js +11 -0
- package/esm2015/plugins/font-size/toolbar-item.component.js +129 -0
- package/esm2015/plugins/index.js +3 -1
- package/esm2015/queries/is-empty-content.js +2 -2
- package/fesm2015/worktile-theia.js +285 -108
- package/fesm2015/worktile-theia.js.map +1 -1
- package/package.json +1 -1
- package/plugins/code/code.component.d.ts +17 -5
- package/plugins/code/code.component.scss +46 -7
- package/plugins/code/code.editor.d.ts +3 -2
- package/plugins/font-size/options.d.ts +3 -0
- package/plugins/font-size/toolbar-item.component.d.ts +35 -0
- package/plugins/font-size/toolbar-item.component.scss +13 -0
- package/queries/get-selection-marks.d.ts +1 -0
- package/styles/editor.scss +6 -0
- package/styles/index.scss +1 -0
- package/styles/typo.scss +8 -23
- package/transforms/set-marks.d.ts +1 -0
package/package.json
CHANGED
|
@@ -2,24 +2,29 @@ import { ElementRef, ChangeDetectorRef, OnInit, AfterViewInit, NgZone } from '@a
|
|
|
2
2
|
import { ThyNotifyService } from 'ngx-tethys/notify';
|
|
3
3
|
import { Editor } from 'slate';
|
|
4
4
|
import { CodeMirrorComponent } from 'ng-codemirror';
|
|
5
|
-
import { DropdownMode,
|
|
5
|
+
import { DropdownMode, TheCodeConfig, ToolbarItemMode } from '../../constants';
|
|
6
6
|
import { DefaultToolbarItem, TheBaseElementComponent } from '../../interfaces';
|
|
7
7
|
import { CodeElement } from '../../custom-types';
|
|
8
|
+
import { ThyResizeEvent } from 'ngx-tethys/resizable';
|
|
8
9
|
import * as i0 from "@angular/core";
|
|
9
10
|
export declare class TheCodeComponent extends TheBaseElementComponent<CodeElement, Editor> implements OnInit, AfterViewInit {
|
|
10
11
|
elementRef: ElementRef;
|
|
11
12
|
cdr: ChangeDetectorRef;
|
|
12
13
|
private thyNotifyService;
|
|
13
14
|
private ngZone;
|
|
14
|
-
private
|
|
15
|
+
private config;
|
|
15
16
|
startRenderCodemirror: boolean;
|
|
16
17
|
dropdownMode: typeof DropdownMode;
|
|
17
|
-
maxHeight: number;
|
|
18
18
|
codeMirrorFocused: boolean;
|
|
19
|
+
maxHeight: number;
|
|
19
20
|
menus: {
|
|
20
21
|
key: string;
|
|
21
22
|
name: string;
|
|
22
23
|
}[];
|
|
24
|
+
ToolbarItemMode: typeof ToolbarItemMode;
|
|
25
|
+
isAutoWrap: boolean;
|
|
26
|
+
isResizing: boolean;
|
|
27
|
+
resizeHeight: number;
|
|
23
28
|
options: {
|
|
24
29
|
mode: string;
|
|
25
30
|
lineNumbers: boolean;
|
|
@@ -32,19 +37,26 @@ export declare class TheCodeComponent extends TheBaseElementComponent<CodeElemen
|
|
|
32
37
|
actives: DefaultToolbarItem;
|
|
33
38
|
get code(): string;
|
|
34
39
|
codemirror: CodeMirrorComponent;
|
|
40
|
+
handleCodeMousedown(event: MouseEvent): void;
|
|
35
41
|
onContextChange(): void;
|
|
36
|
-
constructor(elementRef: ElementRef, cdr: ChangeDetectorRef, thyNotifyService: ThyNotifyService, ngZone: NgZone,
|
|
42
|
+
constructor(elementRef: ElementRef, cdr: ChangeDetectorRef, thyNotifyService: ThyNotifyService, ngZone: NgZone, config: TheCodeConfig);
|
|
37
43
|
ngOnInit(): void;
|
|
38
44
|
ngAfterViewInit(): void;
|
|
45
|
+
focusChange(codeMirrorFocused: boolean): void;
|
|
39
46
|
renderCodemirror(): void;
|
|
40
47
|
initializeCodemirrorFocus(): void;
|
|
41
48
|
codeChange($event: any): void;
|
|
42
|
-
focusChange(codeMirrorFocused: boolean): void;
|
|
43
49
|
onDelete(event: MouseEvent): void;
|
|
44
50
|
onCopy(event: MouseEvent): void;
|
|
45
51
|
onChangeLangulage: (item: any) => void;
|
|
46
52
|
useMode(): void;
|
|
53
|
+
useAutoWrap(): void;
|
|
54
|
+
useHeight(): void;
|
|
47
55
|
useReadonly(): void;
|
|
56
|
+
onResize({ height }: ThyResizeEvent): void;
|
|
57
|
+
onStartResize(): void;
|
|
58
|
+
onEndResize(): void;
|
|
59
|
+
onChangeWrap(value: boolean): void;
|
|
48
60
|
static ɵfac: i0.ɵɵFactoryDeclaration<TheCodeComponent, never>;
|
|
49
61
|
static ɵcmp: i0.ɵɵComponentDeclaration<TheCodeComponent, "div[theCode]", never, {}, {}, never, never>;
|
|
50
62
|
}
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
@import '~ng-codemirror/index.scss';
|
|
2
2
|
|
|
3
3
|
.the-code-container {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
.CodeMirror {
|
|
9
|
-
height: auto;
|
|
4
|
+
.resize-code-container{
|
|
5
|
+
display: block;
|
|
6
|
+
font-size: 14px;
|
|
7
|
+
position: relative;
|
|
10
8
|
counter-reset: codeblock-lm;
|
|
11
9
|
border: 1px solid $gray-300;
|
|
12
10
|
border-radius: 2px;
|
|
13
11
|
color: $gray-600;
|
|
14
12
|
background: rgba(243, 243, 243, 0.8);
|
|
13
|
+
}
|
|
14
|
+
.CodeMirror {
|
|
15
|
+
height: 100% !important;
|
|
15
16
|
z-index: 0;
|
|
17
|
+
color: $gray-600;
|
|
18
|
+
background: transparent;
|
|
19
|
+
border: none;
|
|
16
20
|
|
|
17
21
|
.CodeMirror-gutters {
|
|
18
22
|
border-right: none;
|
|
@@ -30,7 +34,34 @@
|
|
|
30
34
|
}
|
|
31
35
|
.ng-codemirror-wrapper {
|
|
32
36
|
display: block;
|
|
33
|
-
overflow:
|
|
37
|
+
overflow: scroll;
|
|
38
|
+
position: relative;
|
|
39
|
+
height: 100%;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.code-resize-icon.thy-resizable-handle-bottom{
|
|
43
|
+
cursor: row-resize;
|
|
44
|
+
height: 8px;
|
|
45
|
+
width: 45px;
|
|
46
|
+
left: 50%;
|
|
47
|
+
transform: translateX(-50%);
|
|
48
|
+
background: $gray-300;
|
|
49
|
+
bottom: -5px;
|
|
50
|
+
border-radius: 5px;
|
|
51
|
+
position: absolute;
|
|
52
|
+
&::before, &:after{
|
|
53
|
+
content: '';
|
|
54
|
+
position: absolute;
|
|
55
|
+
width: 34px;
|
|
56
|
+
height: 1px;
|
|
57
|
+
background: $white;
|
|
58
|
+
left: 50%;
|
|
59
|
+
transform: translateX(-50%);
|
|
60
|
+
top: 2px;
|
|
61
|
+
}
|
|
62
|
+
&:after{
|
|
63
|
+
top: 5px;
|
|
64
|
+
}
|
|
34
65
|
}
|
|
35
66
|
|
|
36
67
|
@include the-toolbar-active();
|
|
@@ -39,5 +70,13 @@
|
|
|
39
70
|
padding: 0;
|
|
40
71
|
width: 100px;
|
|
41
72
|
}
|
|
73
|
+
|
|
74
|
+
.auto-wrap{
|
|
75
|
+
padding-left: 8px;
|
|
76
|
+
.auto-wrap-btn{
|
|
77
|
+
margin-left: 5px;
|
|
78
|
+
transform: scale(0.8);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
42
81
|
}
|
|
43
82
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Editor } from 'slate';
|
|
2
2
|
import { CodeElement } from '../../custom-types';
|
|
3
3
|
export declare const CodeEditor: {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
setCodeAttribute(editor: Editor, element: CodeElement, value: {
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
}): void;
|
|
6
7
|
insertCode(editor: Editor): void;
|
|
7
8
|
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ElementRef, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';
|
|
2
|
+
import { Editor } from 'slate';
|
|
3
|
+
import { ToolbarItem } from '../../interfaces/toolbar';
|
|
4
|
+
import { TheToolbarBaseItemComponent } from '../../components/toolbar-base-item/toolbar-base-item.component';
|
|
5
|
+
import { ThyPopover, ThyPopoverRef } from 'ngx-tethys/popover';
|
|
6
|
+
import { Overlay } from '@angular/cdk/overlay';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
export declare class TheFontSizeToolbarItemComponent extends TheToolbarBaseItemComponent implements OnInit {
|
|
9
|
+
elementRef: ElementRef;
|
|
10
|
+
private thyPopover;
|
|
11
|
+
private viewContainerRef;
|
|
12
|
+
private overlay;
|
|
13
|
+
editor: Editor;
|
|
14
|
+
item: ToolbarItem;
|
|
15
|
+
activeSize: number | string;
|
|
16
|
+
fontSizes: number[];
|
|
17
|
+
disabled: boolean;
|
|
18
|
+
disableGroup: (import("../../constants/node-types").ElementKinds.image | import("../../constants/node-types").ElementKinds.paragraph | import("../../constants/node-types").ElementKinds.heading_1 | import("../../constants/node-types").ElementKinds.heading_2 | import("../../constants/node-types").ElementKinds.heading_3 | import("../../constants/node-types").ElementKinds.heading_4 | import("../../constants/node-types").ElementKinds.heading_5 | import("../../constants/node-types").ElementKinds.heading_6 | import("../../constants/node-types").ElementKinds.numberedList | import("../../constants/node-types").ElementKinds.bulletedList | import("../../constants/node-types").ElementKinds.listItem | import("../../constants/node-types").ElementKinds.checkItem | import("../../constants/node-types").ElementKinds.table | import("../../constants/node-types").ElementKinds.tableRow | import("../../constants/node-types").ElementKinds.tableCell | import("../../constants/node-types").ElementKinds.code | import("../../constants/node-types").ElementKinds.blockquote | import("../../constants/node-types").ElementKinds.hr | import("../../constants/node-types").ElementKinds.link)[];
|
|
19
|
+
dropdownPopoverRef: ThyPopoverRef<any>;
|
|
20
|
+
get isOpen(): boolean;
|
|
21
|
+
dropdownTemplate: TemplateRef<any>;
|
|
22
|
+
toolbarItemContainer: boolean;
|
|
23
|
+
fontSizeToolbarItem: boolean;
|
|
24
|
+
get disableClass(): boolean;
|
|
25
|
+
toggleDropdown(event: MouseEvent): void;
|
|
26
|
+
handleDocumentMouseDown(event: MouseEvent): void;
|
|
27
|
+
constructor(elementRef: ElementRef, thyPopover: ThyPopover, viewContainerRef: ViewContainerRef, overlay: Overlay);
|
|
28
|
+
ngOnInit(): void;
|
|
29
|
+
statusChange(editor: Editor): void;
|
|
30
|
+
itemMousedown(event: MouseEvent, size: number): void;
|
|
31
|
+
openDropdownPopover(): void;
|
|
32
|
+
closeDropdownPopover(): void;
|
|
33
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TheFontSizeToolbarItemComponent, never>;
|
|
34
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<TheFontSizeToolbarItemComponent, "the-font-size-toolbar-item", never, { "editor": "editor"; "item": "item"; }, {}, never, never>;
|
|
35
|
+
}
|
package/styles/editor.scss
CHANGED
|
@@ -126,6 +126,12 @@ $thy-icon-nav-link-margin-right: 5px;
|
|
|
126
126
|
text-indent: 0;
|
|
127
127
|
color: $gray-700;
|
|
128
128
|
}
|
|
129
|
+
|
|
130
|
+
@each $size in 12, 13, 14, 15, 16, 19, 22, 24, 29, 32, 40, 48 {
|
|
131
|
+
[the-font-size="#{$size}"] {
|
|
132
|
+
font-size: #{$size}px;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
129
135
|
}
|
|
130
136
|
|
|
131
137
|
.the-nav-split-line {
|
package/styles/index.scss
CHANGED
|
@@ -18,3 +18,4 @@
|
|
|
18
18
|
@import '../plugins/quick-insert/components/quick-insert.component.scss';
|
|
19
19
|
@import '../plugins/quick-insert/components/quick-toolbar/quick-toolbar.component.scss';
|
|
20
20
|
@import '../plugins/placeholder/placeholder.component.scss';
|
|
21
|
+
@import '../plugins/font-size/toolbar-item.component.scss';
|
package/styles/typo.scss
CHANGED
|
@@ -1,32 +1,26 @@
|
|
|
1
1
|
@use 'sass:math';
|
|
2
|
-
|
|
3
2
|
$default-text-space: 10px; // text white space 18(distance between paragrahp) - 8(block margin)
|
|
4
|
-
|
|
5
3
|
$headline-one-size: 28px;
|
|
6
4
|
$headline-two-size: 24px;
|
|
7
5
|
$headline-three-size: 20px;
|
|
8
6
|
$headline-four-size: 18px;
|
|
9
7
|
$headline-five-size: 16px;
|
|
10
|
-
|
|
11
8
|
$headline-one-lineHeight: 40px;
|
|
12
9
|
$headline-two-lineHeight: 38px;
|
|
13
10
|
$headline-three-lineHeight: 34px;
|
|
14
11
|
$headline-four-lineHeight: 30px;
|
|
15
12
|
$headline-five-lineHeight: 28px;
|
|
16
13
|
$headline-six-lineHeight: 26px;
|
|
17
|
-
|
|
18
14
|
$the-font-size-base: 14px;
|
|
19
15
|
$block-mb: 8px;
|
|
20
16
|
$block-line-heith: 24px;
|
|
21
17
|
$nav-item-margin: 5px;
|
|
22
18
|
$selection-background: rgba($color: $primary, $alpha: 0.3);
|
|
23
|
-
|
|
24
19
|
.the-editor-typo {
|
|
25
20
|
font-size: $the-font-size-base;
|
|
26
21
|
min-height: 140px;
|
|
27
22
|
padding: 28px 30px;
|
|
28
23
|
word-break: break-all;
|
|
29
|
-
|
|
30
24
|
h1,
|
|
31
25
|
h2,
|
|
32
26
|
h3,
|
|
@@ -59,7 +53,6 @@ $selection-background: rgba($color: $primary, $alpha: 0.3);
|
|
|
59
53
|
line-height: $headline-six-lineHeight;
|
|
60
54
|
font-size: $the-font-size-base;
|
|
61
55
|
}
|
|
62
|
-
|
|
63
56
|
// margin
|
|
64
57
|
ul,
|
|
65
58
|
ol,
|
|
@@ -68,10 +61,12 @@ $selection-background: rgba($color: $primary, $alpha: 0.3);
|
|
|
68
61
|
padding: 0;
|
|
69
62
|
li {
|
|
70
63
|
margin-left: 2em;
|
|
71
|
-
margin-bottom:
|
|
64
|
+
margin-bottom: math.div($block-mb, 2);
|
|
65
|
+
&:last-child {
|
|
66
|
+
margin-bottom: 0;
|
|
67
|
+
}
|
|
72
68
|
}
|
|
73
69
|
}
|
|
74
|
-
|
|
75
70
|
blockquote {
|
|
76
71
|
margin-left: 0;
|
|
77
72
|
margin-right: 0;
|
|
@@ -79,7 +74,6 @@ $selection-background: rgba($color: $primary, $alpha: 0.3);
|
|
|
79
74
|
padding-left: 10px !important;
|
|
80
75
|
border-left: 4px solid $gray-200;
|
|
81
76
|
}
|
|
82
|
-
|
|
83
77
|
.the-hr {
|
|
84
78
|
border: 1px solid transparent;
|
|
85
79
|
padding: 18px 0;
|
|
@@ -98,13 +92,9 @@ $selection-background: rgba($color: $primary, $alpha: 0.3);
|
|
|
98
92
|
cursor: text;
|
|
99
93
|
}
|
|
100
94
|
}
|
|
101
|
-
|
|
102
95
|
&.pointer-paint {
|
|
103
|
-
cursor: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAUCAYAAACTQC2+AAAABGdBTUEAALGPC/xhBQAAATtJREFUSA3dlTFLA0EQhU+jlSkEG63EYGdlZZFG7QUbSyG/QP/C/Q0rqzQWQX+BwUKwtrexEFRQtFSI35NZWDa3soOHhQ8eM/v2zWw2N9xVVVUdwXUYoFxaq5il2wa8hvtG5dJaxYx16xFvLN8i3lmehiFC6Y94wbsTGsxZosajKA/7aewjrKZiyTocJO9DSYHT82r+YXyQs0eRfYBrD/Y1DB58OMyfeM/hrWq8N9qlZkmFBXiPPd6D7ikWUxwjrKWirTeJkzDeNYttKIxhDUuxiFGjfAnfMkUX3hs19emYqFt9P48mU6zVLEQPFjCfwgk8gyuwEd6pS5t0EQYmHhCXLZ8Kvz1oqmFO+H8HxVOXfZC5vwNd46y3xbx5ni1mQ4+dJ6NyDw4xX0GN9484YfcRhg+fcmmt408+5V99wSyVTWN94gAAAABJRU5ErkJggg==)
|
|
104
|
-
5 10,
|
|
105
|
-
text;
|
|
96
|
+
cursor: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAUCAYAAACTQC2+AAAABGdBTUEAALGPC/xhBQAAATtJREFUSA3dlTFLA0EQhU+jlSkEG63EYGdlZZFG7QUbSyG/QP/C/Q0rqzQWQX+BwUKwtrexEFRQtFSI35NZWDa3soOHhQ8eM/v2zWw2N9xVVVUdwXUYoFxaq5il2wa8hvtG5dJaxYx16xFvLN8i3lmehiFC6Y94wbsTGsxZosajKA/7aewjrKZiyTocJO9DSYHT82r+YXyQs0eRfYBrD/Y1DB58OMyfeM/hrWq8N9qlZkmFBXiPPd6D7ikWUxwjrKWirTeJkzDeNYttKIxhDUuxiFGjfAnfMkUX3hs19emYqFt9P48mU6zVLEQPFjCfwgk8gyuwEd6pS5t0EQYmHhCXLZ8Kvz1oqmFO+H8HxVOXfZC5vwNd46y3xbx5ni1mQ4+dJ6NyDw4xX0GN9484YfcRhg+fcmmt408+5V99wSyVTWN94gAAAABJRU5ErkJggg==) 5 10, text;
|
|
106
97
|
}
|
|
107
|
-
|
|
108
98
|
code {
|
|
109
99
|
margin: 0 4px;
|
|
110
100
|
padding: 2px 3px;
|
|
@@ -118,7 +108,6 @@ $selection-background: rgba($color: $primary, $alpha: 0.3);
|
|
|
118
108
|
text-indent: 0;
|
|
119
109
|
color: $gray-700;
|
|
120
110
|
}
|
|
121
|
-
|
|
122
111
|
.slate-element-hr,
|
|
123
112
|
.slate-element-code,
|
|
124
113
|
.slate-element-image,
|
|
@@ -131,7 +120,6 @@ $selection-background: rgba($color: $primary, $alpha: 0.3);
|
|
|
131
120
|
height: auto !important;
|
|
132
121
|
}
|
|
133
122
|
}
|
|
134
|
-
|
|
135
123
|
.slate-block-card {
|
|
136
124
|
.card-left,
|
|
137
125
|
.card-right {
|
|
@@ -144,7 +132,6 @@ $selection-background: rgba($color: $primary, $alpha: 0.3);
|
|
|
144
132
|
bottom: 15px;
|
|
145
133
|
}
|
|
146
134
|
}
|
|
147
|
-
|
|
148
135
|
&.slate-block-card-hr {
|
|
149
136
|
.card-left,
|
|
150
137
|
.card-right {
|
|
@@ -152,7 +139,6 @@ $selection-background: rgba($color: $primary, $alpha: 0.3);
|
|
|
152
139
|
}
|
|
153
140
|
}
|
|
154
141
|
}
|
|
155
|
-
|
|
156
142
|
.slate-element-table-content,
|
|
157
143
|
.slate-element-paragraph {
|
|
158
144
|
line-height: $block-line-heith;
|
|
@@ -164,11 +150,11 @@ $selection-background: rgba($color: $primary, $alpha: 0.3);
|
|
|
164
150
|
.CodeMirror-focused .CodeMirror-selected {
|
|
165
151
|
background: $selection-background;
|
|
166
152
|
}
|
|
167
|
-
|
|
153
|
+
::-moz-selection {
|
|
168
154
|
/* Code for Firefox */
|
|
169
155
|
background: $selection-background;
|
|
170
156
|
}
|
|
171
|
-
|
|
157
|
+
::selection {
|
|
172
158
|
background: $selection-background;
|
|
173
159
|
}
|
|
174
160
|
.thy-icon-nav .thy-icon-nav-link {
|
|
@@ -180,10 +166,9 @@ $selection-background: rgba($color: $primary, $alpha: 0.3);
|
|
|
180
166
|
.remove-link.thy-icon-nav-link:hover {
|
|
181
167
|
color: $danger;
|
|
182
168
|
}
|
|
183
|
-
|
|
184
169
|
@for $i from 1 through 24 {
|
|
185
170
|
.indent-#{$i * 2} {
|
|
186
171
|
margin-left: 2em * $i;
|
|
187
172
|
}
|
|
188
173
|
}
|
|
189
|
-
}
|
|
174
|
+
}
|