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

Write proper selection handling code #19

Closed
obuchtala opened this issue Jul 2, 2015 · 0 comments
Closed

Write proper selection handling code #19

obuchtala opened this issue Jul 2, 2015 · 0 comments
Assignees

Comments

@obuchtala
Copy link
Member

As here:
https://github.com/substance/science-writer/blob/2d906772519e939bbaf665e1617cd818fcc84715/src/state_handlers.js#L20

It is not a sufficient treatment of selections.
There are now 4 categories:
sel.isNull()
sel.isPropertySelection()
sel.isContainerSelection()
sel.isTableSelection()

As in the above case, the code suggests that you want to have property selections only.
A good way is to do either

if (sel.isPropertySelection()) {
...
} else {
 ...
}

or using a guard:

if (!sel.isPropertySelection()) {
  return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants