@worktile/theia 2.4.7 → 2.4.10
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 +49 -55
- package/bundles/worktile-theia.umd.js.map +1 -1
- package/constants/code.d.ts +0 -16
- package/constants/default.d.ts +0 -4
- package/esm2015/constants/code.js +1 -15
- package/esm2015/constants/default.js +1 -6
- package/esm2015/editor.component.js +18 -24
- package/esm2015/editor.module.js +4 -4
- package/esm2015/interfaces/editor.js +16 -1
- package/esm2015/plugins/code/code.component.js +9 -9
- package/esm2015/utils/index.js +2 -1
- package/fesm2015/worktile-theia.js +39 -49
- package/fesm2015/worktile-theia.js.map +1 -1
- package/interfaces/editor.d.ts +15 -0
- package/package.json +1 -1
- package/plugins/code/code.component.d.ts +3 -3
- package/utils/index.d.ts +1 -0
|
@@ -379,11 +379,6 @@
|
|
|
379
379
|
var DEFAULT_SCROLL_CONTAINER = '.the-editable-container';
|
|
380
380
|
var ELEMENT_UNIQUE_ID = 'key';
|
|
381
381
|
var ZERO_WIDTH_CHAR = '\u200B';
|
|
382
|
-
exports.TheMode = void 0;
|
|
383
|
-
(function (TheMode) {
|
|
384
|
-
TheMode["fullMode"] = "full";
|
|
385
|
-
TheMode["liteMode"] = "lite";
|
|
386
|
-
})(exports.TheMode || (exports.TheMode = {}));
|
|
387
382
|
|
|
388
383
|
exports.ElementKinds = void 0;
|
|
389
384
|
(function (ElementKinds) {
|
|
@@ -591,22 +586,6 @@
|
|
|
591
586
|
value: 'htmlmixed'
|
|
592
587
|
}
|
|
593
588
|
];
|
|
594
|
-
var CodeMode = {
|
|
595
|
-
default: 'default',
|
|
596
|
-
print: 'print'
|
|
597
|
-
};
|
|
598
|
-
var TheCodeConfig = /** @class */ (function () {
|
|
599
|
-
function TheCodeConfig() {
|
|
600
|
-
}
|
|
601
|
-
return TheCodeConfig;
|
|
602
|
-
}());
|
|
603
|
-
var THE_CODE_MODE_TOKEN = new i0.InjectionToken('the-code-mode');
|
|
604
|
-
var THE_CODE_MODE_PROVIDER = {
|
|
605
|
-
provide: THE_CODE_MODE_TOKEN,
|
|
606
|
-
useValue: {
|
|
607
|
-
mode: CodeMode.default
|
|
608
|
-
}
|
|
609
|
-
};
|
|
610
589
|
var CODEMIRROR_PADDING_TOP = 10;
|
|
611
590
|
|
|
612
591
|
var TheToolbarGroupToken = new i0.InjectionToken('the-toolbar-group-token');
|
|
@@ -791,6 +770,23 @@
|
|
|
791
770
|
TheDataMode["json"] = "json";
|
|
792
771
|
TheDataMode["html"] = "html";
|
|
793
772
|
})(exports.TheDataMode || (exports.TheDataMode = {}));
|
|
773
|
+
exports.TheMode = void 0;
|
|
774
|
+
(function (TheMode) {
|
|
775
|
+
TheMode["default"] = "default";
|
|
776
|
+
TheMode["print"] = "print";
|
|
777
|
+
})(exports.TheMode || (exports.TheMode = {}));
|
|
778
|
+
var TheModeConfig = /** @class */ (function () {
|
|
779
|
+
function TheModeConfig() {
|
|
780
|
+
}
|
|
781
|
+
return TheModeConfig;
|
|
782
|
+
}());
|
|
783
|
+
var THE_MODE_TOKEN = new i0.InjectionToken('the-mode');
|
|
784
|
+
var THE_MODE_PROVIDER = {
|
|
785
|
+
provide: THE_MODE_TOKEN,
|
|
786
|
+
useValue: {
|
|
787
|
+
mode: exports.TheMode.default
|
|
788
|
+
}
|
|
789
|
+
};
|
|
794
790
|
|
|
795
791
|
exports.ToolbarItemType = void 0;
|
|
796
792
|
(function (ToolbarItemType) {
|
|
@@ -7366,7 +7362,7 @@
|
|
|
7366
7362
|
_this.config = config;
|
|
7367
7363
|
_this.startRenderCodemirror = false;
|
|
7368
7364
|
_this.dropdownMode = exports.DropdownMode;
|
|
7369
|
-
_this.maxHeight = _this.config.mode ===
|
|
7365
|
+
_this.maxHeight = _this.config.mode === exports.TheMode.default ? 350 - CODEMIRROR_PADDING_TOP * 2 : 0;
|
|
7370
7366
|
_this.menus = CODE_MODES.map(function (item) {
|
|
7371
7367
|
return { key: item.value, name: item.showName };
|
|
7372
7368
|
});
|
|
@@ -7380,7 +7376,7 @@
|
|
|
7380
7376
|
readOnly: false,
|
|
7381
7377
|
autofocus: false,
|
|
7382
7378
|
lineWiseCopyCut: true,
|
|
7383
|
-
lineWrapping: _this.config.mode ===
|
|
7379
|
+
lineWrapping: _this.config.mode === exports.TheMode.default ? false : true,
|
|
7384
7380
|
cursorBlinkRate: 500
|
|
7385
7381
|
};
|
|
7386
7382
|
_this.actives = _this.menus[0];
|
|
@@ -7567,7 +7563,7 @@
|
|
|
7567
7563
|
};
|
|
7568
7564
|
return TheCodeComponent;
|
|
7569
7565
|
}(TheBaseElementComponent));
|
|
7570
|
-
TheCodeComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", 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:
|
|
7566
|
+
TheCodeComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", 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_MODE_TOKEN }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
7571
7567
|
TheCodeComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", 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=\"isCollapsed && codemirror && !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\n<!-- \u53EA\u8BFB\u6A21\u5F0F\u4E0BCodeMirror-sizer\u9AD8\u5EA6\u6BD4\u7F16\u8F91\u6A21\u5F0F\u4E0B\u591A2px\uFF0C\u8BBE\u7F6EthyMinHeight\u4E3A46px\u9632\u6B62\u62D6\u62FD\u5230\u6700\u5C0F\u9AD8\u5EA6\u65F6\u53EA\u8BFB\u6A21\u5F0F\u4E0B\u51FA\u73B0\u6EDA\u52A8\u6761 -->\n<div\n thyResizable\n [thyMinHeight]=\"46\"\n [thyBounds]=\"resizeBounds\"\n [style.height.px]=\"resizeHeight\"\n (thyResize)=\"onResize($event)\"\n (thyResizeEnd)=\"onEndResize()\"\n class=\"resize-code-container\"\n [ngClass]=\"{ focus: isCollapsed, readonly: options.readOnly, active: isHightLight && isCollapsed }\"\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=\"isCollapsed && !options.readOnly\"></thy-resize-handle>\n</div>\n", components: [{ type: i3__namespace$1.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }, { type: TheToolbarDropdownComponent, selector: "the-toolbar-dropdown", inputs: ["toolbarItem", "menus", "mode", "item", "itemMousedownHandle"] }, { type: i3__namespace$1.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: i10__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5__namespace.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i4__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4__namespace.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: i10__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i10__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
7572
7568
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheCodeComponent, decorators: [{
|
|
7573
7569
|
type: i0.Component,
|
|
@@ -7577,9 +7573,9 @@
|
|
|
7577
7573
|
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
7578
7574
|
}]
|
|
7579
7575
|
}], ctorParameters: function () {
|
|
7580
|
-
return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }, { type: i1__namespace$4.ThyNotifyService }, { type: TheContextService }, { type: i0__namespace.NgZone }, { type:
|
|
7576
|
+
return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }, { type: i1__namespace$4.ThyNotifyService }, { type: TheContextService }, { type: i0__namespace.NgZone }, { type: TheModeConfig, decorators: [{
|
|
7581
7577
|
type: i0.Inject,
|
|
7582
|
-
args: [
|
|
7578
|
+
args: [THE_MODE_TOKEN]
|
|
7583
7579
|
}] }];
|
|
7584
7580
|
}, propDecorators: { codemirror: [{
|
|
7585
7581
|
type: i0.ViewChild,
|
|
@@ -13967,30 +13963,24 @@
|
|
|
13967
13963
|
};
|
|
13968
13964
|
TheEditorComponent.prototype.mousedown = function (event) {
|
|
13969
13965
|
var editableElement = i1.AngularEditor.toDOMNode(this.editor, this.editor);
|
|
13970
|
-
|
|
13971
|
-
|
|
13966
|
+
var rectEditable = editableElement.getBoundingClientRect();
|
|
13967
|
+
var absoluteElement = document.elementFromPoint(event.x, event.y);
|
|
13968
|
+
if (!editableElement.isEqualNode(absoluteElement)) {
|
|
13969
|
+
var blockCardElement = absoluteElement.querySelector('.slate-block-card');
|
|
13970
|
+
if (!blockCardElement)
|
|
13971
|
+
return;
|
|
13972
|
+
}
|
|
13973
|
+
var paddingRight = window.getComputedStyle(editableElement, null).paddingRight;
|
|
13974
|
+
var paddingRightPixels = coercePixelsFromCssValue(paddingRight);
|
|
13975
|
+
var fakeRightX = rectEditable.right - paddingRightPixels - 50;
|
|
13976
|
+
var relativeElement = document.elementFromPoint(fakeRightX, event.y);
|
|
13977
|
+
var relativeBlockCardElement = relativeElement.closest('.slate-block-card');
|
|
13978
|
+
if (relativeBlockCardElement) {
|
|
13972
13979
|
var centerX = rectEditable.x + rectEditable.width / 2;
|
|
13973
|
-
var
|
|
13974
|
-
|
|
13975
|
-
|
|
13976
|
-
|
|
13977
|
-
var fakeRightX = rectEditable.right - paddingRightPixels - 50;
|
|
13978
|
-
var relativeElement = document.elementFromPoint(fakeLeftX, event.y);
|
|
13979
|
-
var relativeBlockCardElement = relativeElement.closest('.slate-block-card');
|
|
13980
|
-
if (!relativeBlockCardElement) {
|
|
13981
|
-
relativeElement = document.elementFromPoint(fakeRightX, event.y);
|
|
13982
|
-
relativeBlockCardElement = relativeElement.closest('.slate-block-card');
|
|
13983
|
-
}
|
|
13984
|
-
if (relativeBlockCardElement) {
|
|
13985
|
-
var blockCardEntry = i1.AngularEditor.toSlateCardEntry(this.editor, relativeBlockCardElement.firstElementChild);
|
|
13986
|
-
if (blockCardEntry && blockCardEntry[1]) {
|
|
13987
|
-
var rootNodePath = blockCardEntry[1].slice(0, 1);
|
|
13988
|
-
var rootNode = getNode(this.editor, rootNodePath);
|
|
13989
|
-
if (this.editor.isBlockCard(rootNode)) {
|
|
13990
|
-
event.preventDefault();
|
|
13991
|
-
i1.AngularEditor.moveBlockCard(this.editor, rootNode, { direction: event.x < centerX ? 'left' : 'right' });
|
|
13992
|
-
}
|
|
13993
|
-
}
|
|
13980
|
+
var blockCardEntry = i1.AngularEditor.toSlateCardEntry(this.editor, relativeBlockCardElement.firstElementChild);
|
|
13981
|
+
if (blockCardEntry && this.editor.isBlockCard(blockCardEntry[0])) {
|
|
13982
|
+
event.preventDefault();
|
|
13983
|
+
i1.AngularEditor.moveBlockCard(this.editor, blockCardEntry[0], { direction: event.x < centerX ? 'left' : 'right' });
|
|
13994
13984
|
}
|
|
13995
13985
|
}
|
|
13996
13986
|
};
|
|
@@ -14377,7 +14367,7 @@
|
|
|
14377
14367
|
provide: TheToolbarGroupToken,
|
|
14378
14368
|
useValue: TheToolbarGroupComponent
|
|
14379
14369
|
},
|
|
14380
|
-
|
|
14370
|
+
THE_MODE_PROVIDER
|
|
14381
14371
|
], imports: [__spreadArray(__spreadArray([i10.CommonModule, i1.SlateModule, i4.FormsModule], __read(TETHYS)), [i8.CodemirrorModule, TheColumnSizeModule])] });
|
|
14382
14372
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheEditorModule, decorators: [{
|
|
14383
14373
|
type: i0.NgModule,
|
|
@@ -14391,7 +14381,7 @@
|
|
|
14391
14381
|
provide: TheToolbarGroupToken,
|
|
14392
14382
|
useValue: TheToolbarGroupComponent
|
|
14393
14383
|
},
|
|
14394
|
-
|
|
14384
|
+
THE_MODE_PROVIDER
|
|
14395
14385
|
]
|
|
14396
14386
|
}]
|
|
14397
14387
|
}] });
|
|
@@ -14416,7 +14406,6 @@
|
|
|
14416
14406
|
exports.CONTAINER_BLOCKS = CONTAINER_BLOCKS;
|
|
14417
14407
|
exports.CONTROL_KEY = CONTROL_KEY;
|
|
14418
14408
|
exports.CodeEditor = CodeEditor;
|
|
14419
|
-
exports.CodeMode = CodeMode;
|
|
14420
14409
|
exports.ColorEditor = ColorEditor;
|
|
14421
14410
|
exports.DEFAULT_LANGUAGE = DEFAULT_LANGUAGE;
|
|
14422
14411
|
exports.DEFAULT_SCROLL_CONTAINER = DEFAULT_SCROLL_CONTAINER;
|
|
@@ -14445,16 +14434,15 @@
|
|
|
14445
14434
|
exports.QuickInsertEditor = QuickInsertEditor;
|
|
14446
14435
|
exports.STANDARD_HEADING_TYPES = STANDARD_HEADING_TYPES;
|
|
14447
14436
|
exports.TAB_SPACE = TAB_SPACE;
|
|
14448
|
-
exports.THE_CODE_MODE_PROVIDER = THE_CODE_MODE_PROVIDER;
|
|
14449
|
-
exports.THE_CODE_MODE_TOKEN = THE_CODE_MODE_TOKEN;
|
|
14450
14437
|
exports.THE_EDITOR_CONVERSION_HINT_REF = THE_EDITOR_CONVERSION_HINT_REF;
|
|
14451
14438
|
exports.THE_EDITOR_QUICK_TOOLBAR_REF = THE_EDITOR_QUICK_TOOLBAR_REF;
|
|
14452
14439
|
exports.THE_EDITOR_UUID = THE_EDITOR_UUID;
|
|
14453
14440
|
exports.THE_INLINE_TOOLBAR_TYPES = THE_INLINE_TOOLBAR_TYPES;
|
|
14441
|
+
exports.THE_MODE_PROVIDER = THE_MODE_PROVIDER;
|
|
14442
|
+
exports.THE_MODE_TOKEN = THE_MODE_TOKEN;
|
|
14454
14443
|
exports.THE_UPLOAD_SERVICE_TOKEN = THE_UPLOAD_SERVICE_TOKEN;
|
|
14455
14444
|
exports.TableEditor = TableEditor;
|
|
14456
14445
|
exports.TheBaseElementComponent = TheBaseElementComponent;
|
|
14457
|
-
exports.TheCodeConfig = TheCodeConfig;
|
|
14458
14446
|
exports.TheContextService = TheContextService;
|
|
14459
14447
|
exports.TheDefaultElementComponent = TheDefaultElementComponent;
|
|
14460
14448
|
exports.TheEditor = TheEditor;
|
|
@@ -14462,6 +14450,7 @@
|
|
|
14462
14450
|
exports.TheEditorModule = TheEditorModule;
|
|
14463
14451
|
exports.TheImageComponent = TheImageComponent;
|
|
14464
14452
|
exports.TheIndentToolbarComponent = TheIndentToolbarComponent;
|
|
14453
|
+
exports.TheModeConfig = TheModeConfig;
|
|
14465
14454
|
exports.TheQueries = index$1;
|
|
14466
14455
|
exports.TheToolbarBaseItemComponent = TheToolbarBaseItemComponent;
|
|
14467
14456
|
exports.TheToolbarComponent = TheToolbarComponent;
|
|
@@ -14480,11 +14469,16 @@
|
|
|
14480
14469
|
exports.createEmptyParagraph = createEmptyParagraph;
|
|
14481
14470
|
exports.dataDeserialize = dataDeserialize;
|
|
14482
14471
|
exports.dataSerializing = dataSerializing;
|
|
14472
|
+
exports.deleteColorAndBackgroundColorOfText = deleteColorAndBackgroundColorOfText;
|
|
14473
|
+
exports.deleteElementKey = deleteElementKey;
|
|
14474
|
+
exports.extractFragment = extractFragment;
|
|
14483
14475
|
exports.getColsTotalWidth = getColsTotalWidth;
|
|
14484
14476
|
exports.getElementClassByPrefix = getElementClassByPrefix;
|
|
14485
14477
|
exports.getElementHeight = getElementHeight;
|
|
14486
14478
|
exports.getElementWidth = getElementWidth;
|
|
14479
|
+
exports.getEndBlock = getEndBlock;
|
|
14487
14480
|
exports.getRowsTotalHeight = getRowsTotalHeight;
|
|
14481
|
+
exports.getStartBlock = getStartBlock;
|
|
14488
14482
|
exports.getToolbarClass = getToolbarClass;
|
|
14489
14483
|
exports.htmlToTheia = htmlToTheia;
|
|
14490
14484
|
exports.inValidTypes = inValidTypes;
|