-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
151 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.ceditor { | ||
padding: 12px; | ||
margin-top: 28px; | ||
border-radius: 5px; | ||
background: var(--input-background); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { CodeInput } from '@srsholmes/solid-code-input' | ||
import hljs from 'highlight.js/lib/core' | ||
import cssModule from 'highlight.js/lib/languages/css' | ||
|
||
import {css, classes} from './Editor.scss' | ||
|
||
hljs.registerLanguage('css', cssModule) | ||
|
||
const { | ||
ui: { | ||
injectCss, | ||
Header, | ||
HeaderTags | ||
}, | ||
plugin: { store }, | ||
solid: { createSignal }, | ||
} = shelter | ||
|
||
let injectedCss = false | ||
|
||
export default function () { | ||
if (!injectedCss) { | ||
injectCss(css) | ||
injectedCss = true | ||
} | ||
|
||
const [inlineCss, setInlineCss] = createSignal('') | ||
|
||
return ( | ||
<> | ||
<Header tag={HeaderTags.H1}>CSS Editor</Header> | ||
|
||
<div class={classes.ceditor}> | ||
<CodeInput | ||
highlightjs={hljs} | ||
autoHeight={false} | ||
resize="none" | ||
placeholder="Enter any CSS here..." | ||
onChange={setInlineCss} | ||
value={inlineCss()} | ||
language={'css'} | ||
/> | ||
</div> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import Editor from './components/Editor' | ||
|
||
const { | ||
settings: { | ||
registerSection, | ||
} | ||
} = shelter | ||
|
||
const unload = registerSection('section', 'inline-css', 'CSS Editor', Editor) | ||
|
||
export const onUnload = () => { | ||
unload() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "inline-css", | ||
"dependencies": { | ||
"@srsholmes/solid-code-input": "^0.0.18", | ||
"highlight.js": "^11.9.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "Inline CSS", | ||
"author": "SpikeHD", | ||
"description": "Dead-simple inline CSS editor with hot-reloading." | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters