mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
The design of the form is similar to the linkifiers page and is styled similarly. The introduction text for "Code playgrounds" is improved with more details and examples. Also, we can remove the hardcoded playground and the fix we had previously done to prevent breaking the hardcoded playground.
27 lines
853 B
JavaScript
27 lines
853 B
JavaScript
const map_language_to_playground_info = new Map();
|
|
|
|
export function update_playgrounds(playgrounds_data) {
|
|
map_language_to_playground_info.clear();
|
|
|
|
for (const data of Object.values(playgrounds_data)) {
|
|
const element_to_push = {
|
|
id: data.id,
|
|
name: data.name,
|
|
url_prefix: data.url_prefix,
|
|
};
|
|
if (map_language_to_playground_info.has(data.pygments_language)) {
|
|
map_language_to_playground_info.get(data.pygments_language).push(element_to_push);
|
|
} else {
|
|
map_language_to_playground_info.set(data.pygments_language, [element_to_push]);
|
|
}
|
|
}
|
|
}
|
|
|
|
export function get_playground_info_for_languages(lang) {
|
|
return map_language_to_playground_info.get(lang);
|
|
}
|
|
|
|
export function initialize(playground_data) {
|
|
update_playgrounds(playground_data);
|
|
}
|