Skip to content

Commit

Permalink
Merge pull request #4721 from nextcloud/bugfix/noid/code-block-editable
Browse files Browse the repository at this point in the history
  • Loading branch information
juliusknorr authored Sep 6, 2023
2 parents a231529 + ff3ea00 commit 162af60
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
25 changes: 25 additions & 0 deletions cypress/e2e/nodes/CodeBlock.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,31 @@ describe('Front matter support', function() {
})
})

it.only('Show a code block in a public read only link', function() {
cy.shareFile('/codeblock.md')
.then((token) => {
cy.logout()
cy.visit(`/s/${token}`)
})
.then(() => {
cy.getEditor().should('be.visible')
// Plain text block
cy.getContent().find('code').eq(0).find('.hljs-keyword').should('not.exist')

// Javascript block
cy.getContent().find('code').eq(1).find('.hljs-keyword').eq(0).contains('const')
cy.getContent().find('code').eq(1).find('.hljs-string').eq(0).contains('"bar"')
cy.getContent().find('code').eq(1).find('.hljs-keyword').eq(1).contains('function')

// Mermaid diagram
cy.get('#app-content').scrollTo('bottom')
cy.getContent().find('.split-view__preview').eq(2).should('be.visible')
cy.get('.code-block').eq(2).find('code').should('not.be.visible')
cy.get('.split-view__preview').find('svg title')
.contains('Order example')
})
})

it('Add a code block', function() {
cy.isolateTest({ sourceFile: 'codeblock.md' })
cy.openFile('codeblock.md').then(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/nodes/CodeBlockView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
</div>
</div>
<div :class="{'split-view': showCode && showPreview }">
<pre v-show="showCode" class="split-view__code"><NodeViewContent as="code" :contenteditable="editable" /></pre>
<pre v-show="showCode" class="split-view__code"><NodeViewContent as="code" :contenteditable="isEditable" /></pre>
<div v-show="showPreview"
ref="preview"
class="split-view__preview"
Expand Down

0 comments on commit 162af60

Please sign in to comment.