wordpress-mobile / AztecEditor-Android

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

Add support for a task list #960

Closed planarvoid closed 2 years ago

planarvoid commented 2 years ago

Fix

https://github.com/wordpress-mobile/AztecEditor-Android/issues/959

In this PR I've added a support for task list. This option is available in the list menu. Changing the checkbox state was tricky. In the end the checkboxes are drawn within the new parent list span (not on the items themselves). I was considering another option. Drawing the checkbox as part of the listItem instead. This solution has a couple of disadvantages, the biggest one is that all the other bullets are drawn within the list container so switching the lists would've been hacky. The disadvantage of the current solution is that the whole list needs to be redrawn on checking a list item. If this solution is not good enough, we might want to try the other way. The tasklist is hidden by default. It needs to be enabled on the toolbar.

Test

  1. Change the MainActivity to call toolbar.enableTaskList()
  2. Run the app
  3. Notice the lists menu now contains a new option - task list
  4. Try:
    • Add a new task list
    • Check a few items
    • Check the toolbar icon state is task list
    • Change the task list type to ordered or unordered list
    • Check the toolbar icon state has changed back
    • Change the list type back

https://user-images.githubusercontent.com/1079756/155494268-7f308edc-fa9f-4371-8a14-b6d812836fa0.mp4

Make sure strings will be translated:

planarvoid commented 2 years ago

thanks for the review @danilo04 I've fixed the tablet and RTL views:

Screenshot 2022-03-03 at 16 51 33

and implemented all of your other suggestions. I think this is ready for another check!