rework keyboard shortcuts

This commit is contained in:
Hans Pagel
2020-11-19 01:16:10 +01:00
parent 56f1726850
commit a4cc02cff6
25 changed files with 211 additions and 83 deletions

View File

@@ -73,7 +73,7 @@ context('/api/nodes/blockquote', () => {
it('the keyboard shortcut should make the selected line a blockquote', () => {
cy.get('.ProseMirror')
.trigger('keydown', { shiftKey: true, modKey: true, key: '9' })
.trigger('keydown', { shiftKey: true, modKey: true, key: 'b' })
.find('blockquote')
.should('contain', 'Example Text')
})
@@ -83,13 +83,13 @@ context('/api/nodes/blockquote', () => {
.should('not.exist')
cy.get('.ProseMirror')
.trigger('keydown', { shiftKey: true, modKey: true, key: '9' })
.trigger('keydown', { shiftKey: true, modKey: true, key: 'b' })
.find('blockquote')
.should('contain', 'Example Text')
cy.get('.ProseMirror')
.type('{selectall}')
.trigger('keydown', { shiftKey: true, modKey: true, key: '9' })
.trigger('keydown', { shiftKey: true, modKey: true, key: 'b' })
cy.get('.ProseMirror blockquote')
.should('not.exist')

View File

@@ -49,3 +49,17 @@ export default {
},
}
</script>
<style lang="scss">
/* Basic editor styles */
.ProseMirror {
> * + * {
margin-top: 0.75em;
}
blockquote {
padding-left: 1rem;
border-left: 2px solid rgba(#0D0D0D, 0.1);
}
}
</style>

View File

@@ -53,20 +53,20 @@ context('/api/nodes/code-block', () => {
it('the keyboard shortcut should make the selected line a code block', () => {
cy.get('.ProseMirror')
.trigger('keydown', { shiftKey: true, modKey: true, key: 'c' })
.trigger('keydown', { modKey: true, altKey: true, key: 'c' })
.find('pre')
.should('contain', 'Example Text')
})
it('the keyboard shortcut should toggle the code block', () => {
cy.get('.ProseMirror')
.trigger('keydown', { shiftKey: true, modKey: true, key: 'c' })
.trigger('keydown', { modKey: true, altKey: true, key: 'c' })
.find('pre')
.should('contain', 'Example Text')
cy.get('.ProseMirror')
.type('{selectall}')
.trigger('keydown', { shiftKey: true, modKey: true, key: 'c' })
.trigger('keydown', { modKey: true, altKey: true, key: 'c' })
cy.get('.ProseMirror pre')
.should('not.exist')