Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sheets): no style in blank cell #3231

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1043,9 +1043,12 @@ export class SpreadsheetSkeleton extends Skeleton {
ignoreTextRotation: true,
});

const style = this._styles.getStyleByCell(cell);
const textStyle = this._getFontFormat(style);

if (documentModelObject != null) {
if (documentModelObject.documentModel == null) {
documentModelObject.documentModel = this._getDocumentDataByStyle('', {}, {});
documentModelObject.documentModel = this._getDocumentDataByStyle('', textStyle, {});
}
return documentModelObject;
}
Expand All @@ -1062,7 +1065,7 @@ export class SpreadsheetSkeleton extends Skeleton {

fontString = getFontStyleString({}, this._localService).fontCache;

const documentModel = this._getDocumentDataByStyle(content, {}, {});
const documentModel = this._getDocumentDataByStyle(content, textStyle, {});

return {
documentModel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ import {
} from '@univerjs/engine-render';
import { IEditorService, ILayoutService, KeyCode, SetEditorResizeOperation } from '@univerjs/ui';
import type { WorkbookSelections } from '@univerjs/sheets';
import { ClearSelectionFormatCommand, SetRangeValuesCommand, SetSelectionsOperation, SetWorksheetActivateCommand, SheetsSelectionsService } from '@univerjs/sheets';
import { ClearSelectionFormatCommand, SetRangeValuesCommand, SetRangeValuesMutation, SetSelectionsOperation, SetWorksheetActivateCommand, SheetsSelectionsService } from '@univerjs/sheets';
import { distinctUntilChanged, filter } from 'rxjs';
import { IFunctionService, LexerTreeBuilder, matchToken } from '@univerjs/engine-formula';

Expand Down Expand Up @@ -768,6 +768,12 @@ export class EditingRenderController extends Disposable implements IRenderModule
}
}));

d.add(this._commandService.onCommandExecuted((command: ICommandInfo) => {
if (command.id === SetRangeValuesMutation.id) {
this._editorBridgeService.refreshEditCellState();
}
}));

const closeEditorOperation = [SetCellEditVisibleArrowOperation.id];
d.add(this._commandService.onCommandExecuted((command: ICommandInfo) => {
if (closeEditorOperation.includes(command.id)) {
Expand Down
Loading