Skip to content

Conversation

@kacperzolkiewski
Copy link
Collaborator

Summary

Fixes: #334

This PR adds offset to tags location (during html parsing) based on number of parsed images from html.

Test Plan

Test case 1:

  1. Use the Set input's value button with the following html containing 5 images:
<html>
<p><img src="https://picsum.photos/id/1/200/200" width="200.000000" height="200.000000"/></p>
<p><img src="https://picsum.photos/id/2/200/200" width="200.000000" height="200.000000"/></p>
<p><img src="https://picsum.photos/id/3/200/200" width="200.000000" height="200.000000"/></p>
<p><img src="https://picsum.photos/id/4/200/200" width="200.000000" height="200.000000"/></p>
<p><img src="https://picsum.photos/id/5/200/200" width="200.000000" height="200.000000"/></p>
</html>

Test Case 2:

  1. Use the Set input's value button with the following html
<html>
<p><img src="https://picsum.photos/id/1/200/200" width="200.000000" height="200.000000"/></p>
<codeblock>xxx</codeblock>
</html>

codeblock should only contain xxx inside it.

Screenshots / Videos

Before:

Screen.Recording.2025-12-22.at.11.56.04.mov

After:

Screen.Recording.2025-12-22.at.11.54.56.mov

Compatibility

OS Implemented
iOS
Android

// the indices for any text following an image are lower than they will be
// in the final NSTextStorage.
//
// We add '_imagesInHtml' to shift the start index forward, aligning this
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// We add '_imagesInHtml' to shift the start index forward, aligning this
// We add '_precedingImageCount' to shift the start index forward, aligning this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS] Excessive <br> tags when setting value with images.

3 participants