Skip to content

Commit

Permalink
Merge pull request #528 from ruilisi/getRangeAt-safety-check
Browse files Browse the repository at this point in the history
Check rangeCount before getRangeAt
  • Loading branch information
sanchit3008 authored May 6, 2024
2 parents 1c864f9 + 2d484c5 commit e3c7b5e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/core/src/modules/cell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,7 @@ export function isAllSelectedCellsInStatus(
if (!_.isEmpty(ctx.luckysheetCellUpdate)) {
const w = window.getSelection();
if (!w) return false;
if (w.rangeCount === 0) return false;
const range = w.getRangeAt(0);
if (range.collapsed === true) {
return false;
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/modules/inline-string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ export function updateInlineStringFormat(
// let s = ctx.inlineStringEditCache;
const w = window.getSelection();
if (!w) return;
if (w.rangeCount === 0) return;

const range = w.getRangeAt(0);

Expand Down

0 comments on commit e3c7b5e

Please sign in to comment.