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:
eezd committed 2026-10-16 19:19:16 +08:00
1 parent b3f05b501a
commit a11e0ec498
6 files changed
+103 -10

No files matched your search

+5 -1
View File
@@ -42,7 +42,11 @@ export function pasteImages(opts: PasteImagesOptions): Extension {
}
return EditorView.domEventHandlers({
paste(e, view) {
const files = [...(e.clipboardData?.files ?? [])]
// 个别浏览器/来源只在 items 中提供图片
let files = [...(e.clipboardData?.files ?? [])]
if (!files.length) {
files = [...(e.clipboardData?.items ?? [])].filter((i) => i.kind === 'file').map((i) => i.getAsFile()).filter((f) => f !== null)
}
if (!insert(view, files)) return false
e.preventDefault()
return true