Skip to content

Commit

Permalink
Set default playground mode as yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
weareoutman committed May 16, 2024
1 parent 9019647 commit 9f39522
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/pages/playground/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -446,17 +446,17 @@ function useInitialExample(): InitialExample {
// eslint-disable-next-line no-console
console.error("Parse pasted sources failed:", error);
}
if (typeof sharedExample?.yaml === "string") {
if (typeof sharedExample?.html === "string") {
return {
mode: "yaml",
yaml: sharedExample.yaml,
mode: "html",
html: sharedExample.html,
gap: Boolean(sharedExample.gap),
isShared: true,
};
}
return {
mode: "html",
html: sharedExample?.html ?? "",
mode: "yaml",
yaml: sharedExample?.yaml ?? "",
gap: Boolean(sharedExample?.gap),
isShared: true,
};
Expand All @@ -471,9 +471,9 @@ function useInitialExample(): InitialExample {
return {
...example,
mode: paramMode
? paramMode === "yaml"
? "yaml"
: "html"
? paramMode === "html"
? "html"
: "yaml"
: example.mode,
[altMode]: decorateAltCode(example[altMode], example.mode, altMode),
};
Expand All @@ -485,7 +485,7 @@ function useInitialExample(): InitialExample {
(ExecutionEnvironment.canUseDOM
? localStorage.getItem(STORAGE_KEY_MODE)
: null);
const mode = possibleMode === "yaml" ? "yaml" : "html";
const mode = possibleMode === "html" ? "html" : "yaml";

return {
mode,
Expand Down

0 comments on commit 9f39522

Please sign in to comment.