@worktile/theia 2.1.2 → 2.1.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.
- package/bundles/worktile-theia.umd.js +23 -16
- package/bundles/worktile-theia.umd.js.map +1 -1
- package/constants/default.d.ts +0 -1
- package/esm2015/constants/default.js +1 -2
- package/esm2015/editor.component.js +6 -5
- package/esm2015/plugins/code/code.component.js +2 -2
- package/esm2015/plugins/deserializers/deserialize-md.plugin.js +2 -2
- package/esm2015/plugins/heading/heading.editor.js +3 -1
- package/esm2015/plugins/mark/mark.plugin.js +15 -10
- package/fesm2015/worktile-theia.js +24 -16
- package/fesm2015/worktile-theia.js.map +1 -1
- package/package.json +1 -1
- package/plugins/code/code.component.scss +1 -0
|
@@ -65,7 +65,6 @@ const PICTURE_ACCEPTED_UPLOAD_SIZE = 20;
|
|
|
65
65
|
const A_TAG_REL_ATTR = 'noopener noreferrer nofollow external ugc';
|
|
66
66
|
const LINK_DEFAULT_TEXT = '链接';
|
|
67
67
|
const TAB_SPACE = ' ';
|
|
68
|
-
const ZERO_WIDTH_CHAR = '\u200B';
|
|
69
68
|
const CLIPBOARD_FORMAT_KEY = 'x-theia-fragment';
|
|
70
69
|
const DEFAULT_SCROLL_CONTAINER = '.the-editable-container';
|
|
71
70
|
const ELEMENT_UNIQUE_ID = 'key';
|
|
@@ -2030,7 +2029,7 @@ const withDeserializeMd = (options) => (editor) => {
|
|
|
2030
2029
|
editor,
|
|
2031
2030
|
conversion: () => {
|
|
2032
2031
|
try {
|
|
2033
|
-
const html = marked(plainFragment, { gfm: true });
|
|
2032
|
+
const html = marked(plainFragment.replace(/\n```/g, "\n\n```"), { gfm: true });
|
|
2034
2033
|
const htmlDom = new DOMParser().parseFromString(html, 'text/html');
|
|
2035
2034
|
const fragment = TheiaConverter.convertToTheia(Array.from(htmlDom.body.children));
|
|
2036
2035
|
if (!isUnformatted(fragment)) {
|
|
@@ -3860,11 +3859,14 @@ const withMark = () => (editor) => {
|
|
|
3860
3859
|
delete marks[key];
|
|
3861
3860
|
editor.marks = marks;
|
|
3862
3861
|
const text = Editor.string(e, selection.anchor.path);
|
|
3863
|
-
if (text
|
|
3864
|
-
|
|
3862
|
+
if (text !== '') {
|
|
3863
|
+
Editor.setNormalizing(editor, false);
|
|
3864
|
+
e.insertText('');
|
|
3865
|
+
editor.marks = marks;
|
|
3866
|
+
Editor.setNormalizing(editor, true);
|
|
3865
3867
|
}
|
|
3866
|
-
|
|
3867
|
-
e.
|
|
3868
|
+
else {
|
|
3869
|
+
Transforms.unsetNodes(e, key, { at: selection.anchor.path });
|
|
3868
3870
|
}
|
|
3869
3871
|
if (shouldChange) {
|
|
3870
3872
|
editor.onChange();
|
|
@@ -3882,11 +3884,14 @@ const withMark = () => (editor) => {
|
|
|
3882
3884
|
const marks = Object.assign(Object.assign({}, (Editor.marks(e) || {})), { [key]: value });
|
|
3883
3885
|
editor.marks = marks;
|
|
3884
3886
|
const text = Editor.string(e, selection.anchor.path);
|
|
3885
|
-
if (text
|
|
3886
|
-
|
|
3887
|
+
if (text !== '') {
|
|
3888
|
+
Editor.setNormalizing(editor, false);
|
|
3889
|
+
e.insertText('');
|
|
3890
|
+
editor.marks = marks;
|
|
3891
|
+
Editor.setNormalizing(editor, true);
|
|
3887
3892
|
}
|
|
3888
|
-
|
|
3889
|
-
e.
|
|
3893
|
+
else {
|
|
3894
|
+
Transforms.setNodes(e, { [key]: value }, { at: selection.anchor.path });
|
|
3890
3895
|
}
|
|
3891
3896
|
}
|
|
3892
3897
|
}
|
|
@@ -5484,7 +5489,9 @@ const HeadingEditor = {
|
|
|
5484
5489
|
};
|
|
5485
5490
|
if (entry) {
|
|
5486
5491
|
setMarks(editor, unMarks, entry[1]);
|
|
5492
|
+
return;
|
|
5487
5493
|
}
|
|
5494
|
+
setMarks(editor, unMarks, editor.selection);
|
|
5488
5495
|
});
|
|
5489
5496
|
},
|
|
5490
5497
|
isHeadingActive(editor, heading) {
|
|
@@ -6545,7 +6552,7 @@ class TheCodeComponent extends TheBaseElementComponent {
|
|
|
6545
6552
|
}
|
|
6546
6553
|
}
|
|
6547
6554
|
TheCodeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheCodeComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1$4.ThyNotifyService }, { token: TheContextService }, { token: i0.NgZone }, { token: THE_CODE_MODE_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
|
|
6548
|
-
TheCodeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheCodeComponent, selector: "div[theCode]", viewQueries: [{ propertyName: "codemirror", first: true, predicate: ["codemirror"], descendants: true, read: CodeMirrorComponent }], usesInheritance: true, ngImport: i0, template: "<div contenteditable=\"false\" class=\"the-code-block-operation\" *ngIf=\"isFocusCode && !options.readOnly\">\n <thy-icon-nav>\n <the-toolbar-dropdown [menus]=\"menus\" [item]=\"actives\" [itemMousedownHandle]=\"onChangeLangulage\"> </the-toolbar-dropdown>\n <a\n href=\"javascript:;\"\n thyIconNavLink\n thyIconNavLinkIcon=\"copy\"\n thyTooltip=\"\u590D\u5236\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"onCopy($event)\"\n ></a>\n <a\n href=\"javascript:;\"\n thyIconNavLink\n thyIconNavLinkIcon=\"trash\"\n thyTooltip=\"\u5220\u9664\"\n class=\"remove-link\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"onDelete($event)\"\n ></a>\n <nav-split-line [mode]=\"ToolbarItemMode.vertical\"></nav-split-line>\n <span class=\"auto-wrap d-flex align-items-center\">\n <span>\u81EA\u52A8\u6362\u884C</span>\n <thy-switch\n class=\"auto-wrap-btn d-flex\"\n [(ngModel)]=\"options.lineWrapping\"\n (ngModelChange)=\"onChangeWrap($event)\"\n thySize=\"sm\"\n ></thy-switch>\n </span>\n </thy-icon-nav>\n</div>\n\n<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n<div\n thyResizable\n [thyMinHeight]=\"
|
|
6555
|
+
TheCodeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheCodeComponent, selector: "div[theCode]", viewQueries: [{ propertyName: "codemirror", first: true, predicate: ["codemirror"], descendants: true, read: CodeMirrorComponent }], usesInheritance: true, ngImport: i0, template: "<div contenteditable=\"false\" class=\"the-code-block-operation\" *ngIf=\"isFocusCode && !options.readOnly\">\n <thy-icon-nav>\n <the-toolbar-dropdown [menus]=\"menus\" [item]=\"actives\" [itemMousedownHandle]=\"onChangeLangulage\"> </the-toolbar-dropdown>\n <a\n href=\"javascript:;\"\n thyIconNavLink\n thyIconNavLinkIcon=\"copy\"\n thyTooltip=\"\u590D\u5236\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"onCopy($event)\"\n ></a>\n <a\n href=\"javascript:;\"\n thyIconNavLink\n thyIconNavLinkIcon=\"trash\"\n thyTooltip=\"\u5220\u9664\"\n class=\"remove-link\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"onDelete($event)\"\n ></a>\n <nav-split-line [mode]=\"ToolbarItemMode.vertical\"></nav-split-line>\n <span class=\"auto-wrap d-flex align-items-center\">\n <span>\u81EA\u52A8\u6362\u884C</span>\n <thy-switch\n class=\"auto-wrap-btn d-flex\"\n [(ngModel)]=\"options.lineWrapping\"\n (ngModelChange)=\"onChangeWrap($event)\"\n thySize=\"sm\"\n ></thy-switch>\n </span>\n </thy-icon-nav>\n</div>\n\n<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n<div\n thyResizable\n [thyMinHeight]=\"44\"\n [thyBounds]=\"resizeBounds\"\n [style.height.px]=\"resizeHeight\"\n (thyResize)=\"onResize($event)\"\n (thyResizeEnd)=\"onEndResize()\"\n class=\"resize-code-container\"\n>\n <ng-codemirror\n *ngIf=\"startRenderCodemirror\"\n #codemirror\n contenteditable=\"false\"\n class=\"ng-codemirror-wrapper\"\n [ngStyle]=\"{ maxHeight: maxHeight > 0 ? maxHeight + 'px' : 'auto' }\"\n [options]=\"options\"\n [ngModel]=\"code\"\n [delayRefreshTime]=\"300\"\n (ngModelChange)=\"codeChange($event)\"\n (focusChange)=\"focusChange($event)\"\n [autoMaxHeight]=\"maxHeight\"\n >\n </ng-codemirror>\n <thy-resize-handle thyDirection=\"bottom\" class=\"code-resize-icon\" *ngIf=\"isFocusCode && !options.readOnly\"></thy-resize-handle>\n</div>\n", components: [{ type: i3.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }, { type: TheToolbarDropdownComponent, selector: "the-toolbar-dropdown", inputs: ["toolbarItem", "menus", "mode", "item", "itemMousedownHandle"] }, { type: i3.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: NavSplitLineComponent, selector: "nav-split-line", inputs: ["mode"] }, { type: i6$1.ThySwitchComponent, selector: "thy-switch", inputs: ["thyType", "thySize", "thyDisabled"], outputs: ["thyChange"] }, { type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }, { type: i8.CodeMirrorComponent, selector: "ng-codemirror, [ngCodeMirror]", inputs: ["autoMaxHeight", "delayRefreshTime", "options"], outputs: ["focusChange"] }, { type: i9.ThyResizeHandleComponent, selector: "thy-resize-handle, [thy-resize-handle]", inputs: ["thyDirection"], outputs: ["thyMouseDown"], exportAs: ["thyResizeHandle"] }], directives: [{ type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5$1.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i4$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i9.ThyResizableDirective, selector: "[thyResizable]", inputs: ["thyBounds", "thyMaxHeight", "thyMaxWidth", "thyMinHeight", "thyMinWidth", "thyGridColumnCount", "thyMaxColumn", "thyMinColumn", "thyLockAspectRatio", "thyPreview", "thyDisabled"], outputs: ["thyResize", "thyResizeEnd", "thyResizeStart"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
6549
6556
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheCodeComponent, decorators: [{
|
|
6550
6557
|
type: Component,
|
|
6551
6558
|
args: [{
|
|
@@ -11797,14 +11804,14 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
|
|
|
11797
11804
|
return leaf ? leaf : null;
|
|
11798
11805
|
};
|
|
11799
11806
|
this.renderText = (text) => {
|
|
11800
|
-
if (text.text.length === 0) {
|
|
11801
|
-
return;
|
|
11802
|
-
}
|
|
11803
11807
|
for (const key in MarkTypes) {
|
|
11804
11808
|
if (text[MarkTypes[key]]) {
|
|
11805
11809
|
return TheTextComponent;
|
|
11806
11810
|
}
|
|
11807
11811
|
}
|
|
11812
|
+
if (text.text.length === 0) {
|
|
11813
|
+
return;
|
|
11814
|
+
}
|
|
11808
11815
|
};
|
|
11809
11816
|
this.onKeyDown = (event) => {
|
|
11810
11817
|
shortcuts(this.editor, event);
|
|
@@ -11946,7 +11953,7 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
|
|
|
11946
11953
|
}
|
|
11947
11954
|
}
|
|
11948
11955
|
toolbarCalculate() {
|
|
11949
|
-
var _a;
|
|
11956
|
+
var _a, _b;
|
|
11950
11957
|
const toolbar = (_a = this === null || this === void 0 ? void 0 : this.theOptions) === null || _a === void 0 ? void 0 : _a.toolbar;
|
|
11951
11958
|
const toolbarItems = toolbarCompose(toolbar === null || toolbar === void 0 ? void 0 : toolbar.toolbarItems);
|
|
11952
11959
|
const toolbarOption = this.toolbarService.initialize(toolbarItems, toolbar === null || toolbar === void 0 ? void 0 : toolbar.global, toolbar === null || toolbar === void 0 ? void 0 : toolbar.inline, toolbar === null || toolbar === void 0 ? void 0 : toolbar.quick);
|
|
@@ -11957,6 +11964,7 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
|
|
|
11957
11964
|
this.theGlobalToolbarInstance.toolbarItems = toolbarOption.toolbarEntity.global;
|
|
11958
11965
|
this.theGlobalToolbarInstance.containerClass = this.globalToolbarClass;
|
|
11959
11966
|
this.theGlobalToolbarInstance.align = toolbar === null || toolbar === void 0 ? void 0 : toolbar.align;
|
|
11967
|
+
this.theGlobalToolbarInstance.fontSize = (_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.fontSize;
|
|
11960
11968
|
this.theGlobalToolbarInstance.setToolbarClass();
|
|
11961
11969
|
this.theGlobalToolbarInstance.renderToolbarView();
|
|
11962
11970
|
}
|
|
@@ -12441,5 +12449,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
|
|
|
12441
12449
|
* Generated bundle index. Do not edit.
|
|
12442
12450
|
*/
|
|
12443
12451
|
|
|
12444
|
-
export { ALIGN_BLOCK_TYPES, A_TAG_REL_ATTR, AlignEditor, Alignment, BLOCK_DELETEBACKWARD_TYPES, BlockquoteEditor, CLIPBOARD_FORMAT_KEY, CODEMIRROR_PADDING_TOP, CODE_MODES, COMPONENTS, CONTAINER_BLOCKS, CONTROL_KEY, CodeEditor, CodeMode, ColorEditor, DEFAULT_LANGUAGE, DEFAULT_SCROLL_CONTAINER, DefaultElementOptions, DefaultGlobalToolbarDefinition, DefaultInlineToolbarDefinition, DefaultQuickToolbarDefinition, DropdownMode, ELEMENT_UNIQUE_ID, ElementKinds, ErrorCodes, FontSizeTypes, FontSizes, HEADING_TYPES, HeadingEditor, HrEditor, IS_MAC, ImageEditor, LINK_DEFAULT_TEXT, LIST_BLOCK_TYPES, LinkEditor, ListEditor, MarkEditor, MarkProps, MarkTypes, PICTURE_ACCEPTED_UPLOAD_MIME, PICTURE_ACCEPTED_UPLOAD_SIZE, PLUGIN_COMPONENTS, QUICK_TOOLBAR_HOTKEY, QuickInsertEditor, STANDARD_HEADING_TYPES, TAB_SPACE, THE_CODE_MODE_PROVIDER, THE_CODE_MODE_TOKEN, THE_EDITOR_CONVERSION_HINT_REF, THE_EDITOR_QUICK_TOOLBAR_REF, THE_EDITOR_UUID, THE_INLINE_TOOLBAR_TYPES, THE_UPLOAD_SERVICE_TOKEN, TableEditor, TheBaseElementComponent, TheCodeConfig, TheContextService, TheDataMode, TheDefaultElementComponent, TheEditor, TheEditorComponent, TheEditorModule, TheImageComponent, TheMode, index$1 as TheQueries, TheToolbarBaseItemComponent, TheToolbarComponent, TheToolbarDropdownComponent, TheToolbarGroupComponent, TheToolbarGroupToken, TheToolbarItemComponent, TheToolbarService, index as TheTransforms, TodoItemEditor, ToolbarActionTypes, ToolbarAlignment, ToolbarItemMode, ToolbarItemType, ToolbarMoreGroup, VOID_BLOCK_TYPES, VerticalAlignEditor, VerticalAlignment,
|
|
12452
|
+
export { ALIGN_BLOCK_TYPES, A_TAG_REL_ATTR, AlignEditor, Alignment, BLOCK_DELETEBACKWARD_TYPES, BlockquoteEditor, CLIPBOARD_FORMAT_KEY, CODEMIRROR_PADDING_TOP, CODE_MODES, COMPONENTS, CONTAINER_BLOCKS, CONTROL_KEY, CodeEditor, CodeMode, ColorEditor, DEFAULT_LANGUAGE, DEFAULT_SCROLL_CONTAINER, DefaultElementOptions, DefaultGlobalToolbarDefinition, DefaultInlineToolbarDefinition, DefaultQuickToolbarDefinition, DropdownMode, ELEMENT_UNIQUE_ID, ElementKinds, ErrorCodes, FontSizeTypes, FontSizes, HEADING_TYPES, HeadingEditor, HrEditor, IS_MAC, ImageEditor, LINK_DEFAULT_TEXT, LIST_BLOCK_TYPES, LinkEditor, ListEditor, MarkEditor, MarkProps, MarkTypes, PICTURE_ACCEPTED_UPLOAD_MIME, PICTURE_ACCEPTED_UPLOAD_SIZE, PLUGIN_COMPONENTS, QUICK_TOOLBAR_HOTKEY, QuickInsertEditor, STANDARD_HEADING_TYPES, TAB_SPACE, THE_CODE_MODE_PROVIDER, THE_CODE_MODE_TOKEN, THE_EDITOR_CONVERSION_HINT_REF, THE_EDITOR_QUICK_TOOLBAR_REF, THE_EDITOR_UUID, THE_INLINE_TOOLBAR_TYPES, THE_UPLOAD_SERVICE_TOKEN, TableEditor, TheBaseElementComponent, TheCodeConfig, TheContextService, TheDataMode, TheDefaultElementComponent, TheEditor, TheEditorComponent, TheEditorModule, TheImageComponent, TheMode, index$1 as TheQueries, TheToolbarBaseItemComponent, TheToolbarComponent, TheToolbarDropdownComponent, TheToolbarGroupComponent, TheToolbarGroupToken, TheToolbarItemComponent, TheToolbarService, index as TheTransforms, TodoItemEditor, ToolbarActionTypes, ToolbarAlignment, ToolbarItemMode, ToolbarItemType, ToolbarMoreGroup, VOID_BLOCK_TYPES, VerticalAlignEditor, VerticalAlignment, createEmptyParagraph, dataDeserialize, dataSerializing, getToolbarClass, htmlToTheia, inValidTypes, plainToTheia, toolbarCompose, withTheEditor };
|
|
12445
12453
|
//# sourceMappingURL=worktile-theia.js.map
|