Commit 299a2e8
committed
fix: enable search in select editable by keeping label as string
The select editable rendered by pimcore_select with a store configuration
shows a search box (showSearch + optionFilterProp="label"), but typing
never narrows the options — every query returns zero matches.
Root cause: transformDocumentEditableStoreToOptions wraps every label in
<SanitizeHtml>, producing a React element. antd filters options by
String(option.label), so for a React element the comparison becomes
'[object Object]' and no user query ever matches.
Fix: keep label as a plain string so the built-in filter works; move
HTML sanitization to render time via a new renderSanitizedLabel helper,
exported alongside the transform and wired into the SelectEditable via
labelRender / optionRender. XSS protection is unchanged — the label is
still wrapped in <SanitizeHtml> at every point it becomes DOM.
The helper is exported (not defined locally in the component) so the
adjacent MultiSelectEditable, which shares the same transform, can
reuse it without duplication.1 parent b2ffc56 commit 299a2e8
File tree
2 files changed
+21
-3
lines changed- assets/js/src/core/modules/element/dynamic-types/definitions/document/editable
- components/select-editable
- utils
2 files changed
+21
-3
lines changedLines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
| 63 | + | |
62 | 64 | | |
63 | 65 | | |
| 66 | + | |
64 | 67 | | |
65 | 68 | | |
66 | 69 | | |
| |||
Lines changed: 18 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
20 | 25 | | |
21 | 26 | | |
22 | 27 | | |
| |||
27 | 32 | | |
28 | 33 | | |
29 | 34 | | |
30 | | - | |
| 35 | + | |
31 | 36 | | |
32 | 37 | | |
33 | 38 | | |
34 | 39 | | |
35 | 40 | | |
36 | 41 | | |
37 | | - | |
| 42 | + | |
38 | 43 | | |
39 | 44 | | |
40 | 45 | | |
41 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
0 commit comments