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 issues with block media at the end of editable text #976

Merged
merged 3 commits into from
Apr 8, 2022

Conversation

planarvoid
Copy link
Contributor

Fix

There was an issue I discovered when I tried to add an image after the last block of the content. This is now fixed in this PR. I've added a lot of tests covering everything (and found a few minor issues during the process).

Test

  1. Enable the feature by calling aztec.visualEditor.addMediaAfterBlocks()
  2. Load a content ending with a list
  3. Click in the middle of the list
  4. Add an image (or HR)
  5. Notice it gets added correctly after the list (previously it was added as a new list item)

Review

@AmandaRiu

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 Apr 6, 2022
@planarvoid planarvoid self-assigned this Apr 6, 2022
@AmandaRiu AmandaRiu self-assigned this Apr 7, 2022
Copy link
Contributor

@AmandaRiu AmandaRiu left a comment

Choose a reason for hiding this comment

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

Tested and works beautifully!

Screen Shot 2022-04-07 at 2 04 04 PM

Also ran the new tests and all passed. Left a small low-priority code comment for your review @planarvoid . This PR is approved and is ready to merge when you are! :shipit:

buildClickableMediaSpan(ssb, span)
insertSpanAfterBlock(ssb)
}

private fun insertSpanAfterBlock(ssb: SpannableStringBuilder) {
val position = getEndOfBlock()
var position = getEndOfBlock()
Copy link
Contributor

Choose a reason for hiding this comment

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

np: this value is never modified so it can be changed back to val

@AmandaRiu AmandaRiu mentioned this pull request Apr 7, 2022
1 task
@planarvoid planarvoid merged commit 412af29 into release/1.5.6 Apr 8, 2022
@planarvoid planarvoid deleted the fix/block-media-at-the-end-of-editable branch April 8, 2022 10:39
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.

None yet

2 participants