Commit 0be9db4
authored
fix(inline-edit): disable TinyMCE URL conversion to preserve absolute asset paths on blur (#35172)
Fixes #34807
## Problem
When a user clicks on an image inside the Rich Text inline editor and
then clicks outside (triggering `blur`), TinyMCE's default
`convert_urls: true` behavior rewrites root-relative asset paths:
- **Before blur:** `/dA/9bf3ad75d5/dog 2.webp?language_id=1`
- **After blur:** `../dA/9bf3ad75d5/dog 2.webp?language_id=1`
This happens because the editor runs inside an iframe whose base URL
differs from the site root, so TinyMCE incorrectly calculates a relative
path on `getContent()`. The result is broken images whose severity
depends on the page's URL depth.
## Root Cause
`convert_urls` defaults to `true` in TinyMCE. When the editor serializes
content on blur, it resolves all URLs relative to the iframe's base —
not the site root — silently corrupting absolute paths.
## Solution
Set `convert_urls: false` in the shared TinyMCE base options. This tells
TinyMCE to leave all URLs exactly as authored, which is the correct
behavior for a CMS where asset paths are always root-relative.
The base options are extracted into an exported constant
(`INLINE_EDIT_TINYMCE_BASE_OPTIONS`) so the URL-handling behavior is
covered by unit tests independently of the editor lifecycle.
## Testing
- Open a Rich Text contentlet with an image using an absolute path
(`/dA/...`)
- Click the image to focus the inline editor
- Click outside to trigger blur
- Verify the `src` attribute is unchanged in both the DOM and after
saving
### Video1 parent de786d6 commit 0be9db4
2 files changed
Lines changed: 40 additions & 9 deletions
File tree
- core-web/libs/portlets/edit-ema/portlet/src/lib/services/inline-edit
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
15 | 39 | | |
16 | 40 | | |
17 | 41 | | |
| |||
Lines changed: 16 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
33 | 46 | | |
34 | 47 | | |
35 | 48 | | |
| |||
39 | 52 | | |
40 | 53 | | |
41 | 54 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
| 55 | + | |
49 | 56 | | |
50 | 57 | | |
51 | 58 | | |
52 | | - | |
| 59 | + | |
53 | 60 | | |
54 | 61 | | |
55 | 62 | | |
| |||
162 | 169 | | |
163 | 170 | | |
164 | 171 | | |
165 | | - | |
| 172 | + | |
166 | 173 | | |
167 | 174 | | |
168 | 175 | | |
| |||
0 commit comments