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

Block split and merge #167

Closed
9 of 12 tasks
koke opened this issue Oct 17, 2018 · 11 comments
Closed
9 of 12 tasks

Block split and merge #167

koke opened this issue Oct 17, 2018 · 11 comments
Assignees
Milestone

Comments

@koke
Copy link
Member

koke commented Oct 17, 2018

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

@koke
Copy link
Member Author

koke commented Oct 17, 2018

cc @daniloercoli @diegoreymendez since you're already looking into this. Please comment if I missed any important details.

@diegoreymendez
Copy link
Contributor

Issues remaining (at least in iOS):

  1. @Danilo and @hypest reported a problem with the text at the right position of the caret not being removed from the original block.
  2. Blocks are not resizing correctly after being split.
  3. The iOS native caret position should be compatible with unicode characters. This is especially important for languages such as Japanese and Chinese.

@koke
Copy link
Member Author

koke commented Oct 22, 2018

@daniloercoli @diegoreymendez since you're already working on this, can you make a task list of what needs to be done and add some estimations by Wednesday?

The iOS native caret position should be compatible with unicode characters. This is especially important for languages such as Japanese and Chinese

Is this not working now? How is it behaving?

@koke
Copy link
Member Author

koke commented Oct 22, 2018

Also, I initially put this in #168 but take into account as well updating the Heading (and any other ported) block so it works correctly

@diegoreymendez
Copy link
Contributor

diegoreymendez commented Oct 22, 2018

Is this not working now? How is it behaving?

It's a pending task. I'm still working on the basics, to at least make it work fine in most scenarios.

It'll require some changes in iOS for sure, but they should be fairly simple.

@daniloercoli
Copy link
Contributor

daniloercoli commented Oct 23, 2018

  • Intercept the Backspace or Delete on Android Aztec / iOS Aztec.
  • Write the Backspace listener for both platforms in the Aztec Wrapper. Emit the JS event.
  • Merge the content (or return false to let Aztec native to handle the backspace).
  • Resize after block splitting.
  • Check Code block in regard to enter and backspace.

2 weeks sprint should be enough to complete the list above.

Edit:
Moved the list of task at the top.

@koke
Copy link
Member Author

koke commented Nov 12, 2018

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.

I'd say that's the expected behavior and how any other editor does it, no need to worry about that

@Tug
Copy link
Contributor

Tug commented Nov 13, 2018

Not sure it has already been mentioned but here is an extra edge-case/bug to fix:

  • Using backspace while the first word is highlighted should not merge the 2 blocks, only remove the currently selected word

@koke
Copy link
Member Author

koke commented Dec 14, 2018

I did a quick test on RTL (Arabic keyboard), enter and backspace seem to split/merge fine, although the splitted blocks get the wrong alignment

@koke
Copy link
Member Author

koke commented Dec 14, 2018

Moved RTL testing to the beta in #380, since we can use some help with that

@koke
Copy link
Member Author

koke commented Dec 14, 2018

I'm going to close this, since there are only two things in the list:

@koke koke closed this as completed Dec 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants