AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.
HTML ai-agentcloudflarecloudflare-d1cloudflare-r2cloudflare-workersdockerelectronevernoteevernote-alternativeknowledge-basemcpnote-takingobsidian-alternativeoffline-firstpersonal-knowledge-basepwaself-hostedsqlitetiptapweb-clipper
export type PendingEditorInsertFiles = {
memoId: string;
files: File[];
};
export const pendingEditorInsertMatchesMemo = (
pendingInsertFiles: PendingEditorInsertFiles | null | undefined,
memoId: string | null | undefined,
memoAliases?: ReadonlySet<string>,
) => Boolean(
pendingInsertFiles
&& memoId
&& (
pendingInsertFiles.memoId === memoId
|| Boolean(memoAliases?.has(pendingInsertFiles.memoId))
),
);
export const usablePendingInsertFiles = (
pendingInsertFiles: PendingEditorInsertFiles | null | undefined,
) => (pendingInsertFiles?.files ?? []).filter((file) => file.size > 0);
export const shouldInsertPendingEditorFiles = ({
pendingInsertFiles,
memoId,
memoAliases,
editorHydratedForMemo,
editorReady,
readOnly,
}: {
pendingInsertFiles?: PendingEditorInsertFiles | null;
memoId?: string | null;
memoAliases?: ReadonlySet<string>;
editorHydratedForMemo: boolean;
editorReady: boolean;
readOnly: boolean;
}) => Boolean(
pendingEditorInsertMatchesMemo(pendingInsertFiles, memoId, memoAliases)
&& editorHydratedForMemo
&& editorReady
&& !readOnly
&& usablePendingInsertFiles(pendingInsertFiles).length > 0
);