Commit d550c25
authored
feat(Block Editor): Restore internal dotCMS page search in the link popover (#492)
Closes #491
### Proposed Changes
Restores feature parity with the legacy Block Editor by bringing
internal dotCMS **page search** back to the Block Editor 2.0 link
popover.
* **Page search in the URL field** — replaced the plain URL text input
with a PrimeNG `p-autoComplete`. Typing a partial title/path runs a
debounced (250 ms) search and shows a dropdown of matching pages.
* **Reuses existing data-access** — the search goes through
`DotContentSearchService` from `@dotcms/data-access` (the same service
the slash-menu drill-down uses); no new HTTP service. The Lucene query
is built inline at the call site, mirroring the legacy editor
(`basetype:5` pages + URL-mapped content, matched by title/path/urlmap
prefix).
* **Custom result template** — each suggestion shows the contentlet name
and its path, plus a thumbnail (`/dA/{inode}`) when available, with
ellipsis truncation to fit the popover.
* **External URLs never blocked** — when the value parses as a valid
`http(s)` URL the overlay is suppressed entirely (no search, no empty
message), so pasting/typing an external link works unchanged. Manual
entry is always allowed.
* **Empty state** — shows "No results found in dotCMS" when a search
returns nothing.
* **Works in create and edit flows** — selecting a result populates the
link `href`; opening an existing link prefills the field without firing
a spurious search.
* **Selection highlight while editing** — in insert mode, focusing the
URL input no longer hides which text will become the link: the target
range is painted with a ProseMirror decoration that survives the input
blur and is cleared when the popover closes.
* **Popover shell fix** — whitelisted `.p-autocomplete-overlay` in the
popover's click-outside handler so picking a suggestion (body-appended
overlay) doesn't dismiss the popover.
* **`rel` select fix** — the `rel` control now defaults to `null`
instead of `''`, so PrimeNG's `[showClear]` no longer renders a stray
"X" on the empty dropdown.
### Checklist
- [x] Translations — added `dot.block.editor.dialog.link.search.empty`
and updated the URL placeholder in `Language.properties`.
- [x] Security Implications Contemplated — no new endpoint; reuses the
existing `/api/content/_search`. Query-term interpolation matches the
legacy popover's behavior (search scoped to working/non-deleted content
for the active language).
### Additional Info
The search-result set (pages via `basetype:5` plus URL-mapped content,
scoped to the active `languageId`, working + non-deleted) reproduces the
legacy link popover's behavior.
---
*Mirrored from dotCMS#35907 for autodoc pipeline testing.*1 parent cc26f60 commit d550c25
0 file changed
0 commit comments