fix search

This commit is contained in:
beo3000 2026-03-02 19:02:20 +01:00
parent b7489e80b8
commit 3a4fc0e8e0
12 changed files with 72 additions and 42 deletions

View File

@ -1 +1 @@
1.2.10
1.2.14

View File

@ -46,6 +46,7 @@ ul.tree-list li {
/* Markdown content */
.markdown-content {
@apply prose prose-sm prose-invert max-w-none;
overflow-wrap: anywhere;
}
.markdown-content pre {
@ -173,6 +174,7 @@ ul.tree-list li {
.ka-editor-wrapper .ProseMirror {
@apply prose prose-sm prose-invert max-w-none p-2.5 outline-none;
overflow-wrap: anywhere;
}
.ka-editor-wrapper .ProseMirror p.is-editor-empty:first-child::before {

View File

@ -1,18 +1,22 @@
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
<link rel="icon" type="image/png" href="%sveltekit.assets%/icon-192.png" />
<link rel="manifest" href="/manifest.webmanifest" />
<link rel="apple-touch-icon" href="%sveltekit.assets%/icon-192.png" />
<meta name="theme-color" content="#1a1a22" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<title>KaNote</title>
%sveltekit.head%
</head>
<body class="bg-bg text-[#e0e0e0] m-0 p-0">
<div id="svelte">%sveltekit.body%</div>
</body>
</html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
<link rel="icon" type="image/svg+xml" href="%sveltekit.assets%/favicon.svg" />
<link rel="icon" type="image/png" sizes="32x32" href="%sveltekit.assets%/favicon-32.png" />
<link rel="manifest" href="/manifest.webmanifest" />
<link rel="apple-touch-icon" href="%sveltekit.assets%/icon-192.png" />
<meta name="theme-color" content="#1a1a22" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<title>KaNote</title>
%sveltekit.head%
</head>
<body class="bg-bg text-[#e0e0e0] m-0 p-0">
<div id="svelte">%sveltekit.body%</div>
</body>
</html>

View File

@ -56,7 +56,7 @@
const res = await authFetch(`/api/search?q=${encodeURIComponent(q)}&limit=${limit}`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const data = await res.json() as {
history: { id: string; topicId: string; date: string; snippet: string }[];
history: { id: string; topicId: string; contextId: string; date: string; snippet: string }[];
pages: { id: string; title: string; snippet: string }[];
};
const localPageIds = new Set(
@ -65,17 +65,21 @@
.map((p) => p.id),
);
const combined: ServerResult[] = [
...data.history.map((h) => ({
id: `hist-${h.id}`,
type: "nav-history" as const,
icon: "📓",
label: h.snippet.replace(/<[^>]+>/g, ""),
badge: `JOURNAL ${h.date}`,
action: () => {
closeBar();
goto(`/context/daily-log?date=${h.date}`);
},
})),
...data.history.map((h) => {
const isJournal = h.topicId === 'daily-log-journal';
const targetContextId = isJournal ? 'daily-log' : h.contextId;
return {
id: `hist-${h.id}`,
type: "nav-history" as const,
icon: isJournal ? "📓" : "📋",
label: h.snippet.replace(/<[^>]+>/g, ""),
badge: isJournal ? `JOURNAL ${h.date}` : `MEETING ${h.date}`,
action: () => {
closeBar();
goto(`/context/${targetContextId}?date=${h.date}`);
},
};
}),
...data.pages
.filter((p) => !localPageIds.has(p.id))
.map((p) => ({

View File

@ -36,6 +36,7 @@
let entryText = $state('');
let entryEditor: MarkdownEditor;
let selectedDate = $state(initialDate ?? today());
$effect(() => { if (initialDate) selectedDate = initialDate; });
let selectedLinkedContextId = $state('');
let wiedervorlageChecked = $state(true);
let meetingPickerOpen = $state(false);

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -1,10 +1,25 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<defs>
<linearGradient id="bg" x1="0" y1="0" x2="1" y2="1">
<stop offset="0%" stop-color="#3366ff"/>
<stop offset="100%" stop-color="#8b5cf6"/>
<linearGradient id="txt" x1="0" y1="0" x2="0" y2="1">
<stop offset="0%" stop-color="#ffdd44"/>
<stop offset="30%" stop-color="#ff9900"/>
<stop offset="65%" stop-color="#dd4400"/>
<stop offset="100%" stop-color="#881100"/>
</linearGradient>
<filter id="glow" x="-40%" y="-40%" width="180%" height="180%">
<feGaussianBlur in="SourceGraphic" stdDeviation="1.2" result="blur"/>
<feColorMatrix in="blur" type="matrix"
values="1 0 0 0 0.2
0 0.3 0 0 0
0 0 0 0 0
0 0 0 0.6 0" result="colored"/>
<feMerge>
<feMergeNode in="colored"/>
<feMergeNode in="SourceGraphic"/>
</feMerge>
</filter>
</defs>
<rect width="32" height="32" rx="6" fill="url(#bg)"/>
<text x="16" y="23.5" font-family="'Inter', 'Segoe UI', sans-serif" font-size="17" font-weight="800" fill="white" text-anchor="middle" letter-spacing="-1">KA</text>
<text x="16" y="24" font-family="'Segoe UI','Helvetica','Arial',sans-serif" font-size="21"
font-weight="700" fill="url(#txt)" text-anchor="middle" letter-spacing="0"
filter="url(#glow)">KA</text>
</svg>

Before

Width:  |  Height:  |  Size: 485 B

After

Width:  |  Height:  |  Size: 1009 B

View File

@ -16,8 +16,8 @@ export default defineConfig({
background_color: '#1a1a22',
theme_color: '#1a1a22',
icons: [
{ src: '/icon-192.png', sizes: '192x192', type: 'image/png' },
{ src: '/icon-512.png', sizes: '512x512', type: 'image/png', purpose: 'any maskable' }
{ src: '/icon-192.png', sizes: '192x192', type: 'image/png', purpose: 'any' },
{ src: '/icon-512.png', sizes: '512x512', type: 'image/png', purpose: 'maskable' }
]
},
workbox: {

Binary file not shown.

Binary file not shown.

View File

@ -100,6 +100,7 @@ export async function getCalendarEvents(
: raw;
return md
.replace(CAUTION_BANNER, '')
.replace(/(?:\\?[-_=*~]){10,}/g, '\n\n---\n\n')
.replace(/\n{3,}/g, '\n\n')
.trim();
}

View File

@ -7,6 +7,7 @@ const search = new Hono<AuthEnv>();
interface HistoryResult {
id: string;
topicId: string;
contextId: string;
date: string;
snippet: string;
}
@ -19,14 +20,16 @@ interface PageResult {
const stmtSearchHistory = sqlite.prepare(`
SELECT
id,
topic_id AS topicId,
date,
fts.id,
fts.topic_id AS topicId,
COALESCE(t.context_id, '') AS contextId,
fts.date,
snippet(fts_history, 2, '<mark>', '</mark>', '...', 12) AS snippet
FROM fts_history
FROM fts_history fts
LEFT JOIN topics t ON t.id = fts.topic_id
WHERE fts_history MATCH ?
AND user_id = ?
AND id NOT IN (
AND fts.user_id = ?
AND fts.id NOT IN (
SELECT id FROM history_entries WHERE deleted_at IS NOT NULL AND user_id = ?
)
ORDER BY rank