Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

Polish mobile notebook selector

yoma381e0da4b95d
diff --git a/apps/web/src/mobile-edit.tsx b/apps/web/src/mobile-edit.tsx
index 9e36087b..f945f9a1 100644
--- a/apps/web/src/mobile-edit.tsx
+++ b/apps/web/src/mobile-edit.tsx
@@ -4,7 +4,7 @@ import { EditorContent, useEditor } from "@tiptap/react";
import StarterKit from "@tiptap/starter-kit";
import Image from "@tiptap/extension-image";
import Placeholder from "@tiptap/extension-placeholder";
-import { Bold, ImagePlus, List, Minus, Quote } from "lucide-react";
+import { Bold, Check, ChevronDown, ImagePlus, List, Minus, Quote } from "lucide-react";
import { docToMarkdown, emptyDoc, markdownToDoc, type MemoDetail, type Notebook, type Resource, type TiptapDoc } from "@edgeever/shared";
import { getNotebookMoveOptions } from "@/lib/app-helpers";
import { compressImageForUpload } from "@/lib/image-compression";
@@ -104,6 +104,7 @@ const MobileTiptapEditorApp = () => {
const memoRef = useRef<MemoDetail | null>(null);
const [notebooks, setNotebooks] = useState<Notebook[]>([]);
const [notebookUpdatePending, setNotebookUpdatePending] = useState(false);
+ const [notebookSheetOpen, setNotebookSheetOpen] = useState(false);
const [title, setTitle] = useState("");
const titleRef = useRef("");
const [tagsText, setTagsText] = useState("");
@@ -411,6 +412,7 @@ const MobileTiptapEditorApp = () => {
setSaveStateStable("error");
} finally {
setNotebookUpdatePending(false);
+ setNotebookSheetOpen(false);
}
};
@@ -624,6 +626,8 @@ const MobileTiptapEditorApp = () => {
: "";
const editorActionDisabled =
!memo || !editor || saveState === "loading" || saveState === "compressing" || saveState === "uploading" || saveState === "leaving";
+ const currentNotebookLabel =
+ notebookOptions.find((notebook) => notebook.id === memo?.notebookId)?.name ?? (notebookOptions.length === 0 ? "等待分类" : "笔记本");
const fallbackMarkdown = memo ? docToMarkdown(contentJsonRef.current) : "";
@@ -662,23 +666,16 @@ const MobileTiptapEditorApp = () => {
onChange={(event) => handleTitleChange(event.target.value)}
/>
<div className="mobile-editor-meta-row">
- <select
- className="mobile-editor-notebook-select"
- value={memo?.notebookId ?? ""}
+ <button
+ className="mobile-editor-notebook-button"
+ type="button"
aria-label="所在笔记本"
disabled={!memo || notebookUpdatePending || saveState === "loading" || notebookOptions.length === 0}
- onChange={(event) => void handleNotebookChange(event.target.value)}
+ onClick={() => setNotebookSheetOpen(true)}
>
- {notebookOptions.length === 0 ? (
- <option value={memo?.notebookId ?? ""}>等待分类</option>
- ) : (
- notebookOptions.map((notebook) => (
- <option key={notebook.id} value={notebook.id}>
- {notebook.selectLabel}
- </option>
- ))
- )}
- </select>
+ <span>{currentNotebookLabel}</span>
+ <ChevronDown aria-hidden="true" size={14} strokeWidth={2.2} />
+ </button>
<input
className="mobile-editor-tags"
value={tagsText}
@@ -762,6 +759,46 @@ const MobileTiptapEditorApp = () => {
}}
/>
+ {notebookSheetOpen && (
+ <div className="mobile-editor-sheet-backdrop" role="presentation" onClick={() => setNotebookSheetOpen(false)}>
+ <section
+ className="mobile-editor-notebook-sheet"
+ role="dialog"
+ aria-modal="true"
+ aria-label="选择笔记本"
+ onClick={(event) => event.stopPropagation()}
+ >
+ <div className="mobile-editor-notebook-sheet-handle" aria-hidden="true" />
+ <div className="mobile-editor-notebook-sheet-header">
+ <h2>所在笔记本</h2>
+ <button type="button" onClick={() => setNotebookSheetOpen(false)}>
+ 关闭
+ </button>
+ </div>
+ <div className="mobile-editor-notebook-list">
+ {notebookOptions.map((notebook) => {
+ const selected = notebook.id === memo?.notebookId;
+
+ return (
+ <button
+ key={notebook.id}
+ className="mobile-editor-notebook-option"
+ type="button"
+ aria-current={selected ? "page" : undefined}
+ disabled={notebookUpdatePending}
+ style={{ paddingLeft: `${16 + notebook.depth * 18}px` }}
+ onClick={() => void handleNotebookChange(notebook.id)}
+ >
+ <span>{notebook.name}</span>
+ {selected && <Check aria-hidden="true" size={16} strokeWidth={2.4} />}
+ </button>
+ );
+ })}
+ </div>
+ </section>
+ </div>
+ )}
+
<div className="edgeever-mobile-tiptap-editor">
<EditorContent editor={editor} />
</div>
diff --git a/apps/web/src/styles/mobile-markdown-editor.css b/apps/web/src/styles/mobile-markdown-editor.css
index 52ad22ff..6a81bc19 100644
--- a/apps/web/src/styles/mobile-markdown-editor.css
+++ b/apps/web/src/styles/mobile-markdown-editor.css
@@ -24,8 +24,7 @@ body {
}
button,
-input,
-select {
+input {
font: inherit;
}
@@ -125,8 +124,7 @@ select {
}
.mobile-editor-title,
-.mobile-editor-tags,
-.mobile-editor-notebook-select {
+.mobile-editor-tags {
width: 100%;
border: 0;
background: #fff;
@@ -156,20 +154,36 @@ select {
min-width: 0;
}
-.mobile-editor-notebook-select {
+.mobile-editor-notebook-button {
+ display: inline-flex;
+ align-items: center;
+ gap: 3px;
flex: 0 1 auto;
max-width: 46%;
- min-width: 7.5rem;
+ min-width: 0;
+ height: 30px;
+ border: 0;
border-radius: 8px;
- background: #f8fafc;
- color: #475569;
+ background: transparent;
+ color: #64748b;
font-size: 15px;
font-weight: 650;
- line-height: 1.5;
- padding: 5px 26px 5px 8px;
+ line-height: 1;
+ padding: 0 5px 0 0;
+}
+
+.mobile-editor-notebook-button span {
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.mobile-editor-notebook-button:active {
+ color: #047857;
}
-.mobile-editor-notebook-select:disabled {
+.mobile-editor-notebook-button:disabled {
color: #94a3b8;
}
@@ -223,6 +237,97 @@ select {
color: #334155;
}
+.mobile-editor-sheet-backdrop {
+ position: fixed;
+ inset: 0;
+ z-index: 30;
+ display: flex;
+ align-items: flex-end;
+ background: rgb(15 23 42 / 0.22);
+}
+
+.mobile-editor-notebook-sheet {
+ width: 100%;
+ max-height: 68dvh;
+ overflow: hidden;
+ border-radius: 18px 18px 0 0;
+ background: #fff;
+ box-shadow: 0 -18px 45px rgb(15 23 42 / 0.16);
+ padding: 8px 0 max(10px, env(safe-area-inset-bottom));
+}
+
+.mobile-editor-notebook-sheet-handle {
+ width: 38px;
+ height: 4px;
+ border-radius: 999px;
+ background: #cbd5e1;
+ margin: 2px auto 8px;
+}
+
+.mobile-editor-notebook-sheet-header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 12px;
+ border-bottom: 1px solid #f1f5f9;
+ padding: 0 16px 10px;
+}
+
+.mobile-editor-notebook-sheet-header h2 {
+ margin: 0;
+ color: #0f172a;
+ font-size: 16px;
+ font-weight: 750;
+}
+
+.mobile-editor-notebook-sheet-header button {
+ border: 0;
+ border-radius: 999px;
+ background: #f8fafc;
+ color: #64748b;
+ font-size: 14px;
+ font-weight: 650;
+ padding: 6px 10px;
+}
+
+.mobile-editor-notebook-list {
+ max-height: calc(68dvh - 4.5rem - env(safe-area-inset-bottom));
+ overflow-y: auto;
+ padding: 8px;
+}
+
+.mobile-editor-notebook-option {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 12px;
+ width: 100%;
+ min-height: 44px;
+ border: 0;
+ border-radius: 10px;
+ background: transparent;
+ color: #334155;
+ font-size: 16px;
+ font-weight: 600;
+ text-align: left;
+}
+
+.mobile-editor-notebook-option span {
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.mobile-editor-notebook-option[aria-current="page"] {
+ background: #ecfdf5;
+ color: #047857;
+}
+
+.mobile-editor-notebook-option:active {
+ background: #f1f5f9;
+}
+
.edgeever-mobile-tiptap-editor {
min-height: calc(100dvh - 14rem);
margin: 0 -12px;