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

XWIKI-17218: Text in a table cell gets scrambled when cancelling the add annotation form #3204

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

manuelleduc
Copy link
Contributor

@manuelleduc manuelleduc commented Jun 13, 2024

Jira URL

https://jira.xwiki.org/browse/XWIKI-17218

Changes

Description

  • Selecting a piece of text in a table, annotation it and finally cancelling the annotation simply remove the highlighting. And do not change the html structure of the cell.

Executed Tests

mvn clean install -Pquality,integration-tests,docker -pl :xwiki-platform-annotation-ui -amd -f xwiki-platform-core/xwiki-platform-annotation

Expected merging strategy

  • Prefers squash: Yes
  • Backport on branches:
    • stable-15.10.x
    • stable-16.4.x

@manuelleduc manuelleduc added the backport stable-15.10.x Used for automatic backport to 15.10.x branch. label Jun 13, 2024
// We used previously replace for prototype, but it behaves badly when the parent of the wrapper is a td.
// Also, wrapper is always an element containing only text. In otherword, if <strong>a<em>b</em>c</strong> is
// selected for annotation, a, b, and c will each be wrapped in a <span class='selection-highligh' ...>.
// Therefore, when unwrapping we know that the spans of this.highlightWrappers contain only text.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this comment about text nodes isn't needed anymore now that the code uses childNodes as they preserve everything including HTML elements.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, still interesting to understand what's going on here, but it's not really useful to understand the method anymore.

Copy link
Contributor

Choose a reason for hiding this comment

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

So you suggest leaving the comment unmodified? I find it a bit strange to highlight the fact that we only have text nodes several times even though the code would work perfectly fine if there were also other nodes. I'm not against having some comment, I have just the feeling it doesn't fully fit with the code below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No I'll remove the comment, but I'm lagging behind, I'll make the PR a draft until I clean that up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport stable-15.10.x Used for automatic backport to 15.10.x branch. backport stable-16.4.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants