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

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

Merged
merged 1 commit into from
Dec 14, 2022

Conversation

planarvoid
Copy link
Contributor

Fix

The issue fixed here is:

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

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:

  • If there are new strings that have to be translated, I have added them to the client's strings.xml as a part of the integration PR.

@planarvoid planarvoid added the bug label Dec 8, 2022
@planarvoid planarvoid requested a review from khaykov December 8, 2022 12:53
@planarvoid planarvoid self-assigned this Dec 8, 2022
Copy link
Member

@khaykov khaykov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍 Thanks for the fix!

For the record, the original issue only happened to me with "Don't keep activities" flag on.

@khaykov khaykov merged commit 9b58f93 into trunk Dec 14, 2022
@khaykov khaykov deleted the fix/adding-image-on-blank-line-in-placeholder branch December 14, 2022 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants