fix search
This commit is contained in:
parent
b7489e80b8
commit
3a4fc0e8e0
|
|
@ -1 +1 @@
|
||||||
1.2.10
|
1.2.14
|
||||||
|
|
@ -46,6 +46,7 @@ ul.tree-list li {
|
||||||
/* Markdown content */
|
/* Markdown content */
|
||||||
.markdown-content {
|
.markdown-content {
|
||||||
@apply prose prose-sm prose-invert max-w-none;
|
@apply prose prose-sm prose-invert max-w-none;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
}
|
}
|
||||||
|
|
||||||
.markdown-content pre {
|
.markdown-content pre {
|
||||||
|
|
@ -173,6 +174,7 @@ ul.tree-list li {
|
||||||
|
|
||||||
.ka-editor-wrapper .ProseMirror {
|
.ka-editor-wrapper .ProseMirror {
|
||||||
@apply prose prose-sm prose-invert max-w-none p-2.5 outline-none;
|
@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 {
|
.ka-editor-wrapper .ProseMirror p.is-editor-empty:first-child::before {
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,22 @@
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="de">
|
<html lang="de">
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
<head>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
<meta charset="utf-8" />
|
||||||
<link rel="icon" type="image/png" href="%sveltekit.assets%/icon-192.png" />
|
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
||||||
<link rel="manifest" href="/manifest.webmanifest" />
|
<link rel="icon" type="image/svg+xml" href="%sveltekit.assets%/favicon.svg" />
|
||||||
<link rel="apple-touch-icon" href="%sveltekit.assets%/icon-192.png" />
|
<link rel="icon" type="image/png" sizes="32x32" href="%sveltekit.assets%/favicon-32.png" />
|
||||||
<meta name="theme-color" content="#1a1a22" />
|
<link rel="manifest" href="/manifest.webmanifest" />
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
<link rel="apple-touch-icon" href="%sveltekit.assets%/icon-192.png" />
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
<meta name="theme-color" content="#1a1a22" />
|
||||||
<title>KaNote</title>
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||||
%sveltekit.head%
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||||
</head>
|
<title>KaNote</title>
|
||||||
<body class="bg-bg text-[#e0e0e0] m-0 p-0">
|
%sveltekit.head%
|
||||||
<div id="svelte">%sveltekit.body%</div>
|
</head>
|
||||||
</body>
|
|
||||||
</html>
|
<body class="bg-bg text-[#e0e0e0] m-0 p-0">
|
||||||
|
<div id="svelte">%sveltekit.body%</div>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
|
@ -56,7 +56,7 @@
|
||||||
const res = await authFetch(`/api/search?q=${encodeURIComponent(q)}&limit=${limit}`);
|
const res = await authFetch(`/api/search?q=${encodeURIComponent(q)}&limit=${limit}`);
|
||||||
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
||||||
const data = await res.json() as {
|
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 }[];
|
pages: { id: string; title: string; snippet: string }[];
|
||||||
};
|
};
|
||||||
const localPageIds = new Set(
|
const localPageIds = new Set(
|
||||||
|
|
@ -65,17 +65,21 @@
|
||||||
.map((p) => p.id),
|
.map((p) => p.id),
|
||||||
);
|
);
|
||||||
const combined: ServerResult[] = [
|
const combined: ServerResult[] = [
|
||||||
...data.history.map((h) => ({
|
...data.history.map((h) => {
|
||||||
id: `hist-${h.id}`,
|
const isJournal = h.topicId === 'daily-log-journal';
|
||||||
type: "nav-history" as const,
|
const targetContextId = isJournal ? 'daily-log' : h.contextId;
|
||||||
icon: "📓",
|
return {
|
||||||
label: h.snippet.replace(/<[^>]+>/g, ""),
|
id: `hist-${h.id}`,
|
||||||
badge: `JOURNAL ${h.date}`,
|
type: "nav-history" as const,
|
||||||
action: () => {
|
icon: isJournal ? "📓" : "📋",
|
||||||
closeBar();
|
label: h.snippet.replace(/<[^>]+>/g, ""),
|
||||||
goto(`/context/daily-log?date=${h.date}`);
|
badge: isJournal ? `JOURNAL ${h.date}` : `MEETING ${h.date}`,
|
||||||
},
|
action: () => {
|
||||||
})),
|
closeBar();
|
||||||
|
goto(`/context/${targetContextId}?date=${h.date}`);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}),
|
||||||
...data.pages
|
...data.pages
|
||||||
.filter((p) => !localPageIds.has(p.id))
|
.filter((p) => !localPageIds.has(p.id))
|
||||||
.map((p) => ({
|
.map((p) => ({
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@
|
||||||
let entryText = $state('');
|
let entryText = $state('');
|
||||||
let entryEditor: MarkdownEditor;
|
let entryEditor: MarkdownEditor;
|
||||||
let selectedDate = $state(initialDate ?? today());
|
let selectedDate = $state(initialDate ?? today());
|
||||||
|
$effect(() => { if (initialDate) selectedDate = initialDate; });
|
||||||
let selectedLinkedContextId = $state('');
|
let selectedLinkedContextId = $state('');
|
||||||
let wiedervorlageChecked = $state(true);
|
let wiedervorlageChecked = $state(true);
|
||||||
let meetingPickerOpen = $state(false);
|
let meetingPickerOpen = $state(false);
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
|
|
@ -1,10 +1,25 @@
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
|
||||||
<defs>
|
<defs>
|
||||||
<linearGradient id="bg" x1="0" y1="0" x2="1" y2="1">
|
<linearGradient id="txt" x1="0" y1="0" x2="0" y2="1">
|
||||||
<stop offset="0%" stop-color="#3366ff"/>
|
<stop offset="0%" stop-color="#ffdd44"/>
|
||||||
<stop offset="100%" stop-color="#8b5cf6"/>
|
<stop offset="30%" stop-color="#ff9900"/>
|
||||||
|
<stop offset="65%" stop-color="#dd4400"/>
|
||||||
|
<stop offset="100%" stop-color="#881100"/>
|
||||||
</linearGradient>
|
</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>
|
</defs>
|
||||||
<rect width="32" height="32" rx="6" fill="url(#bg)"/>
|
<text x="16" y="24" font-family="'Segoe UI','Helvetica','Arial',sans-serif" font-size="21"
|
||||||
<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>
|
font-weight="700" fill="url(#txt)" text-anchor="middle" letter-spacing="0"
|
||||||
|
filter="url(#glow)">KA</text>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 485 B After Width: | Height: | Size: 1009 B |
|
|
@ -16,8 +16,8 @@ export default defineConfig({
|
||||||
background_color: '#1a1a22',
|
background_color: '#1a1a22',
|
||||||
theme_color: '#1a1a22',
|
theme_color: '#1a1a22',
|
||||||
icons: [
|
icons: [
|
||||||
{ src: '/icon-192.png', sizes: '192x192', type: 'image/png' },
|
{ src: '/icon-192.png', sizes: '192x192', type: 'image/png', purpose: 'any' },
|
||||||
{ src: '/icon-512.png', sizes: '512x512', type: 'image/png', purpose: 'any maskable' }
|
{ src: '/icon-512.png', sizes: '512x512', type: 'image/png', purpose: 'maskable' }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
workbox: {
|
workbox: {
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -100,6 +100,7 @@ export async function getCalendarEvents(
|
||||||
: raw;
|
: raw;
|
||||||
return md
|
return md
|
||||||
.replace(CAUTION_BANNER, '')
|
.replace(CAUTION_BANNER, '')
|
||||||
|
.replace(/(?:\\?[-_=*~]){10,}/g, '\n\n---\n\n')
|
||||||
.replace(/\n{3,}/g, '\n\n')
|
.replace(/\n{3,}/g, '\n\n')
|
||||||
.trim();
|
.trim();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ const search = new Hono<AuthEnv>();
|
||||||
interface HistoryResult {
|
interface HistoryResult {
|
||||||
id: string;
|
id: string;
|
||||||
topicId: string;
|
topicId: string;
|
||||||
|
contextId: string;
|
||||||
date: string;
|
date: string;
|
||||||
snippet: string;
|
snippet: string;
|
||||||
}
|
}
|
||||||
|
|
@ -19,14 +20,16 @@ interface PageResult {
|
||||||
|
|
||||||
const stmtSearchHistory = sqlite.prepare(`
|
const stmtSearchHistory = sqlite.prepare(`
|
||||||
SELECT
|
SELECT
|
||||||
id,
|
fts.id,
|
||||||
topic_id AS topicId,
|
fts.topic_id AS topicId,
|
||||||
date,
|
COALESCE(t.context_id, '') AS contextId,
|
||||||
|
fts.date,
|
||||||
snippet(fts_history, 2, '<mark>', '</mark>', '...', 12) AS snippet
|
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 ?
|
WHERE fts_history MATCH ?
|
||||||
AND user_id = ?
|
AND fts.user_id = ?
|
||||||
AND id NOT IN (
|
AND fts.id NOT IN (
|
||||||
SELECT id FROM history_entries WHERE deleted_at IS NOT NULL AND user_id = ?
|
SELECT id FROM history_entries WHERE deleted_at IS NOT NULL AND user_id = ?
|
||||||
)
|
)
|
||||||
ORDER BY rank
|
ORDER BY rank
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue