diff --git a/.gitignore b/.gitignore index e09a007..3f4eb3b 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,12 @@ main.js # Exclude sourcemaps *.map +# Font files generated by esbuild from bundled dependencies +main.css +*.woff +*.woff2 +*.ttf + # obsidian data.json diff --git a/Components/TopBar.svelte b/Components/TopBar.svelte index a753f2b..ffa4dba 100644 --- a/Components/TopBar.svelte +++ b/Components/TopBar.svelte @@ -1,9 +1,33 @@
- +
@@ -21,7 +45,24 @@ .top-bar-content { grid-row: 2; grid-column: 2; + display: grid; + grid-template-rows: auto; + grid-template-columns: var(--size-4-2) auto 1fr var(--size-4-2); background-color: var(--color-base-30); border-radius: var(--radius-m); } + + .settings-button { + grid-row: 1; + grid-column: 2; + background: none; + border: none; + margin: var(--size-4-2) 0px var(--size-4-2) 0px; + padding: var(--size-4-1) var(--size-4-2) var(--size-4-1) var(--size-4-2); + color: var(--text-muted); + } + + .settings-button:hover { + background-color: var(--color-base-35); + } diff --git a/esbuild.config.mjs b/esbuild.config.mjs index 5b1dcdf..654b483 100644 --- a/esbuild.config.mjs +++ b/esbuild.config.mjs @@ -71,6 +71,12 @@ const buildOptions = { treeShaking: true, outfile: "main.js", minify: prod, + loader: { + '.css': 'css', + '.ttf': 'file', + '.woff': 'file', + '.woff2': 'file', + }, }; if (prod) { diff --git a/main.ts b/main.ts index 81ca7aa..28d7ffa 100644 --- a/main.ts +++ b/main.ts @@ -23,12 +23,8 @@ export default class AIAgentPlugin extends Plugin { settings: AIAgentSettings; async onload() { - const link = document.createElement('link'); - link.rel = 'stylesheet'; - link.href = 'https://cdn.jsdelivr.net/npm/katex@0.16.22/dist/katex.min.css'; - link.integrity = 'sha384-5TcZemv2l/9On385z///+d7MSYlvIEw9FuZTIdZ14vJLqWphw7e7ZPuOiCHJcFCP'; - link.crossOrigin = 'anonymous'; - document.head.appendChild(link); + // KaTeX CSS is bundled with the plugin to comply with CSP + require('katex/dist/katex.min.css'); await this.loadSettings(); diff --git a/package-lock.json b/package-lock.json index 1126ed7..f05aeac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,6 +14,7 @@ "core-js": "^3.45.1", "express": "^5.1.0", "highlight.js": "^11.11.1", + "katex": "^0.16.22", "lowlight": "^3.3.0", "rehype-highlight": "^7.0.2", "rehype-katex": "^7.0.1", diff --git a/package.json b/package.json index e453fd9..0fd3a36 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "core-js": "^3.45.1", "express": "^5.1.0", "highlight.js": "^11.11.1", + "katex": "^0.16.22", "lowlight": "^3.3.0", "rehype-highlight": "^7.0.2", "rehype-katex": "^7.0.1",