File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
playgrounds/app/src/components Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ import {
4444 Setter ,
4545 Show ,
4646} from 'solid-js'
47+ import type { HighlighterGeneric } from 'shiki'
4748import { createHighlighter , bundledThemes , bundledLanguages } from 'shiki'
4849import { ShikiMagicMove } from 'shiki-magic-move/solid'
4950import { AnimationFrameConfig , SnippetSettings } from '~/types'
@@ -106,14 +107,15 @@ export default function Editor(props: EditorProps) {
106107 const [ isShowingGifDialog , setIsShowingGifDialog ] = createSignal ( false )
107108 const [ title , setTitle ] = createSignal ( props . snippetSettings . title )
108109 const [ isSaving , setIsSaving ] = createSignal ( false )
110+ const [ highlighter , setHighlighter ] = createSignal < HighlighterGeneric < any , any > | undefined > ( )
109111
110- const [ highlighter ] = createResource ( async ( ) => {
111- const newHighlighter = await createHighlighter ( {
112- themes : Object . keys ( bundledThemes ) ,
113- langs : Object . keys ( bundledLanguages ) ,
112+ createEffect ( ( ) => {
113+ createHighlighter ( {
114+ themes : [ props . snippetSettings . theme ] ,
115+ langs : [ props . snippetSettings . language ] ,
116+ } ) . then ( newHighlighter => {
117+ setHighlighter ( newHighlighter )
114118 } )
115-
116- return newHighlighter
117119 } )
118120
119121 createEffect ( ( ) => {
You can’t perform that action at this time.
0 commit comments