wordpress-mobile / AztecEditor-Android

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

Fix issue when adding an image on a blank line after a paragraph #1022

Closed planarvoid closed 1 year ago

planarvoid commented 1 year ago

Fix

The issue fixed here is:

The reason for this was that when the cursor is in a paragraph block, it's trying to add the image at the next line break. However, if it's on a line break, it should use that instead of looking for the next one after the current cursor position.

Test (or test it with the linked PR)

  1. turn the addMediaAfterBlocks on the visual editor
  2. Make sure you have 3 paragraphs (for example <p>Line 1</p><p>Line 2</p><p>Line 3</p>
  3. Click at the end of "Line 1"
  4. Add a new line ("enter")
  5. Add an image (or a placeholder)
  6. Notice it gets added after "Line 1"

Review

@khaykov

Make sure strings will be translated: