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 HIX value diff when page content has nested tags #2652

Merged
merged 2 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion integreat_cms/cms/views/utils/hix.py
Expand Up @@ -42,7 +42,7 @@ def normalize_text(text: str) -> str:
root = fromstring(text)

# Remove paragraphs without text (e.g. empty paragraphs or with an image only)
for node in root.iter():
for node in list(root):
node_text = node.text_content()
if not node_text or not node_text.strip():
node.getparent().remove(node)
Expand Down
2 changes: 2 additions & 0 deletions integreat_cms/release_notes/current/unreleased/2621.yml
@@ -0,0 +1,2 @@
en: Mark HIX value as outdated when changes are undone in the editor
de: Markiere HIX-Wert als veraltet, wenn Änderungen im Editor rückgängig gemacht werden
2 changes: 2 additions & 0 deletions integreat_cms/release_notes/current/unreleased/2652.yml
@@ -0,0 +1,2 @@
en: Fix HIX value diff when page content has nested tags
de: Behebe HIX-Wert-Differenz, wenn Seiteninhalt verschachtelte Tags hat
2 changes: 1 addition & 1 deletion integreat_cms/static/src/js/forms/tinymce-init.ts
Expand Up @@ -229,7 +229,7 @@ window.addEventListener("load", () => {
});
});
// Create an event every time the content changes
editor.on("keyup", () =>
editor.on("keyup undo redo", () =>
document.querySelectorAll("[data-content-changed]").forEach((element) => {
element.dispatchEvent(new Event("contentChanged"));
})
Expand Down
6 changes: 3 additions & 3 deletions tests/textlab_api/textlab_config.py
Expand Up @@ -8,8 +8,8 @@
"<p><strong>One</strong> paragraph</p>",
),
(
"<p>One paragraph</p><p>&nbsp;&nbsp;</p><p>&nbsp;</p>",
"<p>One paragraph</p>",
"<p><strong>One</strong> paragraph</p><p>&nbsp;&nbsp;</p><p>&nbsp;</p>",
"<p><strong>One</strong> paragraph</p>",
),
(
"<div><p>One paragraph</p></div>",
Expand Down Expand Up @@ -56,7 +56,7 @@
'<p><a href="some.url">Some link</a></p>',
),
(
'<div><p>Some image</p><p><a href="some.image"><img src="some.image" alt=""></a></p></div>',
'<div><p>Some image</p><p><a href="some.image"><img src="some.image" alt=""></a></p><p>&nbsp;</p></div>',
"<p>Some image</p>",
),
(
Expand Down