File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -49,17 +49,20 @@ watch(
4949 },
5050)
5151
52- // reset theme
53- watch ([theme , previewTheme ], ([theme , previewTheme ]) => {
54- if (! previewTheme ) return
52+ function switchPreviewTheme() {
53+ if (! previewTheme .value ) return
5554
5655 const html = sandbox .contentDocument ?.documentElement
5756 if (html ) {
58- html .className = theme
57+ html .className = theme . value
5958 } else {
59+ // re-create sandbox
6060 createSandbox ()
6161 }
62- })
62+ }
63+
64+ // reset theme
65+ watch ([theme , previewTheme ], switchPreviewTheme )
6366
6467onUnmounted (() => {
6568 proxy .destroy ()
@@ -164,6 +167,7 @@ function createSandbox() {
164167 sandbox .addEventListener (' load' , () => {
165168 proxy .handle_links ()
166169 stopUpdateWatcher = watchEffect (updatePreview )
170+ switchPreviewTheme ()
167171 })
168172}
169173
You can’t perform that action at this time.
0 commit comments