Description
When loading standard HTML content containing block-level elements (like <div>) into the DHX RichText editor, the internal parser completely flattens and alters the DOM structure by converting blocks into a chain of inline <span> elements. This structural loss breaks the core editing layout. Furthermore, performing formatting actions (such as applying a blockquote) on these flattened elements triggers a critical JavaScript runtime error.
Data Flow Analysis
1. Input HTML (Loaded via setValue())
<div><b>Casque jet Vespa Modernist</b></div>
<div>
<ul>
<li>Casque jet en matériau ABS...</li>
</ul>
</div>
2. Internal DOM Structure (After DHX Parsing)
The editor removes the original <div> block containers and converts the content into this inline structure:
<span data-id="37" style="font-weight:bold;">Casque jet Vespa Modernist</span><span data-id="38"> </span><ul data-id="39"><li data-id="40"><span data-id="41">Casque jet en matériau ABS...</span></li></ul><span data-id="44"> </span>
3. Output HTML (Retrieved via getValue())
The original block hierarchy is entirely lost. The editor outputs the flattened structure instead of preserving the input layout:
<span data-id="37" style="font-weight:bold;">Casque jet Vespa Modernist</span><span data-id="38"> </span><ul data-id="39"><li data-id="40"><span data-id="41">Casque jet en matériau ABS...</span></li></ul><span data-id="44"> </span>
Steps to Reproduce
-
Load the provided Input HTML into the DHX RichText editor.
-
Focus the cursor inside the first parsed line:
<span data-id="37" style="font-weight:bold;">Casque jet Vespa Modernist</span>. -
Click the “Quote” action button in the toolbar.
Actual Behavior
The editor crashes instantly because it fails to process the inline element where a block element is expected. The browser console throws the following error:
Uncaught (in promise) TypeError: can't access property "type", c is undefined
Expected Behavior
The general block structure (including <div> elements) must be preserved during parsing, in line with industry standards (e.g., CKEditor). Toolbar actions like “Quote” should execute safely without breaking editor functionality or throwing runtime exceptions.