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

state.isExpanded is true when double clicking in empty block #862

Closed
SamyPesse opened this issue Jun 2, 2017 · 0 comments
Closed

state.isExpanded is true when double clicking in empty block #862

SamyPesse opened this issue Jun 2, 2017 · 0 comments
Assignees

Comments

@SamyPesse
Copy link
Collaborator

When the user double click on an empty block, the selection moves "between" the two blocks.

Since selection.startKey != selection.endKey, then isExpanded = false.

It causes the example Hovering menu to bug (and similar applications).

In the slate example, when double clicking in an empty paragraph, the menu is not visible on the screen, but it is present with a style attribute in the DOM (invalid positioning because of this weird selection).

Suggested solution:

  • Change state.isExpanded to test if the blocks/offsets are consecutives
    • state.isExpanded will depend on the document, and will differ from selection.isExpanded
  • Add a state.isSelectionEmpty to test if the blocks/offsets are consecutives
    • ✅ It will not be a breaking change, but an addition
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

1 participant