mirror of
https://github.com/SrIzan10/spongebin.git
synced 2026-05-01 11:05:09 +00:00
fix: fix overflow for pages by making body background color the theme color; change default code to 'Hello World' rather than 'No Code Provided'
This commit is contained in:
@@ -31,7 +31,7 @@ export default function CodeBlock() {
|
||||
spellCheck={false}
|
||||
/>
|
||||
<div
|
||||
class="ml-4 overflow-x-hidden shiki pointer-events-none"
|
||||
class="ml-4 shiki pointer-events-none"
|
||||
dangerouslySetInnerHTML={{ __html }}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -12,7 +12,7 @@ export default function SaveButton() {
|
||||
const save = async () => {
|
||||
setSaving(true);
|
||||
|
||||
const result = await unwrapOr(encode(code), "");
|
||||
const result = await unwrapOr(encode(code), "Hello World");
|
||||
const url = `${window.location.origin}/?l=${$langStore.get()}&t=${$themeStore.get()}&c=${result}`;
|
||||
|
||||
navigator.clipboard.writeText(url);
|
||||
|
||||
@@ -2,19 +2,26 @@
|
||||
import "../styles/global.css";
|
||||
import { type BundledTheme } from "shiki";
|
||||
import Editor from "../components/Editor";
|
||||
import { $codeStore, $langStore, $themeStore, parseLang } from "../utils/theme";
|
||||
import {
|
||||
$codeStore,
|
||||
$langStore,
|
||||
$themeStore,
|
||||
$themeColorsStore,
|
||||
parseLang,
|
||||
} from "../utils/theme";
|
||||
import { decode } from "../utils/encode";
|
||||
import { unwrapOr } from "../utils/result";
|
||||
|
||||
const langParam = Astro.url.searchParams.get("l") ?? "txt";
|
||||
const themeParam = Astro.url.searchParams.get("t") ?? "github-dark-default";
|
||||
|
||||
const codeParam =
|
||||
Astro.url.searchParams.get("c") ??
|
||||
"H4sIAAAAAAAAE_PLV3DOT0lVCCjKL8tMSU0BAGFoYswQAAAA";
|
||||
"H4sIAAAAAAAAE_NIzcnJVwjPL8pJAQBWsRdKCwAAAA";
|
||||
|
||||
const code = await unwrapOr(
|
||||
decode(codeParam),
|
||||
"H4sIAAAAAAAAE_PLV3DOT0lVCCjKL8tMSU0BAGFoYswQAAAA",
|
||||
"H4sIAAAAAAAAE_NIzcnJVwjPL8pJAQBWsRdKCwAAAA",
|
||||
);
|
||||
|
||||
$codeStore.set(code);
|
||||
@@ -42,7 +49,7 @@ $themeStore.set(themeParam as BundledTheme);
|
||||
<meta property="og:url" content={Astro.url} />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<body style={{ backgroundColor: $themeColorsStore.get().background }}>
|
||||
<Editor client:load />
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user