From edb0a0f9299c7aa08559d417c58e79bbfd0af604 Mon Sep 17 00:00:00 2001 From: SethBurkart123 Date: Mon, 24 Feb 2025 16:51:40 +1100 Subject: [PATCH] feat: add fullscreen custom css editor --- src/interface/components/CodeEditor.svelte | 4 +-- src/interface/index.css | 6 +++- src/interface/pages/themeCreator.svelte | 37 +++++++++++++++++++--- 3 files changed, 40 insertions(+), 7 deletions(-) diff --git a/src/interface/components/CodeEditor.svelte b/src/interface/components/CodeEditor.svelte index af4cb5ba..12820718 100644 --- a/src/interface/components/CodeEditor.svelte +++ b/src/interface/components/CodeEditor.svelte @@ -20,7 +20,7 @@ let editor = $state(null) let view: EditorView | null = null; let editorTheme = new Compartment(); - let { value, onChange } = $props<{value: string, onChange: (value: string) => void}>() + let { value, onChange, className } = $props<{value: string, onChange: (value: string) => void, className?: string}>() function createEditorState(initialContents: string) { let extensions = [ @@ -91,4 +91,4 @@ }) -
\ No newline at end of file +
\ No newline at end of file diff --git a/src/interface/index.css b/src/interface/index.css index 7c2c9299..dedb557e 100644 --- a/src/interface/index.css +++ b/src/interface/index.css @@ -48,5 +48,9 @@ input { .cm-editor { width: 100%; min-height: 100px; - max-height: 400px; + height: inherit; +} + +.editorHeight { + height: calc(100vh - 58px); } \ No newline at end of file diff --git a/src/interface/pages/themeCreator.svelte b/src/interface/pages/themeCreator.svelte index e2501886..3248b7b2 100644 --- a/src/interface/pages/themeCreator.svelte +++ b/src/interface/pages/themeCreator.svelte @@ -46,6 +46,12 @@ }) let closedAccordions = $state([]) let themeLoaded = $state(false); + let codeEditorFullscreen = $state(false); + + function toggleCodeEditorFullscreen(e: MouseEvent) { + e.preventDefault(); + codeEditorFullscreen = !codeEditorFullscreen; + } function toggleAccordion(title: string) { if (closedAccordions.includes(title)) { @@ -169,6 +175,13 @@ {#if item.direction === 'vertical'}
+ {#if item.type === 'codeEditor'} + + + {/if} + {'\ue9e6'}
{/if} @@ -187,9 +200,12 @@ {/key} {:else if item.type === 'codeEditor'} - {#key themeLoaded} - - {/key} + {#if !codeEditorFullscreen} + {#key themeLoaded} + + + {/key} + {/if} {:else if item.type === 'imageUpload'} {#each theme.CustomImages as image (image.id)}
@@ -238,7 +254,20 @@ {/snippet}
-
+ {#if codeEditorFullscreen} +
+
+
+

Custom CSS

+ +
+ { theme = { ...theme, CustomCSS: value } }} /> +
+
+ {/if} +
+ +

Theme Creator

{'\ueb44'}