Skip to content

Block split and merge #167

@koke

Description

@koke

When a user presses return the block should split in two at the cursor. Similarly, backspace at the beginning of a block should merge it with the previous block (or forward delete at the end of a block)

There are some extra rules for this so double check what Gutenberg does and follow the same patterns. I don't think we have to worry about many of those yet since we only support a few block types, but one that I've identified so far is:

  • When you press return, the newly created block will be a paragraph, unless it's a multiline block (I think we only have code in the alpha).

  • Merge the content (or return false to let Aztec native to handle the backspace)

  • Merge 2 blocks of different types

  • Resize after block splitting

  • Fix problem with content lost on merging

  • Fix delayed updated from native side (not completely related to this feature, but we need it)

  • Focus is moved to the wrong block after merging/splitting (We may need to wait until focus problems are resolved)

  • On blocks merging, should we add a white space character before the content of the 2nd block? (if necessary). Otherwise there is a situation where the last word of the first block, and the first word of the 2nd block, are merged together firing up the spell checker inline suggestions.

  • Test on RTL languages Make sure RTL text is handled correctly #380

  • Block Splitting: If before content is omitted, treat as intent to delete block and call onReplace( [] );

  • Check Code block in regard to enter and backspace

  • Using backspace while the first word is highlighted should not merge the 2 blocks, only remove the currently selected word. It's working as expected on Android, but iOS does merge the 2 blocks. [iOS] Fix Pressing backspace when the first word of a Para block is selected #325

  • Add Enter.key handling/detection to PlainText and PlainText powered blocks Add Enter.key handling/detection to PlainText and PlainText powered blocks #324

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions