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:
1 parent
eb63b14c8e
commit
91da6e116e
14 files changed
+565
-68
No files matched your search
@@ -53,3 +53,15 @@ export function fuzzyMatch(query: string, target: string, titleStart: number): F
|
||||
if (lower.slice(titleStart) === query.trim().toLowerCase()) score += 1000
|
||||
return { score, positions: [...positions].sort((a, b) => a - b) }
|
||||
}
|
||||
|
||||
/** 按命中与否把文本切成连续片段,用于高亮 */
|
||||
export function segments(text: string, hits: Set<number>) {
|
||||
const out: { text: string; hit: boolean }[] = []
|
||||
for (let i = 0; i < text.length; i++) {
|
||||
const hit = hits.has(i)
|
||||
const last = out[out.length - 1]
|
||||
if (last?.hit === hit) last.text += text[i]
|
||||
else out.push({ text: text[i], hit })
|
||||
}
|
||||
return out
|
||||
}
|
||||
Reference in new issue
Block a user