Skip to content

Commit

Permalink
Merge pull request #82 from easyops-cn/steve/default-yaml
Browse files Browse the repository at this point in the history
Set default playground mode as yaml
  • Loading branch information
weareoutman authored May 16, 2024
2 parents 9019647 + 9f39522 commit c380a9f
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 c380a9f

Please sign in to comment.