Skip to content

Commit 34d21ab

Browse files
authored
Merge pull request #7498 from nextcloud/backport/7496/stable31
[stable31] fix(mermaid): Use dark theme if appropriate
2 parents 092b3e4 + ed49f86 commit 34d21ab

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/nodes/CodeBlock/CodeBlockView.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
<script>
8282
import debounce from 'debounce'
8383
import { NodeViewWrapper, NodeViewContent } from '@tiptap/vue-2'
84+
import { useIsDarkTheme } from '@nextcloud/vue'
8485
import NcActions from '@nextcloud/vue/components/NcActions'
8586
import NcActionButton from '@nextcloud/vue/components/NcActionButton'
8687
import NcActionInput from '@nextcloud/vue/components/NcActionInput'
@@ -130,7 +131,9 @@ export default {
130131
},
131132
},
132133
setup() {
134+
const isDarkTheme = useIsDarkTheme()
133135
return {
136+
isDarkTheme,
134137
/** The lazy loaded mermaid js module */
135138
mermaid: null,
136139
}
@@ -208,7 +211,10 @@ export default {
208211
// lazy load mermaid on first real usage
209212
if (this.mermaid === null) {
210213
this.mermaid = (await import('mermaid')).default
211-
this.mermaid.initialize({ startOnLoad: false })
214+
this.mermaid.initialize({
215+
startOnLoad: false,
216+
theme: this.isDarkTheme ? 'dark' : 'default',
217+
})
212218
}
213219
await this.mermaid.parse(textContent)
214220

0 commit comments

Comments
 (0)