Skip to content

Commit

Permalink
fix: menu alin when select table cells
Browse files Browse the repository at this point in the history
  • Loading branch information
Jocs committed Nov 22, 2024
1 parent e0025ab commit 328650b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/docs-ui/src/controllers/menu/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -965,14 +965,17 @@ function getFontStyleAtCursor(accessor: IAccessor) {
function getParagraphStyleAtCursor(accessor: IAccessor) {
const univerInstanceService = accessor.get(IUniverInstanceService);
const textSelectionService = accessor.get(DocSelectionManagerService);

const docDataModel = univerInstanceService.getCurrentUniverDocInstance();
const activeTextRange = textSelectionService.getActiveTextRange();

if (docDataModel == null || activeTextRange == null) {
const docRanges = textSelectionService.getDocRanges();
const activeRange = docRanges.find((r) => r.isActive) ?? docRanges[0];

if (docDataModel == null || activeRange == null) {
return;
}

const { startOffset, segmentId } = activeTextRange;
const { startOffset, segmentId } = activeRange;

const paragraphs = docDataModel.getSelfOrHeaderFooterModel(segmentId).getBody()?.paragraphs;

Expand Down

0 comments on commit 328650b

Please sign in to comment.