@worktile/theia 20.1.0-next.6 → 20.1.0-next.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3906,9 +3906,6 @@ const withTheia = (editor, plugins = []) => {
3906
3906
  e.isContainer = (value) => false;
3907
3907
  e.globalMousedown = (event) => null;
3908
3908
  e.mousedown = (event) => { };
3909
- e.isVisible = (element) => {
3910
- return true;
3911
- };
3912
3909
  e.extraElementOptions = [];
3913
3910
  e.disabled = false;
3914
3911
  e.plugins = [];
@@ -10785,9 +10782,13 @@ class TheTable extends TheBaseElement {
10785
10782
  });
10786
10783
  }
10787
10784
  updateHorizontalScrollbar() {
10785
+ this.syncMouseOverState();
10788
10786
  this.updateScrollbarVisibility();
10789
10787
  this.updateScrollbarFixedState();
10790
10788
  }
10789
+ syncMouseOverState() {
10790
+ this.isMouseOverTable = this.nativeElement.matches(':hover');
10791
+ }
10791
10792
  // 更新横向滚动条可见性
10792
10793
  updateScrollbarVisibility() {
10793
10794
  if (!this.tableWrapper || !this.horizontalScrollbarContainer || !this.horizontalScrollbarContent) {
@@ -18257,12 +18258,12 @@ class TheEditorComponent {
18257
18258
  this.theUploadingStatus = new EventEmitter(); // true 上传结束 false 上传中
18258
18259
  this.visibleQuickInsertPlus = true;
18259
18260
  this.elementToHtml = new WeakMap();
18260
- this.virtualConfig = signal({
18261
+ this.virtualScrollConfig = signal({
18261
18262
  enabled: false,
18262
18263
  scrollTop: 0,
18263
18264
  viewportHeight: 0,
18264
18265
  bufferCount: 5
18265
- }, ...(ngDevMode ? [{ debugName: "virtualConfig" }] : []));
18266
+ }, ...(ngDevMode ? [{ debugName: "virtualScrollConfig" }] : []));
18266
18267
  this.onChangeCallback = () => { };
18267
18268
  this.onTouchedCallback = () => { };
18268
18269
  this.locale = injectTranslations(inject(TheI18nService));
@@ -18353,7 +18354,7 @@ class TheEditorComponent {
18353
18354
  initializeDefaultMenuIcons(this.iconRegistry);
18354
18355
  }
18355
18356
  ngAfterViewInit() {
18356
- this.bindVirtualScrollContainer();
18357
+ this.listenScrollEvent();
18357
18358
  }
18358
18359
  ngOnChanges(changes) {
18359
18360
  const options = changes.theOptions;
@@ -18376,18 +18377,20 @@ class TheEditorComponent {
18376
18377
  ngOnDestroy() {
18377
18378
  THE_EDITOR_PREVIOUS_SELECTION.delete(this.editor);
18378
18379
  }
18379
- bindVirtualScrollContainer() {
18380
+ listenScrollEvent() {
18381
+ if (!this.virtualScrollConfig().enabled) {
18382
+ return;
18383
+ }
18380
18384
  const scrollContainer = this.theContextService.getScrollContainer();
18381
18385
  if (!scrollContainer) {
18382
18386
  return;
18383
18387
  }
18384
- this.scrollContainerElement = scrollContainer;
18385
18388
  this.ngZone.runOutsideAngular(() => {
18386
18389
  fromEvent(scrollContainer, 'scroll')
18387
18390
  .pipe(takeUntilDestroyed(this.destroyRef))
18388
18391
  .subscribe(() => {
18389
18392
  if (!JUST_NOW_UPDATED_VIRTUAL_VIEW.get(this.editor)) {
18390
- this.syncVirtualConfig();
18393
+ this.updateVirtualConfig();
18391
18394
  }
18392
18395
  else {
18393
18396
  if (localStorage.getItem(SLATE_DEBUG_KEY)) {
@@ -18396,25 +18399,26 @@ class TheEditorComponent {
18396
18399
  JUST_NOW_UPDATED_VIRTUAL_VIEW.set(this.editor, false);
18397
18400
  }
18398
18401
  });
18399
- this.syncVirtualConfig();
18402
+ this.updateVirtualConfig();
18400
18403
  });
18401
18404
  }
18402
- syncVirtualConfig() {
18403
- if (!this.virtualConfig().enabled || !this.scrollContainerElement) {
18405
+ updateVirtualConfig() {
18406
+ const scrollContainer = this.theContextService.getScrollContainer();
18407
+ if (!this.virtualScrollConfig().enabled || !scrollContainer) {
18404
18408
  return;
18405
18409
  }
18406
- const { scrollTop, offsetHeight } = this.scrollContainerElement;
18410
+ const { scrollTop, offsetHeight } = scrollContainer;
18407
18411
  if (localStorage.getItem(SLATE_DEBUG_KEY + '__SCROLL_TOP')) {
18408
18412
  console.log(`theia: scroll event fired from user: ${scrollTop}`);
18409
18413
  }
18410
- this.virtualConfig.update(config => ({
18414
+ this.virtualScrollConfig.update(config => ({
18411
18415
  ...config,
18412
18416
  scrollTop,
18413
18417
  viewportHeight: offsetHeight
18414
18418
  }));
18415
18419
  }
18416
18420
  initialize() {
18417
- this.virtualConfig.update(config => ({
18421
+ this.virtualScrollConfig.update(config => ({
18418
18422
  ...config,
18419
18423
  enabled: this.theOptions?.enableVirtualScroll
18420
18424
  }));
@@ -18617,7 +18621,7 @@ class TheEditorComponent {
18617
18621
  TheContextService,
18618
18622
  { provide: TheToolbarGroupToken, useValue: TheToolbarGroup },
18619
18623
  { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => TheEditorComponent), multi: true }
18620
- ], viewQueries: [{ propertyName: "theEditableContainer", first: true, predicate: ["theEditableContainer"], descendants: true, read: ElementRef, static: true }, { propertyName: "globalToolbarInstance", first: true, predicate: ["globalToolbar"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "@if (!options?.readonly && !theGlobalToolbar && !isMobileMode) {\n <the-toolbar\n [ngClass]=\"{\n 'the-toolbar-disabled': options?.disabled\n }\"\n #globalToolbar\n [editor]=\"editor\"\n [toolbarItems]=\"toolbarEntity.global\"\n [containerClass]=\"globalToolbarClass\"\n [align]=\"options?.toolbar?.align\"\n ></the-toolbar>\n}\n\n<div\n #theEditableContainer\n class=\"the-editable-container\"\n thyImageGroup\n [ngClass]=\"{\n 'the-editor-disabled': options?.disabled,\n 'max-height': maxHeight\n }\"\n [ngStyle]=\"{ 'max-height': maxHeight }\"\n>\n <slate-editable\n class=\"the-editor-typo\"\n [editor]=\"editor\"\n [ngModel]=\"editorValue\"\n [renderElement]=\"renderElement\"\n [renderText]=\"renderText\"\n [renderLeaf]=\"renderLeaf\"\n [isStrictDecorate]=\"false\"\n [decorate]=\"decorate\"\n [placeholder]=\"options?.placeholder\"\n [placeholderDecorate]=\"options?.placeholderDecorate ? options?.placeholderDecorate : null\"\n [readonly]=\"options?.readonly || options?.disabled\"\n [keydown]=\"onKeyDown\"\n [click]=\"onClick\"\n [paste]=\"onSlaPaste\"\n [blur]=\"onSlaBlur\"\n [focus]=\"onSlaFocus\"\n [copy]=\"onSlaCopy\"\n [cut]=\"onSlaCut\"\n [beforeInput]=\"onSlaBeforeInput\"\n [compositionStart]=\"onSlaCompositionStart\"\n [compositionEnd]=\"onSlaCompositionEnd\"\n [dragStart]=\"onSlaDragStart\"\n [dragOver]=\"onSlaDragOver\"\n [drop]=\"onDrop\"\n [scrollSelectionIntoView]=\"scrollSelectionIntoView\"\n [virtualScroll]=\"virtualConfig()\"\n (ngModelChange)=\"valueChange($event)\"\n (mousedown)=\"mousedown($event)\"\n ></slate-editable>\n\n @if (!isMobileMode) {\n @if (!options?.readonly && options?.inlineToolbarVisible) {\n <the-inline-toolbar [editor]=\"editor\" [toolbarItems]=\"toolbarEntity.inline\"></the-inline-toolbar>\n }\n @if (!options?.readonly) {\n <div theQuickInsert [editor]=\"editor\" [isVisible]=\"visibleQuickInsertPlus\"></div>\n }\n }\n</div>\n", dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { 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: "component", type: i4.SlateEditable, selector: "slate-editable", inputs: ["editor", "renderElement", "renderLeaf", "renderText", "decorate", "placeholderDecorate", "scrollSelectionIntoView", "isStrictDecorate", "trackBy", "readonly", "placeholder", "virtualScroll", "beforeInput", "blur", "click", "compositionEnd", "compositionUpdate", "compositionStart", "copy", "cut", "dragOver", "dragStart", "dragEnd", "drop", "focus", "keydown", "paste", "spellCheck", "autoCorrect", "autoCapitalize"] }, { kind: "component", type: TheQuickInsert, selector: "[theQuickInsert]", inputs: ["editor", "isVisible"] }, { kind: "component", type: TheInlineToolbar, selector: "the-inline-toolbar", inputs: ["editor", "toolbarItems"] }, { kind: "component", type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "containerClass", "isMore", "afterTemplate"] }, { kind: "component", type: ThyImageGroup, selector: "thy-image-group, [thyImageGroup]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
18624
+ ], viewQueries: [{ propertyName: "theEditableContainer", first: true, predicate: ["theEditableContainer"], descendants: true, read: ElementRef, static: true }, { propertyName: "globalToolbarInstance", first: true, predicate: ["globalToolbar"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "@if (!options?.readonly && !theGlobalToolbar && !isMobileMode) {\n <the-toolbar\n [ngClass]=\"{\n 'the-toolbar-disabled': options?.disabled\n }\"\n #globalToolbar\n [editor]=\"editor\"\n [toolbarItems]=\"toolbarEntity.global\"\n [containerClass]=\"globalToolbarClass\"\n [align]=\"options?.toolbar?.align\"\n ></the-toolbar>\n}\n\n<div\n #theEditableContainer\n class=\"the-editable-container\"\n thyImageGroup\n [ngClass]=\"{\n 'the-editor-disabled': options?.disabled,\n 'max-height': maxHeight\n }\"\n [ngStyle]=\"{ 'max-height': maxHeight }\"\n>\n <slate-editable\n class=\"the-editor-typo\"\n [editor]=\"editor\"\n [ngModel]=\"editorValue\"\n [renderElement]=\"renderElement\"\n [renderText]=\"renderText\"\n [renderLeaf]=\"renderLeaf\"\n [isStrictDecorate]=\"false\"\n [decorate]=\"decorate\"\n [placeholder]=\"options?.placeholder\"\n [placeholderDecorate]=\"options?.placeholderDecorate ? options?.placeholderDecorate : null\"\n [readonly]=\"options?.readonly || options?.disabled\"\n [keydown]=\"onKeyDown\"\n [click]=\"onClick\"\n [paste]=\"onSlaPaste\"\n [blur]=\"onSlaBlur\"\n [focus]=\"onSlaFocus\"\n [copy]=\"onSlaCopy\"\n [cut]=\"onSlaCut\"\n [beforeInput]=\"onSlaBeforeInput\"\n [compositionStart]=\"onSlaCompositionStart\"\n [compositionEnd]=\"onSlaCompositionEnd\"\n [dragStart]=\"onSlaDragStart\"\n [dragOver]=\"onSlaDragOver\"\n [drop]=\"onDrop\"\n [scrollSelectionIntoView]=\"scrollSelectionIntoView\"\n [virtualScroll]=\"virtualScrollConfig()\"\n (ngModelChange)=\"valueChange($event)\"\n (mousedown)=\"mousedown($event)\"\n ></slate-editable>\n\n @if (!isMobileMode) {\n @if (!options?.readonly && options?.inlineToolbarVisible) {\n <the-inline-toolbar [editor]=\"editor\" [toolbarItems]=\"toolbarEntity.inline\"></the-inline-toolbar>\n }\n @if (!options?.readonly) {\n <div theQuickInsert [editor]=\"editor\" [isVisible]=\"visibleQuickInsertPlus\"></div>\n }\n }\n</div>\n", dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { 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: "component", type: i4.SlateEditable, selector: "slate-editable", inputs: ["editor", "renderElement", "renderLeaf", "renderText", "decorate", "placeholderDecorate", "scrollSelectionIntoView", "isStrictDecorate", "trackBy", "readonly", "placeholder", "virtualScroll", "beforeInput", "blur", "click", "compositionEnd", "compositionUpdate", "compositionStart", "copy", "cut", "dragOver", "dragStart", "dragEnd", "drop", "focus", "keydown", "paste", "spellCheck", "autoCorrect", "autoCapitalize"] }, { kind: "component", type: TheQuickInsert, selector: "[theQuickInsert]", inputs: ["editor", "isVisible"] }, { kind: "component", type: TheInlineToolbar, selector: "the-inline-toolbar", inputs: ["editor", "toolbarItems"] }, { kind: "component", type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "containerClass", "isMore", "afterTemplate"] }, { kind: "component", type: ThyImageGroup, selector: "thy-image-group, [thyImageGroup]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
18621
18625
  }
18622
18626
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TheEditorComponent, decorators: [{
18623
18627
  type: Component,
@@ -18625,7 +18629,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
18625
18629
  TheContextService,
18626
18630
  { provide: TheToolbarGroupToken, useValue: TheToolbarGroup },
18627
18631
  { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => TheEditorComponent), multi: true }
18628
- ], template: "@if (!options?.readonly && !theGlobalToolbar && !isMobileMode) {\n <the-toolbar\n [ngClass]=\"{\n 'the-toolbar-disabled': options?.disabled\n }\"\n #globalToolbar\n [editor]=\"editor\"\n [toolbarItems]=\"toolbarEntity.global\"\n [containerClass]=\"globalToolbarClass\"\n [align]=\"options?.toolbar?.align\"\n ></the-toolbar>\n}\n\n<div\n #theEditableContainer\n class=\"the-editable-container\"\n thyImageGroup\n [ngClass]=\"{\n 'the-editor-disabled': options?.disabled,\n 'max-height': maxHeight\n }\"\n [ngStyle]=\"{ 'max-height': maxHeight }\"\n>\n <slate-editable\n class=\"the-editor-typo\"\n [editor]=\"editor\"\n [ngModel]=\"editorValue\"\n [renderElement]=\"renderElement\"\n [renderText]=\"renderText\"\n [renderLeaf]=\"renderLeaf\"\n [isStrictDecorate]=\"false\"\n [decorate]=\"decorate\"\n [placeholder]=\"options?.placeholder\"\n [placeholderDecorate]=\"options?.placeholderDecorate ? options?.placeholderDecorate : null\"\n [readonly]=\"options?.readonly || options?.disabled\"\n [keydown]=\"onKeyDown\"\n [click]=\"onClick\"\n [paste]=\"onSlaPaste\"\n [blur]=\"onSlaBlur\"\n [focus]=\"onSlaFocus\"\n [copy]=\"onSlaCopy\"\n [cut]=\"onSlaCut\"\n [beforeInput]=\"onSlaBeforeInput\"\n [compositionStart]=\"onSlaCompositionStart\"\n [compositionEnd]=\"onSlaCompositionEnd\"\n [dragStart]=\"onSlaDragStart\"\n [dragOver]=\"onSlaDragOver\"\n [drop]=\"onDrop\"\n [scrollSelectionIntoView]=\"scrollSelectionIntoView\"\n [virtualScroll]=\"virtualConfig()\"\n (ngModelChange)=\"valueChange($event)\"\n (mousedown)=\"mousedown($event)\"\n ></slate-editable>\n\n @if (!isMobileMode) {\n @if (!options?.readonly && options?.inlineToolbarVisible) {\n <the-inline-toolbar [editor]=\"editor\" [toolbarItems]=\"toolbarEntity.inline\"></the-inline-toolbar>\n }\n @if (!options?.readonly) {\n <div theQuickInsert [editor]=\"editor\" [isVisible]=\"visibleQuickInsertPlus\"></div>\n }\n }\n</div>\n" }]
18632
+ ], template: "@if (!options?.readonly && !theGlobalToolbar && !isMobileMode) {\n <the-toolbar\n [ngClass]=\"{\n 'the-toolbar-disabled': options?.disabled\n }\"\n #globalToolbar\n [editor]=\"editor\"\n [toolbarItems]=\"toolbarEntity.global\"\n [containerClass]=\"globalToolbarClass\"\n [align]=\"options?.toolbar?.align\"\n ></the-toolbar>\n}\n\n<div\n #theEditableContainer\n class=\"the-editable-container\"\n thyImageGroup\n [ngClass]=\"{\n 'the-editor-disabled': options?.disabled,\n 'max-height': maxHeight\n }\"\n [ngStyle]=\"{ 'max-height': maxHeight }\"\n>\n <slate-editable\n class=\"the-editor-typo\"\n [editor]=\"editor\"\n [ngModel]=\"editorValue\"\n [renderElement]=\"renderElement\"\n [renderText]=\"renderText\"\n [renderLeaf]=\"renderLeaf\"\n [isStrictDecorate]=\"false\"\n [decorate]=\"decorate\"\n [placeholder]=\"options?.placeholder\"\n [placeholderDecorate]=\"options?.placeholderDecorate ? options?.placeholderDecorate : null\"\n [readonly]=\"options?.readonly || options?.disabled\"\n [keydown]=\"onKeyDown\"\n [click]=\"onClick\"\n [paste]=\"onSlaPaste\"\n [blur]=\"onSlaBlur\"\n [focus]=\"onSlaFocus\"\n [copy]=\"onSlaCopy\"\n [cut]=\"onSlaCut\"\n [beforeInput]=\"onSlaBeforeInput\"\n [compositionStart]=\"onSlaCompositionStart\"\n [compositionEnd]=\"onSlaCompositionEnd\"\n [dragStart]=\"onSlaDragStart\"\n [dragOver]=\"onSlaDragOver\"\n [drop]=\"onDrop\"\n [scrollSelectionIntoView]=\"scrollSelectionIntoView\"\n [virtualScroll]=\"virtualScrollConfig()\"\n (ngModelChange)=\"valueChange($event)\"\n (mousedown)=\"mousedown($event)\"\n ></slate-editable>\n\n @if (!isMobileMode) {\n @if (!options?.readonly && options?.inlineToolbarVisible) {\n <the-inline-toolbar [editor]=\"editor\" [toolbarItems]=\"toolbarEntity.inline\"></the-inline-toolbar>\n }\n @if (!options?.readonly) {\n <div theQuickInsert [editor]=\"editor\" [isVisible]=\"visibleQuickInsertPlus\"></div>\n }\n }\n</div>\n" }]
18629
18633
  }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i0.DestroyRef }, { type: i0.ElementRef }, { type: i0.Injector }, { type: i0.NgZone }, { type: i0.ViewContainerRef }, { type: TheContextService }, { type: i2$5.ThyIconRegistry }, { type: undefined, decorators: [{
18630
18634
  type: Optional
18631
18635
  }, {