@worktile/theia 1.2.20 → 2.1.1
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 +21 -35
- package/bundles/worktile-theia.umd.js.map +1 -1
- package/esm2015/plugins/code/code.component.js +23 -37
- package/fesm2015/worktile-theia.js +21 -35
- package/fesm2015/worktile-theia.js.map +1 -1
- package/package.json +1 -1
- package/plugins/code/code.component.d.ts +2 -6
- package/styles/editor.scss +2 -1
|
@@ -6932,14 +6932,12 @@
|
|
|
6932
6932
|
_this.config = config;
|
|
6933
6933
|
_this.startRenderCodemirror = false;
|
|
6934
6934
|
_this.dropdownMode = exports.DropdownMode;
|
|
6935
|
-
_this.codeMirrorFocused = false;
|
|
6936
6935
|
_this.maxHeight = _this.config.mode === CodeMode.default ? 350 - CODEMIRROR_PADDING_TOP * 2 : 0;
|
|
6937
6936
|
_this.menus = CODE_MODES.map(function (item) {
|
|
6938
6937
|
return { key: item.value, name: item.showName };
|
|
6939
6938
|
});
|
|
6940
6939
|
_this.ToolbarItemMode = exports.ToolbarItemMode;
|
|
6941
|
-
_this.
|
|
6942
|
-
_this.isResizing = false;
|
|
6940
|
+
_this.isFocusCode = false;
|
|
6943
6941
|
_this.resizeHeight = null;
|
|
6944
6942
|
_this.options = {
|
|
6945
6943
|
mode: _this.menus[0].key,
|
|
@@ -6955,7 +6953,7 @@
|
|
|
6955
6953
|
_this.onChangeLangulage = function (item) {
|
|
6956
6954
|
_this.options = Object.assign(Object.assign({}, _this.options), { mode: item.key });
|
|
6957
6955
|
_this.actives = item;
|
|
6958
|
-
CodeEditor.setCodeAttribute(_this.editor, _this.element, {
|
|
6956
|
+
CodeEditor.setCodeAttribute(_this.editor, _this.element, { language: item.key });
|
|
6959
6957
|
};
|
|
6960
6958
|
return _this;
|
|
6961
6959
|
}
|
|
@@ -6966,11 +6964,6 @@
|
|
|
6966
6964
|
enumerable: false,
|
|
6967
6965
|
configurable: true
|
|
6968
6966
|
});
|
|
6969
|
-
TheCodeComponent.prototype.handleCodeMousedown = function (event) {
|
|
6970
|
-
if (!(event.target instanceof HTMLElement && this.elementRef.nativeElement.contains(event.target))) {
|
|
6971
|
-
this.codeMirrorFocused = false;
|
|
6972
|
-
}
|
|
6973
|
-
};
|
|
6974
6967
|
TheCodeComponent.prototype.onContextChange = function () {
|
|
6975
6968
|
_super.prototype.onContextChange.call(this);
|
|
6976
6969
|
if (this.initialized) {
|
|
@@ -6980,8 +6973,14 @@
|
|
|
6980
6973
|
if (this.options.mode !== this.element.language) {
|
|
6981
6974
|
this.useMode();
|
|
6982
6975
|
}
|
|
6983
|
-
if (
|
|
6984
|
-
this.
|
|
6976
|
+
if (this.options.lineWrapping !== this.element.autoWrap) {
|
|
6977
|
+
this.useAutoWrap();
|
|
6978
|
+
}
|
|
6979
|
+
if (this.resizeHeight !== this.element.height) {
|
|
6980
|
+
this.useHeight();
|
|
6981
|
+
}
|
|
6982
|
+
if (!this.isCollapsed) {
|
|
6983
|
+
this.isFocusCode = false;
|
|
6985
6984
|
}
|
|
6986
6985
|
}
|
|
6987
6986
|
};
|
|
@@ -7009,10 +7008,6 @@
|
|
|
7009
7008
|
});
|
|
7010
7009
|
}
|
|
7011
7010
|
};
|
|
7012
|
-
TheCodeComponent.prototype.focusChange = function (codeMirrorFocused) {
|
|
7013
|
-
if (codeMirrorFocused)
|
|
7014
|
-
this.codeMirrorFocused = codeMirrorFocused;
|
|
7015
|
-
};
|
|
7016
7011
|
TheCodeComponent.prototype.renderCodemirror = function () {
|
|
7017
7012
|
this.startRenderCodemirror = true;
|
|
7018
7013
|
this.useReadonly();
|
|
@@ -7023,7 +7018,7 @@
|
|
|
7023
7018
|
};
|
|
7024
7019
|
TheCodeComponent.prototype.initializeCodemirrorFocus = function () {
|
|
7025
7020
|
var _this = this;
|
|
7026
|
-
if (this.isCollapsed
|
|
7021
|
+
if (this.isCollapsed) {
|
|
7027
7022
|
setTimeout(function () {
|
|
7028
7023
|
if (_this.isCollapsed && _this.codemirror && _this.codemirror.editor && !_this.codemirror.editor.hasFocus()) {
|
|
7029
7024
|
i1.AngularEditor.blur(_this.editor);
|
|
@@ -7038,7 +7033,7 @@
|
|
|
7038
7033
|
};
|
|
7039
7034
|
TheCodeComponent.prototype.onDelete = function (event) {
|
|
7040
7035
|
event.preventDefault();
|
|
7041
|
-
this.
|
|
7036
|
+
this.isFocusCode = false;
|
|
7042
7037
|
deleteElement(this.editor, this.element);
|
|
7043
7038
|
};
|
|
7044
7039
|
TheCodeComponent.prototype.onCopy = function (event) {
|
|
@@ -7054,7 +7049,10 @@
|
|
|
7054
7049
|
document.execCommand('copy');
|
|
7055
7050
|
this.thyNotifyService.success('复制成功');
|
|
7056
7051
|
i1.AngularEditor.deselect(this.editor);
|
|
7057
|
-
|
|
7052
|
+
};
|
|
7053
|
+
TheCodeComponent.prototype.focusChange = function (codeMirrorFocused) {
|
|
7054
|
+
if (codeMirrorFocused)
|
|
7055
|
+
this.isFocusCode = codeMirrorFocused;
|
|
7058
7056
|
};
|
|
7059
7057
|
TheCodeComponent.prototype.useMode = function () {
|
|
7060
7058
|
var _this = this;
|
|
@@ -7062,11 +7060,7 @@
|
|
|
7062
7060
|
this.actives = this.menus.find(function (i) { return i.key === _this.element.language; });
|
|
7063
7061
|
};
|
|
7064
7062
|
TheCodeComponent.prototype.useAutoWrap = function () {
|
|
7065
|
-
|
|
7066
|
-
this.cdr.detectChanges();
|
|
7067
|
-
this.isAutoWrap = this.element.autoWrap;
|
|
7068
|
-
this.codemirror.setOptionIfChanged('lineWrapping', this.element.autoWrap);
|
|
7069
|
-
}
|
|
7063
|
+
this.options = Object.assign(Object.assign({}, this.options), { lineWrapping: this.element.autoWrap || false });
|
|
7070
7064
|
};
|
|
7071
7065
|
TheCodeComponent.prototype.useHeight = function () {
|
|
7072
7066
|
if (this.element.height) {
|
|
@@ -7080,25 +7074,20 @@
|
|
|
7080
7074
|
TheCodeComponent.prototype.onResize = function (_a) {
|
|
7081
7075
|
var height = _a.height;
|
|
7082
7076
|
this.resizeHeight = height;
|
|
7083
|
-
slate.Transforms.select(this.editor, i1.AngularEditor.findPath(this.editor, this.element));
|
|
7084
|
-
CodeEditor.setCodeAttribute(this.editor, this.element, { height: height });
|
|
7085
7077
|
this.maxHeight = height;
|
|
7086
7078
|
};
|
|
7087
|
-
TheCodeComponent.prototype.onStartResize = function () {
|
|
7088
|
-
this.isResizing = true;
|
|
7089
|
-
};
|
|
7090
7079
|
TheCodeComponent.prototype.onEndResize = function () {
|
|
7091
|
-
this.
|
|
7080
|
+
slate.Transforms.select(this.editor, i1.AngularEditor.findPath(this.editor, this.element));
|
|
7081
|
+
CodeEditor.setCodeAttribute(this.editor, this.element, { height: this.resizeHeight });
|
|
7092
7082
|
};
|
|
7093
7083
|
TheCodeComponent.prototype.onChangeWrap = function (value) {
|
|
7094
|
-
|
|
7095
|
-
this.codemirror.setOptionIfChanged('lineWrapping', value);
|
|
7084
|
+
this.options = Object.assign(Object.assign({}, this.options), { lineWrapping: value || false });
|
|
7096
7085
|
CodeEditor.setCodeAttribute(this.editor, this.element, { autoWrap: value ? value : null });
|
|
7097
7086
|
};
|
|
7098
7087
|
return TheCodeComponent;
|
|
7099
7088
|
}(TheBaseElementComponent));
|
|
7100
7089
|
TheCodeComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheCodeComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }, { token: i1__namespace$4.ThyNotifyService }, { token: TheContextService }, { token: i0__namespace.NgZone }, { token: THE_CODE_MODE_TOKEN }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
7101
|
-
TheCodeComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheCodeComponent, selector: "div[theCode]",
|
|
7090
|
+
TheCodeComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheCodeComponent, selector: "div[theCode]", viewQueries: [{ propertyName: "codemirror", first: true, predicate: ["codemirror"], descendants: true, read: i8.CodeMirrorComponent }], usesInheritance: true, ngImport: i0__namespace, 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]=\"42\"\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__namespace.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }, { type: TheToolbarDropdownComponent, selector: "the-toolbar-dropdown", inputs: ["toolbarItem", "menus", "mode", "item", "itemMousedownHandle"] }, { type: i3__namespace.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: NavSplitLineComponent, selector: "nav-split-line", inputs: ["mode"] }, { type: i6__namespace$1.ThySwitchComponent, selector: "thy-switch", inputs: ["thyType", "thySize", "thyDisabled"], outputs: ["thyChange"] }, { type: i1__namespace.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }, { type: i8__namespace.CodeMirrorComponent, selector: "ng-codemirror, [ngCodeMirror]", inputs: ["autoMaxHeight", "delayRefreshTime", "options"], outputs: ["focusChange"] }, { type: i9__namespace.ThyResizeHandleComponent, selector: "thy-resize-handle, [thy-resize-handle]", inputs: ["thyDirection"], outputs: ["thyMouseDown"], exportAs: ["thyResizeHandle"] }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5__namespace$1.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i4__namespace$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4__namespace$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i9__namespace.ThyResizableDirective, selector: "[thyResizable]", inputs: ["thyBounds", "thyMaxHeight", "thyMaxWidth", "thyMinHeight", "thyMinWidth", "thyGridColumnCount", "thyMaxColumn", "thyMinColumn", "thyLockAspectRatio", "thyPreview", "thyDisabled"], outputs: ["thyResize", "thyResizeEnd", "thyResizeStart"] }, { type: i6__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
7102
7091
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheCodeComponent, decorators: [{
|
|
7103
7092
|
type: i0.Component,
|
|
7104
7093
|
args: [{
|
|
@@ -7114,9 +7103,6 @@
|
|
|
7114
7103
|
}, propDecorators: { codemirror: [{
|
|
7115
7104
|
type: i0.ViewChild,
|
|
7116
7105
|
args: ['codemirror', { read: i8.CodeMirrorComponent, static: false }]
|
|
7117
|
-
}], handleCodeMousedown: [{
|
|
7118
|
-
type: i0.HostListener,
|
|
7119
|
-
args: ['document: mousedown', ['$event']]
|
|
7120
7106
|
}] } });
|
|
7121
7107
|
|
|
7122
7108
|
var withCode = function (editor) {
|