Add mobile format toolbar, image picker and move-to dialog

- Markdown format commands shared by Ctrl+B/I/K and a toolbar above the
  soft keyboard on touch devices; bold and italic stack correctly
- Fit the app to the visual viewport so the keyboard does not cover the
  caret or the toolbar
- Insert images from the photo library or a file picker
- Move notes and folders with a folder picker from the file tree menu or
  the command palette
- Open the file tree menu with a long press on touch devices
This commit is contained in:
eezd committed 2026-10-17 17:12:43 +08:00
1 parent eb63b14c8e
commit 91da6e116e
14 files changed
+565 -68

No files matched your search

+10 -1
View File
@@ -8,11 +8,12 @@ import { typoraExtensions } from '../markdown/extensions'
import { renderedBlocks } from './blocks'
import { codeBlockHighlight } from './codeblocks'
import { editorFocus } from './focus'
import { insertLink, toggleBold, toggleItalic } from './format'
import { livePreview, resolveImageUrl } from './livepreview'
import { tableEditing } from './table'
import { markdownTheme } from './theme'
export { pasteImages } from './paste'
export { insertImageFiles, pasteImages } from './paste'
// 在 lang-markdown 的语法集(CommonMark + GFM + 上下标 + emoji)上加 Typora 扩展。
// 沿用其语言数据,markdownKeymap 中的命令据此识别 Markdown(isActiveAt 按语言数据判断)
@@ -41,6 +42,14 @@ export function createEditorState(opts: EditorStateOptions): EditorState {
// 首屏包 gzip 从约 108 KB 增至约 180 KB,而 Live Preview 不需要 HTML 高亮
rawmarkLanguage,
Prec.high(keymap.of(markdownKeymap)),
// 与 Typora 一致的格式快捷键
Prec.high(
keymap.of([
{ key: 'Mod-b', run: toggleBold, preventDefault: true },
{ key: 'Mod-i', run: toggleItalic, preventDefault: true },
{ key: 'Mod-k', run: insertLink, preventDefault: true },
]),
),
markdownTheme,
livePreview,
codeBlockHighlight,