fix(formula): fix the issue where images generated by the IMAGE formula could not be aligned (#6249)

This commit is contained in:
wpxp123456
2025-12-04 17:55:18 +08:00
committed by GitHub
parent f595b78266
commit 53b6c134a8
2 changed files with 6 additions and 3 deletions
@@ -1457,6 +1457,8 @@ export class SpreadsheetSkeleton extends SheetSkeleton {
}
const cell = this.worksheet.getCell(row, col) || this.worksheet.getCellRaw(row, col);
if (!cell) return;
const style = this.worksheet.getComposedCellStyleByCellData(row, col, cell);
this._setBgStylesCache(row, col, style, options);
@@ -18,7 +18,7 @@ import type { ICellData, ICommandInfo, Nullable } from '@univerjs/core';
import type { IImageFormulaInfo, IRuntimeImageFormulaDataType, ISetImageFormulaDataMutationParams, IUnitImageFormulaDataType } from '@univerjs/engine-formula';
import { BooleanNumber, BuildTextUtils, CellValueType, createDocumentModelWithStyle, Disposable, DrawingTypeEnum, generateRandomId, ICommandService, ImageSourceType, Inject, InterceptorEffectEnum, ObjectMatrix, ObjectRelativeFromH, ObjectRelativeFromV, PositionedObjectLayoutType, WrapTextType } from '@univerjs/core';
import { ErrorType, FormulaDataModel, SetImageFormulaDataMutation } from '@univerjs/engine-formula';
import { INTERCEPTOR_POINT, SheetInterceptorService } from '@univerjs/sheets';
import { InterceptCellContentPriority, INTERCEPTOR_POINT, SheetInterceptorService } from '@univerjs/sheets';
export class ImageFormulaCellInterceptorController extends Disposable {
private _errorValueCell: ICellData = {
@@ -87,8 +87,8 @@ export class ImageFormulaCellInterceptorController extends Disposable {
private _initInterceptorCellContent() {
this.disposeWithMe(
this._sheetInterceptorService.intercept(INTERCEPTOR_POINT.CELL_CONTENT, {
priority: 100,
effect: InterceptorEffectEnum.Value,
priority: InterceptCellContentPriority.CELL_IMAGE,
effect: InterceptorEffectEnum.Value | InterceptorEffectEnum.Style,
// eslint-disable-next-line max-lines-per-function
handler: (cell, location, next) => {
const { unitId, subUnitId, row, col } = location;
@@ -172,6 +172,7 @@ export class ImageFormulaCellInterceptorController extends Disposable {
if (jsonXActions) {
docDataModel.apply(jsonXActions);
return next({
...cell,
p: docDataModel.getSnapshot(),
});
}