Fix redo shortcut on Windows, table rendering at doc start, and save on tab close
- Bind Mod-Shift-z to redo on all platforms (CodeMirror only binds it on Linux/macOS) - Render tables based on editor focus so a note starting with a table is not shown as source - Send the save request without waiting for the IndexedDB draft write, and flush on pagehide; Firefox could drop the last edit when a tab was closed right after typing - Fall back to clipboardData.items when pasting images with an empty files list
This commit is contained in:
1 parent
b3f05b501a
commit
a11e0ec498
6 files changed
+103
-10
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { createEditorState } from './index'
|
||||
import { setEditorFocus, tableField } from './table'
|
||||
|
||||
const doc = '| a | b |\n| --- | --- |\n| 1 | 2 |\n\n正文'
|
||||
|
||||
describe('表格渲染', () => {
|
||||
it('光标在文首但编辑器未聚焦时,开头的表格仍渲染', () => {
|
||||
const state = createEditorState({ doc })
|
||||
expect(state.selection.main.head).toBe(0)
|
||||
expect(state.field(tableField).size).toBe(1)
|
||||
})
|
||||
it('编辑器聚焦且光标在表格内时显示源码,移出后恢复渲染', () => {
|
||||
let state = createEditorState({ doc }).update({ effects: setEditorFocus.of(true) }).state
|
||||
expect(state.field(tableField).size).toBe(0)
|
||||
state = state.update({ selection: { anchor: doc.length } }).state
|
||||
expect(state.field(tableField).size).toBe(1)
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user