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

[Feature] Add support for sheet.getSelections() #3951

Open
2 tasks done
F-loat opened this issue Nov 5, 2024 · 0 comments
Open
2 tasks done

[Feature] Add support for sheet.getSelections() #3951

F-loat opened this issue Nov 5, 2024 · 0 comments
Assignees
Labels
feature request New feature or request scope:facade

Comments

@F-loat
Copy link

F-loat commented Nov 5, 2024

Initial checklist

  • Is this really a problem?
  • I have searched the Github Issues for similar issues, but did not find anything.

Problem

Currently I can only get the last selected range through the api.

const workbook = univerAPI.getActiveWorkbook();
const sheet = workbook?.getActiveSheet();
const selection = sheet?.getSelection();
const range = selections?.getActiveRange();

But I need to get all the selected ranges.

const workbook = univerAPI.getActiveWorkbook();
const sheet = workbook?.getActiveSheet();
const selections = sheet?.getSelection()?._selections;
const ranges = selections.map(({ range }) => range);

The above code works, but it uses private properties.

@F-loat F-loat added the feature request New feature or request label Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request scope:facade
Projects
None yet
Development

No branches or pull requests

2 participants