Skip to content

[16.0][ADD] web_richtext_style: add allowCommandJustify option for html field - #1180

Open
n3n wants to merge 3 commits into
16.0from
16.0-imp-richtext-input-custom-style
Open

[16.0][ADD] web_richtext_style: add allowCommandJustify option for html field#1180
n3n wants to merge 3 commits into
16.0from
16.0-imp-richtext-input-custom-style

Conversation

@n3n

@n3n n3n commented Aug 22, 2026

Copy link
Copy Markdown
Member

Summary

  • Add new module web_richtext_style that exposes an allowCommandJustify option for the html field widget
  • Patches wysiwyg.js to detach and re-insert the #justify toolbar group (left/center/right/full) when the option is enabled, bypassing Odoo's default removal of justify in backend (non-snippets) mode
  • Patches HtmlField.extractProps to forward allowCommandJustify from the field's XML options attribute to wysiwyg

Usage

<field name="my_field" widget="html" options="{'allowCommandJustify': true}"/>

Test plan

  • Install web_richtext_style
  • Open a form view with an html field that has options="{'allowCommandJustify': true}"
  • Confirm the justify dropdown (align left/center/right/justify) appears in the toolbar
  • Verify justify buttons correctly apply text-align styles to selected text
  • Confirm fields without the option are unaffected

@n3n
n3n force-pushed the 16.0-imp-richtext-input-custom-style branch from a4ac77a to 321df7a Compare August 22, 2026 15:12
n3n added 2 commits August 23, 2026 12:52
…tml field

Adds a new module with a `stickyToolbar` option for the html widget that
pins the richtext toolbar above the editable area instead of the default
floating/autohide behavior.

Usage: options="{'stickyToolbar': true}"
@n3n
n3n force-pushed the 16.0-imp-richtext-input-custom-style branch from d7d472b to 0215bf2 Compare August 23, 2026 05:52
When stickyToolbar is enabled, always show the justify alignment group in
the toolbar. Adds a wysiwyg_patch that rescues #justify from Odoo's default
removal (non-snippets mode) by detaching it before _configureToolbar super
and re-inserting it after. The patch is idempotent if web_richtext_style is
also installed (double-detach produces an empty jQuery set, which is guarded).
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.

1 participant