@worktile/theia 13.0.0 → 13.0.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.
@@ -2779,6 +2779,8 @@ class TheImageComponent extends TheBaseElementComponent {
2779
2779
  this.overlay = overlay;
2780
2780
  this.thyImageService = thyImageService;
2781
2781
  this.viewContainerRef = viewContainerRef;
2782
+ this.naturalWidth = 0;
2783
+ this.naturalHeight = 0;
2782
2784
  this.imageEntry = {};
2783
2785
  this.uploading = false;
2784
2786
  this.percentage = 0;
@@ -2844,6 +2846,12 @@ class TheImageComponent extends TheBaseElementComponent {
2844
2846
  get isOpen() {
2845
2847
  return this.layoutToolbarRef && this.layoutToolbarRef.getOverlayRef() && this.layoutToolbarRef.getOverlayRef().hasAttached();
2846
2848
  }
2849
+ get imageBindingWidth() {
2850
+ var _a, _b, _c;
2851
+ return ((_a = this.imageEntry) === null || _a === void 0 ? void 0 : _a.layout) && ((_b = this.imageEntry) === null || _b === void 0 ? void 0 : _b.width) > this.layoutDefaultWidth && !((_c = this.imageEntry) === null || _c === void 0 ? void 0 : _c.reSized)
2852
+ ? this.layoutDefaultWidth
2853
+ : this.imageEntry.width;
2854
+ }
2847
2855
  ngOnInit() {
2848
2856
  var _a;
2849
2857
  this.layoutDefaultWidth = this.theContextService.layoutDefaultWidth();
@@ -2897,10 +2905,7 @@ class TheImageComponent extends TheBaseElementComponent {
2897
2905
  }
2898
2906
  uploadImage(file) {
2899
2907
  return __awaiter(this, void 0, void 0, function* () {
2900
- const { width, height } = yield this.resolveImageSize(file, this.theContextService.getOptions().width);
2901
2908
  this.imageEntry = {
2902
- height,
2903
- width,
2904
2909
  align: this.imageEntry.align || Alignment.center,
2905
2910
  thumbUrl: this.sanitizer.bypassSecurityTrustResourceUrl(URL.createObjectURL(file))
2906
2911
  };
@@ -2910,8 +2915,6 @@ class TheImageComponent extends TheBaseElementComponent {
2910
2915
  const { thumbUrl, originUrl } = uploadFileEntity;
2911
2916
  const imageInfo = {
2912
2917
  name: file.name,
2913
- width: this.imageEntry.width,
2914
- height: this.imageEntry.height,
2915
2918
  thumbUrl,
2916
2919
  originUrl,
2917
2920
  align: this.imageEntry.align || Alignment.center
@@ -2919,20 +2922,6 @@ class TheImageComponent extends TheBaseElementComponent {
2919
2922
  this.setImageNodes(imageInfo);
2920
2923
  });
2921
2924
  }
2922
- resolveImageSize(imageFile, maxSize) {
2923
- const image = new Image();
2924
- return new Promise(resolve => {
2925
- image.onload = () => {
2926
- const imageHeight = image.height;
2927
- const imageWidth = image.width;
2928
- const ratio = imageWidth > maxSize ? imageWidth / maxSize : false;
2929
- const height = ratio ? imageHeight / ratio : imageHeight;
2930
- const width = ratio ? imageWidth / ratio : imageWidth;
2931
- resolve({ height, width });
2932
- };
2933
- image.src = URL.createObjectURL(imageFile);
2934
- });
2935
- }
2936
2925
  startDrag(event, axis) {
2937
2926
  event.preventDefault();
2938
2927
  this.dragable = true;
@@ -2996,8 +2985,7 @@ class TheImageComponent extends TheBaseElementComponent {
2996
2985
  if (!this.imageEntry.reSized && this.imageEntry.width !== width) {
2997
2986
  this.imageEntry.reSized = true;
2998
2987
  }
2999
- this.imageContent.nativeElement.style.width = width + 'px';
3000
- this.imageContent.nativeElement.style.height = height + 'px';
2988
+ this.img.nativeElement.style.width = width + 'px';
3001
2989
  this.imageEntry.width = width;
3002
2990
  this.imageEntry.height = height;
3003
2991
  }
@@ -3006,6 +2994,12 @@ class TheImageComponent extends TheBaseElementComponent {
3006
2994
  if (this.dragable) {
3007
2995
  this.dragable = false;
3008
2996
  this.mouseMoveSubscription.unsubscribe();
2997
+ if (this.imageEntry.width === this.theContextService.getOptions().width &&
2998
+ this.imageEntry.width <= this.naturalWidth &&
2999
+ this.element.width) {
3000
+ this.imageEntry.width = null;
3001
+ this.imageEntry.height = null;
3002
+ }
3009
3003
  Transforms.setNodes(this.editor, Object.assign({ type: ElementKinds.image }, this.imageEntry), { at: this.selection });
3010
3004
  }
3011
3005
  }
@@ -3111,12 +3105,17 @@ class TheImageComponent extends TheBaseElementComponent {
3111
3105
  .withPush(false)
3112
3106
  .withPositions([bottomPosition]);
3113
3107
  }
3108
+ imageLoaded(event) {
3109
+ const img = event.target;
3110
+ this.naturalWidth = img.naturalWidth;
3111
+ this.naturalHeight = img.naturalHeight;
3112
+ }
3114
3113
  }
3115
3114
  TheImageComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: TheImageComponent, deps: [{ token: i0.ElementRef }, { token: i1$3.DomSanitizer }, { token: THE_UPLOAD_SERVICE_TOKEN }, { token: i0.ChangeDetectorRef }, { token: TheContextService }, { token: i1$1.ThyPopover }, { token: i2$1.Overlay }, { token: i5$1.ThyImageService }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component });
3116
- TheImageComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.8", type: TheImageComponent, selector: "the-image, [theImage]", viewQueries: [{ propertyName: "imageContent", first: true, predicate: ["imageContent"], descendants: true }, { propertyName: "img", first: true, predicate: ["img"], descendants: true }, { propertyName: "layoutToolbar", first: true, predicate: ["layoutToolbar"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n\n<div class=\"image-container\" contenteditable=\"false\" [style.textAlign]=\"imageEntry.align\">\n <div\n #imageContent\n *ngIf=\"imageEntry.thumbUrl\"\n class=\"image-content\"\n [class.pointer]=\"!selection\"\n [ngStyle]=\"{\n 'width.px':\n imageEntry?.layout && imageEntry?.width > layoutDefaultWidth && !imageEntry?.reSized\n ? layoutDefaultWidth\n : imageEntry.width,\n 'height.px': imageEntry.height\n }\"\n >\n <img #img class=\"main-image\" [src]=\"imageEntry.thumbUrl\" [alt]=\"imageEntry.name\" />\n <div *ngIf=\"selection\" class=\"image-profile\" [class.outline]=\"selection\">\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, '-xl')\" class=\"image-pointer left top\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, 'xl')\" class=\"image-pointer right top\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, 'xl')\" class=\"image-pointer right bottom\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, '-xl')\" class=\"image-pointer left bottom\"></span>\n </div>\n <div *ngIf=\"uploading\" class=\"uploading\">\n <div class=\"uploading-percentage\">\n <thy-progress thyType=\"primary\" [thyValue]=\"percentage\" thySize=\"sm\"></thy-progress>\n <thy-icon (click)=\"cancelUpload($event)\" thyIconName=\"close-circle-bold-fill\" thyIconLegging=\"true\"></thy-icon>\n </div>\n </div>\n <div *ngIf=\"!uploading\" class=\"layer\" (mousedown)=\"preview($event)\" [class.readonly]=\"readonly\"></div>\n </div>\n <div *ngIf=\"!imageEntry.thumbUrl\" class=\"image-loading\" contenteditable=\"false\">\n <thy-icon thyIconName=\"image\"></thy-icon>\n </div>\n</div>\n\n<ng-template #layoutToolbar>\n <div class=\"the-block-toolbar-popover\" contenteditable=\"false\">\n <thy-icon-nav>\n <ng-container *ngFor=\"let item of layoutOptions\">\n <a\n *ngIf=\"item.key !== 'split'\"\n href=\"javascript:;\"\n thyIconNavLink\n [ngClass]=\"{ 'remove-link': item.key === 'remove' }\"\n [thyIconNavLinkIcon]=\"item.icon\"\n [thyTooltip]=\"item.name\"\n [thyIconNavLinkActive]=\"layoutActive(item.key)\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"item?.handle($event, item.key)\"\n ></a>\n <nav-split-line *ngIf=\"item.key === 'split'\"></nav-split-line>\n </ng-container>\n </thy-icon-nav>\n </div>\n</ng-template>\n", components: [{ type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }, { type: i7.ThyProgressComponent, selector: "thy-progress", inputs: ["thyType", "thySize", "thyValue", "thyMax", "thyTips"] }, { type: i3.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: i3$1.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }, { type: i3$1.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: NavSplitLineComponent, selector: "nav-split-line", inputs: ["mode"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i5$2.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
3115
+ TheImageComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.8", type: TheImageComponent, selector: "the-image, [theImage]", viewQueries: [{ propertyName: "imageContent", first: true, predicate: ["imageContent"], descendants: true }, { propertyName: "img", first: true, predicate: ["img"], descendants: true }, { propertyName: "layoutToolbar", first: true, predicate: ["layoutToolbar"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n\n<div class=\"image-container\" contenteditable=\"false\" [style.textAlign]=\"imageEntry.align\">\n <div\n #imageContent\n *ngIf=\"imageEntry.thumbUrl\"\n class=\"image-content\"\n [class.pointer]=\"!selection\">\n <img #img [ngStyle]=\"{'width.px': imageBindingWidth}\" class=\"main-image\" (load)=\"imageLoaded($event)\" [src]=\"imageEntry.thumbUrl\" [alt]=\"imageEntry.name\" />\n <div *ngIf=\"selection\" class=\"image-profile\" [class.outline]=\"selection\">\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, '-xl')\" class=\"image-pointer left top\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, 'xl')\" class=\"image-pointer right top\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, 'xl')\" class=\"image-pointer right bottom\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, '-xl')\" class=\"image-pointer left bottom\"></span>\n </div>\n <div *ngIf=\"uploading\" class=\"uploading\">\n <div class=\"uploading-percentage\">\n <thy-progress thyType=\"primary\" [thyValue]=\"percentage\" thySize=\"sm\"></thy-progress>\n <thy-icon (click)=\"cancelUpload($event)\" thyIconName=\"close-circle-bold-fill\" thyIconLegging=\"true\"></thy-icon>\n </div>\n </div>\n <div *ngIf=\"!uploading\" class=\"layer\" (mousedown)=\"preview($event)\" [class.readonly]=\"readonly\"></div>\n </div>\n <div *ngIf=\"!imageEntry.thumbUrl\" class=\"image-loading\" contenteditable=\"false\">\n <thy-icon thyIconName=\"image\"></thy-icon>\n </div>\n</div>\n\n<ng-template #layoutToolbar>\n <div class=\"the-block-toolbar-popover\" contenteditable=\"false\">\n <thy-icon-nav>\n <ng-container *ngFor=\"let item of layoutOptions\">\n <a\n *ngIf=\"item.key !== 'split'\"\n href=\"javascript:;\"\n thyIconNavLink\n [ngClass]=\"{ 'remove-link': item.key === 'remove' }\"\n [thyIconNavLinkIcon]=\"item.icon\"\n [thyTooltip]=\"item.name\"\n [thyIconNavLinkActive]=\"layoutActive(item.key)\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"item?.handle($event, item.key)\"\n ></a>\n <nav-split-line *ngIf=\"item.key === 'split'\"></nav-split-line>\n </ng-container>\n </thy-icon-nav>\n </div>\n</ng-template>\n", components: [{ type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }, { type: i7.ThyProgressComponent, selector: "thy-progress", inputs: ["thyType", "thySize", "thyValue", "thyMax", "thyTips"] }, { type: i3.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: i3$1.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }, { type: i3$1.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: NavSplitLineComponent, selector: "nav-split-line", inputs: ["mode"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i5$2.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
3117
3116
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: TheImageComponent, decorators: [{
3118
3117
  type: Component,
3119
- args: [{ selector: 'the-image, [theImage]', template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n\n<div class=\"image-container\" contenteditable=\"false\" [style.textAlign]=\"imageEntry.align\">\n <div\n #imageContent\n *ngIf=\"imageEntry.thumbUrl\"\n class=\"image-content\"\n [class.pointer]=\"!selection\"\n [ngStyle]=\"{\n 'width.px':\n imageEntry?.layout && imageEntry?.width > layoutDefaultWidth && !imageEntry?.reSized\n ? layoutDefaultWidth\n : imageEntry.width,\n 'height.px': imageEntry.height\n }\"\n >\n <img #img class=\"main-image\" [src]=\"imageEntry.thumbUrl\" [alt]=\"imageEntry.name\" />\n <div *ngIf=\"selection\" class=\"image-profile\" [class.outline]=\"selection\">\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, '-xl')\" class=\"image-pointer left top\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, 'xl')\" class=\"image-pointer right top\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, 'xl')\" class=\"image-pointer right bottom\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, '-xl')\" class=\"image-pointer left bottom\"></span>\n </div>\n <div *ngIf=\"uploading\" class=\"uploading\">\n <div class=\"uploading-percentage\">\n <thy-progress thyType=\"primary\" [thyValue]=\"percentage\" thySize=\"sm\"></thy-progress>\n <thy-icon (click)=\"cancelUpload($event)\" thyIconName=\"close-circle-bold-fill\" thyIconLegging=\"true\"></thy-icon>\n </div>\n </div>\n <div *ngIf=\"!uploading\" class=\"layer\" (mousedown)=\"preview($event)\" [class.readonly]=\"readonly\"></div>\n </div>\n <div *ngIf=\"!imageEntry.thumbUrl\" class=\"image-loading\" contenteditable=\"false\">\n <thy-icon thyIconName=\"image\"></thy-icon>\n </div>\n</div>\n\n<ng-template #layoutToolbar>\n <div class=\"the-block-toolbar-popover\" contenteditable=\"false\">\n <thy-icon-nav>\n <ng-container *ngFor=\"let item of layoutOptions\">\n <a\n *ngIf=\"item.key !== 'split'\"\n href=\"javascript:;\"\n thyIconNavLink\n [ngClass]=\"{ 'remove-link': item.key === 'remove' }\"\n [thyIconNavLinkIcon]=\"item.icon\"\n [thyTooltip]=\"item.name\"\n [thyIconNavLinkActive]=\"layoutActive(item.key)\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"item?.handle($event, item.key)\"\n ></a>\n <nav-split-line *ngIf=\"item.key === 'split'\"></nav-split-line>\n </ng-container>\n </thy-icon-nav>\n </div>\n</ng-template>\n" }]
3118
+ args: [{ selector: 'the-image, [theImage]', template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n\n<div class=\"image-container\" contenteditable=\"false\" [style.textAlign]=\"imageEntry.align\">\n <div\n #imageContent\n *ngIf=\"imageEntry.thumbUrl\"\n class=\"image-content\"\n [class.pointer]=\"!selection\">\n <img #img [ngStyle]=\"{'width.px': imageBindingWidth}\" class=\"main-image\" (load)=\"imageLoaded($event)\" [src]=\"imageEntry.thumbUrl\" [alt]=\"imageEntry.name\" />\n <div *ngIf=\"selection\" class=\"image-profile\" [class.outline]=\"selection\">\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, '-xl')\" class=\"image-pointer left top\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, 'xl')\" class=\"image-pointer right top\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, 'xl')\" class=\"image-pointer right bottom\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, '-xl')\" class=\"image-pointer left bottom\"></span>\n </div>\n <div *ngIf=\"uploading\" class=\"uploading\">\n <div class=\"uploading-percentage\">\n <thy-progress thyType=\"primary\" [thyValue]=\"percentage\" thySize=\"sm\"></thy-progress>\n <thy-icon (click)=\"cancelUpload($event)\" thyIconName=\"close-circle-bold-fill\" thyIconLegging=\"true\"></thy-icon>\n </div>\n </div>\n <div *ngIf=\"!uploading\" class=\"layer\" (mousedown)=\"preview($event)\" [class.readonly]=\"readonly\"></div>\n </div>\n <div *ngIf=\"!imageEntry.thumbUrl\" class=\"image-loading\" contenteditable=\"false\">\n <thy-icon thyIconName=\"image\"></thy-icon>\n </div>\n</div>\n\n<ng-template #layoutToolbar>\n <div class=\"the-block-toolbar-popover\" contenteditable=\"false\">\n <thy-icon-nav>\n <ng-container *ngFor=\"let item of layoutOptions\">\n <a\n *ngIf=\"item.key !== 'split'\"\n href=\"javascript:;\"\n thyIconNavLink\n [ngClass]=\"{ 'remove-link': item.key === 'remove' }\"\n [thyIconNavLinkIcon]=\"item.icon\"\n [thyTooltip]=\"item.name\"\n [thyIconNavLinkActive]=\"layoutActive(item.key)\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"item?.handle($event, item.key)\"\n ></a>\n <nav-split-line *ngIf=\"item.key === 'split'\"></nav-split-line>\n </ng-container>\n </thy-icon-nav>\n </div>\n</ng-template>\n" }]
3120
3119
  }], ctorParameters: function () {
3121
3120
  return [{ type: i0.ElementRef }, { type: i1$3.DomSanitizer }, { type: undefined, decorators: [{
3122
3121
  type: Inject,
@@ -9229,7 +9228,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImpor
9229
9228
  } });
9230
9229
 
9231
9230
  class TheTableComponent extends TheBaseElementComponent {
9232
- constructor(elementRef, eventDispatcher, resizeNotifier, tableStore, cdr, ngZone, tableService, theContextService, theTableContextMenuService) {
9231
+ constructor(elementRef, eventDispatcher, resizeNotifier, tableStore, cdr, ngZone, tableService, theTableContextMenuService) {
9233
9232
  super(elementRef, cdr);
9234
9233
  this.eventDispatcher = eventDispatcher;
9235
9234
  this.resizeNotifier = resizeNotifier;
@@ -9237,14 +9236,13 @@ class TheTableComponent extends TheBaseElementComponent {
9237
9236
  this.cdr = cdr;
9238
9237
  this.ngZone = ngZone;
9239
9238
  this.tableService = tableService;
9240
- this.theContextService = theContextService;
9241
9239
  this.theTableContextMenuService = theTableContextMenuService;
9242
9240
  this.destroy$ = new Subject();
9243
9241
  this.rowControls = [];
9244
9242
  this.colControls = [];
9245
9243
  }
9246
9244
  get columns() {
9247
- return this.normalizedColumns || (this.element && this.element.columns);
9245
+ return this.element && this.element.columns;
9248
9246
  }
9249
9247
  get nativeElement() {
9250
9248
  return this.elementRef.nativeElement;
@@ -9277,9 +9275,6 @@ class TheTableComponent extends TheBaseElementComponent {
9277
9275
  });
9278
9276
  this.getIsInTable();
9279
9277
  this.getColControls();
9280
- if (this.normalizedColumns) {
9281
- this.normalizeShowColumns();
9282
- }
9283
9278
  }
9284
9279
  }
9285
9280
  ngOnInit() {
@@ -9287,6 +9282,12 @@ class TheTableComponent extends TheBaseElementComponent {
9287
9282
  this.getColControls();
9288
9283
  this.getIsInTable();
9289
9284
  }
9285
+ getWrapperWidth() {
9286
+ const tableContainer = this.nativeElement.firstChild;
9287
+ const paddingLeft = coercePixelsFromCssValue(window.getComputedStyle(tableContainer)['paddingLeft']);
9288
+ const width = tableContainer.offsetWidth - paddingLeft;
9289
+ return width;
9290
+ }
9290
9291
  ngAfterViewInit() {
9291
9292
  this.ngZone.onStable.pipe(take(1)).subscribe(() => __awaiter(this, void 0, void 0, function* () {
9292
9293
  var _a;
@@ -9298,7 +9299,6 @@ class TheTableComponent extends TheBaseElementComponent {
9298
9299
  this.subscribeCellsChange();
9299
9300
  this.subscribeCellPositionChange();
9300
9301
  this.listenTableContextMenuEvent();
9301
- this.useTableWrapperWidth();
9302
9302
  if ((_a = this.element.options) === null || _a === void 0 ? void 0 : _a.numberedColumn) {
9303
9303
  const loadImageDone = yield this.resolveImage();
9304
9304
  // 等待序号列表格内图片加载完成后再去渲染表格行高度
@@ -9321,17 +9321,6 @@ class TheTableComponent extends TheBaseElementComponent {
9321
9321
  this.cdr.detectChanges();
9322
9322
  });
9323
9323
  }
9324
- useTableWrapperWidth() {
9325
- const rootWidth = this.theContextService.getOptions().width;
9326
- const tablePath = TheEditor.findPath(this.editor, this.element);
9327
- if (tablePath.length > 1) {
9328
- // 解决table不在顶层时,拖动单元格宽度计算问题
9329
- this.theTableWrapperWidth = this.tableWrapper.nativeElement.offsetWidth;
9330
- }
9331
- else {
9332
- this.theTableWrapperWidth = rootWidth;
9333
- }
9334
- }
9335
9324
  subscribeCellsChange() {
9336
9325
  this.tableStore
9337
9326
  .dangerousOrSelectedCellsChange()
@@ -9491,33 +9480,19 @@ class TheTableComponent extends TheBaseElementComponent {
9491
9480
  this.isInTable = false;
9492
9481
  }
9493
9482
  }
9494
- normalizeShowColumns() {
9495
- const table = this.element;
9496
- const tr = table.children[0];
9483
+ initializeColumns() {
9497
9484
  if (this.element.columns) {
9498
- let isGood = true;
9499
- this.normalizedColumns = table.columns.map(item => {
9500
- return Object.assign({}, item);
9485
+ const columns = [];
9486
+ this.tableWrapper.nativeElement.querySelectorAll('col').forEach((ele) => {
9487
+ columns.push({ width: ele.clientWidth });
9501
9488
  });
9502
- if (this.element.columns.length !== tr.children.length) {
9503
- this.normalizedColumns = tr.children.map((item, i) => this.columns[i] || { width: 200 });
9504
- isGood = false;
9505
- }
9506
- const totalWidth = this.normalizedColumns.reduce((pre, cur) => {
9507
- return pre + cur.width;
9508
- }, 0);
9509
- if (totalWidth < this.theTableWrapperWidth) {
9510
- const lastColumnWidth = this.theTableWrapperWidth - totalWidth + this.normalizedColumns[this.normalizedColumns.length - 1].width;
9511
- this.normalizedColumns[this.normalizedColumns.length - 1] = { width: lastColumnWidth };
9512
- isGood = false;
9513
- }
9514
- if (isGood) {
9515
- this.normalizedColumns = null;
9489
+ // Editor container width changes, resulting in column widths no longer valid #WIK-6766
9490
+ const warning = this.element.columns.some((col, index) => { var _a; return col.width !== ((_a = columns[index]) === null || _a === void 0 ? void 0 : _a.width); });
9491
+ if (warning) {
9492
+ setNode(this.editor, { columns }, this.element);
9516
9493
  }
9517
9494
  }
9518
- }
9519
- initializeColumns() {
9520
- if (!this.element.columns) {
9495
+ else {
9521
9496
  const tr = this.element.children[0];
9522
9497
  const tableWidth = AngularEditor.toDOMNode(this.editor, tr).offsetWidth;
9523
9498
  const columns = tr.children.map(cell => {
@@ -9626,7 +9601,7 @@ class TheTableComponent extends TheBaseElementComponent {
9626
9601
  this.destroy$.complete();
9627
9602
  }
9628
9603
  }
9629
- TheTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: TheTableComponent, deps: [{ token: i0.ElementRef }, { token: TableCellEventDispatcher }, { token: ColumnResizeNotifierSource }, { token: TableStore }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: TableService }, { token: TheContextService }, { token: TheTableContextMenuService }], target: i0.ɵɵFactoryTarget.Component });
9604
+ TheTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: TheTableComponent, deps: [{ token: i0.ElementRef }, { token: TableCellEventDispatcher }, { token: ColumnResizeNotifierSource }, { token: TableStore }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: TableService }, { token: TheTableContextMenuService }], target: i0.ɵɵFactoryTarget.Component });
9630
9605
  TheTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.8", type: TheTableComponent, selector: "the-table, [theTable]", host: { listeners: { "mousedown": "handleMousedown($event)" } }, providers: [
9631
9606
  TableStore,
9632
9607
  TableService,
@@ -9651,7 +9626,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImpor
9651
9626
  useExisting: TheTableComponent
9652
9627
  }
9653
9628
  ], template: "<!-- \u7C7B\u540D the-temp-*: \u4E34\u65F6\u89E3\u51B3\u56E0\u53D7portal\u5F71\u54CD\u8868\u683C\u6837\u5F0F\u95EE\u9898\uFF0C\u540E\u671F\u6539\u56DEthe-* -->\n<div\n class=\"the-temp-table-container\"\n theColumnResize\n [ngClass]=\"{\n 'the-temp-table-with-controls': isInTable,\n 'the-temp-numbered-column-container': element?.options?.numberedColumn,\n 'the-temp-table-selection-hide': tableStore.isCellSelecting || tableStore.isRightClicking\n }\"\n>\n <div\n class=\"the-temp-table-row-controls-wrapper\"\n [ngClass]=\"{\n 'the-temp-table-focus': isInTable\n }\"\n >\n <div\n class=\"the-temp-table-corner-controls\"\n [ngClass]=\"{\n visible: !readonly && isInTable,\n active: isSelectedAllCell,\n dangerous: tableStore.isSelectedTable && tableStore.dangerousCells.length > 0\n }\"\n >\n <div class=\"the-temp-table-corner-button\" (mousedown)=\"onSelectTable($event)\"></div>\n <div class=\"the-temp-table-corner-controls-insert-row-marker\">\n <the-table-insert-mark type=\"row\" [at]=\"0\" [tableStore]=\"tableStore\"></the-table-insert-mark>\n </div>\n <div class=\"the-temp-table-corner-controls-insert-column-marker\">\n <the-table-insert-mark type=\"column\" [at]=\"0\" [tableStore]=\"tableStore\"></the-table-insert-mark>\n </div>\n </div>\n <div class=\"the-temp-table-row-controls\">\n <div class=\"the-temp-table-row-controls-inner\">\n <div\n class=\"the-temp-table-row-controls-button-wrap\"\n *ngFor=\"let control of rowControls; let i = index; trackBy: trackByFnRowControls\"\n [ngClass]=\"{\n active: tableStore.selectedRowsIndex.includes(control.rowIndex),\n dangerous: tableStore.dangerousRowsIndex.includes(control.rowIndex) && tableStore.dangerousCells.length > 0\n }\"\n >\n <ng-container *ngIf=\"!readonly && isInTable && !element?.options?.numberedColumn\">\n <button\n (mousedown)=\"onRowMouseDown($event, control.rowIndex)\"\n type=\"button\"\n [ngStyle]=\"{ height: control.height + 1 + 'px' }\"\n class=\"the-temp-table-row-controls-button the-temp-table-controls-button\"\n ></button>\n </ng-container>\n <ng-container *ngIf=\"element?.options?.numberedColumn\">\n <div\n [contentEditable]=\"false\"\n contenteditable=\"false\"\n (mousedown)=\"onRowMouseDown($event, control.rowIndex)\"\n class=\"the-temp-table-numbered-controls-button\"\n [ngStyle]=\"{ height: control.height + 1 + 'px' }\"\n >\n <p class=\"row-number d-flex align-items-center\">{{ i + 1 }}</p>\n </div>\n </ng-container>\n <the-table-insert-mark type=\"row\" [at]=\"control.rowIndex + 1\" [tableStore]=\"tableStore\"> </the-table-insert-mark>\n </div>\n </div>\n </div>\n </div>\n <div class=\"the-temp-table-wrapper\" #tableWrapper [ngClass]=\"{ 'the-temp-table-numbered': element?.options?.numberedColumn }\">\n <table class=\"the-temp-table\" #theTable [ngClass]=\"{ 'the-temp-table-with-controls': isInTable }\">\n <colgroup *ngIf=\"columns\">\n <col *ngFor=\"let col of columns\" [ngStyle]=\"{ width: col.width + 'px' }\" />\n </colgroup>\n <thead>\n <tr class=\"the-temp-table-col-controls-wrapper\">\n <th\n class=\"the-temp-table-col-controls\"\n [ngClass]=\"{\n active: tableStore.selectedColumnsIndex.includes(i),\n dangerous: tableStore.dangerousColumnsIndex.includes(i) && tableStore.dangerousCells.length > 0\n }\"\n (mousedown)=\"onColMouseDown($event, i)\"\n *ngFor=\"let control of colControls; let i = index; trackBy: trackByFnColControls\"\n >\n <the-table-insert-mark *ngIf=\"isInTable\" type=\"column\" [at]=\"i + 1\" [tableStore]=\"tableStore\">\n </the-table-insert-mark>\n </th>\n </tr>\n </thead>\n <tbody #tbody>\n <slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"> </slate-children>\n </tbody>\n </table>\n </div>\n</div>\n" }]
9654
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: TableCellEventDispatcher }, { type: ColumnResizeNotifierSource }, { type: TableStore }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: TableService }, { type: TheContextService }, { type: TheTableContextMenuService }]; }, propDecorators: { tableWrapper: [{
9629
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: TableCellEventDispatcher }, { type: ColumnResizeNotifierSource }, { type: TableStore }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: TableService }, { type: TheTableContextMenuService }]; }, propDecorators: { tableWrapper: [{
9655
9630
  type: ViewChild,
9656
9631
  args: ['tableWrapper', { read: ElementRef, static: true }]
9657
9632
  }], theTableElement: [{
@@ -10142,11 +10117,6 @@ class TheTdComponent extends TheBaseElementComponent {
10142
10117
  get resizeNotifier() {
10143
10118
  return this.tableComponent.resizeNotifier;
10144
10119
  }
10145
- get theTableWrapperWidth() {
10146
- const tableContainer = this.tableComponent.nativeElement.firstChild;
10147
- const paddingLeft = coercePixelsFromCssValue(window.getComputedStyle(tableContainer)['paddingLeft']);
10148
- return this.tableComponent.theTableWrapperWidth - paddingLeft;
10149
- }
10150
10120
  get tableElement() {
10151
10121
  return this.tableComponent.theTableElement.nativeElement;
10152
10122
  }
@@ -10599,7 +10569,7 @@ class TheTdComponent extends TheBaseElementComponent {
10599
10569
  }
10600
10570
  }
10601
10571
  else {
10602
- const scrollWidth = getElementWidth(this.tableElement) - this.theTableWrapperWidth;
10572
+ const scrollWidth = getElementWidth(this.tableElement) - this.tableComponent.getWrapperWidth();
10603
10573
  if (scrollWidth > 0) {
10604
10574
  if (scrollWidth > Math.abs(deltaX)) {
10605
10575
  this.applyLeftCols(cols, deltaX, cellIndex);
@@ -12296,6 +12266,8 @@ class TheColorToolbarItemComponent extends TheBaseToolbarItem {
12296
12266
  constructor(thyPopover) {
12297
12267
  super();
12298
12268
  this.thyPopover = thyPopover;
12269
+ this.defaultColorLine = '#FF0100';
12270
+ this.defaultBackgroundColorLine = '#FFDA00';
12299
12271
  }
12300
12272
  get isOpenColorSelect() {
12301
12273
  return this.colorSelectRef && this.colorSelectRef.componentInstance;
@@ -12359,7 +12331,11 @@ TheColorToolbarItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12
12359
12331
  thyTooltipPlacement="top"
12360
12332
  (mousedown)="execute($event)"
12361
12333
  >
12362
- <thy-icon [thyIconName]="toolbarItem.icon" thyIconType="twotone" [thyTwotoneColor]="active"></thy-icon>
12334
+ <thy-icon
12335
+ [thyIconName]="toolbarItem.icon"
12336
+ thyIconType="twotone"
12337
+ [thyTwotoneColor]="active ?? (toolbarItem.key === 'color' ? defaultColorLine : defaultBackgroundColorLine)"
12338
+ ></thy-icon>
12363
12339
  <thy-icon
12364
12340
  [ngClass]="{
12365
12341
  'link-down-icon': true,
@@ -12386,7 +12362,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImpor
12386
12362
  thyTooltipPlacement="top"
12387
12363
  (mousedown)="execute($event)"
12388
12364
  >
12389
- <thy-icon [thyIconName]="toolbarItem.icon" thyIconType="twotone" [thyTwotoneColor]="active"></thy-icon>
12365
+ <thy-icon
12366
+ [thyIconName]="toolbarItem.icon"
12367
+ thyIconType="twotone"
12368
+ [thyTwotoneColor]="active ?? (toolbarItem.key === 'color' ? defaultColorLine : defaultBackgroundColorLine)"
12369
+ ></thy-icon>
12390
12370
  <thy-icon
12391
12371
  [ngClass]="{
12392
12372
  'link-down-icon': true,