Skip to content

Open the embed chooser for the /card slash command - #5674

Draft
FadhlanR wants to merge 2 commits into
mainfrom
cs-11698-forward-slash-card-search
Draft

Open the embed chooser for the /card slash command#5674
FadhlanR wants to merge 2 commits into
mainfrom
cs-11698-forward-slash-card-search

Conversation

@FadhlanR

@FadhlanR FadhlanR commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Problem

Typing / in the rich markdown editor offers a /card autocomplete option. Selecting it opened a custom inline popup (CS-11698) that was broken two ways:

  1. Couldn't be dismissed — the only close path was pressing Esc while the search input was focused. No click-outside, blur, or Cancel.
  2. Search didn't filter — the query filtered on contains: { name: ... }, but CardDef has no queryable name field (the searchable title is cardTitle), so typing never matched. The result rows and format picker read card.title for the same reason, so they rendered blank too.

Fix

Point the /card slash command at the same markdown embed chooser modal the toolbar's Add-embed button already uses, instead of the bespoke inline popup. The modal has working cardTitle search, card/file tabs, format selection, and standard modal dismissal — so both bugs disappear because the broken code is gone, and there's one card chooser to maintain instead of two.

  • _handleOpenCardSearch now delegates to _openEmbedChooser('card'). The slash completion's apply already deletes the typed /, so the caret sits where the directive lands.
  • Removed the inline card-search popup and format-picker popup: templates, tracked state, keydown/input/select handlers, menu-coordinate logic, the search resource, _insertCardWithFormat, and their CSS.
  • Removed the now-dead makeCardRef / labelFromUrl helpers and the maybeRelativeReference import. Kept _preventFocusLoss (used by the toolbar) and the getCards arg (used for embed reference resolution).

Net diff: +79 / −465.

Tests

New acceptance test in markdown-embed-chooser-test.gts: drives the /card autocomplete (startCompletionacceptCompletion), asserts the chooser modal opens on the Cards tab and the old [data-test-card-search] popup is gone, then picks a card and verifies the inserted :card[../Pet/mango] directive (the typed / is consumed).

Verification

  • ember-tsc (host lint:types) — 0 errors
  • prettier --check — clean
  • ember-template-lint — clean

Browser test run for the new acceptance test still pending.

🤖 Generated with Claude Code

Typing `/card` in the rich markdown editor opened a custom inline popup
that could only be dismissed with Escape while its input was focused, and
whose search filtered on a non-existent `name` field so it never matched.

Point the slash command at the same markdown embed chooser modal the
toolbar's Add-embed button already uses, and remove the inline card-search
and format-picker popups along with their now-dead helpers. The modal
provides working search, card/file tabs, format selection, and standard
dismissal.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Preview deployments

Host Test Results

    1 files  ±0      1 suites  ±0   2h 23m 32s ⏱️ - 4m 18s
3 810 tests ±0  3 796 ✅ +1  14 💤 ±0  0 ❌ ±0 
3 829 runs  ±0  3 815 ✅ +2  14 💤 ±0  0 ❌  - 1 

Results for commit fd0e320. ± Comparison against earlier commit cab2dec.

Realm Server Test Results

    1 files  ±0      1 suites  ±0   13m 55s ⏱️ +4s
2 032 tests ±0  2 032 ✅ ±0  0 💤 ±0  0 ❌ ±0 
2 111 runs  ±0  2 111 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit fd0e320. ± Comparison against earlier commit cab2dec.

`acceptCompletion` depends on the autocomplete tooltip's selected-option
state, which is racy under the test runner and left the chooser modal
unopened. Invoke the `/card` completion's `apply` directly instead — the
same callback the real accept runs — so the accept is deterministic.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant