Skip to content

Commit

Permalink
fix(codeblock): Display mermaid graph per default in readonly mode
Browse files Browse the repository at this point in the history
Signed-off-by: Jonas <[email protected]>
  • Loading branch information
mejo- committed Nov 8, 2023
1 parent c49d129 commit aa3cdf3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/nodes/CodeBlockView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ export default {
showPreview() {
return this.supportPreview && (this.viewMode === 'preview' || this.viewMode === 'side-by-side')
},
defaultMode() {
if (this.isEditable) {
return 'side-by-side'
} else {
return this.supportPreview() ? 'code' : 'preview'
}
},
},
watch: {
'node.textContent'() {
Expand All @@ -135,7 +142,7 @@ export default {
const textContent = this.node?.textContent || ''
if (textContent.trim() === '') {
this.viewMode = this.isEditable ? 'side-by-side' : 'code'
this.viewMode = this.defaultMode
this.$refs.preview.innerHTML = ''
}
Expand Down

0 comments on commit aa3cdf3

Please sign in to comment.