@worktile/theia 20.1.0-next.9 → 20.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/fesm2022/worktile-theia.mjs +193 -151
- package/fesm2022/worktile-theia.mjs.map +1 -1
- package/index.d.ts +19 -20
- package/package.json +3 -3
- package/plugins/table/components/table.component.scss +20 -10
- package/styles/typo.scss +1 -0
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { NgStyle, NgTemplateOutlet, NgClass } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { InjectionToken, Component, inject, signal, Injectable, computed, HostBinding, Input, Directive, ViewChild, HostListener, ViewContainerRef, Inject, TemplateRef, forwardRef, ContentChildren, Optional, SkipSelf, EventEmitter, NgZone, ElementRef, DestroyRef, Output, Pipe, ChangeDetectionStrategy, ChangeDetectorRef, ViewChildren, Renderer2, viewChild,
|
|
3
|
+
import { InjectionToken, Component, inject, signal, Injectable, computed, HostBinding, Input, Directive, ViewChild, HostListener, ViewContainerRef, Inject, TemplateRef, forwardRef, ContentChildren, Optional, SkipSelf, EventEmitter, NgZone, ElementRef, DestroyRef, Output, Pipe, ChangeDetectionStrategy, ChangeDetectorRef, ViewChildren, Renderer2, viewChild, Injector, NgModule } from '@angular/core';
|
|
4
4
|
import { ThyDivider } from 'ngx-tethys/divider';
|
|
5
5
|
import { ThyAction, ThyActions } from 'ngx-tethys/action';
|
|
6
6
|
import { ThyDropdownMenuItemDirective, ThyDropdownMenuDivider, ThyDropdownMenuItemNameDirective, ThyDropdownMenuItemIconDirective, ThyDropdownMenuItemActiveDirective, ThyDropdownMenuComponent, ThyDropdownMenuGroup, ThyDropdownDirective, ThyDropdownMenuItemExtendIconDirective } from 'ngx-tethys/dropdown';
|
|
7
7
|
import * as i2$5 from 'ngx-tethys/icon';
|
|
8
8
|
import { ThyIcon, ThyIconRegistry } from 'ngx-tethys/icon';
|
|
9
|
-
import { cloneDeep, map, assign, defaults, groupBy, uniq, isEqual } from 'lodash';
|
|
9
|
+
import { cloneDeep, map, every, assign, defaults, groupBy, uniq, isEqual } from 'lodash';
|
|
10
10
|
export { assign, cloneDeep, debounce, defaults, groupBy, isEqual, map, uniq } from 'lodash';
|
|
11
11
|
import { Editor, Element, Span, Range, Path, Node, Point, Text, Transforms, Operation, createEditor } from 'slate';
|
|
12
12
|
import * as i4 from 'slate-angular';
|
|
13
|
-
import { FAKE_LEFT_BLOCK_CARD_OFFSET, FAKE_RIGHT_BLOCK_CARD_OFFSET, getClipboardData, AngularEditor, hotkeys, getPlainText as getPlainText$1, createClipboardData, setClipboardData, BaseElementComponent, IS_SAFARI, ELEMENT_TO_COMPONENT, SlateModule, getBlockCardByNativeElement, SLATE_BLOCK_CARD_CLASS_NAME, BaseElementFlavour, hasBlockCard, isCardLeft, ELEMENT_KEY_TO_HEIGHTS, DefaultTextFlavour, defaultScrollSelectionIntoView, getDataTransferClipboard,
|
|
13
|
+
import { FAKE_LEFT_BLOCK_CARD_OFFSET, FAKE_RIGHT_BLOCK_CARD_OFFSET, getClipboardData, AngularEditor, hotkeys, getPlainText as getPlainText$1, createClipboardData, setClipboardData, BaseElementComponent, IS_SAFARI, ELEMENT_TO_COMPONENT, SlateModule, getBlockCardByNativeElement, SLATE_BLOCK_CARD_CLASS_NAME, EDITOR_TO_VIRTUAL_SCROLL_SELECTION, BaseElementFlavour, hasBlockCard, isCardLeft, ELEMENT_KEY_TO_HEIGHTS, getRealHeightByElement, isDebug, debugLog, DefaultTextFlavour, defaultScrollSelectionIntoView, getDataTransferClipboard, SLATE_DEBUG_KEY, withAngular } from 'slate-angular';
|
|
14
14
|
import { HistoryEditor, withHistory } from 'slate-history';
|
|
15
15
|
import { NODE_TO_PARENT, NODE_TO_INDEX, NODE_TO_ELEMENT, DOMEditor, EDITOR_TO_ELEMENT } from 'slate-dom';
|
|
16
16
|
import { TheiaConverter } from '@atinc/selene';
|
|
@@ -2438,6 +2438,9 @@ function toggleClass(nativeElement, className, isAdd) {
|
|
|
2438
2438
|
}
|
|
2439
2439
|
}
|
|
2440
2440
|
function toggleHeadingRelatedElement(editor, element, isVisible) {
|
|
2441
|
+
if (editor.options.enableVirtualScroll) {
|
|
2442
|
+
return;
|
|
2443
|
+
}
|
|
2441
2444
|
const targetDom = NODE_TO_ELEMENT.get(element);
|
|
2442
2445
|
if (!targetDom) {
|
|
2443
2446
|
return;
|
|
@@ -2495,7 +2498,7 @@ class TheBaseElement extends BaseElementComponent {
|
|
|
2495
2498
|
super.ngOnInit();
|
|
2496
2499
|
const blockClass = this.editor.isInline(this.element) ? 'slate-inline-block' : 'slate-block';
|
|
2497
2500
|
this.nativeElement.classList.add(`slate-element-${this.element.type}`, blockClass);
|
|
2498
|
-
if (this.editor) {
|
|
2501
|
+
if (this.editor && !this.editor.options.enableVirtualScroll) {
|
|
2499
2502
|
const isVisible = this.editor.isVisible(this.element);
|
|
2500
2503
|
const isBlockCard = this.editor.isBlockCard(this.element);
|
|
2501
2504
|
if (!isVisible) {
|
|
@@ -2715,6 +2718,27 @@ const isPureEmptyParagraph = (editor, block) => {
|
|
|
2715
2718
|
return false;
|
|
2716
2719
|
};
|
|
2717
2720
|
|
|
2721
|
+
const isPureParagraph = (editor, block) => {
|
|
2722
|
+
if (!Array.isArray(block)) {
|
|
2723
|
+
block = [block];
|
|
2724
|
+
}
|
|
2725
|
+
return every(block, block => {
|
|
2726
|
+
return (Element.isElement(block) &&
|
|
2727
|
+
block.type === ElementKinds.paragraph &&
|
|
2728
|
+
block.children.length === 1 &&
|
|
2729
|
+
(block.children[0].text || block.children[0].type === ElementKinds.inlineCode));
|
|
2730
|
+
});
|
|
2731
|
+
};
|
|
2732
|
+
|
|
2733
|
+
const isPureHeading = (editor, block) => {
|
|
2734
|
+
if (!Array.isArray(block)) {
|
|
2735
|
+
block = [block];
|
|
2736
|
+
}
|
|
2737
|
+
return every(block, block => {
|
|
2738
|
+
return Element.isElement(block) && STANDARD_HEADING_TYPES.includes(block.type);
|
|
2739
|
+
});
|
|
2740
|
+
};
|
|
2741
|
+
|
|
2718
2742
|
// credit: https://github.com/segmentio/is-url
|
|
2719
2743
|
// support mailto: protocol
|
|
2720
2744
|
const protocolAndDomainRE = /^(?:\w+:)?\/\/(\S+)$/;
|
|
@@ -5227,7 +5251,6 @@ const TABLE_BORDER = 1;
|
|
|
5227
5251
|
const TABLE_PADDING = 8;
|
|
5228
5252
|
const TABLE_CONTROL = 11;
|
|
5229
5253
|
const TABLE_NUMBER_COLUMN = 45;
|
|
5230
|
-
const TABLE_HORIZONTAL_SCROLL_HEIGHT = 16; // table component horizontal scrollbar height
|
|
5231
5254
|
const TableWithStickyRowClass = 'the-table-with-sticky-row';
|
|
5232
5255
|
var FullscreenState;
|
|
5233
5256
|
(function (FullscreenState) {
|
|
@@ -7101,7 +7124,7 @@ class TheCode extends TheBaseElement {
|
|
|
7101
7124
|
cursorBlinkRate: 500
|
|
7102
7125
|
};
|
|
7103
7126
|
this.resizeBounds = null;
|
|
7104
|
-
this.isDelayRender = signal(
|
|
7127
|
+
this.isDelayRender = signal(true, ...(ngDevMode ? [{ debugName: "isDelayRender" }] : []));
|
|
7105
7128
|
this.thyNotifyService = inject(ThyNotifyService);
|
|
7106
7129
|
this.contextService = inject(TheContextService);
|
|
7107
7130
|
this.ngZone = inject(NgZone);
|
|
@@ -7146,6 +7169,14 @@ class TheCode extends TheBaseElement {
|
|
|
7146
7169
|
super.ngOnInit();
|
|
7147
7170
|
this.initMaxHeight();
|
|
7148
7171
|
this.activeLanguage = this.menus.find(item => item.key === DEFAULT_LANGUAGE.value);
|
|
7172
|
+
this.renderCodemirror();
|
|
7173
|
+
if (!this.readonly) {
|
|
7174
|
+
this.resizeBounds = {
|
|
7175
|
+
nativeElement: this.contextService.getEditableElement()
|
|
7176
|
+
};
|
|
7177
|
+
}
|
|
7178
|
+
}
|
|
7179
|
+
ngAfterViewInit() {
|
|
7149
7180
|
this.ngZone.runOutsideAngular(() => {
|
|
7150
7181
|
fromEvent(this.nativeElement, 'mousedown')
|
|
7151
7182
|
.pipe(takeUntil(this.destroy$))
|
|
@@ -7163,17 +7194,6 @@ class TheCode extends TheBaseElement {
|
|
|
7163
7194
|
}
|
|
7164
7195
|
});
|
|
7165
7196
|
});
|
|
7166
|
-
this.useCodemirror();
|
|
7167
|
-
if (!this.readonly) {
|
|
7168
|
-
this.resizeBounds = {
|
|
7169
|
-
nativeElement: this.contextService.getEditableElement()
|
|
7170
|
-
};
|
|
7171
|
-
}
|
|
7172
|
-
}
|
|
7173
|
-
ngAfterViewInit() {
|
|
7174
|
-
if (this.isCollapsedAndNonReadonly) {
|
|
7175
|
-
this.useAutofocus();
|
|
7176
|
-
}
|
|
7177
7197
|
}
|
|
7178
7198
|
initMaxHeight() {
|
|
7179
7199
|
this.maxHeight = isPrintMode(this.editor) ? 0 : 350 - CODEMIRROR_PADDING_TOP * 2;
|
|
@@ -7202,11 +7222,14 @@ class TheCode extends TheBaseElement {
|
|
|
7202
7222
|
this.toolbarPopoverRef.close();
|
|
7203
7223
|
}
|
|
7204
7224
|
}
|
|
7205
|
-
|
|
7225
|
+
renderCodemirror() {
|
|
7206
7226
|
this.useReadonly();
|
|
7207
7227
|
this.useMode();
|
|
7208
7228
|
this.useAutoWrap();
|
|
7209
7229
|
this.useHeight();
|
|
7230
|
+
if (this.isCollapsedAndNonReadonly) {
|
|
7231
|
+
this.useAutofocus();
|
|
7232
|
+
}
|
|
7210
7233
|
}
|
|
7211
7234
|
codeChange($event) {
|
|
7212
7235
|
this.isHightLight = false;
|
|
@@ -7247,7 +7270,7 @@ class TheCode extends TheBaseElement {
|
|
|
7247
7270
|
this.options = { ...this.options, readonly: this.readonly, cursorBlinkRate: this.readonly ? -1 : 500 };
|
|
7248
7271
|
}
|
|
7249
7272
|
useAutofocus() {
|
|
7250
|
-
this.options = { ...this.options, autofocus: true };
|
|
7273
|
+
this.options = { ...this.options, autofocus: this.readonly ? false : true };
|
|
7251
7274
|
}
|
|
7252
7275
|
onResize({ height }) {
|
|
7253
7276
|
this.resizeHeight = height;
|
|
@@ -7267,7 +7290,7 @@ class TheCode extends TheBaseElement {
|
|
|
7267
7290
|
this.destroy$.complete();
|
|
7268
7291
|
}
|
|
7269
7292
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TheCode, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
7270
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.14", type: TheCode, isStandalone: true, selector: "div[theCode]", host: { classAttribute: "the-code-container" }, viewQueries: [{ propertyName: "toolbar", first: true, predicate: ["toolbar"], descendants: true, read: TemplateRef, static: true }, { propertyName: "codemirror", first: true, predicate: ["codemirror"], descendants: true, read: CodeMirrorComponent }, { propertyName: "toolbarDropdown", first: true, predicate: TheToolbarDropdown, descendants: true, read: TheToolbarDropdown }], usesInheritance: true, ngImport: i0, template: "<!-- \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: isCollapsedAndNonReadonly, readonly: options.readonly, active: isHightLight && isCollapsedAndNonReadonly }\"\n>\n
|
|
7293
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.14", type: TheCode, isStandalone: true, selector: "div[theCode]", host: { classAttribute: "the-code-container" }, viewQueries: [{ propertyName: "toolbar", first: true, predicate: ["toolbar"], descendants: true, read: TemplateRef, static: true }, { propertyName: "codemirror", first: true, predicate: ["codemirror"], descendants: true, read: CodeMirrorComponent }, { propertyName: "toolbarDropdown", first: true, predicate: TheToolbarDropdown, descendants: true, read: TheToolbarDropdown }], usesInheritance: true, ngImport: i0, template: "<!-- \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: isCollapsedAndNonReadonly, readonly: options.readonly, active: isHightLight && isCollapsedAndNonReadonly }\"\n>\n <ng-codemirror\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 (ngModelChange)=\"codeChange($event)\"\n (focusChange)=\"focusChange($event)\"\n >\n </ng-codemirror>\n @if (isCollapsedAndNonReadonly) {\n <thy-resize-handle thyDirection=\"bottom\" class=\"code-resize-icon\"></thy-resize-handle>\n }\n</div>\n\n<ng-template #toolbar>\n <thy-actions thySize=\"xxs\" thePreventDefault>\n <the-toolbar-dropdown\n [menus]=\"menus\"\n [toolbarItem]=\"activeLanguage\"\n [dropdownItemKey]=\"activeLanguage?.key\"\n [itemMousedownHandle]=\"onChangeLanguage\"\n >\n </the-toolbar-dropdown>\n <span class=\"auto-wrap d-flex align-items-center px-2 text-secondary\">\n <span>{{ locale().autoWrap }}</span>\n <thy-switch\n class=\"auto-wrap-btn d-flex ml-1\"\n [(ngModel)]=\"options.lineWrapping\"\n (ngModelChange)=\"onChangeWrap($event)\"\n thySize=\"sm\"\n ></thy-switch>\n </span>\n <a\n href=\"javascript:;\"\n thyAction\n thyActionIcon=\"copy\"\n [thyTooltip]=\"locale().copy\"\n thyTooltipPlacement=\"top\"\n (click)=\"onCopy($event)\"\n ></a>\n <thy-divider class=\"mr-2 ml-1 align-self-center\" [thyVertical]=\"true\" thyColor=\"light\"></thy-divider>\n <a\n href=\"javascript:;\"\n thyAction\n thyType=\"danger\"\n thyActionIcon=\"trash\"\n [thyTooltip]=\"locale().delete\"\n thyTooltipPlacement=\"top\"\n (click)=\"onDelete($event)\"\n ></a>\n </thy-actions>\n</ng-template>\n", dependencies: [{ kind: "directive", type: ThyResizableDirective, selector: "[thyResizable]", inputs: ["thyBounds", "thyMaxHeight", "thyMaxWidth", "thyMinHeight", "thyMinWidth", "thyGridColumnCount", "thyMaxColumn", "thyMinColumn", "thyLockAspectRatio", "thyPreview", "thyDisabled"], outputs: ["thyResize", "thyResizeStart", "thyResizeEnd"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: SlateModule }, { kind: "ngmodule", type: CodemirrorModule }, { kind: "component", type: i2$2.CodeMirrorComponent, selector: "ng-codemirror, [ngCodeMirror]", inputs: ["options", "extensions", "languages"], outputs: ["focusChange"] }, { kind: "component", type: ThySwitch, selector: "thy-switch", inputs: ["thyType", "thySize", "thyDisabled", "thyLoading"], outputs: ["thyChange"] }, { kind: "component", type: ThyAction, selector: "thy-action, [thyAction]", inputs: ["thyType", "thyIcon", "thyActionIcon", "thyActive", "thyActionActive", "thyTheme", "thyHoverIcon", "thyDisabled"] }, { kind: "component", type: ThyDivider, selector: "thy-divider", inputs: ["thyVertical", "thyStyle", "thyColor", "thyText", "thyTextDirection", "thyDeeper"] }, { kind: "component", type: ThyActions, selector: "thy-actions", inputs: ["thySize"] }, { kind: "directive", type: ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { kind: "component", type: ThyResizeHandle, selector: "thy-resize-handle, [thy-resize-handle]", inputs: ["thyDirection", "thyLine"], outputs: ["thyMouseDown"], exportAs: ["thyResizeHandle"] }, { kind: "component", type: TheToolbarDropdown, selector: "the-toolbar-dropdown" }, { kind: "directive", type: ThePreventDefaultDirective, selector: "[thePreventDefault]", exportAs: ["thePreventDefault"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
7271
7294
|
}
|
|
7272
7295
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TheCode, decorators: [{
|
|
7273
7296
|
type: Component,
|
|
@@ -7290,7 +7313,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
|
|
|
7290
7313
|
ThyResizeHandle,
|
|
7291
7314
|
TheToolbarDropdown,
|
|
7292
7315
|
ThePreventDefaultDirective
|
|
7293
|
-
], template: "<!-- \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: isCollapsedAndNonReadonly, readonly: options.readonly, active: isHightLight && isCollapsedAndNonReadonly }\"\n>\n
|
|
7316
|
+
], template: "<!-- \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: isCollapsedAndNonReadonly, readonly: options.readonly, active: isHightLight && isCollapsedAndNonReadonly }\"\n>\n <ng-codemirror\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 (ngModelChange)=\"codeChange($event)\"\n (focusChange)=\"focusChange($event)\"\n >\n </ng-codemirror>\n @if (isCollapsedAndNonReadonly) {\n <thy-resize-handle thyDirection=\"bottom\" class=\"code-resize-icon\"></thy-resize-handle>\n }\n</div>\n\n<ng-template #toolbar>\n <thy-actions thySize=\"xxs\" thePreventDefault>\n <the-toolbar-dropdown\n [menus]=\"menus\"\n [toolbarItem]=\"activeLanguage\"\n [dropdownItemKey]=\"activeLanguage?.key\"\n [itemMousedownHandle]=\"onChangeLanguage\"\n >\n </the-toolbar-dropdown>\n <span class=\"auto-wrap d-flex align-items-center px-2 text-secondary\">\n <span>{{ locale().autoWrap }}</span>\n <thy-switch\n class=\"auto-wrap-btn d-flex ml-1\"\n [(ngModel)]=\"options.lineWrapping\"\n (ngModelChange)=\"onChangeWrap($event)\"\n thySize=\"sm\"\n ></thy-switch>\n </span>\n <a\n href=\"javascript:;\"\n thyAction\n thyActionIcon=\"copy\"\n [thyTooltip]=\"locale().copy\"\n thyTooltipPlacement=\"top\"\n (click)=\"onCopy($event)\"\n ></a>\n <thy-divider class=\"mr-2 ml-1 align-self-center\" [thyVertical]=\"true\" thyColor=\"light\"></thy-divider>\n <a\n href=\"javascript:;\"\n thyAction\n thyType=\"danger\"\n thyActionIcon=\"trash\"\n [thyTooltip]=\"locale().delete\"\n thyTooltipPlacement=\"top\"\n (click)=\"onDelete($event)\"\n ></a>\n </thy-actions>\n</ng-template>\n" }]
|
|
7294
7317
|
}], propDecorators: { toolbar: [{
|
|
7295
7318
|
type: ViewChild,
|
|
7296
7319
|
args: ['toolbar', { read: TemplateRef, static: true }]
|
|
@@ -9181,8 +9204,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
|
|
|
9181
9204
|
}], ctorParameters: () => [{ type: TableStore }, { type: i1.ThyPopover }, { type: i0.NgZone }, { type: TheContextService }] });
|
|
9182
9205
|
|
|
9183
9206
|
class TableFreezeColumnPipe {
|
|
9184
|
-
transform(table, tablePluginOptions, tableWrapperWidth) {
|
|
9185
|
-
|
|
9207
|
+
transform(table, tablePluginOptions, tableWrapperWidth, editor) {
|
|
9208
|
+
let freezeColumnHeader = tablePluginOptions?.freezeColumnHeader;
|
|
9209
|
+
if (typeof tablePluginOptions?.freezeColumnHeader === 'function' && editor) {
|
|
9210
|
+
freezeColumnHeader = tablePluginOptions?.freezeColumnHeader(editor);
|
|
9211
|
+
}
|
|
9212
|
+
if (!(freezeColumnHeader && table.options?.headerColumn)) {
|
|
9186
9213
|
return false;
|
|
9187
9214
|
}
|
|
9188
9215
|
const rows = table.children?.map(item => item.children);
|
|
@@ -9209,11 +9236,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
|
|
|
9209
9236
|
}]
|
|
9210
9237
|
}] });
|
|
9211
9238
|
class TableFreezeRowPipe {
|
|
9212
|
-
transform(table, tablePluginOptions) {
|
|
9239
|
+
transform(table, tablePluginOptions, editor) {
|
|
9213
9240
|
if (!table.children.length) {
|
|
9214
9241
|
return false;
|
|
9215
9242
|
}
|
|
9216
|
-
|
|
9243
|
+
let freezeRowHeader = tablePluginOptions?.freezeRowHeader;
|
|
9244
|
+
if (typeof tablePluginOptions?.freezeRowHeader === 'function' && editor) {
|
|
9245
|
+
freezeRowHeader = tablePluginOptions?.freezeRowHeader(editor);
|
|
9246
|
+
}
|
|
9247
|
+
if (!(hasHeaderRow(table) && freezeRowHeader)) {
|
|
9217
9248
|
return false;
|
|
9218
9249
|
}
|
|
9219
9250
|
// 标题行存在合并的行时,取消冻结
|
|
@@ -9934,9 +9965,10 @@ class TheTable extends TheBaseElement {
|
|
|
9934
9965
|
setTimeout(() => {
|
|
9935
9966
|
this.afterRowControlsUpdate();
|
|
9936
9967
|
}, 0);
|
|
9968
|
+
// 表格数据变化,更新横向滚动条
|
|
9969
|
+
this.updateHorizontalScrollbar();
|
|
9937
9970
|
}, 0);
|
|
9938
|
-
this.
|
|
9939
|
-
this.isFreezeColumn = this.freezeColumnPipe.transform(this.element, this.tablePluginOptions, this.tableWrapperWidth);
|
|
9971
|
+
this.updateFreezeState();
|
|
9940
9972
|
this.getIsInTable();
|
|
9941
9973
|
this.getColControls();
|
|
9942
9974
|
this.columns = this.element.columns;
|
|
@@ -9945,8 +9977,6 @@ class TheTable extends TheBaseElement {
|
|
|
9945
9977
|
this.theTableContextMenuService.closeContextMenu();
|
|
9946
9978
|
this.tableStore.isExistSelectedCell && this.tableStore.clearSelectedCells();
|
|
9947
9979
|
}
|
|
9948
|
-
// 表格数据变化,更新横向滚动条
|
|
9949
|
-
this.updateHorizontalScrollbar();
|
|
9950
9980
|
}
|
|
9951
9981
|
}
|
|
9952
9982
|
// 需要等待内容更新后,才可以执行 useRowControls,否则获取的高度可能不正确
|
|
@@ -9982,7 +10012,7 @@ class TheTable extends TheBaseElement {
|
|
|
9982
10012
|
this.destroy$ = new Subject();
|
|
9983
10013
|
this.rowControls = [];
|
|
9984
10014
|
this.colControls = [];
|
|
9985
|
-
this.
|
|
10015
|
+
this.disabledHorizontalScrollbarFixed = signal(false, ...(ngDevMode ? [{ debugName: "disabledHorizontalScrollbarFixed" }] : []));
|
|
9986
10016
|
this.getOutletParent = () => {
|
|
9987
10017
|
return this.tbodyElement.nativeElement;
|
|
9988
10018
|
};
|
|
@@ -9998,6 +10028,7 @@ class TheTable extends TheBaseElement {
|
|
|
9998
10028
|
this.getColControls();
|
|
9999
10029
|
this.getIsInTable();
|
|
10000
10030
|
this.tablePluginOptions = getPluginOptions(this.editor, PluginKeys.table);
|
|
10031
|
+
this.disabledHorizontalScrollbarFixed.set(this.tablePluginOptions.disabledHorizontalScrollbarFixed);
|
|
10001
10032
|
if (this.tablePluginOptions.showFullscreen && this.tablePluginOptions.fullscreenAction) {
|
|
10002
10033
|
this.tablePluginOptions
|
|
10003
10034
|
.fullscreenAction(this.editor)
|
|
@@ -10049,7 +10080,7 @@ class TheTable extends TheBaseElement {
|
|
|
10049
10080
|
}
|
|
10050
10081
|
ngAfterViewInit() {
|
|
10051
10082
|
this.tableStore.initEditor(this.editor);
|
|
10052
|
-
this.ngZone.onStable.pipe(take(1)).subscribe(async () => {
|
|
10083
|
+
this.ngZone.onStable.pipe(take(1), takeUntil(this.destroy$)).subscribe(async () => {
|
|
10053
10084
|
const blockCardElement = getBlockCardByNativeElement(this.nativeElement);
|
|
10054
10085
|
if (blockCardElement) {
|
|
10055
10086
|
blockCardElement.classList.add(`${SLATE_BLOCK_CARD_CLASS_NAME}-${this.element.type}`);
|
|
@@ -10077,14 +10108,15 @@ class TheTable extends TheBaseElement {
|
|
|
10077
10108
|
}
|
|
10078
10109
|
}
|
|
10079
10110
|
});
|
|
10080
|
-
|
|
10111
|
+
timer(0)
|
|
10112
|
+
.pipe(takeUntil(this.destroy$))
|
|
10113
|
+
.subscribe(() => {
|
|
10081
10114
|
const isPrintMode = this.config.mode === TheMode.print;
|
|
10082
10115
|
this.getWrapperWidthAndLeft();
|
|
10083
10116
|
if (isPrintMode) {
|
|
10084
10117
|
this.columns = calcPrintColumnWidth(this.element);
|
|
10085
10118
|
}
|
|
10086
|
-
this.
|
|
10087
|
-
this.isFreezeColumn = this.freezeColumnPipe.transform(this.element, this.tablePluginOptions, this.tableWrapperWidth);
|
|
10119
|
+
this.updateFreezeState();
|
|
10088
10120
|
this.setHeaderColumnStickyCellClass();
|
|
10089
10121
|
this.setTableRightShadow();
|
|
10090
10122
|
this.subscribeCellsChange();
|
|
@@ -10110,6 +10142,7 @@ class TheTable extends TheBaseElement {
|
|
|
10110
10142
|
});
|
|
10111
10143
|
this.contextService.theEditorResized$.pipe(takeUntil(this.destroy$)).subscribe(result => {
|
|
10112
10144
|
if (result.widthChanged) {
|
|
10145
|
+
this.updateFreezeState();
|
|
10113
10146
|
this.getWrapperWidthAndLeft();
|
|
10114
10147
|
this.setTableScrollingShadow();
|
|
10115
10148
|
this.setGridColumnsStyle();
|
|
@@ -10118,7 +10151,7 @@ class TheTable extends TheBaseElement {
|
|
|
10118
10151
|
}
|
|
10119
10152
|
});
|
|
10120
10153
|
});
|
|
10121
|
-
}
|
|
10154
|
+
});
|
|
10122
10155
|
}
|
|
10123
10156
|
/* 给标题行的左/右加阴影 */
|
|
10124
10157
|
setHeaderRowShadow() {
|
|
@@ -10199,6 +10232,10 @@ class TheTable extends TheBaseElement {
|
|
|
10199
10232
|
this.renderer.removeClass(nativeElement, className);
|
|
10200
10233
|
}
|
|
10201
10234
|
}
|
|
10235
|
+
updateFreezeState() {
|
|
10236
|
+
this.isFreezeRow = this.freezeRowPipe.transform(this.element, this.tablePluginOptions, this.editor);
|
|
10237
|
+
this.isFreezeColumn = this.freezeColumnPipe.transform(this.element, this.tablePluginOptions, this.tableWrapperWidth, this.editor);
|
|
10238
|
+
}
|
|
10202
10239
|
setTableHeaderStyle() {
|
|
10203
10240
|
this.setHeaderCellClass();
|
|
10204
10241
|
this.setHeaderColumnStickyCellClass();
|
|
@@ -10655,6 +10692,8 @@ class TheTable extends TheBaseElement {
|
|
|
10655
10692
|
fromEvent(this.tableWrapper.nativeElement, 'scroll')
|
|
10656
10693
|
.pipe(takeUntil(this.destroy$))
|
|
10657
10694
|
.subscribe(() => {
|
|
10695
|
+
const scrollbarContainer = this.horizontalScrollbarContainer.nativeElement;
|
|
10696
|
+
scrollbarContainer.scrollLeft = this.tableWrapper.nativeElement.scrollLeft;
|
|
10658
10697
|
this.setTableScrollingShadow();
|
|
10659
10698
|
this.updateStickyRowScrollLeft();
|
|
10660
10699
|
this.setHeaderRowShadow();
|
|
@@ -10684,7 +10723,7 @@ class TheTable extends TheBaseElement {
|
|
|
10684
10723
|
const buffer = this.isInTable ? -TABLE_CONTROL : 0;
|
|
10685
10724
|
if (this.isStickyTop && this.isScrolledXOfScrollContainer) {
|
|
10686
10725
|
stickyRows.forEach((element) => {
|
|
10687
|
-
this.renderer.setStyle(element, 'left', `${this.tableWrapperLeft
|
|
10726
|
+
this.renderer.setStyle(element, 'left', `${this.tableWrapperLeft}px`);
|
|
10688
10727
|
});
|
|
10689
10728
|
this.renderer.setStyle(cornerControl, 'left', `${this.tableWrapperLeft + buffer}px`);
|
|
10690
10729
|
rowControl && this.renderer.setStyle(rowControl, 'left', `${this.tableWrapperLeft + buffer}px`);
|
|
@@ -10711,64 +10750,15 @@ class TheTable extends TheBaseElement {
|
|
|
10711
10750
|
this.destroy$.complete();
|
|
10712
10751
|
}
|
|
10713
10752
|
initHorizontalScrollbar() {
|
|
10714
|
-
if (!this.horizontalScrollbarContainer || !this.horizontalScrollbarContent) {
|
|
10753
|
+
if (!this.horizontalScrollbarContainer || !this.horizontalScrollbarContent || this.disabledHorizontalScrollbarFixed()) {
|
|
10715
10754
|
return;
|
|
10716
10755
|
}
|
|
10717
|
-
this.bindTableMouseEvents();
|
|
10718
10756
|
this.bindScrollbarEvents();
|
|
10719
10757
|
this.updateHorizontalScrollbar();
|
|
10720
10758
|
}
|
|
10721
|
-
// 绑定鼠标和滚轮事件,用于处理表格横向滚动条显隐
|
|
10722
|
-
bindTableMouseEvents() {
|
|
10723
|
-
if (!this.nativeElement) {
|
|
10724
|
-
return;
|
|
10725
|
-
}
|
|
10726
|
-
// 鼠标移入表格时,更新滚动条是否显示固定
|
|
10727
|
-
fromEvent(this.nativeElement, 'mouseenter')
|
|
10728
|
-
.pipe(takeUntil(this.destroy$))
|
|
10729
|
-
.subscribe(() => {
|
|
10730
|
-
this.isMouseOverTable = true;
|
|
10731
|
-
this.updateHorizontalScrollbar();
|
|
10732
|
-
});
|
|
10733
|
-
fromEvent(this.nativeElement, 'mouseleave')
|
|
10734
|
-
.pipe(takeUntil(this.destroy$))
|
|
10735
|
-
.subscribe(() => {
|
|
10736
|
-
this.isMouseOverTable = false;
|
|
10737
|
-
this.updateHorizontalScrollbar();
|
|
10738
|
-
});
|
|
10739
|
-
// 在表格上的滚轮滚动监听,处理滚动过程中超过可视范围滚动条的显隐
|
|
10740
|
-
// 页面的垂直滚动由使用方的页面决定,表格组件无法准确获取,这里通过监听滚轮实现
|
|
10741
|
-
fromEvent(this.nativeElement, 'wheel', { passive: false })
|
|
10742
|
-
.pipe(takeUntil(this.destroy$))
|
|
10743
|
-
.subscribe((event) => {
|
|
10744
|
-
// 只有在鼠标在表格上时才处理
|
|
10745
|
-
if (!this.isMouseOverTable) {
|
|
10746
|
-
return;
|
|
10747
|
-
}
|
|
10748
|
-
const isHorizontalScroll = Math.abs(event.deltaX) > Math.abs(event.deltaY) || event.shiftKey;
|
|
10749
|
-
if (isHorizontalScroll && this.horizontalScrollbarContainer) {
|
|
10750
|
-
event.preventDefault();
|
|
10751
|
-
let deltaX = event.deltaX;
|
|
10752
|
-
// 如果是 Shift + 滚轮,将垂直滚动转换为横向滚动
|
|
10753
|
-
if (event.shiftKey && Math.abs(event.deltaY) > Math.abs(event.deltaX)) {
|
|
10754
|
-
deltaX = event.deltaY;
|
|
10755
|
-
}
|
|
10756
|
-
const scrollbarContainer = this.horizontalScrollbarContainer.nativeElement;
|
|
10757
|
-
const newScrollLeft = Math.max(0, Math.min(scrollbarContainer.scrollLeft + deltaX, scrollbarContainer.scrollWidth - scrollbarContainer.clientWidth));
|
|
10758
|
-
// 同步滚动到滚动条
|
|
10759
|
-
scrollbarContainer.scrollLeft = newScrollLeft;
|
|
10760
|
-
}
|
|
10761
|
-
else {
|
|
10762
|
-
// 纵向滚动,需要延迟执行是否需要固定滚动条
|
|
10763
|
-
setTimeout(() => {
|
|
10764
|
-
this.updateScrollbarFixedState();
|
|
10765
|
-
}, 100);
|
|
10766
|
-
}
|
|
10767
|
-
});
|
|
10768
|
-
}
|
|
10769
10759
|
// 监听横向滚动条滚动事件
|
|
10770
10760
|
bindScrollbarEvents() {
|
|
10771
|
-
if (!this.horizontalScrollbarContainer || !this.horizontalScrollbarContent) {
|
|
10761
|
+
if (!this.horizontalScrollbarContainer || !this.horizontalScrollbarContent || this.disabledHorizontalScrollbarFixed()) {
|
|
10772
10762
|
return;
|
|
10773
10763
|
}
|
|
10774
10764
|
// 滚动条滚动事件同步到表格
|
|
@@ -10782,36 +10772,27 @@ class TheTable extends TheBaseElement {
|
|
|
10782
10772
|
});
|
|
10783
10773
|
}
|
|
10784
10774
|
updateHorizontalScrollbar() {
|
|
10785
|
-
this.
|
|
10786
|
-
this.updateScrollbarVisibility();
|
|
10775
|
+
this.setScrollbarWidth();
|
|
10787
10776
|
this.updateScrollbarFixedState();
|
|
10788
10777
|
}
|
|
10789
|
-
|
|
10790
|
-
this.
|
|
10791
|
-
}
|
|
10792
|
-
// 更新横向滚动条可见性
|
|
10793
|
-
updateScrollbarVisibility() {
|
|
10794
|
-
if (!this.tableWrapper || !this.horizontalScrollbarContainer || !this.horizontalScrollbarContent) {
|
|
10778
|
+
setScrollbarWidth() {
|
|
10779
|
+
if (!this.tableWrapper || !this.horizontalScrollbarContent) {
|
|
10795
10780
|
return;
|
|
10796
10781
|
}
|
|
10797
10782
|
const tableWrapper = this.tableWrapper.nativeElement;
|
|
10798
|
-
const scrollbarContainer = this.horizontalScrollbarContainer.nativeElement;
|
|
10799
10783
|
const scrollbarContent = this.horizontalScrollbarContent.nativeElement;
|
|
10800
10784
|
const hasHorizontalScroll = tableWrapper.scrollWidth > tableWrapper.clientWidth;
|
|
10801
10785
|
if (!hasHorizontalScroll) {
|
|
10802
|
-
this.renderer.
|
|
10786
|
+
this.renderer.removeStyle(scrollbarContent, 'width');
|
|
10803
10787
|
return;
|
|
10804
10788
|
}
|
|
10805
10789
|
this.renderer.setStyle(scrollbarContent, 'width', `${tableWrapper.scrollWidth}px`);
|
|
10806
|
-
this.renderer.addClass(scrollbarContainer, 'visible');
|
|
10807
10790
|
}
|
|
10808
10791
|
// 更新横向滚动条固定状态
|
|
10809
10792
|
updateScrollbarFixedState() {
|
|
10810
|
-
if (this.editor.options.disabledTableStickyScrollbar ||
|
|
10811
|
-
|
|
10812
|
-
|
|
10813
|
-
if (!this.isMouseOverTable) {
|
|
10814
|
-
this.setScrollbarFixed(false, 0);
|
|
10793
|
+
if (this.editor.options.disabledTableStickyScrollbar ||
|
|
10794
|
+
!this.horizontalScrollbarContainer ||
|
|
10795
|
+
this.disabledHorizontalScrollbarFixed()) {
|
|
10815
10796
|
return;
|
|
10816
10797
|
}
|
|
10817
10798
|
const tableRect = this.nativeElement.getBoundingClientRect();
|
|
@@ -10843,25 +10824,24 @@ class TheTable extends TheBaseElement {
|
|
|
10843
10824
|
}
|
|
10844
10825
|
}
|
|
10845
10826
|
setScrollbarFixed(fixed, viewportHeight) {
|
|
10846
|
-
if (!this.horizontalScrollbarContainer) {
|
|
10827
|
+
if (!this.horizontalScrollbarContainer || this.disabledHorizontalScrollbarFixed()) {
|
|
10847
10828
|
return;
|
|
10848
10829
|
}
|
|
10849
10830
|
const scrollbar = this.horizontalScrollbarContainer.nativeElement;
|
|
10850
10831
|
const currentScrollLeft = scrollbar.scrollLeft;
|
|
10851
10832
|
if (fixed) {
|
|
10852
10833
|
const tableRect = this.nativeElement.getBoundingClientRect();
|
|
10834
|
+
const tableElement = this.nativeElement;
|
|
10835
|
+
// 页面缩放比
|
|
10836
|
+
const scaleX = tableRect.width && tableElement.offsetWidth ? tableRect.width / tableElement.offsetWidth : 1;
|
|
10853
10837
|
this.renderer.addClass(scrollbar, 'fixed');
|
|
10854
|
-
this.renderer.setStyle(scrollbar, 'left', `${Math.max(0, tableRect.left)}px`);
|
|
10855
|
-
this.renderer.setStyle(scrollbar, 'width', `${tableRect.width}px`);
|
|
10856
|
-
this.renderer.setStyle(scrollbar, 'top', `${viewportHeight - TABLE_HORIZONTAL_SCROLL_HEIGHT}px`);
|
|
10857
|
-
this.renderer.removeStyle(scrollbar, 'bottom');
|
|
10838
|
+
this.renderer.setStyle(scrollbar, 'left', `${Math.max(0, tableRect.left / scaleX)}px`);
|
|
10839
|
+
this.renderer.setStyle(scrollbar, 'width', `${tableRect.width / scaleX}px`);
|
|
10858
10840
|
}
|
|
10859
10841
|
else {
|
|
10860
10842
|
this.renderer.removeClass(scrollbar, 'fixed');
|
|
10861
10843
|
this.renderer.removeStyle(scrollbar, 'left');
|
|
10862
10844
|
this.renderer.removeStyle(scrollbar, 'width');
|
|
10863
|
-
this.renderer.removeStyle(scrollbar, 'top');
|
|
10864
|
-
this.renderer.setStyle(scrollbar, 'bottom', `-${TABLE_HORIZONTAL_SCROLL_HEIGHT}px`);
|
|
10865
10845
|
}
|
|
10866
10846
|
requestAnimationFrame(() => {
|
|
10867
10847
|
if (scrollbar.scrollLeft !== currentScrollLeft) {
|
|
@@ -10870,7 +10850,7 @@ class TheTable extends TheBaseElement {
|
|
|
10870
10850
|
});
|
|
10871
10851
|
}
|
|
10872
10852
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TheTable, deps: [{ token: TableCellEventDispatcher }, { token: ColumnResizeNotifierSource }, { token: TableStore }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: i0.Injector }, { token: i2.ScrollDispatcher }, { token: i2.Overlay }, { token: TableService }, { token: TheTableContextMenuService }, { token: TableFreezeColumnPipe }, { token: TableFreezeRowPipe }, { token: i0.Renderer2 }, { token: TheContextService }, { token: THE_MODE_TOKEN }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
10873
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.14", type: TheTable, isStandalone: true, selector: "the-table", host: { properties: { "class.the-table-with-controls": "isInTable || tableStore.isRightClicking || tableStore.isFocusedInput", "class.the-table-with-sticky-column": "isFreezeColumn", "class.the-numbered-table": "element?.options?.numberedColumn", "class.the-table-selection-hide": "tableStore.isCellSelecting || tableStore.isRightClicking || tableStore.isFocusedInput" } }, providers: [
|
|
10853
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.14", type: TheTable, isStandalone: true, selector: "the-table", host: { properties: { "class.the-table-with-controls": "isInTable || tableStore.isRightClicking || tableStore.isFocusedInput", "class.the-table-with-sticky-column": "isFreezeColumn", "class.the-numbered-table": "element?.options?.numberedColumn", "class.the-table-selection-hide": "tableStore.isCellSelecting || tableStore.isRightClicking || tableStore.isFocusedInput", "class.the-table-disabled-horizontal-scrollbar-fixed": "disabledHorizontalScrollbarFixed()" } }, providers: [
|
|
10874
10854
|
TableStore,
|
|
10875
10855
|
TableService,
|
|
10876
10856
|
TheTableContextMenuService,
|
|
@@ -10902,7 +10882,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
|
|
|
10902
10882
|
'[class.the-table-with-controls]': 'isInTable || tableStore.isRightClicking || tableStore.isFocusedInput',
|
|
10903
10883
|
'[class.the-table-with-sticky-column]': 'isFreezeColumn',
|
|
10904
10884
|
'[class.the-numbered-table]': 'element?.options?.numberedColumn',
|
|
10905
|
-
'[class.the-table-selection-hide]': 'tableStore.isCellSelecting || tableStore.isRightClicking || tableStore.isFocusedInput'
|
|
10885
|
+
'[class.the-table-selection-hide]': 'tableStore.isCellSelecting || tableStore.isRightClicking || tableStore.isFocusedInput',
|
|
10886
|
+
'[class.the-table-disabled-horizontal-scrollbar-fixed]': 'disabledHorizontalScrollbarFixed()'
|
|
10906
10887
|
}, imports: [NgClass, NgStyle, TheInsertMark, TheColumnResizeDirective, TableHasHeaderRowPipe], template: "<div class=\"the-table-container\" theColumnResize>\n <div #tableRowControlsWrapper class=\"the-table-row-controls-wrapper\">\n <div\n class=\"the-table-corner-controls\"\n #cornerControl\n contenteditable=\"false\"\n [ngClass]=\"{\n visible: !readonly && (isInTable || tableStore.isRightClicking || tableStore.isFocusedInput),\n 'control-active': isSelectedAllCell,\n dangerous: tableStore.isSelectedTable && tableStore.dangerousCells.length > 0\n }\"\n >\n <div class=\"the-table-corner-button\" (pointerdown)=\"onSelectTable($event)\"></div>\n @if (!(element | hasHeaderRow) && !isMobileMode) {\n <div class=\"the-table-corner-controls-insert-row-marker\">\n <the-table-insert-mark type=\"row\" [at]=\"0\" [tableStore]=\"tableStore\"></the-table-insert-mark>\n </div>\n }\n @if (!element?.options?.headerColumn && !isMobileMode) {\n <div class=\"the-table-corner-controls-insert-column-marker\">\n <the-table-insert-mark type=\"column\" [at]=\"0\" [tableStore]=\"tableStore\"></the-table-insert-mark>\n </div>\n }\n </div>\n <div class=\"the-table-row-controls\">\n <div class=\"the-table-row-controls-inner\" #rowControlsInner>\n @for (control of rowControls; track trackByFnRowControls(i); let i = $index) {\n <div\n class=\"the-table-row-control-button-wrap\"\n #rowControlsButtonWrapper\n contenteditable=\"false\"\n [ngClass]=\"{\n 'control-active': tableStore.selectedRowsIndex.includes(control.rowIndex),\n dangerous: tableStore.dangerousRowsIndex.includes(control.rowIndex) && tableStore.dangerousCells.length > 0\n }\"\n >\n @if (!readonly && (isInTable || tableStore.isRightClicking || tableStore.isFocusedInput) && !element?.options?.numberedColumn) {\n <button\n (pointerdown)=\"onRowMousedown($event, control.rowIndex)\"\n type=\"button\"\n contenteditable=\"false\"\n [ngStyle]=\"{ height: control.height + 1 + 'px' }\"\n class=\"the-table-row-controls-button the-table-controls-button\"\n ></button>\n }\n @if (element?.options?.numberedColumn) {\n <div\n contenteditable=\"false\"\n (pointerdown)=\"onRowMousedown($event, control.rowIndex)\"\n class=\"the-table-numbered-controls-button\"\n [ngStyle]=\"{ height: control.height + 1 + 'px' }\"\n >\n <p class=\"row-number d-flex align-items-center\">\n {{ (element | hasHeaderRow) && i === 0 ? '' : (element | hasHeaderRow) ? i : i + 1 }}\n </p>\n </div>\n }\n @if (!isMobileMode) {\n <the-table-insert-mark type=\"row\" [at]=\"control.rowIndex + 1\" [tableStore]=\"tableStore\"> </the-table-insert-mark>\n }\n </div>\n }\n </div>\n </div>\n </div>\n <div class=\"the-table-wrapper\" #tableWrapper [ngClass]=\"{ 'the-table-numbered': element?.options?.numberedColumn }\">\n <table class=\"the-table\" #theTable>\n <colgroup #colgroup>\n <!--\u63A7\u5236\u5E8F\u53F7\u5217\u5BBD\u5EA6-->\n @if (readonly && element?.options?.numberedColumn) {\n <col class=\"the-table-number-col\" />\n }\n @for (col of columns; track $index) {\n <col [ngStyle]=\"{ width: col.width + 'px' }\" />\n }\n </colgroup>\n <thead>\n <tr class=\"the-table-col-controls-wrapper the-sticky-row\" #columnControlsWrapper>\n @if (readonly && element?.options?.numberedColumn) {\n <th class=\"the-table-number-col\"></th>\n }\n @for (control of colControls; track trackByFnColControls(i); let i = $index) {\n <th\n #colControl\n class=\"the-table-col-control\"\n contenteditable=\"false\"\n [ngClass]=\"{\n 'control-active': tableStore.selectedColumnsIndex.includes(i),\n dangerous: tableStore.dangerousColumnsIndex.includes(i) && tableStore.dangerousCells.length > 0,\n 'the-sticky-cell': i === 0 && isFreezeColumn\n }\"\n (pointerdown)=\"onColMousedown($event, i)\"\n >\n @if ((isInTable || tableStore.isRightClicking || tableStore.isFocusedInput) && !isMobileMode) {\n <the-table-insert-mark type=\"column\" [at]=\"i + 1\" [tableStore]=\"tableStore\" [parentElement]=\"colControl\">\n </the-table-insert-mark>\n }\n </th>\n }\n </tr>\n </thead>\n <tbody #tbody></tbody>\n @if (!element?.options?.headerColumn) {\n <div #headerRowLeftShadow class=\"header-row-shadow header-row-left-shadow\" contenteditable=\"false\"></div>\n }\n <div class=\"header-row-shadow header-row-right-shadow\" #headerRowRightShadow contenteditable=\"false\"></div>\n </table>\n </div>\n <div class=\"the-table-horizontal-scrollbar-container\" #horizontalScrollbarContainer>\n <div class=\"the-table-horizontal-scrollbar-content\" #horizontalScrollbarContent></div>\n </div>\n</div>\n" }]
|
|
10907
10888
|
}], ctorParameters: () => [{ type: TableCellEventDispatcher }, { type: ColumnResizeNotifierSource }, { type: TableStore }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: i0.Injector }, { type: i2.ScrollDispatcher }, { type: i2.Overlay }, { type: TableService }, { type: TheTableContextMenuService }, { type: TableFreezeColumnPipe }, { type: TableFreezeRowPipe }, { type: i0.Renderer2 }, { type: TheContextService }, { type: TheModeConfig, decorators: [{
|
|
10908
10889
|
type: Inject,
|
|
@@ -11195,9 +11176,13 @@ class TheQuickInsert {
|
|
|
11195
11176
|
}
|
|
11196
11177
|
updateIconDisplay() {
|
|
11197
11178
|
const { editor } = this;
|
|
11179
|
+
const virtualScrollSelection = EDITOR_TO_VIRTUAL_SCROLL_SELECTION.get(editor);
|
|
11180
|
+
const conditionWithVirtualScroll = !AngularEditor.isEnabledVirtualScroll(editor) ||
|
|
11181
|
+
(editor.selection && virtualScrollSelection && Range.equals(virtualScrollSelection, editor.selection));
|
|
11198
11182
|
if (this.isVisible &&
|
|
11199
11183
|
!QuickInsertEditor.isOpenedMenu(editor) &&
|
|
11200
11184
|
isCleanEmptyParagraph(editor) &&
|
|
11185
|
+
conditionWithVirtualScroll &&
|
|
11201
11186
|
!this.hasExcludeAttribute() &&
|
|
11202
11187
|
!this.isRichMediaScope()) {
|
|
11203
11188
|
const block = Node.ancestor(editor, [editor?.selection?.anchor.path[0]]);
|
|
@@ -12041,14 +12026,13 @@ class ResizeRef {
|
|
|
12041
12026
|
}
|
|
12042
12027
|
|
|
12043
12028
|
class TheColumnResizeOverlayHandle {
|
|
12044
|
-
constructor(elementRef, viewContainerRef, cdr, ngZone, resizeRef, eventDispatcher,
|
|
12029
|
+
constructor(elementRef, viewContainerRef, cdr, ngZone, resizeRef, eventDispatcher, resizeNotifier, destroyRef) {
|
|
12045
12030
|
this.elementRef = elementRef;
|
|
12046
12031
|
this.viewContainerRef = viewContainerRef;
|
|
12047
12032
|
this.cdr = cdr;
|
|
12048
12033
|
this.ngZone = ngZone;
|
|
12049
12034
|
this.resizeRef = resizeRef;
|
|
12050
12035
|
this.eventDispatcher = eventDispatcher;
|
|
12051
|
-
this.document = document;
|
|
12052
12036
|
this.resizeNotifier = resizeNotifier;
|
|
12053
12037
|
this.destroyRef = destroyRef;
|
|
12054
12038
|
}
|
|
@@ -12082,9 +12066,9 @@ class TheColumnResizeOverlayHandle {
|
|
|
12082
12066
|
if (mousedownEvent.button !== 0) {
|
|
12083
12067
|
return;
|
|
12084
12068
|
}
|
|
12085
|
-
const mouseup = fromEvent(
|
|
12086
|
-
const mousemove = fromEvent(
|
|
12087
|
-
const escape = fromEvent(
|
|
12069
|
+
const mouseup = fromEvent(document, 'mouseup');
|
|
12070
|
+
const mousemove = fromEvent(document, 'mousemove');
|
|
12071
|
+
const escape = fromEvent(document, 'keyup').pipe(filter((event) => event.key === 'Escape'));
|
|
12088
12072
|
const startX = mousedownEvent.clientX;
|
|
12089
12073
|
const startY = mousedownEvent.clientY;
|
|
12090
12074
|
const initialWidthSize = this._getOriginWidth();
|
|
@@ -12159,7 +12143,7 @@ class TheColumnResizeOverlayHandle {
|
|
|
12159
12143
|
this.resizeNotifier.resizeStarted.next(sizeMessage);
|
|
12160
12144
|
});
|
|
12161
12145
|
}
|
|
12162
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TheColumnResizeOverlayHandle, deps: [{ token: i0.ElementRef }, { token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: ResizeRef }, { token: TableCellEventDispatcher }, { token:
|
|
12146
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TheColumnResizeOverlayHandle, deps: [{ token: i0.ElementRef }, { token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: ResizeRef }, { token: TableCellEventDispatcher }, { token: ColumnResizeNotifierSource }, { token: i0.DestroyRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
12163
12147
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.14", type: TheColumnResizeOverlayHandle, isStandalone: true, selector: "ng-component", host: { classAttribute: "the-table-resize-overlay-thumb" }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
12164
12148
|
}
|
|
12165
12149
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TheColumnResizeOverlayHandle, decorators: [{
|
|
@@ -12170,10 +12154,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
|
|
|
12170
12154
|
template: '',
|
|
12171
12155
|
standalone: true
|
|
12172
12156
|
}]
|
|
12173
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ViewContainerRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: ResizeRef }, { type: TableCellEventDispatcher }, { type:
|
|
12174
|
-
type: Inject,
|
|
12175
|
-
args: [DOCUMENT]
|
|
12176
|
-
}] }, { type: ColumnResizeNotifierSource }, { type: i0.DestroyRef }] });
|
|
12157
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ViewContainerRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: ResizeRef }, { type: TableCellEventDispatcher }, { type: ColumnResizeNotifierSource }, { type: i0.DestroyRef }] });
|
|
12177
12158
|
|
|
12178
12159
|
class ColumnResizingStore {
|
|
12179
12160
|
constructor() {
|
|
@@ -12720,7 +12701,7 @@ class TheBaseFlavourElement extends BaseElementFlavour {
|
|
|
12720
12701
|
}
|
|
12721
12702
|
onInit() {
|
|
12722
12703
|
super.onInit();
|
|
12723
|
-
if (this.editor) {
|
|
12704
|
+
if (this.editor && !this.editor.options.enableVirtualScroll) {
|
|
12724
12705
|
const isVisible = this.editor.isVisible(this.element);
|
|
12725
12706
|
const isBlockCard = this.editor.isBlockCard(this.element);
|
|
12726
12707
|
if (!isVisible) {
|
|
@@ -13857,6 +13838,9 @@ const createFontSizePlugin = (locale) => createPluginFactory({
|
|
|
13857
13838
|
})();
|
|
13858
13839
|
|
|
13859
13840
|
const cleanHeadingEffect = (editor, path) => {
|
|
13841
|
+
if (editor.options.enableVirtualScroll) {
|
|
13842
|
+
return;
|
|
13843
|
+
}
|
|
13860
13844
|
const index = path[0];
|
|
13861
13845
|
const headingElement = editor.children[index];
|
|
13862
13846
|
if (!isStandardHeadingElement(headingElement)) {
|
|
@@ -14379,13 +14363,26 @@ class TheImage extends TheBaseElement {
|
|
|
14379
14363
|
if (!AngularEditor.isEnabledVirtualScroll(this.editor)) {
|
|
14380
14364
|
return;
|
|
14381
14365
|
}
|
|
14382
|
-
const
|
|
14383
|
-
|
|
14384
|
-
if (heights && heights.get(key.id)) {
|
|
14366
|
+
const realHeight = getRealHeightByElement(this.editor, this.element, 0);
|
|
14367
|
+
if (realHeight > 0) {
|
|
14385
14368
|
const blockCard = getBlockCardByNativeElement(this.nativeElement);
|
|
14386
14369
|
if (blockCard) {
|
|
14387
14370
|
const style = getComputedStyle(blockCard);
|
|
14388
|
-
|
|
14371
|
+
const minHeight = realHeight - parseFloat(style.marginTop) - parseFloat(style.marginBottom);
|
|
14372
|
+
blockCard.style.minHeight = minHeight + 'px';
|
|
14373
|
+
// if (isDebug) {
|
|
14374
|
+
// debugLog('warn', 'setImageMinHeight in blockCard, realHeight(cache): ', realHeight, this.element.key, 'minHeight: ', minHeight);
|
|
14375
|
+
// }
|
|
14376
|
+
}
|
|
14377
|
+
else {
|
|
14378
|
+
if (isDebug) {
|
|
14379
|
+
debugLog('warn', 'image render and can not find blockCard', this.element.key, this.editor.children.indexOf(this.element));
|
|
14380
|
+
}
|
|
14381
|
+
}
|
|
14382
|
+
}
|
|
14383
|
+
else {
|
|
14384
|
+
if (isDebug) {
|
|
14385
|
+
debugLog('warn', 'image render and can not find cache height', this.element.key, this.editor.children.indexOf(this.element));
|
|
14389
14386
|
}
|
|
14390
14387
|
}
|
|
14391
14388
|
}
|
|
@@ -14394,8 +14391,12 @@ class TheImage extends TheBaseElement {
|
|
|
14394
14391
|
return;
|
|
14395
14392
|
}
|
|
14396
14393
|
const blockCard = getBlockCardByNativeElement(this.nativeElement);
|
|
14397
|
-
if (blockCard) {
|
|
14394
|
+
if (blockCard && blockCard.style.minHeight) {
|
|
14398
14395
|
blockCard.style.minHeight = '';
|
|
14396
|
+
return true;
|
|
14397
|
+
}
|
|
14398
|
+
else {
|
|
14399
|
+
return false;
|
|
14399
14400
|
}
|
|
14400
14401
|
}
|
|
14401
14402
|
setImagePluginOptions() {
|
|
@@ -14635,13 +14636,30 @@ class TheImage extends TheBaseElement {
|
|
|
14635
14636
|
.withPositions([bottomPosition]);
|
|
14636
14637
|
}
|
|
14637
14638
|
imageLoaded(event) {
|
|
14638
|
-
this.clearMinHeight();
|
|
14639
14639
|
const img = event.target;
|
|
14640
14640
|
this.naturalWidth = img.naturalWidth;
|
|
14641
14641
|
this.naturalHeight = img.naturalHeight;
|
|
14642
14642
|
if (AngularEditor.isEnabledVirtualScroll(this.editor)) {
|
|
14643
|
+
// if (isDebug) {
|
|
14644
|
+
// const realHeight = this.getRealHeight();
|
|
14645
|
+
// debugLog('warn', 'imageLoaded, realHeight: ', realHeight, this.element.key, this.editor.children.indexOf(this.element));
|
|
14646
|
+
// }
|
|
14643
14647
|
this.imageLoadedCacheHeightTimer = setTimeout(() => {
|
|
14644
|
-
|
|
14648
|
+
// if (isDebug) {
|
|
14649
|
+
// const realHeight = this.getRealHeight();
|
|
14650
|
+
// debugLog(
|
|
14651
|
+
// 'warn',
|
|
14652
|
+
// 'imageLoaded, realHeight setTimeout period: ',
|
|
14653
|
+
// realHeight,
|
|
14654
|
+
// this.element.key,
|
|
14655
|
+
// 'index: ',
|
|
14656
|
+
// this.editor.children.indexOf(this.element)
|
|
14657
|
+
// );
|
|
14658
|
+
// }
|
|
14659
|
+
const result = this.clearMinHeight();
|
|
14660
|
+
if (!result) {
|
|
14661
|
+
this.cacheImageHeight(this.getRealHeight());
|
|
14662
|
+
}
|
|
14645
14663
|
}, 0);
|
|
14646
14664
|
}
|
|
14647
14665
|
}
|
|
@@ -14933,7 +14951,7 @@ class TheInlineCodeFlavour extends TheBaseFlavourElement {
|
|
|
14933
14951
|
}
|
|
14934
14952
|
|
|
14935
14953
|
const withInlineCode = (editor) => {
|
|
14936
|
-
const { isInline, renderElement, insertText } = editor;
|
|
14954
|
+
const { isInline, renderElement, insertText, customInsertFragmentData } = editor;
|
|
14937
14955
|
editor.isInline = (element) => {
|
|
14938
14956
|
return element.type === ElementKinds.inlineCode ? true : isInline(element);
|
|
14939
14957
|
};
|
|
@@ -14969,6 +14987,28 @@ const withInlineCode = (editor) => {
|
|
|
14969
14987
|
insertText(text);
|
|
14970
14988
|
}
|
|
14971
14989
|
};
|
|
14990
|
+
editor.customInsertFragmentData = async (data, contextClipboardData) => {
|
|
14991
|
+
if (InlineCodeEditor.isInlineCodeActive(editor)) {
|
|
14992
|
+
const fragment = await extractFragment(data);
|
|
14993
|
+
if (fragment) {
|
|
14994
|
+
if (fragment.length === 1 &&
|
|
14995
|
+
!isPureEmptyParagraph(editor, fragment[0]) &&
|
|
14996
|
+
(isPureHeading(editor, fragment) || isPureParagraph(editor, fragment))) {
|
|
14997
|
+
const text = fragment.map(node => Node.string(node)).join('');
|
|
14998
|
+
editor.insertText(text);
|
|
14999
|
+
return true;
|
|
15000
|
+
}
|
|
15001
|
+
}
|
|
15002
|
+
else {
|
|
15003
|
+
const clipboardData = await getClipboardData(data);
|
|
15004
|
+
if (clipboardData?.text) {
|
|
15005
|
+
editor.insertText(clipboardData.text);
|
|
15006
|
+
return true;
|
|
15007
|
+
}
|
|
15008
|
+
}
|
|
15009
|
+
}
|
|
15010
|
+
return customInsertFragmentData(data, contextClipboardData);
|
|
15011
|
+
};
|
|
14972
15012
|
editor = withRemoveEmptyNodes({ type: ElementKinds.inlineCode })(editor);
|
|
14973
15013
|
return editor;
|
|
14974
15014
|
};
|
|
@@ -18115,6 +18155,9 @@ class HeadingFlavour extends TheBaseFlavourElement {
|
|
|
18115
18155
|
constructor() {
|
|
18116
18156
|
super(...arguments);
|
|
18117
18157
|
this.beforeContextChange = (value) => {
|
|
18158
|
+
if (this.editor.options.enableVirtualScroll) {
|
|
18159
|
+
return;
|
|
18160
|
+
}
|
|
18118
18161
|
const isHeading = isStandardHeadingElement(value.element);
|
|
18119
18162
|
if (isHeading && this.element && value.element !== this.element) {
|
|
18120
18163
|
if (value.element.isCollapsed !== this.element.isCollapsed) {
|
|
@@ -18136,7 +18179,10 @@ class HeadingFlavour extends TheBaseFlavourElement {
|
|
|
18136
18179
|
}
|
|
18137
18180
|
onInit() {
|
|
18138
18181
|
super.onInit();
|
|
18139
|
-
if (this.
|
|
18182
|
+
if (!this.editor.options.enableVirtualScroll &&
|
|
18183
|
+
this.element &&
|
|
18184
|
+
isStandardHeadingElement(this.element) &&
|
|
18185
|
+
this.element.isCollapsed) {
|
|
18140
18186
|
const followElements = getFollowElements(this.editor, this.element);
|
|
18141
18187
|
// 处理删除后撤销场景
|
|
18142
18188
|
followElements.forEach(el => {
|
|
@@ -18273,11 +18319,12 @@ class TheEditorComponent {
|
|
|
18273
18319
|
enabled: false,
|
|
18274
18320
|
scrollTop: 0,
|
|
18275
18321
|
viewportHeight: 0,
|
|
18276
|
-
|
|
18322
|
+
viewportBoundingTop: 0
|
|
18277
18323
|
}, ...(ngDevMode ? [{ debugName: "virtualScrollConfig" }] : []));
|
|
18278
18324
|
this.onChangeCallback = () => { };
|
|
18279
18325
|
this.onTouchedCallback = () => { };
|
|
18280
18326
|
this.locale = injectTranslations(inject(TheI18nService));
|
|
18327
|
+
this.scrollContainerBoundingTop = null;
|
|
18281
18328
|
this.isFirstWriteValue = true;
|
|
18282
18329
|
this.scrollSelectionIntoView = (e, domRange) => {
|
|
18283
18330
|
const { neededScrollIntoView } = e.options;
|
|
@@ -18365,7 +18412,7 @@ class TheEditorComponent {
|
|
|
18365
18412
|
initializeDefaultMenuIcons(this.iconRegistry);
|
|
18366
18413
|
}
|
|
18367
18414
|
ngAfterViewInit() {
|
|
18368
|
-
this.
|
|
18415
|
+
this.initializeVirtualScroll();
|
|
18369
18416
|
}
|
|
18370
18417
|
ngOnChanges(changes) {
|
|
18371
18418
|
const options = changes.theOptions;
|
|
@@ -18388,7 +18435,7 @@ class TheEditorComponent {
|
|
|
18388
18435
|
ngOnDestroy() {
|
|
18389
18436
|
THE_EDITOR_PREVIOUS_SELECTION.delete(this.editor);
|
|
18390
18437
|
}
|
|
18391
|
-
|
|
18438
|
+
initializeVirtualScroll() {
|
|
18392
18439
|
if (!this.virtualScrollConfig().enabled) {
|
|
18393
18440
|
return;
|
|
18394
18441
|
}
|
|
@@ -18396,22 +18443,12 @@ class TheEditorComponent {
|
|
|
18396
18443
|
if (!scrollContainer) {
|
|
18397
18444
|
return;
|
|
18398
18445
|
}
|
|
18399
|
-
|
|
18400
|
-
|
|
18401
|
-
|
|
18402
|
-
.subscribe(() => {
|
|
18403
|
-
if (!JUST_NOW_UPDATED_VIRTUAL_VIEW.get(this.editor)) {
|
|
18404
|
-
this.updateVirtualConfig();
|
|
18405
|
-
}
|
|
18406
|
-
else {
|
|
18407
|
-
if (localStorage.getItem(SLATE_DEBUG_KEY)) {
|
|
18408
|
-
console.log('theia: scroll event fired from updated virtual view(skip this scroll)');
|
|
18409
|
-
}
|
|
18410
|
-
JUST_NOW_UPDATED_VIRTUAL_VIEW.set(this.editor, false);
|
|
18411
|
-
}
|
|
18412
|
-
});
|
|
18446
|
+
fromEvent(scrollContainer, 'scroll')
|
|
18447
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
18448
|
+
.subscribe(() => {
|
|
18413
18449
|
this.updateVirtualConfig();
|
|
18414
18450
|
});
|
|
18451
|
+
this.updateVirtualConfig();
|
|
18415
18452
|
}
|
|
18416
18453
|
updateVirtualConfig() {
|
|
18417
18454
|
const scrollContainer = this.theContextService.getScrollContainer();
|
|
@@ -18419,13 +18456,18 @@ class TheEditorComponent {
|
|
|
18419
18456
|
return;
|
|
18420
18457
|
}
|
|
18421
18458
|
const { scrollTop, offsetHeight } = scrollContainer;
|
|
18459
|
+
if (this.scrollContainerBoundingTop === null) {
|
|
18460
|
+
this.scrollContainerBoundingTop = scrollContainer.getBoundingClientRect().top;
|
|
18461
|
+
}
|
|
18422
18462
|
if (localStorage.getItem(SLATE_DEBUG_KEY + '__SCROLL_TOP')) {
|
|
18423
18463
|
console.log(`theia: scroll event fired from user: ${scrollTop}`);
|
|
18424
18464
|
}
|
|
18425
18465
|
this.virtualScrollConfig.update(config => ({
|
|
18426
18466
|
...config,
|
|
18427
18467
|
scrollTop,
|
|
18428
|
-
viewportHeight: offsetHeight
|
|
18468
|
+
viewportHeight: offsetHeight,
|
|
18469
|
+
scrollContainer: this.theContextService.getScrollContainer(),
|
|
18470
|
+
viewportBoundingTop: this.scrollContainerBoundingTop
|
|
18429
18471
|
}));
|
|
18430
18472
|
}
|
|
18431
18473
|
initialize() {
|
|
@@ -18938,5 +18980,5 @@ const withTestPlugin = (plugins, initValue) => {
|
|
|
18938
18980
|
* Generated bundle index. Do not edit.
|
|
18939
18981
|
*/
|
|
18940
18982
|
|
|
18941
|
-
export { ALIGN_BLOCK_TYPES, A_TAG_REL_ATTR, AlignEditor, Alignment, BLOCK_DELETE_BACKWARD_TYPES, BLOCK_HIDDEN_CLASS, BasicTest, BlockquoteEditor, CLIPBOARD_FORMAT_KEY, CODEMIRROR_PADDING_TOP, CODE_MODES, CONTAINER_BLOCKS, CONTROL_KEY, CodeEditor, ColorEditor, ColumnResizeNotifierSource, ColumnResizingStore, DEFAULT_LANGUAGE, DEFAULT_SCROLL_CONTAINER, DISABLED_OPERATE_TYPES, DataTransferFaker, DefaultElementOptions, DefaultGlobalToolbarDefinition, DefaultInlineToolbarDefinition, DropdownMode, ELEMENT_UNIQUE_ID, EditorPresetConfigFactoryMock, ElementKinds, ErrorCodes, FontSizeTypes, FontSizes, HEADING_TYPES, HeaderLevelMap, HeadingEditor, HoveredCellInfo, HrEditor, IS_MAC, ImageEditor, IndentEditor, Indents, InlineCodeEditor, LINK_DEFAULT_TEXT, LIST_BLOCK_TYPES, LOWEST_TEXT_CONTAINER_TYPES, LayoutTypes, LinkEditor, ListEditor, MarkEditor, MarkProps, MarkTypes, MentionEditor, PICTURE_ACCEPTED_UPLOAD_MIME, PICTURE_ACCEPTED_UPLOAD_SIZE, PluginKeys, PluginMenuIcons, PluginMenuSvgs, Position, QUICK_INSERT_HOTKEY, QuickInsertEditor, ResizeRef, SLA_TABLE_CELL_SELECTOR, SLA_TABLE_SELECTOR, STANDARD_HEADING_TYPES, ScrollDirection, SpecialBackgroundColor, TAB_SPACE, THE_EDITOR_BG_COLOR, THE_EDITOR_COLOR, THE_EDITOR_CONVERSION_HINT_REF, THE_EDITOR_ORIGIN_ANCHOR, THE_EDITOR_POPOVER_REF, THE_EDITOR_PREVIOUS_SELECTION, THE_EDITOR_UUID, THE_I18N_DE_DE, THE_I18N_EN_US, THE_I18N_JA_JP, THE_I18N_LOCALE_ID, THE_I18N_RU_RU, THE_I18N_ZH_HANS, THE_I18N_ZH_HANT, THE_IMAGE_SERVICE_TOKEN, THE_LISTBOX_PARENT_GROUP_TOKEN, THE_LISTBOX_PARENT_OPTION_TOKEN, THE_LISTBOX_TOKEN, THE_MODE_PROVIDER, THE_MODE_TOKEN, THE_PLUGIN_MENU_REF, THE_PRESET_CONFIG_TOKEN, TableCellEventDispatcher, TableEditor, TableHeaderBackgroundColor, TablePosition, TheBaseElement, TheBaseSuggestion, TheBaseToolbarDropdown, TheBaseToolbarItem, TheCode, TheColumnResizeDirective, TheColumnResizeOverlayHandle, TheContextMenu, TheContextService, TheConversionHint, TheDataMode, TheEditor, TheEditorComponent, TheEditorModule, TheI18nService, TheImage, TheInlineToolbar, TheListboxDirective, TheListboxGroupDirective, TheListboxOptionDirective, TheLocaleType, TheMode, TheModeConfig, ThePluginMenu, ThePluginMenuComponent, ThePluginMenuItemType, ThePreventDefaultDirective, index$1 as TheQueries, TheQuickInsert, TheTable, TheTableSelect, TheToolbarComponent, TheToolbarDropdown, TheToolbarGroup, TheToolbarGroupToken, TheToolbarItem, TheToolbarService, index as TheTransforms, TodoItemEditor, ToolbarActionTypes, ToolbarAlignment, ToolbarItemType, ToolbarMoreGroup, VOID_BLOCK_TYPES, VerticalAlignEditor, VerticalAlignment, ZERO_WIDTH_CHAR, autoFocus, base64toBlob, bottomLeftPosition, bottomRightPosition, buildPluginMenu, buildPluginMenuItemMap, buildQuickInsertMenus, calcPrintColumnWidth, calcSpanForColumn, calcSpanForRow, calculateHeaderRowHeight, calculateRowControls, coercePixelsFromCssValue, combinePlugins, copyNode, createBreakBarChar, createCell, createEmptyContent, createEmptyParagraph, createMentionPlugin, createPluginFactory, createRow, createTable, createTablePosition, createTest1Plugin, createTestPlugin, createToolbar, createVerticalAlignPlugin, customPluginMock, customPluginMockKey, dataDeserialize, dataSerializing, deDeLocale, deleteElementKey, enUsLocale, errorImageUrlMock, expandPreviousHeadings, extractFragment, extractFragmentByHTML, filterTextFormat, fixBlockWithoutParagraph, fixBlockWithoutText, flattenDeepPlugins, getCellPositionsFromRange, getCollapsedStandardHeadingAbove, getColsTotalWidth, getColumnsWidth, getDirtyElements, getEditorScrollContainer, getEditorUUID, getElementClassByPrefix, getElementHeight, getElementWidth, getEndBlock, getFollowElements, getGridColumns, getMode, getNextCell, getOriginCell, getPlugin, getPluginOptions, getPlugins, getPreviousRelatedHeadingElements, getRowsTotalHeight, getSelectCellNode, getSelectedCellPositions, getStartBlock, getTableByCell, getTableByRow, getTheDefaultPluginMenu, getToolbarClass, hasHeaderRow, hasNumberedColumn, headingOptions, htmlToTheia, idCreator, inValidTypes, initializeDefaultMenuIcons, injectTranslations, insertDataByInvalidType, internalPlugins, isCleanEmptyParagraph, isColorIndicator, isColorInput, isColorPanel, isDirectionKeydown, isHeadingElement, isInside, isMobileMode, isPrintMode, isPureEmptyParagraph, isRangeInTable, isRectangularInTableCells, isSelectedAllCell, isSelectionInTable, isStandardHeadingElement, isStandardHeadingElementByType, isUrl, isVirtualKey, jaJpLocale, matchOptions, mergeArray, mergeDeepPlugins, mergeElementOptions, mergeOptions, nestedStructureByKey, normalizeValue, originOptions, plainToTheia, pluginKey, pluginKey1, pluginsByKey, reSelection, recursionNodes, refocus, ruRuLocale, setClipboardDataByDom, setEditorUUID, theTethysIconRegistryFaker, toggleClass, toggleHeadingRelatedElement, toggleProperty, toggleStyle, topLeftPosition, topRightPosition, uniqueCellPosition, updatePopoverPosition, withMention, withTestPlugin, withTheia, zhHansLocale, zhHantLocale };
|
|
18983
|
+
export { ALIGN_BLOCK_TYPES, A_TAG_REL_ATTR, AlignEditor, Alignment, BLOCK_DELETE_BACKWARD_TYPES, BLOCK_HIDDEN_CLASS, BasicTest, BlockquoteEditor, CLIPBOARD_FORMAT_KEY, CODEMIRROR_PADDING_TOP, CODE_MODES, CONTAINER_BLOCKS, CONTROL_KEY, CodeEditor, ColorEditor, ColumnResizeNotifierSource, ColumnResizingStore, DEFAULT_LANGUAGE, DEFAULT_SCROLL_CONTAINER, DISABLED_OPERATE_TYPES, DataTransferFaker, DefaultElementOptions, DefaultGlobalToolbarDefinition, DefaultInlineToolbarDefinition, DropdownMode, ELEMENT_UNIQUE_ID, EditorPresetConfigFactoryMock, ElementKinds, ErrorCodes, FontSizeTypes, FontSizes, HEADING_TYPES, HeaderLevelMap, HeadingEditor, HoveredCellInfo, HrEditor, IS_MAC, ImageEditor, IndentEditor, Indents, InlineCodeEditor, LINK_DEFAULT_TEXT, LIST_BLOCK_TYPES, LOWEST_TEXT_CONTAINER_TYPES, LayoutTypes, LinkEditor, ListEditor, MarkEditor, MarkProps, MarkTypes, MentionEditor, PICTURE_ACCEPTED_UPLOAD_MIME, PICTURE_ACCEPTED_UPLOAD_SIZE, PluginKeys, PluginMenuIcons, PluginMenuSvgs, Position, QUICK_INSERT_HOTKEY, QuickInsertEditor, ResizeRef, SLA_TABLE_CELL_SELECTOR, SLA_TABLE_SELECTOR, STANDARD_HEADING_TYPES, ScrollDirection, SpecialBackgroundColor, TAB_SPACE, THE_EDITOR_BG_COLOR, THE_EDITOR_COLOR, THE_EDITOR_CONVERSION_HINT_REF, THE_EDITOR_ORIGIN_ANCHOR, THE_EDITOR_POPOVER_REF, THE_EDITOR_PREVIOUS_SELECTION, THE_EDITOR_UUID, THE_I18N_DE_DE, THE_I18N_EN_US, THE_I18N_JA_JP, THE_I18N_LOCALE_ID, THE_I18N_RU_RU, THE_I18N_ZH_HANS, THE_I18N_ZH_HANT, THE_IMAGE_SERVICE_TOKEN, THE_LISTBOX_PARENT_GROUP_TOKEN, THE_LISTBOX_PARENT_OPTION_TOKEN, THE_LISTBOX_TOKEN, THE_MODE_PROVIDER, THE_MODE_TOKEN, THE_PLUGIN_MENU_REF, THE_PRESET_CONFIG_TOKEN, TableCellEventDispatcher, TableEditor, TableHeaderBackgroundColor, TablePosition, TheBaseElement, TheBaseSuggestion, TheBaseToolbarDropdown, TheBaseToolbarItem, TheCode, TheColumnResizeDirective, TheColumnResizeOverlayHandle, TheContextMenu, TheContextService, TheConversionHint, TheDataMode, TheEditor, TheEditorComponent, TheEditorModule, TheI18nService, TheImage, TheInlineToolbar, TheListboxDirective, TheListboxGroupDirective, TheListboxOptionDirective, TheLocaleType, TheMode, TheModeConfig, ThePluginMenu, ThePluginMenuComponent, ThePluginMenuItemType, ThePreventDefaultDirective, index$1 as TheQueries, TheQuickInsert, TheTable, TheTableSelect, TheToolbarComponent, TheToolbarDropdown, TheToolbarGroup, TheToolbarGroupToken, TheToolbarItem, TheToolbarService, index as TheTransforms, TodoItemEditor, ToolbarActionTypes, ToolbarAlignment, ToolbarItemType, ToolbarMoreGroup, VOID_BLOCK_TYPES, VerticalAlignEditor, VerticalAlignment, ZERO_WIDTH_CHAR, autoFocus, base64toBlob, bottomLeftPosition, bottomRightPosition, buildPluginMenu, buildPluginMenuItemMap, buildQuickInsertMenus, calcPrintColumnWidth, calcSpanForColumn, calcSpanForRow, calculateHeaderRowHeight, calculateRowControls, coercePixelsFromCssValue, combinePlugins, copyNode, createBreakBarChar, createCell, createEmptyContent, createEmptyParagraph, createMentionPlugin, createPluginFactory, createRow, createTable, createTablePosition, createTest1Plugin, createTestPlugin, createToolbar, createVerticalAlignPlugin, customPluginMock, customPluginMockKey, dataDeserialize, dataSerializing, deDeLocale, deleteElementKey, enUsLocale, errorImageUrlMock, expandPreviousHeadings, extractFragment, extractFragmentByHTML, filterTextFormat, fixBlockWithoutParagraph, fixBlockWithoutText, flattenDeepPlugins, getCellPositionsFromRange, getCollapsedStandardHeadingAbove, getColsTotalWidth, getColumnsWidth, getDirtyElements, getEditorScrollContainer, getEditorUUID, getElementClassByPrefix, getElementHeight, getElementWidth, getEndBlock, getFollowElements, getGridColumns, getMode, getNextCell, getOriginCell, getPlugin, getPluginOptions, getPlugins, getPreviousRelatedHeadingElements, getRowsTotalHeight, getSelectCellNode, getSelectedCellPositions, getStartBlock, getTableByCell, getTableByRow, getTheDefaultPluginMenu, getToolbarClass, hasHeaderRow, hasNumberedColumn, headingOptions, htmlToTheia, idCreator, inValidTypes, initializeDefaultMenuIcons, injectTranslations, insertDataByInvalidType, internalPlugins, isCleanEmptyParagraph, isColorIndicator, isColorInput, isColorPanel, isDirectionKeydown, isHeadingElement, isInside, isMobileMode, isPrintMode, isPureEmptyParagraph, isPureHeading, isPureParagraph, isRangeInTable, isRectangularInTableCells, isSelectedAllCell, isSelectionInTable, isStandardHeadingElement, isStandardHeadingElementByType, isUrl, isVirtualKey, jaJpLocale, matchOptions, mergeArray, mergeDeepPlugins, mergeElementOptions, mergeOptions, nestedStructureByKey, normalizeValue, originOptions, plainToTheia, pluginKey, pluginKey1, pluginsByKey, reSelection, recursionNodes, refocus, ruRuLocale, setClipboardDataByDom, setEditorUUID, theTethysIconRegistryFaker, toggleClass, toggleHeadingRelatedElement, toggleProperty, toggleStyle, topLeftPosition, topRightPosition, uniqueCellPosition, updatePopoverPosition, withMention, withTestPlugin, withTheia, zhHansLocale, zhHantLocale };
|
|
18942
18984
|
//# sourceMappingURL=worktile-theia.mjs.map
|