@worktile/theia 20.1.0-next.7 → 20.1.0-next.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.
@@ -22,7 +22,8 @@
22
22
  color: variables.$gray-700;
23
23
  }
24
24
  }
25
- :nth-child(6) {
25
+ :nth-child(6),
26
+ :nth-child(12) {
26
27
  margin-right: 0;
27
28
  }
28
29
  }
@@ -10782,9 +10782,13 @@ class TheTable extends TheBaseElement {
10782
10782
  });
10783
10783
  }
10784
10784
  updateHorizontalScrollbar() {
10785
+ this.syncMouseOverState();
10785
10786
  this.updateScrollbarVisibility();
10786
10787
  this.updateScrollbarFixedState();
10787
10788
  }
10789
+ syncMouseOverState() {
10790
+ this.isMouseOverTable = this.nativeElement.matches(':hover');
10791
+ }
10788
10792
  // 更新横向滚动条可见性
10789
10793
  updateScrollbarVisibility() {
10790
10794
  if (!this.tableWrapper || !this.horizontalScrollbarContainer || !this.horizontalScrollbarContent) {
@@ -14364,11 +14368,17 @@ class TheImage extends TheBaseElement {
14364
14368
  super.ngOnDestroy();
14365
14369
  }
14366
14370
  cacheImageHeight(height) {
14371
+ if (!AngularEditor.isEnabledVirtualScroll(this.editor)) {
14372
+ return;
14373
+ }
14367
14374
  const heights = ELEMENT_KEY_TO_HEIGHTS.get(this.editor);
14368
14375
  const key = AngularEditor.findKey(this.editor, this.element);
14369
14376
  heights.set(key.id, height);
14370
14377
  }
14371
14378
  setImageMinHeight() {
14379
+ if (!AngularEditor.isEnabledVirtualScroll(this.editor)) {
14380
+ return;
14381
+ }
14372
14382
  const heights = ELEMENT_KEY_TO_HEIGHTS.get(this.editor);
14373
14383
  const key = AngularEditor.findKey(this.editor, this.element);
14374
14384
  if (heights && heights.get(key.id)) {
@@ -14380,6 +14390,9 @@ class TheImage extends TheBaseElement {
14380
14390
  }
14381
14391
  }
14382
14392
  clearMinHeight() {
14393
+ if (!AngularEditor.isEnabledVirtualScroll(this.editor)) {
14394
+ return;
14395
+ }
14383
14396
  const blockCard = getBlockCardByNativeElement(this.nativeElement);
14384
14397
  if (blockCard) {
14385
14398
  blockCard.style.minHeight = '';
@@ -14626,9 +14639,11 @@ class TheImage extends TheBaseElement {
14626
14639
  const img = event.target;
14627
14640
  this.naturalWidth = img.naturalWidth;
14628
14641
  this.naturalHeight = img.naturalHeight;
14629
- this.imageLoadedCacheHeightTimer = setTimeout(() => {
14630
- this.cacheImageHeight(this.getRealHeight());
14631
- }, 0);
14642
+ if (AngularEditor.isEnabledVirtualScroll(this.editor)) {
14643
+ this.imageLoadedCacheHeightTimer = setTimeout(() => {
14644
+ this.cacheImageHeight(this.getRealHeight());
14645
+ }, 0);
14646
+ }
14632
14647
  }
14633
14648
  imageError(event) {
14634
14649
  const img = event.target;
@@ -18254,12 +18269,12 @@ class TheEditorComponent {
18254
18269
  this.theUploadingStatus = new EventEmitter(); // true 上传结束 false 上传中
18255
18270
  this.visibleQuickInsertPlus = true;
18256
18271
  this.elementToHtml = new WeakMap();
18257
- this.virtualConfig = signal({
18272
+ this.virtualScrollConfig = signal({
18258
18273
  enabled: false,
18259
18274
  scrollTop: 0,
18260
18275
  viewportHeight: 0,
18261
18276
  bufferCount: 5
18262
- }, ...(ngDevMode ? [{ debugName: "virtualConfig" }] : []));
18277
+ }, ...(ngDevMode ? [{ debugName: "virtualScrollConfig" }] : []));
18263
18278
  this.onChangeCallback = () => { };
18264
18279
  this.onTouchedCallback = () => { };
18265
18280
  this.locale = injectTranslations(inject(TheI18nService));
@@ -18350,7 +18365,7 @@ class TheEditorComponent {
18350
18365
  initializeDefaultMenuIcons(this.iconRegistry);
18351
18366
  }
18352
18367
  ngAfterViewInit() {
18353
- this.bindVirtualScrollContainer();
18368
+ this.listenScrollEvent();
18354
18369
  }
18355
18370
  ngOnChanges(changes) {
18356
18371
  const options = changes.theOptions;
@@ -18373,18 +18388,20 @@ class TheEditorComponent {
18373
18388
  ngOnDestroy() {
18374
18389
  THE_EDITOR_PREVIOUS_SELECTION.delete(this.editor);
18375
18390
  }
18376
- bindVirtualScrollContainer() {
18391
+ listenScrollEvent() {
18392
+ if (!this.virtualScrollConfig().enabled) {
18393
+ return;
18394
+ }
18377
18395
  const scrollContainer = this.theContextService.getScrollContainer();
18378
18396
  if (!scrollContainer) {
18379
18397
  return;
18380
18398
  }
18381
- this.scrollContainerElement = scrollContainer;
18382
18399
  this.ngZone.runOutsideAngular(() => {
18383
18400
  fromEvent(scrollContainer, 'scroll')
18384
18401
  .pipe(takeUntilDestroyed(this.destroyRef))
18385
18402
  .subscribe(() => {
18386
18403
  if (!JUST_NOW_UPDATED_VIRTUAL_VIEW.get(this.editor)) {
18387
- this.syncVirtualConfig();
18404
+ this.updateVirtualConfig();
18388
18405
  }
18389
18406
  else {
18390
18407
  if (localStorage.getItem(SLATE_DEBUG_KEY)) {
@@ -18393,25 +18410,26 @@ class TheEditorComponent {
18393
18410
  JUST_NOW_UPDATED_VIRTUAL_VIEW.set(this.editor, false);
18394
18411
  }
18395
18412
  });
18396
- this.syncVirtualConfig();
18413
+ this.updateVirtualConfig();
18397
18414
  });
18398
18415
  }
18399
- syncVirtualConfig() {
18400
- if (!this.virtualConfig().enabled || !this.scrollContainerElement) {
18416
+ updateVirtualConfig() {
18417
+ const scrollContainer = this.theContextService.getScrollContainer();
18418
+ if (!this.virtualScrollConfig().enabled || !scrollContainer) {
18401
18419
  return;
18402
18420
  }
18403
- const { scrollTop, offsetHeight } = this.scrollContainerElement;
18421
+ const { scrollTop, offsetHeight } = scrollContainer;
18404
18422
  if (localStorage.getItem(SLATE_DEBUG_KEY + '__SCROLL_TOP')) {
18405
18423
  console.log(`theia: scroll event fired from user: ${scrollTop}`);
18406
18424
  }
18407
- this.virtualConfig.update(config => ({
18425
+ this.virtualScrollConfig.update(config => ({
18408
18426
  ...config,
18409
18427
  scrollTop,
18410
18428
  viewportHeight: offsetHeight
18411
18429
  }));
18412
18430
  }
18413
18431
  initialize() {
18414
- this.virtualConfig.update(config => ({
18432
+ this.virtualScrollConfig.update(config => ({
18415
18433
  ...config,
18416
18434
  enabled: this.theOptions?.enableVirtualScroll
18417
18435
  }));
@@ -18614,7 +18632,7 @@ class TheEditorComponent {
18614
18632
  TheContextService,
18615
18633
  { provide: TheToolbarGroupToken, useValue: TheToolbarGroup },
18616
18634
  { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => TheEditorComponent), multi: true }
18617
- ], 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 }); }
18635
+ ], 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 }); }
18618
18636
  }
18619
18637
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TheEditorComponent, decorators: [{
18620
18638
  type: Component,
@@ -18622,7 +18640,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
18622
18640
  TheContextService,
18623
18641
  { provide: TheToolbarGroupToken, useValue: TheToolbarGroup },
18624
18642
  { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => TheEditorComponent), multi: true }
18625
- ], 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" }]
18643
+ ], 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" }]
18626
18644
  }], 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: [{
18627
18645
  type: Optional
18628
18646
  }, {