@worktile/theia 2.4.5 → 2.4.8
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 +157 -131
- 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 +2 -3
- 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/plugins/indent/indent.editor.js +7 -12
- package/esm2015/plugins/indent/indent.plugin.js +1 -8
- package/esm2015/plugins/public-api.js +3 -1
- package/esm2015/plugins/table/components/table.component.js +37 -6
- package/esm2015/plugins/todo-item/todo-item.component.js +4 -3
- package/fesm2015/worktile-theia.js +131 -116
- package/fesm2015/worktile-theia.js.map +1 -1
- package/interfaces/editor.d.ts +15 -2
- package/package.json +1 -1
- package/plugins/code/code.component.d.ts +3 -3
- package/plugins/indent/indent.editor.d.ts +1 -0
- package/plugins/public-api.d.ts +2 -0
- package/plugins/table/components/table.component.d.ts +1 -0
- package/plugins/table/components/table.component.scss +7 -2
- package/plugins/todo-item/todo-item.component.scss +1 -1
- package/styles/editor.scss +3 -3
|
@@ -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) {
|
|
@@ -4099,6 +4095,7 @@
|
|
|
4099
4095
|
_this.elementRef = elementRef;
|
|
4100
4096
|
_this.cdr = cdr;
|
|
4101
4097
|
_this.ctxService = ctxService;
|
|
4098
|
+
// 类名 the-temp-*: 临时解决因受portal影响样式问题,后期改回the-
|
|
4102
4099
|
_this.checkItemClass = true;
|
|
4103
4100
|
return _this;
|
|
4104
4101
|
}
|
|
@@ -4127,7 +4124,7 @@
|
|
|
4127
4124
|
return TheTodoItemComponent;
|
|
4128
4125
|
}(TheBaseElementComponent));
|
|
4129
4126
|
TheTodoItemComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheTodoItemComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }, { token: TheContextService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
4130
|
-
TheTodoItemComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheTodoItemComponent, selector: "div[theTodoItem]", host: { properties: { "class.the-check-item": "this.checkItemClass", "attr.the-level": "this.level" } }, usesInheritance: true, ngImport: i0__namespace, template: "\n <span contenteditable=\"false\" class=\"todo-item-status\">\n <input #checkbox type=\"checkbox\" [checked]=\"element.checked\" (click)=\"onCheck(checkbox.checked)\" />\n </span>\n <span><slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children></span>\n ", isInline: true, components: [{ type: i1__namespace.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
|
|
4127
|
+
TheTodoItemComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheTodoItemComponent, selector: "div[theTodoItem]", host: { properties: { "class.the-temp-check-item": "this.checkItemClass", "attr.the-level": "this.level" } }, usesInheritance: true, ngImport: i0__namespace, template: "\n <span contenteditable=\"false\" class=\"todo-item-status\">\n <input #checkbox type=\"checkbox\" [checked]=\"element.checked\" (click)=\"onCheck(checkbox.checked)\" />\n </span>\n <span><slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children></span>\n ", isInline: true, components: [{ type: i1__namespace.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
|
|
4131
4128
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheTodoItemComponent, decorators: [{
|
|
4132
4129
|
type: i0.Component,
|
|
4133
4130
|
args: [{
|
|
@@ -4136,7 +4133,7 @@
|
|
|
4136
4133
|
}]
|
|
4137
4134
|
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }, { type: TheContextService }]; }, propDecorators: { checkItemClass: [{
|
|
4138
4135
|
type: i0.HostBinding,
|
|
4139
|
-
args: ['class.the-check-item']
|
|
4136
|
+
args: ['class.the-temp-check-item']
|
|
4140
4137
|
}], level: [{
|
|
4141
4138
|
type: i0.HostBinding,
|
|
4142
4139
|
args: ['attr.the-level']
|
|
@@ -7365,7 +7362,7 @@
|
|
|
7365
7362
|
_this.config = config;
|
|
7366
7363
|
_this.startRenderCodemirror = false;
|
|
7367
7364
|
_this.dropdownMode = exports.DropdownMode;
|
|
7368
|
-
_this.maxHeight = _this.config.mode ===
|
|
7365
|
+
_this.maxHeight = _this.config.mode === exports.TheMode.default ? 350 - CODEMIRROR_PADDING_TOP * 2 : 0;
|
|
7369
7366
|
_this.menus = CODE_MODES.map(function (item) {
|
|
7370
7367
|
return { key: item.value, name: item.showName };
|
|
7371
7368
|
});
|
|
@@ -7379,7 +7376,7 @@
|
|
|
7379
7376
|
readOnly: false,
|
|
7380
7377
|
autofocus: false,
|
|
7381
7378
|
lineWiseCopyCut: true,
|
|
7382
|
-
lineWrapping: _this.config.mode ===
|
|
7379
|
+
lineWrapping: _this.config.mode === exports.TheMode.default ? false : true,
|
|
7383
7380
|
cursorBlinkRate: 500
|
|
7384
7381
|
};
|
|
7385
7382
|
_this.actives = _this.menus[0];
|
|
@@ -7566,7 +7563,7 @@
|
|
|
7566
7563
|
};
|
|
7567
7564
|
return TheCodeComponent;
|
|
7568
7565
|
}(TheBaseElementComponent));
|
|
7569
|
-
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 });
|
|
7570
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 });
|
|
7571
7568
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheCodeComponent, decorators: [{
|
|
7572
7569
|
type: i0.Component,
|
|
@@ -7576,9 +7573,9 @@
|
|
|
7576
7573
|
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
7577
7574
|
}]
|
|
7578
7575
|
}], ctorParameters: function () {
|
|
7579
|
-
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: [{
|
|
7580
7577
|
type: i0.Inject,
|
|
7581
|
-
args: [
|
|
7578
|
+
args: [THE_MODE_TOKEN]
|
|
7582
7579
|
}] }];
|
|
7583
7580
|
}, propDecorators: { codemirror: [{
|
|
7584
7581
|
type: i0.ViewChild,
|
|
@@ -9793,19 +9790,41 @@
|
|
|
9793
9790
|
};
|
|
9794
9791
|
TheTableComponent.prototype.ngAfterViewInit = function () {
|
|
9795
9792
|
var _this = this;
|
|
9796
|
-
this.ngZone.onStable.pipe(operators.take(1)).subscribe(function () {
|
|
9797
|
-
var blockCardElement
|
|
9798
|
-
|
|
9799
|
-
|
|
9800
|
-
|
|
9801
|
-
|
|
9802
|
-
|
|
9803
|
-
|
|
9804
|
-
|
|
9805
|
-
|
|
9806
|
-
|
|
9807
|
-
|
|
9808
|
-
|
|
9793
|
+
this.ngZone.onStable.pipe(operators.take(1)).subscribe(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
9794
|
+
var _a, blockCardElement, loadImageDone;
|
|
9795
|
+
var _this = this;
|
|
9796
|
+
return __generator(this, function (_c) {
|
|
9797
|
+
switch (_c.label) {
|
|
9798
|
+
case 0:
|
|
9799
|
+
blockCardElement = this.nativeElement.closest('slate-block-card');
|
|
9800
|
+
if (blockCardElement) {
|
|
9801
|
+
blockCardElement.classList.add("slate-block-card-" + this.element.type);
|
|
9802
|
+
}
|
|
9803
|
+
this.tableStore.initEditor(this.editor);
|
|
9804
|
+
this.subscribeCellsChange();
|
|
9805
|
+
this.subscribeCellPositionChange();
|
|
9806
|
+
this.listenTableContextMenuEvent();
|
|
9807
|
+
this.useTableWrapperWidth();
|
|
9808
|
+
if (!((_a = this.element.options) === null || _a === void 0 ? void 0 : _a.numberedColumn)) return [3 /*break*/, 2];
|
|
9809
|
+
return [4 /*yield*/, this.resolveImage()];
|
|
9810
|
+
case 1:
|
|
9811
|
+
loadImageDone = _c.sent();
|
|
9812
|
+
// 等待序号列表格内图片加载完成后再去渲染表格行高度
|
|
9813
|
+
if (loadImageDone) {
|
|
9814
|
+
setTimeout(function () {
|
|
9815
|
+
_this.useRowControls();
|
|
9816
|
+
_this.cdr.detectChanges();
|
|
9817
|
+
}, 200); // 200ms:通过通知打开页面动画加载时间
|
|
9818
|
+
}
|
|
9819
|
+
return [3 /*break*/, 3];
|
|
9820
|
+
case 2:
|
|
9821
|
+
this.useRowControls();
|
|
9822
|
+
this.cdr.markForCheck();
|
|
9823
|
+
_c.label = 3;
|
|
9824
|
+
case 3: return [2 /*return*/];
|
|
9825
|
+
}
|
|
9826
|
+
});
|
|
9827
|
+
}); });
|
|
9809
9828
|
};
|
|
9810
9829
|
TheTableComponent.prototype.subscribeCellPositionChange = function () {
|
|
9811
9830
|
var _this = this;
|
|
@@ -9840,7 +9859,6 @@
|
|
|
9840
9859
|
var _a;
|
|
9841
9860
|
if (this.selection || ((_a = this.element.options) === null || _a === void 0 ? void 0 : _a.numberedColumn)) {
|
|
9842
9861
|
this.rowControls = this.calculateRowControls();
|
|
9843
|
-
this.cdr.markForCheck();
|
|
9844
9862
|
}
|
|
9845
9863
|
};
|
|
9846
9864
|
TheTableComponent.prototype.detectChanges = function () {
|
|
@@ -9944,6 +9962,24 @@
|
|
|
9944
9962
|
});
|
|
9945
9963
|
return belowRowlHeight;
|
|
9946
9964
|
};
|
|
9965
|
+
TheTableComponent.prototype.resolveImage = function () {
|
|
9966
|
+
var imageElements = this.nativeElement.querySelectorAll('img');
|
|
9967
|
+
if (imageElements.length) {
|
|
9968
|
+
var imageResolves_1 = [];
|
|
9969
|
+
imageElements.forEach(function (item) {
|
|
9970
|
+
var image = new Image();
|
|
9971
|
+
var imageLoad = new Promise(function (resolve) {
|
|
9972
|
+
image.onload = function () {
|
|
9973
|
+
resolve(true);
|
|
9974
|
+
};
|
|
9975
|
+
image.src = item.getAttribute('src');
|
|
9976
|
+
});
|
|
9977
|
+
imageResolves_1.push(imageLoad);
|
|
9978
|
+
});
|
|
9979
|
+
return Promise.all(imageResolves_1);
|
|
9980
|
+
}
|
|
9981
|
+
return Promise.resolve(true);
|
|
9982
|
+
};
|
|
9947
9983
|
TheTableComponent.prototype.getColControls = function () {
|
|
9948
9984
|
var _a, _b;
|
|
9949
9985
|
this.colControls = ((_b = (_a = this.element) === null || _a === void 0 ? void 0 : _a.children[0]) === null || _b === void 0 ? void 0 : _b.children) || [];
|
|
@@ -12648,78 +12684,6 @@
|
|
|
12648
12684
|
args: ['class.disabled']
|
|
12649
12685
|
}] } });
|
|
12650
12686
|
|
|
12651
|
-
var onKeydownTextIndent = function (editor, event, kinds, textIndentDisabled) {
|
|
12652
|
-
var selection = editor.selection;
|
|
12653
|
-
var isExpanded = slate.Range.isExpanded(selection);
|
|
12654
|
-
var nodes = Array.from(slate.Editor.nodes(editor, {
|
|
12655
|
-
mode: 'highest',
|
|
12656
|
-
match: function (node) { return slate.Element.isElement(node) && kinds.includes(node.type); }
|
|
12657
|
-
}));
|
|
12658
|
-
var _a = __read(nodes, 1), startBlock = _a[0];
|
|
12659
|
-
if (!startBlock) {
|
|
12660
|
-
return false;
|
|
12661
|
-
}
|
|
12662
|
-
var _b = __read(startBlock, 2), block = _b[0], path = _b[1];
|
|
12663
|
-
var isStart = slate.Editor.isStart(editor, selection.anchor, path);
|
|
12664
|
-
if (isHotkey.isKeyHotkey('Tab', event)) {
|
|
12665
|
-
event.preventDefault();
|
|
12666
|
-
if (startBlock && (isExpanded || isStart)) {
|
|
12667
|
-
if (!editor.isVoid(block)) {
|
|
12668
|
-
var textIndent = block.textIndent, type = block.type;
|
|
12669
|
-
// do not apply first-line indentation for lists
|
|
12670
|
-
if (!textIndent && !textIndentDisabled.includes(type)) {
|
|
12671
|
-
IndentEditor.setTextIndent(editor, kinds, 2);
|
|
12672
|
-
return true;
|
|
12673
|
-
}
|
|
12674
|
-
else {
|
|
12675
|
-
IndentEditor.setIndent(editor);
|
|
12676
|
-
return true;
|
|
12677
|
-
}
|
|
12678
|
-
}
|
|
12679
|
-
}
|
|
12680
|
-
else {
|
|
12681
|
-
editor.insertText(TAB_SPACE);
|
|
12682
|
-
return true;
|
|
12683
|
-
}
|
|
12684
|
-
}
|
|
12685
|
-
if (isHotkey.isKeyHotkey('shift+Tab', event)) {
|
|
12686
|
-
if (startBlock && (isExpanded || isStart)) {
|
|
12687
|
-
if (!editor.isVoid(block)) {
|
|
12688
|
-
return IndentEditor.cancelTextIntent(editor, event, block, kinds);
|
|
12689
|
-
}
|
|
12690
|
-
}
|
|
12691
|
-
}
|
|
12692
|
-
if (selection && slate.Range.isCollapsed(selection) && i1.hotkeys.isDeleteBackward(event)) {
|
|
12693
|
-
if (startBlock && isStart) {
|
|
12694
|
-
return IndentEditor.cancelTextIntent(editor, event, block, kinds);
|
|
12695
|
-
}
|
|
12696
|
-
}
|
|
12697
|
-
return false;
|
|
12698
|
-
};
|
|
12699
|
-
|
|
12700
|
-
var withIndent = function (kinds) { return function (editor) {
|
|
12701
|
-
var onKeydown = editor.onKeydown;
|
|
12702
|
-
editor.onKeydown = function (event) {
|
|
12703
|
-
var _a, _b, _c, _d;
|
|
12704
|
-
var indentTypes = kinds;
|
|
12705
|
-
var disableIndentTypes = [exports.ElementKinds.bulletedList, exports.ElementKinds.numberedList, exports.ElementKinds.checkItem];
|
|
12706
|
-
if ((_b = (_a = editor.extraIndentOptions) === null || _a === void 0 ? void 0 : _a.indentTypes) === null || _b === void 0 ? void 0 : _b.length) {
|
|
12707
|
-
indentTypes = mergIndentTypes(kinds, editor.extraIndentOptions.indentTypes);
|
|
12708
|
-
}
|
|
12709
|
-
if ((_d = (_c = editor.extraIndentOptions) === null || _c === void 0 ? void 0 : _c.disabledIndentTypes) === null || _d === void 0 ? void 0 : _d.length) {
|
|
12710
|
-
disableIndentTypes = mergIndentTypes(disableIndentTypes, editor.extraIndentOptions.disabledIndentTypes);
|
|
12711
|
-
}
|
|
12712
|
-
var isContinue = !onKeydownTextIndent(editor, event, indentTypes, disableIndentTypes);
|
|
12713
|
-
if (isContinue) {
|
|
12714
|
-
onKeydown(event);
|
|
12715
|
-
}
|
|
12716
|
-
};
|
|
12717
|
-
return editor;
|
|
12718
|
-
}; };
|
|
12719
|
-
var mergIndentTypes = function (defaultTypes, indentTypes) {
|
|
12720
|
-
return Array.from(new Set(__spreadArray(__spreadArray([], __read(defaultTypes)), __read(indentTypes))));
|
|
12721
|
-
};
|
|
12722
|
-
|
|
12723
12687
|
var MaxIndent = 11;
|
|
12724
12688
|
var includesIndentTypes = __spreadArray([
|
|
12725
12689
|
exports.ElementKinds.checkItem,
|
|
@@ -12727,15 +12691,11 @@
|
|
|
12727
12691
|
exports.ElementKinds.bulletedList,
|
|
12728
12692
|
exports.ElementKinds.paragraph
|
|
12729
12693
|
], __read(HEADING_TYPES));
|
|
12730
|
-
var getIndentTypes = function (editor) {
|
|
12731
|
-
var indentTypes = editor.extraIndentOptions ? editor.extraIndentOptions.indentTypes : [];
|
|
12732
|
-
return mergIndentTypes(includesIndentTypes, indentTypes);
|
|
12733
|
-
};
|
|
12734
12694
|
var IndentEditor = {
|
|
12735
12695
|
setIndent: function (editor) {
|
|
12736
12696
|
var nodes = Array.from(slate.Editor.nodes(editor, {
|
|
12737
12697
|
mode: 'highest',
|
|
12738
|
-
match: function (n) { return slate.Element.isElement(n) &&
|
|
12698
|
+
match: function (n) { return slate.Element.isElement(n) && includesIndentTypes.includes(n.type); }
|
|
12739
12699
|
}));
|
|
12740
12700
|
var _a = __read(nodes, 1), startBlock = _a[0];
|
|
12741
12701
|
if (startBlock) {
|
|
@@ -12745,7 +12705,7 @@
|
|
|
12745
12705
|
if (indent <= MaxIndent) {
|
|
12746
12706
|
slate.Transforms.setNodes(editor, { indent: indent }, {
|
|
12747
12707
|
mode: 'highest',
|
|
12748
|
-
match: function (n) { return slate.Element.isElement(n) &&
|
|
12708
|
+
match: function (n) { return slate.Element.isElement(n) && includesIndentTypes.includes(n.type); }
|
|
12749
12709
|
});
|
|
12750
12710
|
}
|
|
12751
12711
|
}
|
|
@@ -12753,7 +12713,7 @@
|
|
|
12753
12713
|
cancelIndent: function (editor) {
|
|
12754
12714
|
var nodes = Array.from(slate.Editor.nodes(editor, {
|
|
12755
12715
|
mode: 'highest',
|
|
12756
|
-
match: function (n) { return slate.Element.isElement(n) &&
|
|
12716
|
+
match: function (n) { return slate.Element.isElement(n) && includesIndentTypes.includes(n.type); }
|
|
12757
12717
|
}));
|
|
12758
12718
|
var _a = __read(nodes, 1), startBlock = _a[0];
|
|
12759
12719
|
if (startBlock) {
|
|
@@ -12761,7 +12721,7 @@
|
|
|
12761
12721
|
indent = indent === 1 ? null : (indent -= 1);
|
|
12762
12722
|
slate.Transforms.setNodes(editor, { indent: indent }, {
|
|
12763
12723
|
mode: 'highest',
|
|
12764
|
-
match: function (n) { return slate.Element.isElement(n) &&
|
|
12724
|
+
match: function (n) { return slate.Element.isElement(n) && includesIndentTypes.includes(n.type); }
|
|
12765
12725
|
});
|
|
12766
12726
|
}
|
|
12767
12727
|
},
|
|
@@ -12794,7 +12754,7 @@
|
|
|
12794
12754
|
isDisabled: function (editor) {
|
|
12795
12755
|
if (editor.selection) {
|
|
12796
12756
|
var anchorBlock$1 = anchorBlock(editor);
|
|
12797
|
-
return anchorBlock$1 && !
|
|
12757
|
+
return anchorBlock$1 && !includesIndentTypes.includes(anchorBlock$1 === null || anchorBlock$1 === void 0 ? void 0 : anchorBlock$1.type);
|
|
12798
12758
|
}
|
|
12799
12759
|
return false;
|
|
12800
12760
|
}
|
|
@@ -12824,6 +12784,71 @@
|
|
|
12824
12784
|
}
|
|
12825
12785
|
];
|
|
12826
12786
|
|
|
12787
|
+
var onKeydownTextIndent = function (editor, event, kinds, textIndentDisabled) {
|
|
12788
|
+
var selection = editor.selection;
|
|
12789
|
+
var isExpanded = slate.Range.isExpanded(selection);
|
|
12790
|
+
var nodes = Array.from(slate.Editor.nodes(editor, {
|
|
12791
|
+
mode: 'highest',
|
|
12792
|
+
match: function (node) { return slate.Element.isElement(node) && kinds.includes(node.type); }
|
|
12793
|
+
}));
|
|
12794
|
+
var _a = __read(nodes, 1), startBlock = _a[0];
|
|
12795
|
+
if (!startBlock) {
|
|
12796
|
+
return false;
|
|
12797
|
+
}
|
|
12798
|
+
var _b = __read(startBlock, 2), block = _b[0], path = _b[1];
|
|
12799
|
+
var isStart = slate.Editor.isStart(editor, selection.anchor, path);
|
|
12800
|
+
if (isHotkey.isKeyHotkey('Tab', event)) {
|
|
12801
|
+
event.preventDefault();
|
|
12802
|
+
if (startBlock && (isExpanded || isStart)) {
|
|
12803
|
+
if (!editor.isVoid(block)) {
|
|
12804
|
+
var textIndent = block.textIndent, type = block.type;
|
|
12805
|
+
// do not apply first-line indentation for lists
|
|
12806
|
+
if (!textIndent && !textIndentDisabled.includes(type)) {
|
|
12807
|
+
IndentEditor.setTextIndent(editor, kinds, 2);
|
|
12808
|
+
return true;
|
|
12809
|
+
}
|
|
12810
|
+
else {
|
|
12811
|
+
IndentEditor.setIndent(editor);
|
|
12812
|
+
return true;
|
|
12813
|
+
}
|
|
12814
|
+
}
|
|
12815
|
+
}
|
|
12816
|
+
else {
|
|
12817
|
+
editor.insertText(TAB_SPACE);
|
|
12818
|
+
return true;
|
|
12819
|
+
}
|
|
12820
|
+
}
|
|
12821
|
+
if (isHotkey.isKeyHotkey('shift+Tab', event)) {
|
|
12822
|
+
if (startBlock && (isExpanded || isStart)) {
|
|
12823
|
+
if (!editor.isVoid(block)) {
|
|
12824
|
+
return IndentEditor.cancelTextIntent(editor, event, block, kinds);
|
|
12825
|
+
}
|
|
12826
|
+
}
|
|
12827
|
+
}
|
|
12828
|
+
if (selection && slate.Range.isCollapsed(selection) && i1.hotkeys.isDeleteBackward(event)) {
|
|
12829
|
+
if (startBlock && isStart) {
|
|
12830
|
+
return IndentEditor.cancelTextIntent(editor, event, block, kinds);
|
|
12831
|
+
}
|
|
12832
|
+
}
|
|
12833
|
+
return false;
|
|
12834
|
+
};
|
|
12835
|
+
|
|
12836
|
+
var withIndent = function (kinds) { return function (editor) {
|
|
12837
|
+
var onKeydown = editor.onKeydown;
|
|
12838
|
+
editor.onKeydown = function (event) {
|
|
12839
|
+
var indentTypes = kinds;
|
|
12840
|
+
var disableIndentTypes = [exports.ElementKinds.bulletedList, exports.ElementKinds.numberedList, exports.ElementKinds.checkItem];
|
|
12841
|
+
var isContinue = !onKeydownTextIndent(editor, event, indentTypes, disableIndentTypes);
|
|
12842
|
+
if (isContinue) {
|
|
12843
|
+
onKeydown(event);
|
|
12844
|
+
}
|
|
12845
|
+
};
|
|
12846
|
+
return editor;
|
|
12847
|
+
}; };
|
|
12848
|
+
var mergIndentTypes = function (defaultTypes, indentTypes) {
|
|
12849
|
+
return Array.from(new Set(__spreadArray(__spreadArray([], __read(defaultTypes)), __read(indentTypes))));
|
|
12850
|
+
};
|
|
12851
|
+
|
|
12827
12852
|
var internalPlugins = [
|
|
12828
12853
|
withTheHistory,
|
|
12829
12854
|
withAutoInsertData(),
|
|
@@ -13799,13 +13824,12 @@
|
|
|
13799
13824
|
};
|
|
13800
13825
|
TheEditorComponent.prototype.initialize = function () {
|
|
13801
13826
|
var _this = this;
|
|
13802
|
-
var _a, _b, _c
|
|
13827
|
+
var _a, _b, _c;
|
|
13803
13828
|
this.editor = withTheEditor(this.thePlugins, slateHistory.withHistory(i1.withAngular(slate.createEditor(), CLIPBOARD_FORMAT_KEY)));
|
|
13804
13829
|
this.generateDecorate();
|
|
13805
13830
|
this.editor.disabled = (_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.disabled;
|
|
13806
13831
|
this.editor.extraElementOptions = (_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.extraElementOptions;
|
|
13807
13832
|
this.editor.extraAutoFormatRules = (_c = this.theOptions) === null || _c === void 0 ? void 0 : _c.extraAutoFormatRules;
|
|
13808
|
-
this.editor.extraIndentOptions = (_d = this.theOptions) === null || _d === void 0 ? void 0 : _d.extraIndentOptions;
|
|
13809
13833
|
this.editor.options = this.theOptions;
|
|
13810
13834
|
setEditorUUID(this.editor, idCreator());
|
|
13811
13835
|
this.theContextService.initialize({
|
|
@@ -14349,7 +14373,7 @@
|
|
|
14349
14373
|
provide: TheToolbarGroupToken,
|
|
14350
14374
|
useValue: TheToolbarGroupComponent
|
|
14351
14375
|
},
|
|
14352
|
-
|
|
14376
|
+
THE_MODE_PROVIDER
|
|
14353
14377
|
], imports: [__spreadArray(__spreadArray([i10.CommonModule, i1.SlateModule, i4.FormsModule], __read(TETHYS)), [i8.CodemirrorModule, TheColumnSizeModule])] });
|
|
14354
14378
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheEditorModule, decorators: [{
|
|
14355
14379
|
type: i0.NgModule,
|
|
@@ -14363,7 +14387,7 @@
|
|
|
14363
14387
|
provide: TheToolbarGroupToken,
|
|
14364
14388
|
useValue: TheToolbarGroupComponent
|
|
14365
14389
|
},
|
|
14366
|
-
|
|
14390
|
+
THE_MODE_PROVIDER
|
|
14367
14391
|
]
|
|
14368
14392
|
}]
|
|
14369
14393
|
}] });
|
|
@@ -14388,7 +14412,6 @@
|
|
|
14388
14412
|
exports.CONTAINER_BLOCKS = CONTAINER_BLOCKS;
|
|
14389
14413
|
exports.CONTROL_KEY = CONTROL_KEY;
|
|
14390
14414
|
exports.CodeEditor = CodeEditor;
|
|
14391
|
-
exports.CodeMode = CodeMode;
|
|
14392
14415
|
exports.ColorEditor = ColorEditor;
|
|
14393
14416
|
exports.DEFAULT_LANGUAGE = DEFAULT_LANGUAGE;
|
|
14394
14417
|
exports.DEFAULT_SCROLL_CONTAINER = DEFAULT_SCROLL_CONTAINER;
|
|
@@ -14403,6 +14426,7 @@
|
|
|
14403
14426
|
exports.HrEditor = HrEditor;
|
|
14404
14427
|
exports.IS_MAC = IS_MAC;
|
|
14405
14428
|
exports.ImageEditor = ImageEditor;
|
|
14429
|
+
exports.IndentEditor = IndentEditor;
|
|
14406
14430
|
exports.LINK_DEFAULT_TEXT = LINK_DEFAULT_TEXT;
|
|
14407
14431
|
exports.LIST_BLOCK_TYPES = LIST_BLOCK_TYPES;
|
|
14408
14432
|
exports.LinkEditor = LinkEditor;
|
|
@@ -14416,22 +14440,23 @@
|
|
|
14416
14440
|
exports.QuickInsertEditor = QuickInsertEditor;
|
|
14417
14441
|
exports.STANDARD_HEADING_TYPES = STANDARD_HEADING_TYPES;
|
|
14418
14442
|
exports.TAB_SPACE = TAB_SPACE;
|
|
14419
|
-
exports.THE_CODE_MODE_PROVIDER = THE_CODE_MODE_PROVIDER;
|
|
14420
|
-
exports.THE_CODE_MODE_TOKEN = THE_CODE_MODE_TOKEN;
|
|
14421
14443
|
exports.THE_EDITOR_CONVERSION_HINT_REF = THE_EDITOR_CONVERSION_HINT_REF;
|
|
14422
14444
|
exports.THE_EDITOR_QUICK_TOOLBAR_REF = THE_EDITOR_QUICK_TOOLBAR_REF;
|
|
14423
14445
|
exports.THE_EDITOR_UUID = THE_EDITOR_UUID;
|
|
14424
14446
|
exports.THE_INLINE_TOOLBAR_TYPES = THE_INLINE_TOOLBAR_TYPES;
|
|
14447
|
+
exports.THE_MODE_PROVIDER = THE_MODE_PROVIDER;
|
|
14448
|
+
exports.THE_MODE_TOKEN = THE_MODE_TOKEN;
|
|
14425
14449
|
exports.THE_UPLOAD_SERVICE_TOKEN = THE_UPLOAD_SERVICE_TOKEN;
|
|
14426
14450
|
exports.TableEditor = TableEditor;
|
|
14427
14451
|
exports.TheBaseElementComponent = TheBaseElementComponent;
|
|
14428
|
-
exports.TheCodeConfig = TheCodeConfig;
|
|
14429
14452
|
exports.TheContextService = TheContextService;
|
|
14430
14453
|
exports.TheDefaultElementComponent = TheDefaultElementComponent;
|
|
14431
14454
|
exports.TheEditor = TheEditor;
|
|
14432
14455
|
exports.TheEditorComponent = TheEditorComponent;
|
|
14433
14456
|
exports.TheEditorModule = TheEditorModule;
|
|
14434
14457
|
exports.TheImageComponent = TheImageComponent;
|
|
14458
|
+
exports.TheIndentToolbarComponent = TheIndentToolbarComponent;
|
|
14459
|
+
exports.TheModeConfig = TheModeConfig;
|
|
14435
14460
|
exports.TheQueries = index$1;
|
|
14436
14461
|
exports.TheToolbarBaseItemComponent = TheToolbarBaseItemComponent;
|
|
14437
14462
|
exports.TheToolbarComponent = TheToolbarComponent;
|
|
@@ -14458,6 +14483,7 @@
|
|
|
14458
14483
|
exports.getToolbarClass = getToolbarClass;
|
|
14459
14484
|
exports.htmlToTheia = htmlToTheia;
|
|
14460
14485
|
exports.inValidTypes = inValidTypes;
|
|
14486
|
+
exports.includesIndentTypes = includesIndentTypes;
|
|
14461
14487
|
exports.isCleanEmptyParagraph = isCleanEmptyParagraph;
|
|
14462
14488
|
exports.isPureEmptyParagraph = isPureEmptyParagraph;
|
|
14463
14489
|
exports.mergeElementOptions = mergeElementOptions;
|