@worktile/theia 2.4.6 → 2.4.9
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 +171 -152
- 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 +19 -26
- 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/fesm2015/worktile-theia.js +145 -137
- 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
|
@@ -69,11 +69,6 @@ const CLIPBOARD_FORMAT_KEY = 'x-theia-fragment';
|
|
|
69
69
|
const DEFAULT_SCROLL_CONTAINER = '.the-editable-container';
|
|
70
70
|
const ELEMENT_UNIQUE_ID = 'key';
|
|
71
71
|
const ZERO_WIDTH_CHAR = '\u200B';
|
|
72
|
-
var TheMode;
|
|
73
|
-
(function (TheMode) {
|
|
74
|
-
TheMode["fullMode"] = "full";
|
|
75
|
-
TheMode["liteMode"] = "lite";
|
|
76
|
-
})(TheMode || (TheMode = {}));
|
|
77
72
|
|
|
78
73
|
var ElementKinds;
|
|
79
74
|
(function (ElementKinds) {
|
|
@@ -281,19 +276,6 @@ const CODE_MODES = [
|
|
|
281
276
|
value: 'htmlmixed'
|
|
282
277
|
}
|
|
283
278
|
];
|
|
284
|
-
const CodeMode = {
|
|
285
|
-
default: 'default',
|
|
286
|
-
print: 'print'
|
|
287
|
-
};
|
|
288
|
-
class TheCodeConfig {
|
|
289
|
-
}
|
|
290
|
-
const THE_CODE_MODE_TOKEN = new InjectionToken('the-code-mode');
|
|
291
|
-
const THE_CODE_MODE_PROVIDER = {
|
|
292
|
-
provide: THE_CODE_MODE_TOKEN,
|
|
293
|
-
useValue: {
|
|
294
|
-
mode: CodeMode.default
|
|
295
|
-
}
|
|
296
|
-
};
|
|
297
279
|
const CODEMIRROR_PADDING_TOP = 10;
|
|
298
280
|
|
|
299
281
|
const TheToolbarGroupToken = new InjectionToken('the-toolbar-group-token');
|
|
@@ -461,6 +443,20 @@ var TheDataMode;
|
|
|
461
443
|
TheDataMode["json"] = "json";
|
|
462
444
|
TheDataMode["html"] = "html";
|
|
463
445
|
})(TheDataMode || (TheDataMode = {}));
|
|
446
|
+
var TheMode;
|
|
447
|
+
(function (TheMode) {
|
|
448
|
+
TheMode["default"] = "default";
|
|
449
|
+
TheMode["print"] = "print";
|
|
450
|
+
})(TheMode || (TheMode = {}));
|
|
451
|
+
class TheModeConfig {
|
|
452
|
+
}
|
|
453
|
+
const THE_MODE_TOKEN = new InjectionToken('the-mode');
|
|
454
|
+
const THE_MODE_PROVIDER = {
|
|
455
|
+
provide: THE_MODE_TOKEN,
|
|
456
|
+
useValue: {
|
|
457
|
+
mode: TheMode.default
|
|
458
|
+
}
|
|
459
|
+
};
|
|
464
460
|
|
|
465
461
|
var ToolbarItemType;
|
|
466
462
|
(function (ToolbarItemType) {
|
|
@@ -6766,7 +6762,7 @@ class TheCodeComponent extends TheBaseElementComponent {
|
|
|
6766
6762
|
this.config = config;
|
|
6767
6763
|
this.startRenderCodemirror = false;
|
|
6768
6764
|
this.dropdownMode = DropdownMode;
|
|
6769
|
-
this.maxHeight = this.config.mode ===
|
|
6765
|
+
this.maxHeight = this.config.mode === TheMode.default ? 350 - CODEMIRROR_PADDING_TOP * 2 : 0;
|
|
6770
6766
|
this.menus = CODE_MODES.map(item => {
|
|
6771
6767
|
return { key: item.value, name: item.showName };
|
|
6772
6768
|
});
|
|
@@ -6780,7 +6776,7 @@ class TheCodeComponent extends TheBaseElementComponent {
|
|
|
6780
6776
|
readOnly: false,
|
|
6781
6777
|
autofocus: false,
|
|
6782
6778
|
lineWiseCopyCut: true,
|
|
6783
|
-
lineWrapping: this.config.mode ===
|
|
6779
|
+
lineWrapping: this.config.mode === TheMode.default ? false : true,
|
|
6784
6780
|
cursorBlinkRate: 500
|
|
6785
6781
|
};
|
|
6786
6782
|
this.actives = this.menus[0];
|
|
@@ -6956,7 +6952,7 @@ class TheCodeComponent extends TheBaseElementComponent {
|
|
|
6956
6952
|
this.destroy$.complete();
|
|
6957
6953
|
}
|
|
6958
6954
|
}
|
|
6959
|
-
TheCodeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheCodeComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1$4.ThyNotifyService }, { token: TheContextService }, { token: i0.NgZone }, { token:
|
|
6955
|
+
TheCodeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheCodeComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1$4.ThyNotifyService }, { token: TheContextService }, { token: i0.NgZone }, { token: THE_MODE_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
|
|
6960
6956
|
TheCodeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", 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=\"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$1.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }, { type: TheToolbarDropdownComponent, selector: "the-toolbar-dropdown", inputs: ["toolbarItem", "menus", "mode", "item", "itemMousedownHandle"] }, { type: i3$1.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: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.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: i10.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i10.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
6961
6957
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheCodeComponent, decorators: [{
|
|
6962
6958
|
type: Component,
|
|
@@ -6965,9 +6961,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
6965
6961
|
templateUrl: './code.component.html',
|
|
6966
6962
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
6967
6963
|
}]
|
|
6968
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$4.ThyNotifyService }, { type: TheContextService }, { type: i0.NgZone }, { type:
|
|
6964
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$4.ThyNotifyService }, { type: TheContextService }, { type: i0.NgZone }, { type: TheModeConfig, decorators: [{
|
|
6969
6965
|
type: Inject,
|
|
6970
|
-
args: [
|
|
6966
|
+
args: [THE_MODE_TOKEN]
|
|
6971
6967
|
}] }]; }, propDecorators: { codemirror: [{
|
|
6972
6968
|
type: ViewChild,
|
|
6973
6969
|
args: ['codemirror', { read: CodeMirrorComponent, static: false }]
|
|
@@ -9055,7 +9051,8 @@ class TheTableComponent extends TheBaseElementComponent {
|
|
|
9055
9051
|
this.getIsInTable();
|
|
9056
9052
|
}
|
|
9057
9053
|
ngAfterViewInit() {
|
|
9058
|
-
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
|
9054
|
+
this.ngZone.onStable.pipe(take(1)).subscribe(() => __awaiter(this, void 0, void 0, function* () {
|
|
9055
|
+
var _a;
|
|
9059
9056
|
const blockCardElement = this.nativeElement.closest('slate-block-card');
|
|
9060
9057
|
if (blockCardElement) {
|
|
9061
9058
|
blockCardElement.classList.add(`slate-block-card-${this.element.type}`);
|
|
@@ -9065,9 +9062,21 @@ class TheTableComponent extends TheBaseElementComponent {
|
|
|
9065
9062
|
this.subscribeCellPositionChange();
|
|
9066
9063
|
this.listenTableContextMenuEvent();
|
|
9067
9064
|
this.useTableWrapperWidth();
|
|
9068
|
-
|
|
9069
|
-
|
|
9070
|
-
|
|
9065
|
+
if ((_a = this.element.options) === null || _a === void 0 ? void 0 : _a.numberedColumn) {
|
|
9066
|
+
const loadImageDone = yield this.resolveImage();
|
|
9067
|
+
// 等待序号列表格内图片加载完成后再去渲染表格行高度
|
|
9068
|
+
if (loadImageDone) {
|
|
9069
|
+
setTimeout(() => {
|
|
9070
|
+
this.useRowControls();
|
|
9071
|
+
this.cdr.detectChanges();
|
|
9072
|
+
}, 200); // 200ms:通过通知打开页面动画加载时间
|
|
9073
|
+
}
|
|
9074
|
+
}
|
|
9075
|
+
else {
|
|
9076
|
+
this.useRowControls();
|
|
9077
|
+
this.cdr.markForCheck();
|
|
9078
|
+
}
|
|
9079
|
+
}));
|
|
9071
9080
|
}
|
|
9072
9081
|
subscribeCellPositionChange() {
|
|
9073
9082
|
this.tableStore
|
|
@@ -9100,7 +9109,6 @@ class TheTableComponent extends TheBaseElementComponent {
|
|
|
9100
9109
|
var _a;
|
|
9101
9110
|
if (this.selection || ((_a = this.element.options) === null || _a === void 0 ? void 0 : _a.numberedColumn)) {
|
|
9102
9111
|
this.rowControls = this.calculateRowControls();
|
|
9103
|
-
this.cdr.markForCheck();
|
|
9104
9112
|
}
|
|
9105
9113
|
}
|
|
9106
9114
|
detectChanges() {
|
|
@@ -9202,6 +9210,24 @@ class TheTableComponent extends TheBaseElementComponent {
|
|
|
9202
9210
|
});
|
|
9203
9211
|
return belowRowlHeight;
|
|
9204
9212
|
}
|
|
9213
|
+
resolveImage() {
|
|
9214
|
+
const imageElements = this.nativeElement.querySelectorAll('img');
|
|
9215
|
+
if (imageElements.length) {
|
|
9216
|
+
const imageResolves = [];
|
|
9217
|
+
imageElements.forEach(item => {
|
|
9218
|
+
const image = new Image();
|
|
9219
|
+
const imageLoad = new Promise(resolve => {
|
|
9220
|
+
image.onload = () => {
|
|
9221
|
+
resolve(true);
|
|
9222
|
+
};
|
|
9223
|
+
image.src = item.getAttribute('src');
|
|
9224
|
+
});
|
|
9225
|
+
imageResolves.push(imageLoad);
|
|
9226
|
+
});
|
|
9227
|
+
return Promise.all(imageResolves);
|
|
9228
|
+
}
|
|
9229
|
+
return Promise.resolve(true);
|
|
9230
|
+
}
|
|
9205
9231
|
getColControls() {
|
|
9206
9232
|
var _a, _b;
|
|
9207
9233
|
this.colControls = ((_b = (_a = this.element) === null || _a === void 0 ? void 0 : _a.children[0]) === null || _b === void 0 ? void 0 : _b.children) || [];
|
|
@@ -11783,78 +11809,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
11783
11809
|
args: ['class.disabled']
|
|
11784
11810
|
}] } });
|
|
11785
11811
|
|
|
11786
|
-
const onKeydownTextIndent = (editor, event, kinds, textIndentDisabled) => {
|
|
11787
|
-
const { selection } = editor;
|
|
11788
|
-
const isExpanded = Range.isExpanded(selection);
|
|
11789
|
-
const nodes = Array.from(Editor.nodes(editor, {
|
|
11790
|
-
mode: 'highest',
|
|
11791
|
-
match: node => Element$1.isElement(node) && kinds.includes(node.type)
|
|
11792
|
-
}));
|
|
11793
|
-
const [startBlock] = nodes;
|
|
11794
|
-
if (!startBlock) {
|
|
11795
|
-
return false;
|
|
11796
|
-
}
|
|
11797
|
-
const [block, path] = startBlock;
|
|
11798
|
-
const isStart = Editor.isStart(editor, selection.anchor, path);
|
|
11799
|
-
if (isKeyHotkey('Tab', event)) {
|
|
11800
|
-
event.preventDefault();
|
|
11801
|
-
if (startBlock && (isExpanded || isStart)) {
|
|
11802
|
-
if (!editor.isVoid(block)) {
|
|
11803
|
-
let { textIndent, type } = block;
|
|
11804
|
-
// do not apply first-line indentation for lists
|
|
11805
|
-
if (!textIndent && !textIndentDisabled.includes(type)) {
|
|
11806
|
-
IndentEditor.setTextIndent(editor, kinds, 2);
|
|
11807
|
-
return true;
|
|
11808
|
-
}
|
|
11809
|
-
else {
|
|
11810
|
-
IndentEditor.setIndent(editor);
|
|
11811
|
-
return true;
|
|
11812
|
-
}
|
|
11813
|
-
}
|
|
11814
|
-
}
|
|
11815
|
-
else {
|
|
11816
|
-
editor.insertText(TAB_SPACE);
|
|
11817
|
-
return true;
|
|
11818
|
-
}
|
|
11819
|
-
}
|
|
11820
|
-
if (isKeyHotkey('shift+Tab', event)) {
|
|
11821
|
-
if (startBlock && (isExpanded || isStart)) {
|
|
11822
|
-
if (!editor.isVoid(block)) {
|
|
11823
|
-
return IndentEditor.cancelTextIntent(editor, event, block, kinds);
|
|
11824
|
-
}
|
|
11825
|
-
}
|
|
11826
|
-
}
|
|
11827
|
-
if (selection && Range.isCollapsed(selection) && hotkeys.isDeleteBackward(event)) {
|
|
11828
|
-
if (startBlock && isStart) {
|
|
11829
|
-
return IndentEditor.cancelTextIntent(editor, event, block, kinds);
|
|
11830
|
-
}
|
|
11831
|
-
}
|
|
11832
|
-
return false;
|
|
11833
|
-
};
|
|
11834
|
-
|
|
11835
|
-
const withIndent = (kinds) => (editor) => {
|
|
11836
|
-
const { onKeydown } = editor;
|
|
11837
|
-
editor.onKeydown = (event) => {
|
|
11838
|
-
var _a, _b, _c, _d;
|
|
11839
|
-
let indentTypes = kinds;
|
|
11840
|
-
let disableIndentTypes = [ElementKinds.bulletedList, ElementKinds.numberedList, ElementKinds.checkItem];
|
|
11841
|
-
if ((_b = (_a = editor.extraIndentOptions) === null || _a === void 0 ? void 0 : _a.indentTypes) === null || _b === void 0 ? void 0 : _b.length) {
|
|
11842
|
-
indentTypes = mergIndentTypes(kinds, editor.extraIndentOptions.indentTypes);
|
|
11843
|
-
}
|
|
11844
|
-
if ((_d = (_c = editor.extraIndentOptions) === null || _c === void 0 ? void 0 : _c.disabledIndentTypes) === null || _d === void 0 ? void 0 : _d.length) {
|
|
11845
|
-
disableIndentTypes = mergIndentTypes(disableIndentTypes, editor.extraIndentOptions.disabledIndentTypes);
|
|
11846
|
-
}
|
|
11847
|
-
const isContinue = !onKeydownTextIndent(editor, event, indentTypes, disableIndentTypes);
|
|
11848
|
-
if (isContinue) {
|
|
11849
|
-
onKeydown(event);
|
|
11850
|
-
}
|
|
11851
|
-
};
|
|
11852
|
-
return editor;
|
|
11853
|
-
};
|
|
11854
|
-
const mergIndentTypes = (defaultTypes, indentTypes) => {
|
|
11855
|
-
return Array.from(new Set([...defaultTypes, ...indentTypes]));
|
|
11856
|
-
};
|
|
11857
|
-
|
|
11858
11812
|
const MaxIndent = 11;
|
|
11859
11813
|
const includesIndentTypes = [
|
|
11860
11814
|
ElementKinds.checkItem,
|
|
@@ -11863,15 +11817,11 @@ const includesIndentTypes = [
|
|
|
11863
11817
|
ElementKinds.paragraph,
|
|
11864
11818
|
...HEADING_TYPES
|
|
11865
11819
|
];
|
|
11866
|
-
const getIndentTypes = editor => {
|
|
11867
|
-
let indentTypes = editor.extraIndentOptions ? editor.extraIndentOptions.indentTypes : [];
|
|
11868
|
-
return mergIndentTypes(includesIndentTypes, indentTypes);
|
|
11869
|
-
};
|
|
11870
11820
|
const IndentEditor = {
|
|
11871
11821
|
setIndent(editor) {
|
|
11872
11822
|
const nodes = Array.from(Editor.nodes(editor, {
|
|
11873
11823
|
mode: 'highest',
|
|
11874
|
-
match: n => Element$1.isElement(n) &&
|
|
11824
|
+
match: n => Element$1.isElement(n) && includesIndentTypes.includes(n.type)
|
|
11875
11825
|
}));
|
|
11876
11826
|
const [startBlock] = nodes;
|
|
11877
11827
|
if (startBlock) {
|
|
@@ -11881,7 +11831,7 @@ const IndentEditor = {
|
|
|
11881
11831
|
if (indent <= MaxIndent) {
|
|
11882
11832
|
Transforms.setNodes(editor, { indent }, {
|
|
11883
11833
|
mode: 'highest',
|
|
11884
|
-
match: n => Element$1.isElement(n) &&
|
|
11834
|
+
match: n => Element$1.isElement(n) && includesIndentTypes.includes(n.type)
|
|
11885
11835
|
});
|
|
11886
11836
|
}
|
|
11887
11837
|
}
|
|
@@ -11889,7 +11839,7 @@ const IndentEditor = {
|
|
|
11889
11839
|
cancelIndent(editor) {
|
|
11890
11840
|
const nodes = Array.from(Editor.nodes(editor, {
|
|
11891
11841
|
mode: 'highest',
|
|
11892
|
-
match: n => Element$1.isElement(n) &&
|
|
11842
|
+
match: n => Element$1.isElement(n) && includesIndentTypes.includes(n.type)
|
|
11893
11843
|
}));
|
|
11894
11844
|
const [startBlock] = nodes;
|
|
11895
11845
|
if (startBlock) {
|
|
@@ -11897,7 +11847,7 @@ const IndentEditor = {
|
|
|
11897
11847
|
indent = indent === 1 ? null : (indent -= 1);
|
|
11898
11848
|
Transforms.setNodes(editor, { indent }, {
|
|
11899
11849
|
mode: 'highest',
|
|
11900
|
-
match: n => Element$1.isElement(n) &&
|
|
11850
|
+
match: n => Element$1.isElement(n) && includesIndentTypes.includes(n.type)
|
|
11901
11851
|
});
|
|
11902
11852
|
}
|
|
11903
11853
|
},
|
|
@@ -11930,7 +11880,7 @@ const IndentEditor = {
|
|
|
11930
11880
|
isDisabled(editor) {
|
|
11931
11881
|
if (editor.selection) {
|
|
11932
11882
|
const anchorBlock$1 = anchorBlock(editor);
|
|
11933
|
-
return anchorBlock$1 && !
|
|
11883
|
+
return anchorBlock$1 && !includesIndentTypes.includes(anchorBlock$1 === null || anchorBlock$1 === void 0 ? void 0 : anchorBlock$1.type);
|
|
11934
11884
|
}
|
|
11935
11885
|
return false;
|
|
11936
11886
|
}
|
|
@@ -11960,6 +11910,71 @@ const IndentOptions = [
|
|
|
11960
11910
|
}
|
|
11961
11911
|
];
|
|
11962
11912
|
|
|
11913
|
+
const onKeydownTextIndent = (editor, event, kinds, textIndentDisabled) => {
|
|
11914
|
+
const { selection } = editor;
|
|
11915
|
+
const isExpanded = Range.isExpanded(selection);
|
|
11916
|
+
const nodes = Array.from(Editor.nodes(editor, {
|
|
11917
|
+
mode: 'highest',
|
|
11918
|
+
match: node => Element$1.isElement(node) && kinds.includes(node.type)
|
|
11919
|
+
}));
|
|
11920
|
+
const [startBlock] = nodes;
|
|
11921
|
+
if (!startBlock) {
|
|
11922
|
+
return false;
|
|
11923
|
+
}
|
|
11924
|
+
const [block, path] = startBlock;
|
|
11925
|
+
const isStart = Editor.isStart(editor, selection.anchor, path);
|
|
11926
|
+
if (isKeyHotkey('Tab', event)) {
|
|
11927
|
+
event.preventDefault();
|
|
11928
|
+
if (startBlock && (isExpanded || isStart)) {
|
|
11929
|
+
if (!editor.isVoid(block)) {
|
|
11930
|
+
let { textIndent, type } = block;
|
|
11931
|
+
// do not apply first-line indentation for lists
|
|
11932
|
+
if (!textIndent && !textIndentDisabled.includes(type)) {
|
|
11933
|
+
IndentEditor.setTextIndent(editor, kinds, 2);
|
|
11934
|
+
return true;
|
|
11935
|
+
}
|
|
11936
|
+
else {
|
|
11937
|
+
IndentEditor.setIndent(editor);
|
|
11938
|
+
return true;
|
|
11939
|
+
}
|
|
11940
|
+
}
|
|
11941
|
+
}
|
|
11942
|
+
else {
|
|
11943
|
+
editor.insertText(TAB_SPACE);
|
|
11944
|
+
return true;
|
|
11945
|
+
}
|
|
11946
|
+
}
|
|
11947
|
+
if (isKeyHotkey('shift+Tab', event)) {
|
|
11948
|
+
if (startBlock && (isExpanded || isStart)) {
|
|
11949
|
+
if (!editor.isVoid(block)) {
|
|
11950
|
+
return IndentEditor.cancelTextIntent(editor, event, block, kinds);
|
|
11951
|
+
}
|
|
11952
|
+
}
|
|
11953
|
+
}
|
|
11954
|
+
if (selection && Range.isCollapsed(selection) && hotkeys.isDeleteBackward(event)) {
|
|
11955
|
+
if (startBlock && isStart) {
|
|
11956
|
+
return IndentEditor.cancelTextIntent(editor, event, block, kinds);
|
|
11957
|
+
}
|
|
11958
|
+
}
|
|
11959
|
+
return false;
|
|
11960
|
+
};
|
|
11961
|
+
|
|
11962
|
+
const withIndent = (kinds) => (editor) => {
|
|
11963
|
+
const { onKeydown } = editor;
|
|
11964
|
+
editor.onKeydown = (event) => {
|
|
11965
|
+
let indentTypes = kinds;
|
|
11966
|
+
let disableIndentTypes = [ElementKinds.bulletedList, ElementKinds.numberedList, ElementKinds.checkItem];
|
|
11967
|
+
const isContinue = !onKeydownTextIndent(editor, event, indentTypes, disableIndentTypes);
|
|
11968
|
+
if (isContinue) {
|
|
11969
|
+
onKeydown(event);
|
|
11970
|
+
}
|
|
11971
|
+
};
|
|
11972
|
+
return editor;
|
|
11973
|
+
};
|
|
11974
|
+
const mergIndentTypes = (defaultTypes, indentTypes) => {
|
|
11975
|
+
return Array.from(new Set([...defaultTypes, ...indentTypes]));
|
|
11976
|
+
};
|
|
11977
|
+
|
|
11963
11978
|
const internalPlugins = [
|
|
11964
11979
|
withTheHistory,
|
|
11965
11980
|
withAutoInsertData(),
|
|
@@ -12859,13 +12874,12 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
|
|
|
12859
12874
|
super.ngOnDestroy();
|
|
12860
12875
|
}
|
|
12861
12876
|
initialize() {
|
|
12862
|
-
var _a, _b, _c
|
|
12877
|
+
var _a, _b, _c;
|
|
12863
12878
|
this.editor = withTheEditor(this.thePlugins, withHistory(withAngular(createEditor(), CLIPBOARD_FORMAT_KEY)));
|
|
12864
12879
|
this.generateDecorate();
|
|
12865
12880
|
this.editor.disabled = (_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.disabled;
|
|
12866
12881
|
this.editor.extraElementOptions = (_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.extraElementOptions;
|
|
12867
12882
|
this.editor.extraAutoFormatRules = (_c = this.theOptions) === null || _c === void 0 ? void 0 : _c.extraAutoFormatRules;
|
|
12868
|
-
this.editor.extraIndentOptions = (_d = this.theOptions) === null || _d === void 0 ? void 0 : _d.extraIndentOptions;
|
|
12869
12883
|
this.editor.options = this.theOptions;
|
|
12870
12884
|
setEditorUUID(this.editor, idCreator());
|
|
12871
12885
|
this.theContextService.initialize({
|
|
@@ -12996,30 +13010,24 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
|
|
|
12996
13010
|
}
|
|
12997
13011
|
mousedown(event) {
|
|
12998
13012
|
const editableElement = AngularEditor.toDOMNode(this.editor, this.editor);
|
|
12999
|
-
|
|
13000
|
-
|
|
13013
|
+
const rectEditable = editableElement.getBoundingClientRect();
|
|
13014
|
+
const absoluteElement = document.elementFromPoint(event.x, event.y);
|
|
13015
|
+
if (!editableElement.isEqualNode(absoluteElement)) {
|
|
13016
|
+
const blockCardElement = absoluteElement.querySelector('.slate-block-card');
|
|
13017
|
+
if (!blockCardElement)
|
|
13018
|
+
return;
|
|
13019
|
+
}
|
|
13020
|
+
let { paddingRight } = window.getComputedStyle(editableElement, null);
|
|
13021
|
+
const paddingRightPixels = coercePixelsFromCssValue(paddingRight);
|
|
13022
|
+
const fakeRightX = rectEditable.right - paddingRightPixels - 50;
|
|
13023
|
+
let relativeElement = document.elementFromPoint(fakeRightX, event.y);
|
|
13024
|
+
let relativeBlockCardElement = relativeElement.closest('.slate-block-card');
|
|
13025
|
+
if (relativeBlockCardElement) {
|
|
13001
13026
|
const centerX = rectEditable.x + rectEditable.width / 2;
|
|
13002
|
-
|
|
13003
|
-
|
|
13004
|
-
|
|
13005
|
-
|
|
13006
|
-
const fakeRightX = rectEditable.right - paddingRightPixels - 50;
|
|
13007
|
-
let relativeElement = document.elementFromPoint(fakeLeftX, event.y);
|
|
13008
|
-
let relativeBlockCardElement = relativeElement.closest('.slate-block-card');
|
|
13009
|
-
if (!relativeBlockCardElement) {
|
|
13010
|
-
relativeElement = document.elementFromPoint(fakeRightX, event.y);
|
|
13011
|
-
relativeBlockCardElement = relativeElement.closest('.slate-block-card');
|
|
13012
|
-
}
|
|
13013
|
-
if (relativeBlockCardElement) {
|
|
13014
|
-
const blockCardEntry = AngularEditor.toSlateCardEntry(this.editor, relativeBlockCardElement.firstElementChild);
|
|
13015
|
-
if (blockCardEntry && blockCardEntry[1]) {
|
|
13016
|
-
const rootNodePath = blockCardEntry[1].slice(0, 1);
|
|
13017
|
-
const rootNode = getNode(this.editor, rootNodePath);
|
|
13018
|
-
if (this.editor.isBlockCard(rootNode)) {
|
|
13019
|
-
event.preventDefault();
|
|
13020
|
-
AngularEditor.moveBlockCard(this.editor, rootNode, { direction: event.x < centerX ? 'left' : 'right' });
|
|
13021
|
-
}
|
|
13022
|
-
}
|
|
13027
|
+
const blockCardEntry = AngularEditor.toSlateCardEntry(this.editor, relativeBlockCardElement.firstElementChild);
|
|
13028
|
+
if (blockCardEntry && this.editor.isBlockCard(blockCardEntry[0])) {
|
|
13029
|
+
event.preventDefault();
|
|
13030
|
+
AngularEditor.moveBlockCard(this.editor, blockCardEntry[0], { direction: event.x < centerX ? 'left' : 'right' });
|
|
13023
13031
|
}
|
|
13024
13032
|
}
|
|
13025
13033
|
}
|
|
@@ -13384,7 +13392,7 @@ TheEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version
|
|
|
13384
13392
|
provide: TheToolbarGroupToken,
|
|
13385
13393
|
useValue: TheToolbarGroupComponent
|
|
13386
13394
|
},
|
|
13387
|
-
|
|
13395
|
+
THE_MODE_PROVIDER
|
|
13388
13396
|
], imports: [[CommonModule, SlateModule, FormsModule, ...TETHYS, CodemirrorModule, TheColumnSizeModule]] });
|
|
13389
13397
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheEditorModule, decorators: [{
|
|
13390
13398
|
type: NgModule,
|
|
@@ -13398,7 +13406,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
13398
13406
|
provide: TheToolbarGroupToken,
|
|
13399
13407
|
useValue: TheToolbarGroupComponent
|
|
13400
13408
|
},
|
|
13401
|
-
|
|
13409
|
+
THE_MODE_PROVIDER
|
|
13402
13410
|
]
|
|
13403
13411
|
}]
|
|
13404
13412
|
}] });
|
|
@@ -13411,5 +13419,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
13411
13419
|
* Generated bundle index. Do not edit.
|
|
13412
13420
|
*/
|
|
13413
13421
|
|
|
13414
|
-
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,
|
|
13422
|
+
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, 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, IndentEditor, Indents, LINK_DEFAULT_TEXT, LIST_BLOCK_TYPES, LayoutTypes, 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_EDITOR_CONVERSION_HINT_REF, THE_EDITOR_QUICK_TOOLBAR_REF, THE_EDITOR_UUID, THE_INLINE_TOOLBAR_TYPES, THE_MODE_PROVIDER, THE_MODE_TOKEN, THE_UPLOAD_SERVICE_TOKEN, TableEditor, TheBaseElementComponent, TheContextService, TheDataMode, TheDefaultElementComponent, TheEditor, TheEditorComponent, TheEditorModule, TheImageComponent, TheIndentToolbarComponent, TheMode, TheModeConfig, 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, ZERO_WIDTH_CHAR, coercePixelsFromCssValue, createEmptyParagraph, dataDeserialize, dataSerializing, getColsTotalWidth, getElementClassByPrefix, getElementHeight, getElementWidth, getRowsTotalHeight, getToolbarClass, htmlToTheia, inValidTypes, includesIndentTypes, isCleanEmptyParagraph, isPureEmptyParagraph, mergeElementOptions, plainToTheia, toolbarCompose, useElementStyle, withTheEditor };
|
|
13415
13423
|
//# sourceMappingURL=worktile-theia.js.map
|