@worktile/theia 2.0.1 → 2.1.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@worktile/theia",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "description": "theia editor",
5
5
  "author": "YanDong <nanianqiumo@foxmail.com>",
6
6
  "homepage": "https://github.com/atinc/theia#readme",
@@ -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, TheCodeMode } from '../../constants';
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';
9
+ import { TheContextService } from '../../services/context.service';
8
10
  import * as i0 from "@angular/core";
9
11
  export declare class TheCodeComponent extends TheBaseElementComponent<CodeElement, Editor> implements OnInit, AfterViewInit {
10
12
  elementRef: ElementRef;
11
13
  cdr: ChangeDetectorRef;
12
14
  private thyNotifyService;
15
+ private contextService;
13
16
  private ngZone;
14
17
  private config;
15
18
  startRenderCodemirror: boolean;
16
19
  dropdownMode: typeof DropdownMode;
17
20
  maxHeight: number;
18
- codeMirrorFocused: boolean;
19
21
  menus: {
20
22
  key: string;
21
23
  name: string;
22
24
  }[];
25
+ ToolbarItemMode: typeof ToolbarItemMode;
26
+ isFocusCode: boolean;
27
+ resizeHeight: number;
23
28
  options: {
24
29
  mode: string;
25
30
  lineNumbers: boolean;
@@ -30,21 +35,27 @@ export declare class TheCodeComponent extends TheBaseElementComponent<CodeElemen
30
35
  cursorBlinkRate: number;
31
36
  };
32
37
  actives: DefaultToolbarItem;
38
+ resizeBounds: any;
33
39
  get code(): string;
34
40
  codemirror: CodeMirrorComponent;
35
41
  onContextChange(): void;
36
- constructor(elementRef: ElementRef, cdr: ChangeDetectorRef, thyNotifyService: ThyNotifyService, ngZone: NgZone, config: TheCodeMode);
42
+ constructor(elementRef: ElementRef, cdr: ChangeDetectorRef, thyNotifyService: ThyNotifyService, contextService: TheContextService, ngZone: NgZone, config: TheCodeConfig);
37
43
  ngOnInit(): void;
38
44
  ngAfterViewInit(): void;
39
45
  renderCodemirror(): void;
40
46
  initializeCodemirrorFocus(): void;
41
47
  codeChange($event: any): void;
42
- focusChange(codeMirrorFocused: boolean): void;
43
48
  onDelete(event: MouseEvent): void;
44
49
  onCopy(event: MouseEvent): void;
50
+ focusChange(codeMirrorFocused: boolean): 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
+ onEndResize(): void;
58
+ onChangeWrap(value: boolean): void;
48
59
  static ɵfac: i0.ɵɵFactoryDeclaration<TheCodeComponent, never>;
49
60
  static ɵcmp: i0.ɵɵComponentDeclaration<TheCodeComponent, "div[theCode]", never, {}, {}, never, never>;
50
61
  }
@@ -1,18 +1,22 @@
1
1
  @import '~ng-codemirror/index.scss';
2
2
 
3
3
  .the-code-container {
4
- display: block;
5
- font-size: 14px;
6
- position: relative;
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: hidden;
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
- setLanguage(editor: Editor, language: string, element: CodeElement): void;
5
- setCodeContent(editor: Editor, content: string, element: CodeElement): void;
4
+ setCodeAttribute(editor: Editor, element: CodeElement, value: {
5
+ [key: string]: unknown;
6
+ }): void;
6
7
  insertCode(editor: Editor): void;
7
8
  };
@@ -0,0 +1,3 @@
1
+ import { ToolbarItem } from '../../interfaces/toolbar';
2
+ export declare const FontSizes: number[];
3
+ export declare const FontSizeOptions: ToolbarItem[];
@@ -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
+ }
@@ -0,0 +1,24 @@
1
+ .the-font-size-toolbar-item {
2
+ width: 45px;
3
+
4
+ &.disabled {
5
+ cursor: not-allowed;
6
+ opacity: 0.25;
7
+
8
+
9
+ .thy-icon-nav-link {
10
+ pointer-events: none;
11
+ }
12
+ }
13
+ }
14
+ .the-toolbar-dropdown-popover.font-size {
15
+ .thy-popover-container {
16
+ min-width: 90px;
17
+ }
18
+ .dropdown {
19
+ width: 90px;
20
+ }
21
+ .action-menu-item {
22
+ text-align: center;
23
+ }
24
+ }
@@ -8,4 +8,5 @@ export declare const getSelectionMarks: (editor: Editor) => {
8
8
  color?: any;
9
9
  "background-color"?: any;
10
10
  "code-line"?: any;
11
+ "font-size"?: any;
11
12
  };
@@ -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 {
@@ -183,13 +189,14 @@ $thy-icon-nav-link-margin-right: 5px;
183
189
  box-shadow: $box-shadow;
184
190
  }
185
191
 
186
- .the-block-operation {
192
+ .the-code-block-operation {
187
193
  @include the-toolbar-layout();
188
194
  display: flex;
189
195
  transform: translateY(-100%);
190
196
  left: 0;
191
197
  top: -10px;
192
198
  z-index: 10;
199
+ min-width: 306px;
193
200
  .thy-select-custom {
194
201
  width: 115px;
195
202
  .form-control {
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';
@@ -8,4 +8,5 @@ export declare const setMarks: (editor: Editor, marks: {
8
8
  color?: any;
9
9
  "background-color"?: any;
10
10
  "code-line"?: any;
11
+ "font-size"?: any;
11
12
  }, at?: Path | Point | Range) => void;