Name:
[IMP] viin_brain,viin_web_editor: Brain core UI polish wave — runtime bug + a11y/responsive
State:
Failed
finished in 20m
PR State:
merged
PR Author:
David Tran
PR Author Email:
PR:
#37
Committer:
David Tran
Committer Email:
davidtran.hp@gmail.com
Commit:
7f7d88dbacf39d98617ce5d613386412d82e9624
Description:
[IMP] viin_brain: drawer note body uses native web_editor Wysiwyg (ADR-003 Path B)
Replaces the quick-create drawer's hand-rolled contenteditable + execCommand
toolbar with the native web_editor Wysiwyg (OdooEditor) — the editor the
project's own ADR-003 mandates (TipTap rejected; PageEditor migration is P16).
Why the previous approach was wrong:
- It declared a raw, static contenteditable="true" in Brain markup, which
is a rogue editable surface under the normative contenteditable_policy.md
(two-surface invariant §2). The §5 rogue-detection lint went non-empty.
Why native Wysiwyg fits here (and PageEditor does not):
- Wysiwyg edits in-memory HTML and exposes getValue(), so it needs no
persisted page — the drawer's create-on-save / discard flow is preserved.
PageEditor requires an existing pageId and brings full-pane chrome +
autosave/collab machinery, unsuitable for a quick-capture drawer.
- viin_web_editor already patches Wysiwyg._getPowerboxOptions, so the Brain
powerbox/slash commands appear automatically (parity, no extra code).
Implementation (OSM-grounded, mirrors web_editor HtmlField + the in-org
viin_customizer HTMLEditor pattern):
- Lazy-load web_editor.backend_assets_wysiwyg in onWillStart, mount Wysiwyg as
a dynamic <t t-component>; capture the instance via the startWysiwyg prop.
- Build the Wysiwyg props ONCE (stable identity) so the dynamic component does
not remount and drop the captured instance.
- _bodyHtml() reads getValue(); empty sentinel <p><br></p> => no content.
- The editable's contenteditable lives inside web_editor (audited), so Brain
declares none: contenteditable_policy.md §5 grep is empty again. Policy §2
+ change history updated to document the delegated surface.
Verified live (sale.order form, pg16): drawer mounts exactly one Wysiwyg,
rich content persists (content_html=<p><b>…</b></p>), §5 lint empty, module
upgrade compiles assets clean.
Branch:
17.0
Instance ID:
0
Age:
Up-time: