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

Readd russian history shortcuts #1589

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/src/demos/Examples/MarkdownShortcuts/Vue/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ context('/demos/Examples/MarkdownShortcuts/Vue', () => {
.should('contain', '$foobar')
})

it.skip('should create a code block without language', () => {
it('should create a code block without language', () => {
cy.get('.ProseMirror')
.type('``` {enter}const foo = bar{enter}```')
.find('pre')
Expand Down Expand Up @@ -86,14 +86,14 @@ context('/demos/Examples/MarkdownShortcuts/Vue', () => {
.should('contain', 'foobar')
})

it.skip('should create a ordered list', () => {
it('should create a ordered list', () => {
cy.get('.ProseMirror')
.type('1. foobar')
.find('ol')
.should('contain', 'foobar')
})

it.skip('should create a blockquote', () => {
it('should create a blockquote', () => {
cy.get('.ProseMirror')
.type('> foobar')
.find('blockquote')
Expand Down
56 changes: 43 additions & 13 deletions docs/src/demos/Extensions/History/index.spec.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
context('/demos/Extensions/History', () => {
before(() => {
cy.visit('/demos/Extensions/History')
})

beforeEach(() => {
cy.visit('/demos/Extensions/History')
cy.get('.ProseMirror').then(([{ editor }]) => {
editor.commands.setContent('<p>Mistake</p>')
})
Expand All @@ -20,34 +17,67 @@ context('/demos/Extensions/History', () => {
.should('not.contain', 'Mistake')
})

it('the keyboard shortcut should make the last change undone', () => {
it('should make the last change undone with the keyboard shortcut', () => {
cy.get('.ProseMirror')
.trigger('keydown', { modKey: true, key: 'z' })

cy.get('.ProseMirror')
.should('not.contain', 'Mistake')
})

it('should apply the last undone change again', () => {
it('should make the last change undone with the keyboard shortcut (russian)', () => {
cy.get('.ProseMirror')
.should('contain', 'Mistake')

cy.get('button:first')
.click()
cy.get('.ProseMirror')
.trigger('keydown', { modKey: true, key: 'я' })

cy.get('.ProseMirror')
.should('not.contain', 'Mistake')
})

cy.get('button:nth-child(2)')
.click()
it('should apply the last undone change again with the keyboard shortcut', () => {
cy.get('.ProseMirror')
.trigger('keydown', { modKey: true, key: 'z' })

cy.get('.ProseMirror')
.should('not.contain', 'Mistake')

cy.get('.ProseMirror')
.trigger('keydown', { modKey: true, shiftKey: true, key: 'z' })

cy.get('.ProseMirror')
.should('contain', 'Mistake')
})

it.skip('the keyboard shortcut should apply the last undone change again', () => {
it('should apply the last undone change again with the keyboard shortcut (russian)', () => {
cy.get('.ProseMirror')
.trigger('keydown', { modKey: true, key: 'я' })

cy.get('.ProseMirror')
.trigger('keydown', { modKey: true, key: 'z' })
.should('not.contain', 'Mistake')
.trigger('keydown', { modKey: true, shiftKey: true, key: 'z' })

cy.get('.ProseMirror')
.trigger('keydown', { modKey: true, shiftKey: true, key: 'я' })

cy.get('.ProseMirror')
.should('contain', 'Mistake')
})

it('should apply the last undone change again', () => {
cy.get('.ProseMirror')
.should('contain', 'Mistake')

cy.get('button:first')
.click()

cy.get('.ProseMirror')
.should('not.contain', 'Mistake')

cy.get('button:nth-child(2)')
.click()

cy.get('.ProseMirror')
.should('contain', 'Mistake')
})
})
2 changes: 1 addition & 1 deletion docs/src/demos/Nodes/HardBreak/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ context('/demos/Nodes/HardBreak', () => {
.should('exist')
})

it.skip('the default keyboard shortcut should add a line break', () => {
it('the default keyboard shortcut should add a line break', () => {
cy.get('.ProseMirror br')
.should('not.exist')

Expand Down
2 changes: 2 additions & 0 deletions packages/extension-history/src/history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ export const History = Extension.create<HistoryOptions>({
addKeyboardShortcuts() {
return {
'Mod-z': () => this.editor.commands.undo(),
'Mod-я': () => this.editor.commands.undo(),
'Mod-y': () => this.editor.commands.redo(),
'Shift-Mod-z': () => this.editor.commands.redo(),
'Shift-Mod-я': () => this.editor.commands.redo(),
}
},
})