Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix(codeblock): Display mermaid graph per default in readonly mode
Signed-off-by: Jonas <[email protected]>
  • Loading branch information
mejo- authored and backportbot-nextcloud[bot] committed Nov 9, 2023
commit eb353b28b1be289c2f1734036c36016cf3a50c28
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