feat(Block Editor): Restore internal dotCMS Page search in the link popover#35907
Conversation
|
Claude finished @rjvelazco's task in 4m 23s —— View job Claude PR Review
Status since prior review
Remaining findings🟠 Multi-word search terms silently mis-parse (new finding)
return `... +(title:${safe}* OR path:*${safe}* OR urlmap:*${safe}*)`;
🟠 Leading wildcards in
+(title:${safe}* OR path:*${safe}* OR urlmap:*${safe}*)
🟡 PrimeNG private API — now documented, still fragile
ac.loading = false;
ac.overlayVisible = false;
ac.cd.markForCheck();The added comment calls this out and pins the PrimeNG version — that's the right move. Just confirm the comment makes it into the upgrade checklist so it isn't lost. 🟡 No host filter on internal page search Query has no 🟡 Selecting a page that hasn't gone live yet produces a link that 404s for end-users until publish. 🟡 No unit tests
🟢 Non-substantive observation
|
…andling of empty values
…-dotcms-page-search-in-the-link-popover
|
@claude review these changes |
|
Claude finished @rjvelazco's task in 1m 37s —— View job Claude PR Review (re-review)
Status since prior review
Remaining findings🔴 Bug —
<p-autoComplete
inputId="link-url"
appendTo="body"
optionLabel="url"
size="'small'" ← literal value 'small' (with the single quotes)The fix commit attempted to set 🟠 Lucene query — unescaped user input + leading wildcards (unchanged)
return `+languageId:${languageId || 1} +deleted:false +working:true +(urlmap:* OR basetype:5) +(title:${term}* OR path:*${term}* OR urlmap:*${term}*)`;Two compounding issues:
🟠
url: c.path || c.urlMap,Both fields come from the
Guard the mapping: skip the contentlet, fall back to 🟡 Reaching into PrimeNG internals (
const ac = this.autoComplete();
if (ac) {
ac.loading = false;
ac.overlayVisible = false;
ac.cd.markForCheck();
}Mutating 🟡 No host filter on internal page search The Lucene query has no 🟡 Authors can select a page that isn't live yet, producing a link that 404s for end users until the page goes live. Intentional? 🟡 No unit tests 200 lines of new behavior — debounce, external-URL short-circuit, sync between
🟢 Other observations (non-blocking)
· Branch |
- Escape Lucene/ES reserved chars in the search term so typing ':' or '/' (common in URLs) no longer breaks the query into an empty dropdown - Guard suggestion URL: fall back to '' and filter out results with no resolvable URL so "undefined" is never written into the link href - Fix the AutoComplete size to [size]="'small'" (was the literal "'small'") - Document that the external-URL overlay-close branch mutates non-public PrimeNG fields (pinned to primeng 21.x) for the upgrade checklist - Revert incidental .claude/settings.json reformat to keep the PR focused Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…-dotcms-page-search-in-the-link-popover # Conflicts: # core-web/libs/new-block-editor/src/lib/editor/components/link-popover/link-popover.component.html
Reformats the two block-editor files flagged by CI's `nx format:check` (Tailwind class ordering + line wrap) that were missed because the prior merge commit used --no-verify. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…opover (#35907) This PR fixes: #35890 ### 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. ### Screenshots https://github.com/user-attachments/assets/453d14be-f426-4971-a7f8-a81ce0f8fd53 --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This PR fixes: #35890
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.
p-autoComplete. Typing a partial title/path runs a debounced (250 ms) search and shows a dropdown of matching pages.DotContentSearchServicefrom@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:5pages + URL-mapped content, matched by title/path/urlmap prefix)./dA/{inode}) when available, with ellipsis truncation to fit the popover.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.href; opening an existing link prefills the field without firing a spurious search..p-autocomplete-overlayin the popover's click-outside handler so picking a suggestion (body-appended overlay) doesn't dismiss the popover.relselect fix — therelcontrol now defaults tonullinstead of'', so PrimeNG's[showClear]no longer renders a stray "X" on the empty dropdown.Checklist
dot.block.editor.dialog.link.search.emptyand updated the URL placeholder inLanguage.properties./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:5plus URL-mapped content, scoped to the activelanguageId, working + non-deleted) reproduces the legacy link popover's behavior.Screenshots
video.mov
This PR fixes: #35890