playground_popover: Update external code btn behavior on setting change.

This commit removes the `href` attribute from the external code button
when multiple code playground links are present for a language. This
prevents the bug where the external code button would always link to
the previously set code playground link, even when multiple links are
added and the expected behavior is to show the popover.
This commit is contained in:
Sayam Samal 2024-07-03 20:02:39 +05:30 committed by Tim Abbott
parent 5191a80a3a
commit 3fda65c37d
1 changed files with 4 additions and 0 deletions

View File

@ -122,6 +122,10 @@ function register_click_handlers(): void {
url_template.expand({code: extracted_code}),
);
} else {
// Remove the href attribute that was set when there was only
// one playground link, so that it doesn't interfere with the
// popover toggle when multiple playground links exist.
$view_in_playground_button.removeAttr("href");
const playground_store = new Map<number, RealmPlaygroundWithURL>();
for (const playground of playground_info) {
const url_template = url_template_lib.parse(playground.url_template);