Skip to content

[18.0][FIX] document_page: show styled diff in the Difference wizard - #651

Open
miquelrosell99 wants to merge 1 commit into
OCA:18.0from
miquelrosell99:18.0-document_page-show-diff-style
Open

miquelrosell99 wants to merge 1 commit into
OCA:18.0from
miquelrosell99:18.0-document_page-show-diff-style

Conversation

@miquelrosell99

Copy link
Copy Markdown

Steps to reproduce (runbot or local, document_page only)

  1. Open a document page with at least two revisions, open History, and select a revision.
  2. Action menu → Difference (or select two revisions, then Difference).

Current behavior

The wizard dialog shows the version text as unstyled plain text — no added/removed highlighting is visible at all.

The computed diff HTML marks changes with custom <added> / <removed> tags. The only stylesheet for those tags is document_page/static/src/scss/document_page.scss, which scopes them under the .o_document_page_diff class. The wizard form view (view_wiki_show_diff) never sets that class (the history form's Changes tab does), so the tags render as plain inline text and the differences are invisible.

The view also carried an invalid class="overflow-x: scroll" — class names cannot contain spaces or colons, so it applied no styles at all.

Desired behavior

The wizard highlights added content (green) and removed content (red strikethrough), like the history form's Changes tab.

Fix

Set class="o_document_page_diff overflow-auto" on the wizard's diff field.

Prepared with assistance from an AI coding agent (Kimi Code).

The "Difference" wizard (wizard.document.page.history.show_diff) renders
the computed diff HTML, which marks changes with custom <added>/<removed>
tags. The only stylesheet for those tags (document_page.scss) scopes them
under the .o_document_page_diff class, which the wizard view never sets,
so the diff rendered as unstyled plain text and no differences were
visible to the user.

Set the class on the wizard's diff field so the wizard highlights the
added/removed content, like the history form's Changes tab does. Also
replace the invalid class="overflow-x: scroll" (class names cannot
contain spaces or colons) with the overflow-auto utility.

@ajimenez-pyming ajimenez-pyming left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM

@OCA-git-bot

Copy link
Copy Markdown
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants