Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable26] List fixes #4775

Merged
merged 3 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 0 additions & 4 deletions css/prosemirror.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ div.ProseMirror {
.checkbox-item {
display: flex;
align-items: start;
// Left-align with list item text
margin-left: -23px;

input[type=checkbox] {
display: none;
Expand All @@ -57,7 +55,6 @@ div.ProseMirror {
vertical-align: middle;
margin: 3px 6px 3px 2px;
border: 1px solid var(--color-text-maxcontrast);
position: relative;
display: block;
border-radius: var(--border-radius);
height: 14px;
Expand All @@ -82,7 +79,6 @@ div.ProseMirror {
display: block;
flex-grow: 1;
max-width: calc(100% - 28px);
margin-left: 9px;
}
}

Expand Down
29 changes: 29 additions & 0 deletions cypress/e2e/viewer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,33 @@ describe('Open test.md in viewer', function() {
cy.get('#viewer .modal-header button.header-close').click()
cy.get('#viewer').should('not.exist')
})

it('Can use tab keys for list in the viewer', function() {
// This used to break with the focus trap that the viewer modal has
cy.openFile('empty.md')

cy.getContent()
.type('- test{enter}')

// Cypress does not have native tab key support, though this seems to work
// for triggering the key handler of tiptap
// https://github.com/cypress-io/cypress/issues/311
cy.getContent()
.trigger('keydown', { keyCode: 9 })
cy.getContent()
.trigger('keyup', { keyCode: 9 })
cy.getContent()
.type('Nested list')

cy.getContent().find('ul li').should('contain', 'test')
cy.getContent().find('ul li ul li').should('contain', 'Nested list')

cy.getContent()
.trigger('keydown', { keyCode: 9, shiftKey: true })
cy.getContent()
.trigger('keyup', { keyCode: 9, shiftKey: true })

cy.getContent().find('ul li').eq(0).should('contain', 'test')
cy.getContent().find('ul li').eq(1).should('contain', 'Nested list')
})
})
4 changes: 2 additions & 2 deletions js/editor.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/editor.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/files-modal.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/files-modal.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions js/text-editors.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-editors.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-files.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-files.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-public.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-public.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-text.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-text.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-viewer.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-viewer.js.map

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions src/components/Editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -629,9 +629,16 @@ export default {

onFocus() {
this.emit('focus')

// Make sure that the focus trap doesn't catch tab keys while being in the contenteditable
window._nc_focus_trap?.[0]?.pause()
},
onBlur() {
this.emit('blur')

// Hand back focus to the previous trap
window._nc_focus_trap?.[0]?.unpause()
this.$el.focus()
},

onAddImageNode() {
Expand Down
Loading