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

Support atomic blocks (images, embeds, hr, etc) without wrapper text blocks #158

Open
thibaudcolas opened this issue Jun 11, 2018 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed
Milestone

Comments

@thibaudcolas
Copy link
Collaborator

Feature. At the moment, atomic blocks always have to be preceded and followed by text blocks so focus can move before/after the non-contenteditable atomic blocks. This is done by Draft.js by design, and is documented for Draftail as such:

  • Atomic blocks (images, embeds, hr) are always preceded and followed by a block (empty if no other block is present). See facebook/draft-js#327.

I know a lot of people are confused / annoyed by this, so it would be nice to figure out whether it's possible to support atomic blocks without those "wrapper" blocks for focus management.


Changing this would require implementing custom focus management for those blocks, which is no easy task. We would need ways to:

  • Position the cursor above the atomic block, when it is the first block in the editor.
  • Position the cursor between successive atomic blocks.
  • Position the cursor below the atomic block, when it is the last block in the editor.
  • Focus the atomic block only.
  • Extend focus above the atomic block, starting below.
  • Extend focus below the atomic block, starting above.

I'm not willing to work on this at the moment, but at least this issue can track those discussions, and if anyone else is willing to spend time exploring this I'm happy to help.

@thibaudcolas thibaudcolas added the help wanted Extra attention is needed label Aug 18, 2018
@thibaudcolas
Copy link
Collaborator Author

#171 introduces a "focus" plugin example, which can be leveraged for this. It would be nice to have it built-in though, if possible (to be considered).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant