Open the embed chooser for the /card slash command - #5674
Draft
FadhlanR wants to merge 2 commits into
Draft
Conversation
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>
Contributor
Preview deploymentsHost Test Results 1 files ±0 1 suites ±0 2h 23m 32s ⏱️ - 4m 18s Results for commit fd0e320. ± Comparison against earlier commit cab2dec. Realm Server Test Results 1 files ±0 1 suites ±0 13m 55s ⏱️ +4s 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Typing
/in the rich markdown editor offers a/cardautocomplete option. Selecting it opened a custom inline popup (CS-11698) that was broken two ways:contains: { name: ... }, butCardDefhas no queryablenamefield (the searchable title iscardTitle), so typing never matched. The result rows and format picker readcard.titlefor the same reason, so they rendered blank too.Fix
Point the
/cardslash 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 workingcardTitlesearch, 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._handleOpenCardSearchnow delegates to_openEmbedChooser('card'). The slash completion'sapplyalready deletes the typed/, so the caret sits where the directive lands._insertCardWithFormat, and their CSS.makeCardRef/labelFromUrlhelpers and themaybeRelativeReferenceimport. Kept_preventFocusLoss(used by the toolbar) and thegetCardsarg (used for embed reference resolution).Net diff: +79 / −465.
Tests
New acceptance test in
markdown-embed-chooser-test.gts: drives the/cardautocomplete (startCompletion→acceptCompletion), 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(hostlint:types) — 0 errorsprettier --check— cleanember-template-lint— cleanBrowser test run for the new acceptance test still pending.
🤖 Generated with Claude Code