Skip to content

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

Polish memo selection and pinning interactions

tianma202e795ca6ba
diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts
index 928e0fee..c6aadcaf 100644
--- a/apps/api/src/index.ts
+++ b/apps/api/src/index.ts
@@ -1057,6 +1057,32 @@ app.patch("/api/v1/memos/:id", zValidator("json", MemoUpdateSchema), async (c) =
);
}
+ const isPinned = input.isPinned ?? Boolean(current.is_pinned);
+ const hasContentUpdate =
+ input.notebookId !== undefined ||
+ input.title !== undefined ||
+ input.contentJson !== undefined ||
+ input.contentMarkdown !== undefined ||
+ input.tags !== undefined;
+ const now = isoNow();
+
+ if (!hasContentUpdate) {
+ if (input.isPinned === undefined || isPinned === Boolean(current.is_pinned)) {
+ return c.json({ memo: await getMemoDetail(c.env.DB, id) });
+ }
+
+ await c.env.DB.batch([
+ c.env.DB.prepare(
+ `UPDATE memos
+ SET is_pinned = ?, updated_by = ?, updated_at = ?
+ WHERE id = ? AND is_deleted = 0`
+ ).bind(isPinned ? 1 : 0, actorLabel, now, id),
+ auditStatement(c.env.DB, actor.actorType, actor.actorId, isPinned ? "memo.pin" : "memo.unpin", "memo", id, {}),
+ ]);
+
+ return c.json({ memo: await getMemoDetail(c.env.DB, id) });
+ }
+
const currentContentJson = JSON.parse(current.content_json) as TiptapDoc;
const contentJson = input.contentJson
? (input.contentJson as TiptapDoc)
@@ -1073,7 +1099,6 @@ app.patch("/api/v1/memos/:id", zValidator("json", MemoUpdateSchema), async (c) =
const notebookId = input.notebookId ?? current.notebook_id;
const nextRevision = current.revision + 1;
const contentHash = await sha256(contentMarkdown + JSON.stringify(contentJson));
- const now = isoNow();
const revisionStatements = (await shouldSnapshotMemoRevision(c.env.DB, current, title, JSON.stringify(tags), contentHash, now))
? [createMemoRevisionStatement(c.env.DB, current, actorLabel, now)]
: [];
@@ -1082,9 +1107,9 @@ app.patch("/api/v1/memos/:id", zValidator("json", MemoUpdateSchema), async (c) =
...revisionStatements,
c.env.DB.prepare(
`UPDATE memos
- SET notebook_id = ?, title = ?, excerpt = ?, tags_json = ?, updated_by = ?, updated_at = ?
+ SET notebook_id = ?, title = ?, excerpt = ?, tags_json = ?, is_pinned = ?, updated_by = ?, updated_at = ?
WHERE id = ? AND is_deleted = 0`
- ).bind(notebookId, title, excerpt, JSON.stringify(tags), actorLabel, now, id),
+ ).bind(notebookId, title, excerpt, JSON.stringify(tags), isPinned ? 1 : 0, actorLabel, now, id),
c.env.DB.prepare(
`UPDATE memo_contents
SET content_json = ?, content_markdown = ?, content_text = ?, content_hash = ?,
@@ -1463,7 +1488,7 @@ const MCP_TOOLS = [
},
{
name: "update_memo",
- description: "Update memo title, Markdown, tags, or notebook.",
+ description: "Update memo title, Markdown, tags, notebook, or pinned state.",
inputSchema: {
type: "object",
required: ["memoId"],
@@ -1471,6 +1496,7 @@ const MCP_TOOLS = [
properties: {
memoId: { type: "string" },
title: { type: "string" },
+ isPinned: { type: "boolean" },
contentMarkdown: { type: "string" },
tags: { type: "array", items: { type: "string" } },
notebookId: { type: "string" },
@@ -1596,6 +1622,7 @@ const callMcpTool = async (
: undefined,
notebookId: getOptionalString(args.notebookId) ?? undefined,
title: getOptionalString(args.title) ?? undefined,
+ isPinned: typeof args.isPinned === "boolean" ? args.isPinned : undefined,
contentMarkdown: getOptionalString(args.contentMarkdown) ?? undefined,
tags: Array.isArray(args.tags) ? getOptionalStringArray(args.tags) : undefined,
},
@@ -2787,6 +2814,7 @@ const updateMemoRecord = async (
expectedRevision?: number;
notebookId?: string;
title?: string;
+ isPinned?: boolean;
contentMarkdown?: string;
tags?: string[];
},
@@ -2803,6 +2831,45 @@ const updateMemoRecord = async (
return { error: "revision_conflict", message: "Memo was updated elsewhere. Reload before saving." };
}
+ const isPinned = input.isPinned ?? Boolean(current.is_pinned);
+ const hasContentUpdate =
+ input.notebookId !== undefined ||
+ input.title !== undefined ||
+ input.contentMarkdown !== undefined ||
+ input.tags !== undefined;
+ const now = isoNow();
+
+ if (!hasContentUpdate) {
+ if (input.isPinned === undefined || isPinned === Boolean(current.is_pinned)) {
+ const memo = await getMemoDetail(db, id);
+
+ if (!memo) {
+ return { error: "not_found", message: "Memo not found after update" };
+ }
+
+ return { memo };
+ }
+
+ await db.batch([
+ db
+ .prepare(
+ `UPDATE memos
+ SET is_pinned = ?, updated_by = ?, updated_at = ?
+ WHERE id = ? AND is_deleted = 0`
+ )
+ .bind(isPinned ? 1 : 0, actorLabel, now, id),
+ auditStatement(db, actor.actorType, actor.actorId, isPinned ? "memo.pin" : "memo.unpin", "memo", id, {}),
+ ]);
+
+ const memo = await getMemoDetail(db, id);
+
+ if (!memo) {
+ return { error: "not_found", message: "Memo not found after update" };
+ }
+
+ return { memo };
+ }
+
const currentContentJson = parseDoc(current.content_json);
const contentJson = input.contentMarkdown !== undefined ? markdownToDoc(input.contentMarkdown) : currentContentJson;
const contentMarkdown =
@@ -2815,7 +2882,6 @@ const updateMemoRecord = async (
const notebookId = input.notebookId ?? current.notebook_id;
const nextRevision = current.revision + 1;
const contentHash = await sha256(contentMarkdown + JSON.stringify(contentJson));
- const now = isoNow();
const revisionStatements = (await shouldSnapshotMemoRevision(db, current, title, JSON.stringify(tags), contentHash, now))
? [createMemoRevisionStatement(db, current, actorLabel, now)]
: [];
@@ -2825,10 +2891,10 @@ const updateMemoRecord = async (
db
.prepare(
`UPDATE memos
- SET notebook_id = ?, title = ?, excerpt = ?, tags_json = ?, updated_by = ?, updated_at = ?
+ SET notebook_id = ?, title = ?, excerpt = ?, tags_json = ?, is_pinned = ?, updated_by = ?, updated_at = ?
WHERE id = ? AND is_deleted = 0`
)
- .bind(notebookId, title, excerpt, JSON.stringify(tags), actorLabel, now, id),
+ .bind(notebookId, title, excerpt, JSON.stringify(tags), isPinned ? 1 : 0, actorLabel, now, id),
db
.prepare(
`UPDATE memo_contents
diff --git a/apps/web/src/app/App.tsx b/apps/web/src/app/App.tsx
index baf78aa8..52a36fc3 100644
--- a/apps/web/src/app/App.tsx
+++ b/apps/web/src/app/App.tsx
@@ -524,6 +524,50 @@ const WorkspaceApp = ({
},
});
+ const pinMemosMutation = useMutation({
+ mutationFn: async ({ memoIds, isPinned }: { memoIds: string[]; isPinned: boolean }) =>
+ Promise.all(memoIds.map((memoId) => api.updateMemo(memoId, { isPinned }))),
+ onMutate: async ({ memoIds, isPinned }) => {
+ await Promise.all([
+ queryClient.cancelQueries({ queryKey: ["memos"] }),
+ queryClient.cancelQueries({ queryKey: ["memo"] }),
+ ]);
+
+ const memoIdSet = new Set(memoIds);
+ const previousMemoQueries = queryClient.getQueriesData<{ memos: MemoSummary[] }>({ queryKey: ["memos"] });
+ const previousMemoDetailQueries = queryClient.getQueriesData<{ memo: MemoDetail }>({ queryKey: ["memo"] });
+
+ queryClient.setQueriesData<{ memos: MemoSummary[] }>({ queryKey: ["memos"] }, (current) =>
+ current
+ ? {
+ memos: current.memos.map((memo) => (memoIdSet.has(memo.id) ? { ...memo, isPinned } : memo)),
+ }
+ : current
+ );
+ queryClient.setQueriesData<{ memo: MemoDetail }>({ queryKey: ["memo"] }, (current) =>
+ current && memoIdSet.has(current.memo.id)
+ ? {
+ memo: { ...current.memo, isPinned },
+ }
+ : current
+ );
+
+ return { previousMemoQueries, previousMemoDetailQueries };
+ },
+ onError: (_error, _variables, context) => {
+ context?.previousMemoQueries.forEach(([queryKey, data]) => {
+ queryClient.setQueryData(queryKey, data);
+ });
+ context?.previousMemoDetailQueries.forEach(([queryKey, data]) => {
+ queryClient.setQueryData(queryKey, data);
+ });
+ },
+ onSuccess: async () => {
+ await queryClient.invalidateQueries({ queryKey: ["memos"] });
+ await queryClient.invalidateQueries({ queryKey: ["memo"] });
+ },
+ });
+
const deleteMemosMutation = useMutation({
mutationFn: api.deleteMemos,
onSuccess: async (_, variables) => {
@@ -672,6 +716,33 @@ const WorkspaceApp = ({
});
};
+ const handleToggleMemoPinned = (memo: MemoSummary) => {
+ if (memoView === "trash") {
+ return;
+ }
+
+ pinMemosMutation.mutate({
+ memoIds: [memo.id],
+ isPinned: !memo.isPinned,
+ });
+ };
+
+ const handlePinSelectedMemos = (isPinned: boolean) => {
+ if (selectedMemoIds.size === 0 || memoView === "trash") {
+ return;
+ }
+
+ pinMemosMutation.mutate(
+ {
+ memoIds: Array.from(selectedMemoIds),
+ isPinned,
+ },
+ {
+ onSuccess: clearMemoSelection,
+ }
+ );
+ };
+
const handleMerge = () => {
if (selectedMemoIds.size < 2 || memoView === "trash") {
return;
@@ -901,6 +972,7 @@ const WorkspaceApp = ({
isCreating={createMemoMutation.isPending}
isMerging={mergeMutation.isPending}
isMoving={moveMemosMutation.isPending}
+ isPinning={pinMemosMutation.isPending}
isDeleting={deleteMemosMutation.isPending || deleteMemoMutation.isPending}
isOnline={isOnline}
isSyncingQueuedChanges={isSyncingQueuedChanges}
@@ -948,6 +1020,8 @@ const WorkspaceApp = ({
onDeleteMemo={handleDeleteMemoFromList}
onRestoreMemo={handleRestoreMemoFromList}
onMoveMemo={handleMoveMemoFromList}
+ onTogglePinMemo={handleToggleMemoPinned}
+ onPinSelectedMemos={handlePinSelectedMemos}
onDeleteSelectedMemos={handleDeleteSelectedMemos}
onMoveSelectedMemos={handleMoveSelectedMemos}
onSyncQueuedChanges={() => void runQueuedSync()}
@@ -2286,25 +2360,33 @@ const MobileNotebookSelectSheet = ({
const MobileSelectionMoreSheet = ({
canMerge,
+ canPin,
canToggleVisibleSelection,
mergeTitle,
+ pinLabel,
+ pinTitle,
selectedCount,
selectionToggleLabel,
selectionToggleTitle,
onClearSelection,
onClose,
onMerge,
+ onPin,
onToggleVisibleSelection,
}: {
canMerge: boolean;
+ canPin: boolean;
canToggleVisibleSelection: boolean;
mergeTitle: string;
+ pinLabel: string;
+ pinTitle: string;
selectedCount: number;
selectionToggleLabel: string;
selectionToggleTitle: string;
onClearSelection: () => void;
onClose: () => void;
onMerge: () => void;
+ onPin: () => void;
onToggleVisibleSelection: () => void;
}) => (
<div className="fixed inset-0 z-50 bg-slate-950/25 px-3 pb-[calc(5.25rem+env(safe-area-inset-bottom))] lg:hidden" onClick={onClose}>
@@ -2342,6 +2424,16 @@ const MobileSelectionMoreSheet = ({
<Merge className="h-4 w-4" />
合并笔记
</button>
+ <button
+ className="flex h-12 w-full items-center gap-3 border-b border-slate-100 px-4 text-left text-sm font-medium text-slate-800 transition hover:bg-slate-50 disabled:cursor-not-allowed disabled:text-slate-300 disabled:opacity-100 disabled:hover:bg-transparent"
+ type="button"
+ disabled={!canPin}
+ title={pinTitle}
+ onClick={onPin}
+ >
+ <Star className="h-4 w-4" />
+ {pinLabel}
+ </button>
<button
className="flex h-12 w-full items-center gap-3 px-4 text-left text-sm font-medium text-slate-800 transition hover:bg-slate-50"
type="button"
@@ -2515,6 +2607,7 @@ const MemoListPane = ({
isCreating,
isMerging,
isMoving,
+ isPinning,
isDeleting,
isOnline,
isSyncingQueuedChanges,
@@ -2537,6 +2630,8 @@ const MemoListPane = ({
onDeleteMemo,
onRestoreMemo,
onMoveMemo,
+ onTogglePinMemo,
+ onPinSelectedMemos,
onDeleteSelectedMemos,
onMoveSelectedMemos,
onSyncQueuedChanges,
@@ -2556,6 +2651,7 @@ const MemoListPane = ({
isCreating: boolean;
isMerging: boolean;
isMoving: boolean;
+ isPinning: boolean;
isDeleting: boolean;
isOnline: boolean;
isSyncingQueuedChanges: boolean;
@@ -2578,6 +2674,8 @@ const MemoListPane = ({
onDeleteMemo: (memoId: string) => void;
onRestoreMemo: (memoId: string) => void;
onMoveMemo: (memoId: string, targetNotebookId: string) => void;
+ onTogglePinMemo: (memo: MemoSummary) => void;
+ onPinSelectedMemos: (isPinned: boolean) => void;
onDeleteSelectedMemos: () => void;
onMoveSelectedMemos: (notebookId: string) => void;
onSyncQueuedChanges: () => void;
@@ -2598,10 +2696,11 @@ const MemoListPane = ({
const filterOptions = MEMO_FILTER_OPTIONS;
const mobileFilterOptions = useMemo(() => filterOptions.filter((option) => option.value !== "all"), [filterOptions]);
const filteredMemos = useMemo(() => filterMemos(memos, filterMode), [filterMode, memos]);
- const sortedMemos = useMemo(() => sortMemos(filteredMemos, sortMode), [filteredMemos, sortMode]);
+ const sortedMemos = useMemo(() => sortMemos(filteredMemos, sortMode, view !== "trash"), [filteredMemos, sortMode, view]);
const visibleMemoIds = useMemo(() => sortedMemos.map((memo) => memo.id), [sortedMemos]);
const memoGroups = useMemo(() => groupMemos(sortedMemos, sortMode), [sortedMemos, sortMode]);
const moveNotebookOptions = useMemo(() => getNotebookMoveOptions(notebooks), [notebooks]);
+ const selectedMemosInList = useMemo(() => memos.filter((memo) => selectedMemoIds.has(memo.id)), [memos, selectedMemoIds]);
const searchInputRef = useRef<HTMLInputElement | null>(null);
const listScrollRef = useRef<HTMLDivElement | null>(null);
const canEnterSelectionMode = visibleMemoIds.length > 0;
@@ -2633,6 +2732,17 @@ const MemoListPane = ({
selectedMemoIds.size === 0 ? "请选择笔记" : isDeleting ? "正在删除" : view === "trash" ? "永久删除" : "删除";
const selectionMergeTitle =
selectedMemoIds.size < 2 ? "至少选择 2 条笔记" : view === "trash" ? "回收站内不可合并" : isMerging ? "正在合并" : "合并笔记";
+ const allSelectedMemosPinned = selectedMemosInList.length > 0 && selectedMemosInList.every((memo) => memo.isPinned);
+ const selectedPinTarget = !allSelectedMemosPinned;
+ const selectionPinLabel = allSelectedMemosPinned ? "取消置顶" : "置顶";
+ const selectionPinTitle =
+ selectedMemoIds.size === 0
+ ? "请选择笔记"
+ : view === "trash"
+ ? "回收站内不可置顶"
+ : isPinning
+ ? "正在更新置顶"
+ : selectionPinLabel;
const selectionToggleTitle = canToggleVisibleMemoSelection ? visibleSelectionToggleLabel : "当前列表没有可选择的笔记";
const moveTargetTitle =
view === "trash" ? "回收站内不可移动" : notebooks.length === 0 ? "没有可移动的笔记本" : isMoving ? "正在移动" : "移动到笔记本";
@@ -2665,6 +2775,26 @@ const MemoListPane = ({
}
}, [filterMode, filterOptions]);
+ useEffect(() => {
+ if (!selectionMode || selectedMemoIds.size === 0) {
+ return;
+ }
+
+ const visibleMemoIdSet = new Set(visibleMemoIds);
+ const nextSelectedMemoIds = Array.from(selectedMemoIds).filter((memoId) => visibleMemoIdSet.has(memoId));
+
+ if (nextSelectedMemoIds.length === selectedMemoIds.size) {
+ return;
+ }
+
+ if (nextSelectedMemoIds.length === 0) {
+ onClearSelection();
+ return;
+ }
+
+ onReplaceSelection(nextSelectedMemoIds);
+ }, [onClearSelection, onReplaceSelection, selectedMemoIds, selectionMode, visibleMemoIds]);
+
useEffect(() => {
if (!selectedMemoId || !visibleMemoIds.includes(selectedMemoId) || !window.matchMedia("(min-width: 1024px)").matches) {
return;
@@ -2756,16 +2886,31 @@ const MemoListPane = ({
};
const handleClearSearch = () => {
+ onClearSelection();
onSearch("");
searchInputRef.current?.focus();
};
+ const handleSearchChange = (value: string) => {
+ if (value !== search) {
+ onClearSelection();
+ }
+
+ onSearch(value);
+ };
+
const handleResetListConstraints = () => {
+ onClearSelection();
setFilterMode("all");
onSearch("");
searchInputRef.current?.focus();
};
+ const handleFilterModeChange = (value: MemoFilterMode) => {
+ onClearSelection();
+ setFilterMode(value);
+ };
+
const handleListDensityChange = (value: MemoListDensity) => {
setListDensity(value);
writeMemoListDensityPreference(value);
@@ -2954,7 +3099,7 @@ const MemoListPane = ({
className="flex h-9 w-full items-center gap-2 px-3 text-left text-sm text-slate-700 transition hover:bg-slate-50"
type="button"
onClick={() => {
- setFilterMode(option.value);
+ handleFilterModeChange(option.value);
setDesktopFilterOpen(false);
}}
>
@@ -3109,7 +3254,7 @@ const MemoListPane = ({
<input
ref={searchInputRef}
value={search}
- onChange={(event) => onSearch(event.target.value)}
+ onChange={(event) => handleSearchChange(event.target.value)}
onKeyDown={(event) => {
if (event.key === "Escape" && search) {
event.preventDefault();
@@ -3146,7 +3291,7 @@ const MemoListPane = ({
title={filterMode === option.value ? `取消${option.label}` : option.label}
aria-label={filterMode === option.value ? `取消${option.label}` : option.label}
aria-pressed={filterMode === option.value}
- onClick={() => setFilterMode(filterMode === option.value ? "all" : option.value)}
+ onClick={() => handleFilterModeChange(filterMode === option.value ? "all" : option.value)}
>
{getMobileFilterIcon(option.value)}
</button>
@@ -3191,6 +3336,16 @@ const MemoListPane = ({
<X className="h-4 w-4" />
取消
</Button>
+ <Button
+ size="sm"
+ variant="ghost"
+ title={selectionPinTitle}
+ onClick={() => onPinSelectedMemos(selectedPinTarget)}
+ disabled={selectedMemoIds.size === 0 || isPinning || view === "trash"}
+ >
+ <Star className="h-4 w-4" />
+ {selectionPinLabel}
+ </Button>
<select
className="h-8 max-w-40 rounded-md border border-emerald-100 bg-emerald-50/70 px-2 text-xs text-emerald-900 outline-none disabled:opacity-50"
value={moveTargetNotebookId}
@@ -3322,6 +3477,22 @@ const MemoListPane = ({
<CheckSquare className="h-4 w-4" />
选择笔记
</button>
+ {view !== "trash" ? (
+ <button
+ className="flex h-9 w-full items-center gap-2 px-3 text-left text-sm text-slate-700 transition hover:bg-slate-50 disabled:cursor-not-allowed disabled:text-slate-300 disabled:hover:bg-transparent"
+ type="button"
+ disabled={isPinning}
+ title={isPinning ? "正在更新置顶" : memoContextMenu.memo.isPinned ? "取消置顶" : "置顶笔记"}
+ onClick={() => {
+ const { memo } = memoContextMenu;
+ setMemoContextMenu(null);
+ onTogglePinMemo(memo);
+ }}
+ >
+ <Star className={cn("h-4 w-4", memoContextMenu.memo.isPinned && "fill-current text-emerald-600")} />
+ {memoContextMenu.memo.isPinned ? "取消置顶" : "置顶笔记"}
+ </button>
+ ) : null}
<div className="my-1 h-px bg-slate-100" />
{view === "trash" ? (
<>
@@ -3468,8 +3639,11 @@ const MemoListPane = ({
{mobileMoreOpen ? (
<MobileSelectionMoreSheet
canMerge={selectedMemoIds.size >= 2 && view !== "trash" && !isMerging}
+ canPin={selectedMemoIds.size > 0 && view !== "trash" && !isPinning}
canToggleVisibleSelection={canToggleVisibleMemoSelection}
mergeTitle={selectionMergeTitle}
+ pinLabel={selectionPinLabel}
+ pinTitle={selectionPinTitle}
selectedCount={selectedMemoIds.size}
selectionToggleLabel={visibleSelectionToggleLabel}
selectionToggleTitle={selectionToggleTitle}
@@ -3491,14 +3665,22 @@ const MemoListPane = ({
setMobileMoreOpen(false);
onMerge();
}}
+ onPin={() => {
+ setMobileMoreOpen(false);
+ onPinSelectedMemos(selectedPinTarget);
+ }}
/>
) : null}
</div>
);
};
-const sortMemos = (memos: MemoSummary[], sortMode: MemoSortMode) =>
+const sortMemos = (memos: MemoSummary[], sortMode: MemoSortMode, prioritizePinned = true) =>
[...memos].sort((first, second) => {
+ if (prioritizePinned && first.isPinned !== second.isPinned) {
+ return first.isPinned ? -1 : 1;
+ }
+
if (sortMode === "title-asc") {
const titleCompare = getMemoTitle(first.title).localeCompare(getMemoTitle(second.title), "zh-CN", {
numeric: true,
@@ -3730,6 +3912,12 @@ const MemoCard = ({
return;
}
+ try {
+ event.currentTarget.setPointerCapture(event.pointerId);
+ } catch {
+ // Some browsers may already release capture during gesture cancellation.
+ }
+
clearLongPressTimer();
longPressPointRef.current = { x: event.clientX, y: event.clientY };
longPressTimerRef.current = window.setTimeout(() => {
@@ -3754,6 +3942,14 @@ const MemoCard = ({
const handlePointerEnd = (event: ReactPointerEvent<HTMLButtonElement>) => {
if (event.pointerType === "touch") {
+ try {
+ if (event.currentTarget.hasPointerCapture(event.pointerId)) {
+ event.currentTarget.releasePointerCapture(event.pointerId);
+ }
+ } catch {
+ // Gesture cancellation can race with pointer capture release.
+ }
+
resetLongPress();
}
};
@@ -3862,8 +4058,9 @@ const MemoCard = ({
onContextMenu={handleContextMenu}
title="Ctrl/Cmd 点击切换选择,Shift 点击连续选择,移动端长按进入选择"
>
- <div className={cn("mb-2 truncate text-base font-semibold leading-6 text-slate-900 lg:text-base", listDensity === "compact" && "mb-1")}>
- {memoTitle}
+ <div className={cn("mb-2 flex min-w-0 items-center gap-1.5 text-base font-semibold leading-6 text-slate-900 lg:text-base", listDensity === "compact" && "mb-1")}>
+ {memo.isPinned ? <Star className="h-4 w-4 shrink-0 fill-current text-emerald-600" /> : null}
+ <span className="min-w-0 truncate">{memoTitle}</span>
</div>
<div
className={cn(
diff --git a/apps/web/src/lib/api.ts b/apps/web/src/lib/api.ts
index 97d75a3c..4245c543 100644
--- a/apps/web/src/lib/api.ts
+++ b/apps/web/src/lib/api.ts
@@ -228,6 +228,7 @@ export const api = {
expectedRevision?: number;
notebookId?: string;
title?: string;
+ isPinned?: boolean;
contentJson?: TiptapDoc;
contentMarkdown?: string;
tags?: string[];
diff --git a/docs/openapi.json b/docs/openapi.json
index ee969496..1e3ead12 100644
--- a/docs/openapi.json
+++ b/docs/openapi.json
@@ -1185,6 +1185,9 @@
"type": "string",
"maxLength": 160
},
+ "isPinned": {
+ "type": "boolean"
+ },
"contentJson": {
"$ref": "#/components/schemas/TiptapDoc"
},
diff --git a/packages/shared/src/schemas.ts b/packages/shared/src/schemas.ts
index f768de8a..e18a7529 100644
--- a/packages/shared/src/schemas.ts
+++ b/packages/shared/src/schemas.ts
@@ -22,6 +22,7 @@ export const MemoUpdateSchema = z.object({
expectedRevision: z.number().int().min(0).optional(),
notebookId: z.string().trim().min(1).optional(),
title: z.string().trim().max(160).optional(),
+ isPinned: z.boolean().optional(),
contentJson: z.unknown().optional(),
contentMarkdown: z.string().optional(),
tags: z.array(z.string()).optional(),