wordpress-mobile / AztecEditor-Android

A reusable native Android rich text editor component.
Mozilla Public License 2.0
681 stars 115 forks source link

Implement indent and outdent across multiple item types #980

Closed planarvoid closed 2 years ago

planarvoid commented 2 years ago

Fix

In this PR I've added support for indent and outdent for headings, preformat, quotes and paragraphs (as well as text without any spans). The logic adds a \t element at the beginning of each selected line on indent and removes the \t if present on outdent.

Test

  1. Make sure you add the indent and outdent toolbar actions in MainActivity
  2. Run the app
  3. Try indenting/outdenting everything including selection over multiple items
  4. Notice the selection is moving correctly when indenting/outdenting
  5. Notice the indent/outdent buttons are enabled when they should be

Review

@AmandaRiu

Make sure strings will be translated:

planarvoid commented 2 years ago

thanks for the review @AmandaRiu ! Good catches!

Odd behavior after indenting list items where the indent/outdent buttons will randomly not be available. See video:

this was fixed in another PR so I've pointed this PR to the feature/enable-combined-lists branch and it works now

Crash just trying to type into the editor outside of a block. I can also add a list and type just fine and then add some space after the list and attempt to type or indent/outdent and get the same type of crash:

This should be fixed now. I've added checks around empty strings for indent and outdent and added tests around this behaviour