Skip to content

Edge-Drop is a clipboard shelf on the edge of your screen. Hover to open it. Drag files and images into any app, click to copy text and links. Free and open-source for Windows.

feat(notes): one searchable note per card replaces labels and tags

Deepender2560274030676f
diff --git a/electron/main/saveImages.ts b/electron/main/saveImages.ts
index 4892a4c..8486c9c 100644
--- a/electron/main/saveImages.ts
+++ b/electron/main/saveImages.ts
@@ -14,15 +14,15 @@ export interface SaveImagesDeps {
destDir: string
/** On-disk original for a stored image, or null when it is gone. */
resolveSource: (imageId: string, ext?: string) => string | null
- /** Default name when the item has no label (same names drag-out uses). */
+ /** Default name when the item has no note (same names drag-out uses). */
defaultName: (capturedAt: number, ext: string, img: ClipboardImageFields, index: number) => string
}
const RESERVED = /^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i
-/** A label as a Windows-safe file name base (no extension). */
-export function fileBaseFromLabel(label: string): string {
- let base = label
+/** A note as a Windows-safe file name base (no extension). */
+export function fileBaseFromNote(note: string): string {
+ let base = note
.replace(/[<>:"/\\|?*\u0000-\u001f]/g, '_')
.replace(/\s+/g, ' ')
.trim()
@@ -54,14 +54,14 @@ export function saveItemImages(item: ClipboardItem, deps: SaveImagesDeps): strin
if (images.length === 0) return []
mkdirSync(deps.destDir, { recursive: true })
- const labelBase = item.label ? fileBaseFromLabel(item.label) : null
+ const noteBase = item.note ? fileBaseFromNote(item.note) : null
const saved: string[] = []
images.forEach((img, i) => {
const src = deps.resolveSource(img.imageId, img.ext)
if (!src) return
const ext = extname(src).replace(/^\./, '') || img.ext || 'png'
- const base = labelBase
- ? images.length > 1 ? `${labelBase} (${i + 1})` : labelBase
+ const base = noteBase
+ ? images.length > 1 ? `${noteBase} (${i + 1})` : noteBase
: deps.defaultName(item.capturedAt, ext, img, i + 1).replace(/\.[^.]+$/, '')
const dest = uniqueDest(deps.destDir, base, ext)
try {
diff --git a/electron/store/ItemStore.ts b/electron/store/ItemStore.ts
index 2721cdd..fc0b3a9 100644
--- a/electron/store/ItemStore.ts
+++ b/electron/store/ItemStore.ts
@@ -5,7 +5,8 @@
* - Keep an ordered list (most recent first) of ClipboardItem.
* - Deduplicate by content signature so re-copies bump `hitCount` instead of
* adding a clone.
- * - Enforce a size cap, evicting the oldest *unpinned* items.
+ * - Enforce a size cap, evicting the oldest items that aren't kept
+ * (pinned or noted, see isKept).
* - Persist the index to JSON and image bytes to per-item PNG files.
* - Convert internal items to the serializable DTO form for the renderer.
*/
@@ -26,14 +27,12 @@ import { PATHS } from './paths'
import { createId } from './ids'
import { contentSignature } from './signature'
import { MAX_ITEM_HTML_CHARS } from '../clipboard/formats'
-import { combineTags, hasItemMeta, normalizeLabel, normalizeTags, type ItemMetaPatch } from '../../shared/itemMeta'
-
-/** Write already-normalized metadata, removing the fields when empty. */
-function applyMeta(it: ClipboardItem, label: string | undefined, tags: string[] | undefined): void {
- if (label) it.label = label
- else delete it.label
- if (tags && tags.length > 0) it.tags = tags
- else delete it.tags
+import { isKept, joinNotes, normalizeNote, noteFromLegacy, type ItemMetaPatch } from '../../shared/itemMeta'
+
+/** Write an already-normalized note, removing the field when empty. */
+function applyNote(it: ClipboardItem, note: string | undefined): void {
+ if (note) it.note = note
+ else delete it.note
}
/** Maps a signature -> item id so dedup is O(1). */
@@ -112,9 +111,19 @@ export class ItemStore {
// Auto-migrate large text items to disk payload files
let migratedAnyPayloads = false
for (const it of this.items) {
- // A hand-edited or damaged file must never feed odd label/tag
- // values to the renderer: re-run the same cleanup as writes.
- if ('label' in it || 'tags' in it) applyMeta(it, normalizeLabel(it.label), normalizeTags(it.tags))
+ // A hand-edited or damaged file must never feed an odd note to the
+ // renderer: re-run the same cleanup as writes. Items saved with the
+ // old label + tags get them as one note (they were pinned when
+ // named, and stay pinned).
+ const legacy = it as ClipboardItem & { label?: unknown; tags?: unknown }
+ if ('label' in legacy || 'tags' in legacy) {
+ applyNote(it, joinNotes(normalizeNote(it.note), noteFromLegacy(legacy.label, legacy.tags)))
+ delete legacy.label
+ delete legacy.tags
+ migratedAnyPayloads = true
+ } else if ('note' in it) {
+ applyNote(it, normalizeNote(it.note))
+ }
if (it.data.kind === 'text') {
if (!it.data.hasFullPayload && it.data.text.length > 300) {
this.writeTextPayload(it.id, it.data.text)
@@ -210,8 +219,8 @@ export class ItemStore {
}
/**
- * Enforce the size cap by evicting oldest *unpinned* items. Walks from the
- * tail (oldest) forward, skipping anything pinned so favorites survive.
+ * Enforce the size cap by evicting the oldest items that aren't kept. Walks
+ * from the tail (oldest) forward, skipping pinned and noted items.
*/
private trim(limit: number): void {
if (this.items.length <= limit) return
@@ -221,7 +230,7 @@ export class ItemStore {
let stillNeed = need
for (let i = this.items.length - 1; i >= 0; i--) {
const it = this.items[i]
- if (stillNeed > 0 && !it.pinned) {
+ if (stillNeed > 0 && !isKept(it)) {
this.sigToId.delete(contentSignature(it.data))
if (it.data.kind === 'image') this.removeImageFile(it.data.imageId)
if (it.data.kind === 'image-collection') {
@@ -319,19 +328,15 @@ export class ItemStore {
}
/**
- * Set or clear an item's label and tags. Values are normalized here, so
- * nothing unclean is ever stored. Giving an unpinned item a label or tag
- * pins it: history limit, auto-delete and "clear" never touch pinned items,
- * so something the user named cannot silently disappear. Clearing the
- * metadata leaves the pin alone. Returns false when the item is gone.
+ * Set or clear an item's note. Normalized here, so nothing unclean is ever
+ * stored. The pin is left alone: a note keeps the item by itself (history
+ * limit, auto-delete and "clear" skip noted items, see isKept). Returns
+ * false when the item is gone.
*/
setMeta(id: string, patch: ItemMetaPatch): boolean {
const it = this.items.find((x) => x.id === id)
if (!it || !patch || typeof patch !== 'object') return false
- const label = 'label' in patch ? normalizeLabel(patch.label) : it.label
- const tags = 'tags' in patch ? normalizeTags(patch.tags) : it.tags
- applyMeta(it, label, tags)
- if (hasItemMeta(it)) it.pinned = true
+ if ('note' in patch) applyNote(it, normalizeNote(patch.note))
this.persist()
return true
}
@@ -447,13 +452,8 @@ export class ItemStore {
tgt.capturedAt = Date.now() // bump time
// The source card disappears, so carry what the user gave it: the
- // target keeps its own label (or takes the source's when it has none)
- // and gets both sets of tags. A named source was kept by its pin; keep
- // the merged card the same way.
- if (hasItemMeta(src)) {
- applyMeta(tgt, tgt.label ?? src.label, combineTags(tgt.tags, src.tags))
- if (src.pinned) tgt.pinned = true
- }
+ // target gets both notes (and with them, is kept).
+ if (src.note) applyNote(tgt, joinNotes(tgt.note, src.note))
// Remove source item completely but DO NOT delete its underlying files/images
// because they are now owned by the target!
@@ -595,11 +595,12 @@ export class ItemStore {
return false
}
+ /** Remove everything that isn't kept (pinned or noted). */
clearUnpinned(): void {
const kept: ClipboardItem[] = []
const removed: ClipboardItem[] = []
for (const it of this.items) {
- if (it.pinned) kept.push(it)
+ if (isKept(it)) kept.push(it)
else {
this.sigToId.delete(contentSignature(it.data))
if (it.data.kind === 'image') this.removeImageFile(it.data.imageId)
@@ -621,7 +622,7 @@ export class ItemStore {
const kept: ClipboardItem[] = []
const expired: ClipboardItem[] = []
for (const it of this.items) {
- if (it.pinned || it.capturedAt >= cutoff) {
+ if (isKept(it) || it.capturedAt >= cutoff) {
kept.push(it)
} else {
expired.push(it)
diff --git a/shared/ipc.ts b/shared/ipc.ts
index f8a3fd0..51a4508 100644
--- a/shared/ipc.ts
+++ b/shared/ipc.ts
@@ -51,8 +51,8 @@ export interface InvokeMap {
'item:paste': { args: [id: string, opts?: { plain?: boolean }]; result: boolean }
/**
- * Set or clear an item's label / tags (normalized in main). Giving an item
- * a label or tag also pins it. Returns the updated list.
+ * Set or clear an item's note (normalized in main). Returns the updated
+ * list.
*/
'item:set-meta': { args: [id: string, meta: import('./itemMeta').ItemMetaPatch]; result: ClipboardItemDto[] }
diff --git a/shared/itemMeta.ts b/shared/itemMeta.ts
index 7d180dd..d532031 100644
--- a/shared/itemMeta.ts
+++ b/shared/itemMeta.ts
@@ -1,21 +1,20 @@
/**
- * User-given metadata on a clipboard item: one short label and a few tags.
+ * The user's note on a clipboard item: one line of plain text that says what
+ * it is ("Office Wi-Fi password", "Invoice for Acme, March"), so search finds
+ * it later and the card is recognizable.
*
- * Both are optional, live at the top level of the item (not inside `data`, so
- * dedup, touch and the DTO keep them unchanged) and are searchable. The main
- * process normalizes every write through these functions, so whatever the
- * renderer sends, only clean values are ever stored.
+ * It lives at the top level of the item (not inside `data`, so dedup, touch
+ * and the DTO keep it unchanged). The main process normalizes every write
+ * through these functions, so whatever the renderer sends, only clean values
+ * are ever stored. A note also keeps the item: history limit, auto-delete,
+ * clear-on-restart and the Clear button leave it alone (see isKept).
*/
-export const LABEL_MAX = 60
-export const TAG_MAX_LEN = 24
-export const TAGS_MAX = 5
+export const NOTE_MAX = 120
export interface ItemMetaPatch {
- /** New label; empty / null removes it. Omitted keeps the current one. */
- label?: string | null
- /** New tag list; empty / null removes all. Omitted keeps the current ones. */
- tags?: string[] | null
+ /** New note; empty / null removes it. Omitted keeps the current one. */
+ note?: string | null
}
/** Cut a string to `max` characters without splitting a surrogate pair. */
@@ -26,47 +25,34 @@ function clip(value: string, max: number): string {
/**
* One line of plain text: control characters and runs of whitespace become a
- * single space, trimmed, at most LABEL_MAX characters. Empty -> undefined.
+ * single space, trimmed, at most NOTE_MAX characters. Empty -> undefined.
*/
-export function normalizeLabel(value: unknown): string | undefined {
+export function normalizeNote(value: unknown): string | undefined {
if (typeof value !== 'string') return undefined
const flat = value.replace(/[\u0000-\u001f\u007f\s]+/g, ' ').trim()
- const out = clip(flat, LABEL_MAX).trim()
+ const out = clip(flat, NOTE_MAX).trim()
return out || undefined
}
-/**
- * A tag is one lowercase word: a leading '#' is dropped, spaces become '-',
- * and only letters, marks and numbers (any language) plus - _ . + are kept.
- * At most TAG_MAX_LEN characters. Empty -> undefined.
- */
-export function normalizeTag(value: unknown): string | undefined {
- if (typeof value !== 'string') return undefined
- let tag = value.trim().replace(/^#+/, '').toLowerCase()
- tag = tag.replace(/\s+/g, '-').replace(/[^\p{L}\p{M}\p{N}_.+-]/gu, '')
- tag = tag.replace(/-{2,}/g, '-').replace(/^[-.]+|[-.]+$/g, '')
- tag = clip(tag, TAG_MAX_LEN).replace(/[-.]+$/g, '')
- return tag || undefined
+/** Two notes as one (merging cards): both, once each, joined with " · ". */
+export function joinNotes(a: string | undefined, b: string | undefined): string | undefined {
+ if (!a || !b) return normalizeNote(a ?? b)
+ if (a.toLowerCase() === b.toLowerCase()) return normalizeNote(a)
+ return normalizeNote(`${a} · ${b}`)
}
-/** Clean, de-duplicated tags in their given order, at most TAGS_MAX. Empty -> undefined. */
-export function normalizeTags(value: unknown): string[] | undefined {
- if (!Array.isArray(value)) return undefined
- const out: string[] = []
- for (const raw of value) {
- const tag = normalizeTag(raw)
- if (tag && !out.includes(tag)) out.push(tag)
- if (out.length >= TAGS_MAX) break
- }
- return out.length > 0 ? out : undefined
-}
-
-/** Tags of `a` followed by the new ones of `b`, normalized and capped. */
-export function combineTags(a: readonly string[] | undefined, b: readonly string[] | undefined): string[] | undefined {
- return normalizeTags([...(a ?? []), ...(b ?? [])])
+/**
+ * The note for an item saved before notes replaced labels and tags: the
+ * label, then the tags as words ("Wifi password · home network").
+ */
+export function noteFromLegacy(label: unknown, tags: unknown): string | undefined {
+ const words = Array.isArray(tags)
+ ? tags.filter((t): t is string => typeof t === 'string').map((t) => t.replace(/^#+/, '').trim()).filter(Boolean).join(' ')
+ : ''
+ return joinNotes(normalizeNote(label), normalizeNote(words))
}
-/** True when the item carries a label or at least one tag. */
-export function hasItemMeta(item: { label?: string; tags?: readonly string[] }): boolean {
- return !!item.label || (Array.isArray(item.tags) && item.tags.length > 0)
+/** Kept items survive every automatic or bulk removal: pinned, or noted. */
+export function isKept(item: { pinned?: boolean; note?: string }): boolean {
+ return !!item.pinned || !!item.note
}
diff --git a/shared/types.ts b/shared/types.ts
index cbd4e55..359a17a 100644
--- a/shared/types.ts
+++ b/shared/types.ts
@@ -85,10 +85,8 @@ export interface ClipboardItem {
hitCount: number
/** Pinned items never scroll off and survive app restarts. */
pinned: boolean
- /** User-given short name (see shared/itemMeta.ts). Searchable. */
- label?: string
- /** User-given lowercase tags (see shared/itemMeta.ts). Searchable. */
- tags?: string[]
+ /** The user's note (see shared/itemMeta.ts). Searchable; keeps the item. */
+ note?: string
}
/**
diff --git a/src/components/CardMenu.tsx b/src/components/CardMenu.tsx
index 7be691a..1fe2363 100644
--- a/src/components/CardMenu.tsx
+++ b/src/components/CardMenu.tsx
@@ -1,6 +1,6 @@
/**
- * CardMenu — the right-click menu of an item card, and the label / tags
- * editor it turns into.
+ * CardMenu — the right-click menu of an item card, and the note editor it
+ * turns into.
*
* One instance for the whole shelf (mounted next to the other flyouts),
* rendered only while open, so it costs nothing the rest of the time. It is
@@ -22,21 +22,19 @@
* shelf waits a moment before hover-closing (cardMenuStayUntil), so a
* pointer left outside the blade by the menu has time to come back.
*/
-import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type ReactNode } from 'react'
+import { useCallback, useEffect, useLayoutEffect, useRef, useState, type ReactNode } from 'react'
import { createPortal } from 'react-dom'
import type { ClipboardItemDto } from '../../shared/types'
-import { LABEL_MAX, TAGS_MAX, TAG_MAX_LEN, hasItemMeta, normalizeLabel, normalizeTag } from '../../shared/itemMeta'
-import { useStore } from '../store/appStore'
+import { NOTE_MAX, normalizeNote } from '../../shared/itemMeta'
+import { registerCardEditorCommit, useStore } from '../store/appStore'
import { useTranslation } from '../i18n'
import { edge } from '../lib/edge'
import { tryPaste } from '../lib/tryPaste'
import { colorFormats, type ColorFormat } from '../lib/colorUtils'
import { externalHref, stripTracking } from '../lib/urlPreview'
import { acquireKeyboard, releaseKeyboard } from '../lib/keyboardFocus'
-import { suggestTags, tagCounts } from '../lib/tagQuery'
import { playCardExpandSound, playDeleteSound, playToggleSound } from '../lib/soundEffects'
import {
- CloseIcon,
CopyIcon,
DownloadIcon,
ExpandIcon,
@@ -47,14 +45,14 @@ import {
PaletteIcon,
PasteIcon,
PinFillIcon,
+ NoteIcon,
PinIcon,
- TagIcon,
TrashIcon,
TypeIcon
} from './icons'
import '../styles/cardMenu.css'
-/** Keyboard-focus holder name for the label / tags editor. */
+/** Keyboard-focus holder name for the note editor. */
const EDITOR_FOCUS_OWNER = 'card-meta'
/** Space kept between the menu and the edge of its allowed area. */
const EDGE_GAP = 8
@@ -178,6 +176,11 @@ export function CardMenu() {
const closeCardMenu = useStore((s) => s.closeCardMenu)
const boxRef = useRef<HTMLDivElement>(null)
const commitRef = useRef<(() => void) | null>(null)
+ // The shelf closing while the editor is open saves it (see setOpen).
+ useEffect(() => {
+ registerCardEditorCommit(() => commitRef.current?.())
+ return () => registerCardEditorCommit(null)
+ }, [])
const [placement, setPlacement] = useState<MenuPlacement | null>(null)
// The item was deleted / merged away (auto-delete, another window).
@@ -186,7 +189,7 @@ export function CardMenu() {
}, [menu, item, closeCardMenu])
// The editor's keyboard hold ends with edit mode (or a pointer-down on
- // "Label & tags" that never became a click).
+ // "Add note" that never became a click).
const editing = menu?.mode === 'edit'
useEffect(() => {
if (!editing) releaseKeyboard(EDITOR_FOCUS_OWNER)
@@ -295,7 +298,6 @@ export function CardMenu() {
<MetaEditor
key={item.id}
item={item}
- focus={menu.focus ?? 'label'}
commitRef={commitRef}
onDone={() => useStore.getState().closeCardMenu()}
/>
@@ -366,7 +368,6 @@ function MenuList({ item }: { item: ClipboardItemDto }) {
const canCleanLink = isLink && (!!d.hasFullPayload || stripTracking(text) !== text.trim())
const isImage = d.kind === 'image' || d.kind === 'image-collection'
const filePaths = d.kind === 'files' ? d.paths : []
- const named = hasItemMeta(item)
const copyText = (value: string) => {
void store().copyText(value)
@@ -494,12 +495,12 @@ function MenuList({ item }: { item: ClipboardItemDto }) {
/>
<Separator />
<MenuRow
- icon={<TagIcon />}
- label={named ? t('menu.editLabel') : t('menu.addLabel')}
+ icon={<NoteIcon />}
+ label={item.note ? t('menu.editNote') : t('menu.addNote')}
// Borrow the keyboard on pointer-down: the shelf window may never
// see a focus event from a plain click (NOACTIVATE).
onPress={() => void acquireKeyboard(EDITOR_FOCUS_OWNER)}
- onSelect={() => store().editCardMeta('label')}
+ onSelect={() => store().editCardMeta()}
/>
<MenuRow
icon={item.pinned ? <PinFillIcon /> : <PinIcon />}
@@ -537,33 +538,21 @@ function MenuList({ item }: { item: ClipboardItemDto }) {
}
/* ------------------------------------------------------------------ */
-/* Label / tags editor */
+/* Note editor */
/* ------------------------------------------------------------------ */
function MetaEditor({
item,
- focus,
commitRef,
onDone
}: {
item: ClipboardItemDto
- focus: 'label' | 'tags'
commitRef: React.MutableRefObject<(() => void) | null>
onDone: () => void
}) {
const { t } = useTranslation()
- const [label, setLabel] = useState(item.label ?? '')
- const [tags, setTags] = useState<string[]>(item.tags ?? [])
- const [draft, setDraft] = useState('')
- const labelRef = useRef<HTMLInputElement>(null)
- const tagRef = useRef<HTMLInputElement>(null)
- const items = useStore((s) => s.items)
- const counts = useMemo(() => tagCounts(items), [items])
- const suggestions = useMemo(
- () => (tags.length < TAGS_MAX ? suggestTags(counts, draft, { exclude: tags, limit: 6 }) : []),
- [counts, draft, tags]
- )
- const full = tags.length >= TAGS_MAX
+ const [note, setNote] = useState(item.note ?? '')
+ const inputRef = useRef<HTMLInputElement>(null)
// Hold the keyboard while the editor is open (acquired on the menu row's
// pointer-down already; this is a no-op then) and put the caret in.
@@ -571,161 +560,62 @@ function MetaEditor({
let alive = true
void acquireKeyboard(EDITOR_FOCUS_OWNER).then(() => {
if (!alive) return
- const el = focus === 'tags' ? tagRef.current ?? labelRef.current : labelRef.current
try {
- el?.focus()
- el?.select?.()
+ inputRef.current?.focus()
+ inputRef.current?.select()
} catch { /* ignore */ }
})
return () => {
alive = false
releaseKeyboard(EDITOR_FOCUS_OWNER)
}
- }, [focus])
-
- const addTag = useCallback((raw: string) => {
- const tag = normalizeTag(raw)
- setDraft('')
- if (!tag) return
- setTags((cur) => (cur.includes(tag) || cur.length >= TAGS_MAX ? cur : [...cur, tag]))
}, [])
const save = useCallback(() => {
- let nextTags = tags
- const pending = normalizeTag(draft)
- if (pending && !nextTags.includes(pending) && nextTags.length < TAGS_MAX) nextTags = [...nextTags, pending]
- const nextLabel = normalizeLabel(label)
- const changed = (nextLabel ?? '') !== (item.label ?? '') || nextTags.join('\u0001') !== (item.tags ?? []).join('\u0001')
- if (changed) void useStore.getState().setItemMeta(item.id, { label: nextLabel ?? null, tags: nextTags })
+ const next = normalizeNote(note)
+ if ((next ?? '') !== (item.note ?? '')) void useStore.getState().setItemMeta(item.id, { note: next ?? null })
onDone()
- }, [tags, draft, label, item, onDone])
+ }, [note, item, onDone])
commitRef.current = save
- const removeAll = () => {
- void useStore.getState().setItemMeta(item.id, { label: null, tags: null })
+ const remove = () => {
+ void useStore.getState().setItemMeta(item.id, { note: null })
onDone()
}
return (
<form
className="card-meta-editor"
- aria-label={t('menu.editLabel')}
+ aria-label={item.note ? t('menu.editNote') : t('menu.addNote')}
onSubmit={(e) => {
e.preventDefault()
save()
}}
- onKeyDown={(e) => {
- if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) {
- e.preventDefault()
- save()
- }
- }}
>
<label className="card-meta-field">
- <span className="card-meta-caption">{t('menu.label')}</span>
+ <span className="card-meta-caption">{t('menu.note')}</span>
<input
- ref={labelRef}
+ ref={inputRef}
className="card-meta-input"
- value={label}
- maxLength={LABEL_MAX}
- placeholder={t('menu.labelPlaceholder')}
+ value={note}
+ maxLength={NOTE_MAX}
+ placeholder={t('menu.notePlaceholder')}
spellCheck={false}
autoComplete="off"
- onChange={(e) => setLabel(e.target.value)}
- onKeyDown={(e) => {
- if (e.key === 'Enter' && !e.ctrlKey && !e.metaKey) {
- e.preventDefault()
- if (full) save()
- else tagRef.current?.focus()
- }
- }}
+ onChange={(e) => setNote(e.target.value)}
/>
+ <span className="card-meta-hint">{t('menu.noteHint')}</span>
</label>
- <div className="card-meta-field">
- <span className="card-meta-caption">
- {t('menu.tags')}
- <span className="card-meta-count">{tags.length}/{TAGS_MAX}</span>
- </span>
- <div className="card-meta-tags" onMouseDown={(e) => {
- if (e.target === e.currentTarget) {
- e.preventDefault()
- tagRef.current?.focus()
- }
- }}>
- {tags.map((tag) => (
- <span key={tag} className="card-meta-chip">
- <span className="card-meta-chip-text">#{tag}</span>
- <button
- type="button"
- className="card-meta-chip-remove"
- aria-label={t('menu.removeTag', { tag })}
- title={t('menu.removeTag', { tag })}
- onMouseDown={(e) => e.preventDefault()}
- onClick={() => setTags((cur) => cur.filter((x) => x !== tag))}
- >
- <CloseIcon width={8} height={8} />
- </button>
- </span>
- ))}
- {!full && (
- <input
- ref={tagRef}
- className="card-meta-tag-input"
- value={draft}
- maxLength={TAG_MAX_LEN + 1}
- placeholder={tags.length === 0 ? t('menu.tagPlaceholder') : ''}
- spellCheck={false}
- autoComplete="off"
- onChange={(e) => {
- const v = e.target.value
- if (v.includes(',')) {
- const parts = v.split(',')
- parts.slice(0, -1).forEach(addTag)
- setDraft(parts[parts.length - 1])
- } else {
- setDraft(v)
- }
- }}
- onKeyDown={(e) => {
- if (e.key === 'Enter' && !e.ctrlKey && !e.metaKey) {
- e.preventDefault()
- if (draft.trim()) addTag(draft)
- else save()
- } else if (e.key === 'Backspace' && draft === '' && tags.length > 0) {
- e.preventDefault()
- setTags((cur) => cur.slice(0, -1))
- }
- }}
- />
- )}
- </div>
- {suggestions.length > 0 && (
- <div className="card-meta-suggest" aria-label={t('menu.usedBefore')}>
- {suggestions.map((s) => (
- <button
- key={s.tag}
- type="button"
- className="card-meta-suggestion"
- onMouseDown={(e) => e.preventDefault()}
- onClick={() => addTag(s.tag)}
- >
- #{s.tag}
- </button>
- ))}
- </div>
- )}
- </div>
-
<div className="card-meta-actions">
- {hasItemMeta(item) && (
+ {item.note && (
<button
type="button"
className="card-meta-btn is-quiet"
onMouseDown={(e) => e.preventDefault()}
- onClick={removeAll}
+ onClick={remove}
>
- {t('menu.removeAll')}
+ {t('menu.removeNote')}
</button>
)}
<span className="card-meta-spacer" />
diff --git a/src/components/ClearMenu.tsx b/src/components/ClearMenu.tsx
index b1328f5..1a06199 100644
--- a/src/components/ClearMenu.tsx
+++ b/src/components/ClearMenu.tsx
@@ -4,6 +4,7 @@ import { TrashIcon } from './icons'
import { playButtonClickSound } from '../lib/soundEffects'
import { useTranslation } from '../i18n'
import type { ClipboardItemDto } from '../../shared/types'
+import { isKept } from '../../shared/itemMeta'
interface ClearMenuProps {
/** Full item list (pinned + recent) to compute time-window ids from. */
@@ -79,8 +80,8 @@ export function ClearMenu({
const clearWindow = (hours: number) => {
const cutoff = Date.now() - hours * 3600 * 1000
- // Pinned items are never included in a bulk clear
- const ids = items.filter((it) => !it.pinned && it.capturedAt >= cutoff).map((it) => it.id)
+ // Pinned and noted cards are never included in a bulk clear
+ const ids = items.filter((it) => !isKept(it) && it.capturedAt >= cutoff).map((it) => it.id)
playButtonClickSound()
setOpen(false)
if (ids.length > 0) onClear(ids)
diff --git a/src/components/ClipboardItem.tsx b/src/components/ClipboardItem.tsx
index 55f26dd..b1ad7fa 100644
--- a/src/components/ClipboardItem.tsx
+++ b/src/components/ClipboardItem.tsx
@@ -406,8 +406,8 @@ const ClipboardItemBase = forwardRef<HTMLDivElement, Props>(({ item }, ref) => {
/>
) : (
<div className="body">
- {item.label && !isHorizontal && (!isBundle || !expanded) && (
- <div className="item-label" title={item.label}>{item.label}</div>
+ {item.note && (!isBundle || !expanded) && (
+ <div className="item-note" title={item.note}>{item.note}</div>
)}
<div className="item-content">
{isBundle ? (
@@ -428,19 +428,7 @@ const ClipboardItemBase = forwardRef<HTMLDivElement, Props>(({ item }, ref) => {
<div className="item-footer">
<div className="meta">
<KindBadge item={item} />
- {isHorizontal && item.label ? (
- // Fixed-size top-dock card: the label gets the whole line
- // (tags stay searchable and show in the tooltip / preview).
- <>
- <span>·</span>
- <span className="meta-label" title={item.tags?.length ? `${item.label} · ${item.tags.map((tag) => `#${tag}`).join(' ')}` : item.label}>{item.label}</span>
- </>
- ) : (
- <>
- <MetaTags tags={item.tags} max={2} />
- <ItemDetails item={item} />
- </>
- )}
+ <ItemDetails item={item} />
{item.hitCount > 1 && (
<>
<span>·</span>
@@ -1364,23 +1352,21 @@ function ImageFolderCard({
{/* Flap Footer: Left side shows image source/file name, Right side shows relative time */}
<div className="image-folder-flap-footer">
<div className="image-folder-meta">
- {item.label ? (
- <span className="image-folder-source-name meta-label" title={metaDetail ? `${item.label} · ${metaDetail}` : item.label}>
- {item.label}
+ {item.note ? (
+ <span className="image-folder-source-name meta-label" title={metaDetail ? `${item.note} · ${metaDetail}` : item.note}>
+ {item.note}
</span>
) : metaDetail && (
<span className="image-folder-source-name file-name-meta" title={metaDetail}>
{metaDetail}
</span>
)}
- {/* Narrow top-dock tiles: a label gets the whole line. */}
- {!(isHorizontal && item.label) && <MetaTags tags={item.tags} max={1} />}
{item.hitCount > 1 && (
<span className="meta-hit-count" title={t('item.copiedTimes', { count: item.hitCount })}>
- {(item.label || metaDetail) ? ' · ×' : '×'}{item.hitCount}
+ {(item.note || metaDetail) ? ' · ×' : '×'}{item.hitCount}
</span>
)}
- {copied && <span className="meta-copied">{(item.label || metaDetail || item.hitCount > 1) ? ' · ' : ''}{t('item.copied')}</span>}
+ {copied && <span className="meta-copied">{(item.note || metaDetail || item.hitCount > 1) ? ' · ' : ''}{t('item.copied')}</span>}
</div>
<RelativeTime capturedAt={item.capturedAt} />
</div>
@@ -1582,17 +1568,15 @@ function FileFolderCard({
{/* Flap Footer: Left side shows file name, Right side shows relative time */}
<div className="image-folder-flap-footer">
<div className="image-folder-meta">
- {item.label ? (
- <span className="image-folder-source-name meta-label" title={`${item.label} · ${rawName}`}>
- {item.label}
+ {item.note ? (
+ <span className="image-folder-source-name meta-label" title={`${item.note} · ${rawName}`}>
+ {item.note}
</span>
) : (
<span className="image-folder-source-name file-name-meta" title={rawName}>
{rawName}
</span>
)}
- {/* Narrow top-dock tiles: a label gets the whole line. */}
- {!(isHorizontal && item.label) && <MetaTags tags={item.tags} max={1} />}
{item.hitCount > 1 && (
<span className="meta-hit-count" title={t('item.copiedTimes', { count: item.hitCount })}>
· ×{item.hitCount}
@@ -1724,21 +1708,6 @@ function Preview({ item }: { item: ClipboardItemDto }) {
/* Kind badge */
/* ------------------------------------------------------------------ */
-/** Up to `max` tag chips, then "+N" for the rest. Nothing when untagged. */
-function MetaTags({ tags, max }: { tags?: string[]; max: number }) {
- if (!tags || tags.length === 0) return null
- return (
- <>
- {tags.slice(0, max).map((tag) => (
- <span key={tag} className="meta-tag" title={`#${tag}`}>#{tag}</span>
- ))}
- {tags.length > max && (
- <span className="meta-tag-more" title={tags.slice(max).map((tag) => `#${tag}`).join(' ')}>+{tags.length - max}</span>
- )}
- </>
- )
-}
-
function KindBadge({ item }: { item: ClipboardItemDto }) {
switch (item.data.kind) {
case 'text':
diff --git a/src/components/Panel.tsx b/src/components/Panel.tsx
index 09d5a49..4669503 100644
--- a/src/components/Panel.tsx
+++ b/src/components/Panel.tsx
@@ -22,11 +22,11 @@ import { PreviewFlyout } from './PreviewFlyout'
import { IndicatorStyleFlyout } from './IndicatorStyleFlyout'
import { LanguageFlyout } from './LanguageFlyout'
import { CardMenu } from './CardMenu'
-import { TagSuggest } from './TagSuggest'
import { CopyIndicatorCurve } from './CopyIndicatorCurve'
import { useFilteredItems } from '../hooks/useFilteredItems'
import { registerEdgeDragCue } from '../lib/edgeDrag'
import { DashedLine, DashedOutline } from './DashedOutline'
+import { isKept } from '../../shared/itemMeta'
import { useTranslation } from '../i18n'
@@ -60,6 +60,9 @@ export function Panel() {
const { pinned, recent } = useFilteredItems()
const filteredItems = useMemo(() => [...pinned, ...recent], [pinned, recent])
const filteredCount = filteredItems.length
+ // What Clear removes: the visible recent cards without a note (pinned and
+ // noted cards are kept).
+ const clearable = useMemo(() => recent.filter((it) => !isKept(it)), [recent])
const clear = useStore((s) => s.clear)
const typeFilter = useStore((s) => s.typeFilter)
const query = useStore((s) => s.query)
@@ -573,14 +576,14 @@ export function Panel() {
itemCount={filteredCount}
clearProps={{
items: filteredItems,
- disabled: recent.length === 0,
+ disabled: clearable.length === 0,
panelOpen: open,
onClear: (ids) => clear(ids),
onClearAll: () => {
if (typeFilter === 'all' && !query.trim()) {
clear()
} else {
- clear(recent.map((it) => it.id))
+ clear(clearable.map((it) => it.id))
}
}
}}
@@ -588,9 +591,7 @@ export function Panel() {
<ToastStack />
{!isHorizontal && !emojiOpen && !settingsOpen && <ShelfSearch />}
- {!isHorizontal && !emojiOpen && !settingsOpen && <TagSuggest isHorizontal={false} />}
<div style={{ flex: 1, display: 'grid', gridTemplate: '1fr / 1fr', overflow: 'hidden', position: 'relative' }}>
- {isHorizontal && !emojiOpen && !settingsOpen && <TagSuggest isHorizontal />}
{/* Main clipboard / emoji view (persistent so ItemList is never torn down and doesn't jump on Y-axis) */}
<div
style={{
@@ -644,14 +645,14 @@ export function Panel() {
<div className="spacer" />
<ClearMenu
items={filteredItems}
- disabled={recent.length === 0}
+ disabled={clearable.length === 0}
panelOpen={open}
onClear={(ids) => clear(ids)}
onClearAll={() => {
if (typeFilter === 'all' && !query.trim()) {
clear()
} else {
- clear(recent.map((it) => it.id))
+ clear(clearable.map((it) => it.id))
}
}}
/>
diff --git a/src/components/PreviewFlyout.tsx b/src/components/PreviewFlyout.tsx
index 677945e..e278629 100644
--- a/src/components/PreviewFlyout.tsx
+++ b/src/components/PreviewFlyout.tsx
@@ -44,12 +44,11 @@ const TOP_FLYOUT_MAX_W = 760
const IMAGE_CHROME_H = 78
const BODY_SIDE_PADDING = 40
-/** Rough height of the label + tags block above the content. */
+/** Rough height of the note above the content (up to 120 characters wrap to ~3 lines). */
function metaHeight(item: any): number {
- const hasLabel = !!item?.label
- const hasTags = !!item?.tags?.length
- if (!hasLabel && !hasTags) return 0
- return 14 + (hasLabel ? 22 : 0) + (hasTags ? 22 : 0) + (hasLabel && hasTags ? 8 : 0)
+ const note: string | undefined = item?.note
+ if (!note) return 0
+ return 14 + 20 * Math.min(3, Math.ceil(note.length / 46))
}
/** Same soft spring as the CSS open, for the slide when the anchor card moves. */
@@ -592,19 +591,12 @@ function FlyoutHead({
)
}
-/** The item's label and every tag, above the content. */
+/** The item's whole note, above the content. */
function MetaHead({ item }: { item: any }) {
- if (!item.label && !item.tags?.length) return null
+ if (!item.note) return null
return (
<div className="flyout-meta-head">
- {item.label && <div className="flyout-meta-label">{item.label}</div>}
- {item.tags?.length ? (
- <div className="flyout-meta-tags">
- {item.tags.map((tag: string) => (
- <span key={tag} className="flyout-meta-tag">#{tag}</span>
- ))}
- </div>
- ) : null}
+ <div className="flyout-meta-label">{item.note}</div>
</div>
)
}
diff --git a/src/components/TagSuggest.tsx b/src/components/TagSuggest.tsx
deleted file mode 100644
index b0342d8..0000000
--- a/src/components/TagSuggest.tsx
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * TagSuggest — while the search ends in `#word`, a row of matching tags
- * (most used first, with counts). Clicking one completes the query.
- *
- * Side docks: a row between the search box and the list. Top dock: a strip
- * floating over the top of the list, so the fixed-height cards never move.
- * Buttons never take focus, so typing continues in the search box.
- */
-import { useMemo } from 'react'
-import { useStore } from '../store/appStore'
-import { useTranslation } from '../i18n'
-import { activeTagPrefix, completeTag, suggestTags, tagCounts } from '../lib/tagQuery'
-
-export function TagSuggest({ isHorizontal }: { isHorizontal: boolean }) {
- const { t } = useTranslation()
- const query = useStore((s) => s.query)
- const items = useStore((s) => s.items)
- const prefix = activeTagPrefix(query)
- const active = prefix !== null
- const counts = useMemo(() => (active ? tagCounts(items) : null), [items, active])
- const suggestions = useMemo(
- () => (prefix === null || !counts ? [] : suggestTags(counts, prefix, { limit: isHorizontal ? 6 : 8 })),
- [counts, prefix, isHorizontal]
- )
- if (suggestions.length === 0) return null
-
- return (
- <div className={`tag-suggest${isHorizontal ? ' is-horizontal' : ''}`} role="listbox" aria-label={t('menu.tags')}>
- {suggestions.map((s) => (
- <button
- key={s.tag}
- type="button"
- role="option"
- aria-selected={false}
- className="tag-suggest-chip"
- tabIndex={-1}
- onPointerDown={(e) => e.preventDefault()}
- onMouseDown={(e) => e.preventDefault()}
- onClick={() => useStore.getState().setQuery(completeTag(useStore.getState().query, s.tag))}
- >
- <span className="tag-suggest-name">#{s.tag}</span>
- <span className="tag-suggest-count">{s.count}</span>
- </button>
- ))}
- </div>
- )
-}
diff --git a/src/components/icons.tsx b/src/components/icons.tsx
index b785a35..e40f3fe 100644
--- a/src/components/icons.tsx
+++ b/src/components/icons.tsx
@@ -119,7 +119,7 @@ export const RecentIcon = ClockIcon
export const TypeIcon = uiIcon('textT')
export const FilesIcon = uiIcon('files')
export const PaletteIcon = uiIcon('palette')
-export const TagIcon = uiIcon('tag')
+export const NoteIcon = uiIcon('pencilSimple')
export const PasteIcon = uiIcon('clipboardText')
export const DownloadIcon = uiIcon('downloadSimple')
diff --git a/src/components/phosphorPaths.ts b/src/components/phosphorPaths.ts
index e45b05e..b16926c 100644
--- a/src/components/phosphorPaths.ts
+++ b/src/components/phosphorPaths.ts
@@ -63,6 +63,7 @@ export const PHOSPHOR_BOLD = {
minus: 'M228,128a12,12,0,0,1-12,12H40a12,12,0,0,1,0-24H216A12,12,0,0,1,228,128Z',
palette: 'M203.57,51A107.9,107.9,0,0,0,20,128c0,44.72,27.6,82.25,72,97.94A36,36,0,0,0,140,192a12,12,0,0,1,12-12h46.21a35.79,35.79,0,0,0,35.1-28A108.6,108.6,0,0,0,236,127.09,107.23,107.23,0,0,0,203.57,51Zm6.34,95.67a11.91,11.91,0,0,1-11.7,9.3H152a36,36,0,0,0-36,36,12,12,0,0,1-16,11.3c-16.65-5.88-30.65-15.76-40.48-28.56A76,76,0,0,1,44,128a84,84,0,0,1,83.13-84H128a84.35,84.35,0,0,1,84,83.29A84.72,84.72,0,0,1,209.91,146.71ZM144,76a16,16,0,1,1-16-16A16,16,0,0,1,144,76Zm-44,24A16,16,0,1,1,84,84,16,16,0,0,1,100,100Zm0,56a16,16,0,1,1-16-16A16,16,0,0,1,100,156Zm88-56a16,16,0,1,1-16-16A16,16,0,0,1,188,100Z',
pawPrint: 'M236,108a24,24,0,1,1-24-24A24,24,0,0,1,236,108ZM68,108a24,24,0,1,0-24,24A24,24,0,0,0,68,108ZM92,84A24,24,0,1,0,68,60,24,24,0,0,0,92,84Zm72,0a24,24,0,1,0-24-24A24,24,0,0,0,164,84Zm48,100a44,44,0,0,1-61.1,40.55,60.15,60.15,0,0,0-45.8,0A44,44,0,0,1,67,145.34,31.33,31.33,0,0,0,81.91,126.6a48,48,0,0,1,92.18,0A31.34,31.34,0,0,0,189,145.34,44,44,0,0,1,212,184Zm-24,0a20,20,0,0,0-10.49-17.6l-.1-.06a55.22,55.22,0,0,1-26.37-33,24,24,0,0,0-46.08,0,55.21,55.21,0,0,1-26.37,33.05l-.1.06A20,20,0,0,0,88,204a19.77,19.77,0,0,0,7.8-1.58l.13,0a84,84,0,0,1,64.14,0l.13,0A19.77,19.77,0,0,0,168,204,20,20,0,0,0,188,184Z',
+ pencilSimple: 'M230.14,70.54,185.46,25.85a20,20,0,0,0-28.29,0L33.86,149.17A19.85,19.85,0,0,0,28,163.31V208a20,20,0,0,0,20,20H92.69a19.86,19.86,0,0,0,14.14-5.86L230.14,98.82a20,20,0,0,0,0-28.28ZM91,204H52V165l84-84,39,39ZM192,103,153,64l18.34-18.34,39,39Z',
pushPin: 'M238.15,78.54,177.46,17.86a20,20,0,0,0-28.3,0L97.2,70c-12.43-3.33-36.68-5.72-61.74,14.5a20,20,0,0,0-1.6,29.73l45.46,45.47-39.8,39.8a12,12,0,0,0,17,17l39.8-39.81,45.47,45.46A20,20,0,0,0,155.91,228c.46,0,.93,0,1.4-.05A20,20,0,0,0,171.87,220c4.69-6.23,11-16.13,14.44-28s3.45-22.88.16-33.4l51.7-51.87A20,20,0,0,0,238.15,78.54Zm-74.26,68.79a12,12,0,0,0-2.23,13.84c3.43,6.86,6.9,21-6.28,40.65L54.08,100.53c21.09-14.59,39.53-6.64,41-6a11.67,11.67,0,0,0,13.81-2.29l54.43-54.61,55,55Z',
shapes: 'M71.49,60.55a12,12,0,0,0-23,0l-36,120A12,12,0,0,0,24,196H96a12,12,0,0,0,11.49-15.45ZM40.13,172,60,105.76,79.87,172ZM212,74a54,54,0,1,0-54,54A54.06,54.06,0,0,0,212,74Zm-84,0a30,30,0,1,1,30,30A30,30,0,0,1,128,74Zm96,70H136a12,12,0,0,0-12,12v52a12,12,0,0,0,12,12h88a12,12,0,0,0,12-12V156A12,12,0,0,0,224,144Zm-12,52H148V168h64Z',
signOut: 'M124,216a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V40A12,12,0,0,1,48,28h64a12,12,0,0,1,0,24H60V204h52A12,12,0,0,1,124,216Zm108.49-96.49-40-40a12,12,0,0,0-17,17L195,116H112a12,12,0,0,0,0,24h83l-19.52,19.51a12,12,0,0,0,17,17l40-40A12,12,0,0,0,232.49,119.51Z',
@@ -70,7 +71,6 @@ export const PHOSPHOR_BOLD = {
sparkle: 'M199,125.31l-49.88-18.39L130.69,57a19.92,19.92,0,0,0-37.38,0L74.92,106.92,25,125.31a19.92,19.92,0,0,0,0,37.38l49.88,18.39L93.31,231a19.92,19.92,0,0,0,37.38,0l18.39-49.88L199,162.69a19.92,19.92,0,0,0,0-37.38Zm-63.38,35.16a12,12,0,0,0-7.11,7.11L112,212.28l-16.47-44.7a12,12,0,0,0-7.11-7.11L43.72,144l44.7-16.47a12,12,0,0,0,7.11-7.11L112,75.72l16.47,44.7a12,12,0,0,0,7.11,7.11L180.28,144ZM140,40a12,12,0,0,1,12-12h12V16a12,12,0,0,1,24,0V28h12a12,12,0,0,1,0,24H188V64a12,12,0,0,1-24,0V52H152A12,12,0,0,1,140,40ZM252,88a12,12,0,0,1-12,12h-4v4a12,12,0,0,1-24,0v-4h-4a12,12,0,0,1,0-24h4V72a12,12,0,0,1,24,0v4h4A12,12,0,0,1,252,88Z',
stack: 'M234.36,170A12,12,0,0,1,230,186.37l-96,56a12,12,0,0,1-12.1,0l-96-56a12,12,0,0,1,12.09-20.74l90,52.48L218,165.63A12,12,0,0,1,234.36,170ZM218,117.63,128,170.11,38.05,117.63A12,12,0,0,0,26,138.37l96,56a12,12,0,0,0,12.1,0l96-56A12,12,0,0,0,218,117.63ZM20,80a12,12,0,0,1,6-10.37l96-56a12.06,12.06,0,0,1,12.1,0l96,56a12,12,0,0,1,0,20.74l-96,56a12,12,0,0,1-12.1,0l-96-56A12,12,0,0,1,20,80Zm35.82,0L128,122.11,200.18,80,128,37.89Z',
star: 'M243,96a20.33,20.33,0,0,0-17.74-14l-56.59-4.57L146.83,24.62a20.36,20.36,0,0,0-37.66,0L87.35,77.44,30.76,82A20.45,20.45,0,0,0,19.1,117.88l43.18,37.24-13.2,55.7A20.37,20.37,0,0,0,79.57,233L128,203.19,176.43,233a20.39,20.39,0,0,0,30.49-22.15l-13.2-55.7,43.18-37.24A20.43,20.43,0,0,0,243,96ZM172.53,141.7a12,12,0,0,0-3.84,11.86L181.58,208l-47.29-29.08a12,12,0,0,0-12.58,0L74.42,208l12.89-54.4a12,12,0,0,0-3.84-11.86L41.2,105.24l55.4-4.47a12,12,0,0,0,10.13-7.38L128,41.89l21.27,51.5a12,12,0,0,0,10.13,7.38l55.4,4.47Z',
- tag: 'M246.15,133.18,146.83,33.86A19.85,19.85,0,0,0,132.69,28H40A12,12,0,0,0,28,40v92.69a19.85,19.85,0,0,0,5.86,14.14l99.32,99.32a20,20,0,0,0,28.28,0l84.69-84.69A20,20,0,0,0,246.15,133.18Zm-98.83,93.17L52,131V52h79l95.32,95.32ZM104,88A16,16,0,1,1,88,72,16,16,0,0,1,104,88Z',
textT: 'M212,56V88a12,12,0,0,1-24,0V68H140V188h20a12,12,0,0,1,0,24H96a12,12,0,0,1,0-24h20V68H68V88a12,12,0,0,1-24,0V56A12,12,0,0,1,56,44H200A12,12,0,0,1,212,56Z',
trash: 'M216,48H180V36A28,28,0,0,0,152,8H104A28,28,0,0,0,76,36V48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM100,36a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4V48H100Zm88,168H68V72H188ZM116,104v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Zm48,0v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Z',
trophy: 'M232,60H212V48a12,12,0,0,0-12-12H56A12,12,0,0,0,44,48V60H24A20,20,0,0,0,4,80V96a44.05,44.05,0,0,0,44,44h.77A84.18,84.18,0,0,0,116,195.15V212H96a12,12,0,0,0,0,24h64a12,12,0,0,0,0-24H140V195.11c30.94-4.51,56.53-26.2,67-55.11h1a44.05,44.05,0,0,0,44-44V80A20,20,0,0,0,232,60ZM28,96V84H44v28c0,1.21,0,2.41.09,3.61A20,20,0,0,1,28,96Zm160,15.1c0,33.33-26.71,60.65-59.54,60.9A60,60,0,0,1,68,112V60H188ZM228,96a20,20,0,0,1-16.12,19.62c.08-1.5.12-3,.12-4.52V84h16Z',
diff --git a/src/hooks/useEdgeHover.ts b/src/hooks/useEdgeHover.ts
index ce50736..2194c07 100644
--- a/src/hooks/useEdgeHover.ts
+++ b/src/hooks/useEdgeHover.ts
@@ -148,20 +148,19 @@ export function cursorToWindow(
return { x: cursor.x, y: cursor.y }
}
-/** True while the card menu should hold the shelf open for this cursor. */
+/**
+ * True while the card menu (or the note editor it turns into) holds the shelf
+ * open for this cursor: only while the pointer is on it. Leaving both the
+ * shelf and the menu closes the shelf like any other leave; an open editor
+ * saves what was typed as it closes (setOpen in the store) and the keyboard
+ * goes back to the app that had it.
+ */
export function cardMenuHolds(
menu: { mode: 'menu' | 'edit' } | null,
rect: { left: number; top: number; right: number; bottom: number } | null,
- point: { x: number; y: number },
- hasKeyboard = false
+ point: { x: number; y: number }
): boolean {
- if (!menu) return false
- // Typing a label (the shelf holds the keyboard): never close under the
- // user. An outside click or app switch saves and closes the editor, then
- // normal hover rules resume. Without the keyboard nobody can be typing, so
- // the editor counts only where it is, like the menu.
- if (menu.mode === 'edit' && hasKeyboard) return true
- if (!rect) return false
+ if (!menu || !rect) return false
return (
point.x >= rect.left - CARD_MENU_BUFFER &&
point.x <= rect.right + CARD_MENU_BUFFER &&
@@ -170,20 +169,6 @@ export function cardMenuHolds(
)
}
-/** Whether the shelf window currently holds OS keyboard focus. */
-function windowHasKeyboard(): boolean {
- try {
- return typeof document !== 'undefined' && document.hasFocus()
- } catch {
- return false
- }
-}
-
-/** The label editor is open and the user can actually type into it. */
-function isTypingInCardMenu(state: { cardMenu: { mode: 'menu' | 'edit' } | null }): boolean {
- return state.cardMenu?.mode === 'edit' && windowHasKeyboard()
-}
-
export function useEdgeHover(): void {
// Throttle the self-healing setInteractive(true) call.
// Without this, it fires at 60Hz (every 16ms) via the cursor-edge poll,
@@ -308,7 +293,6 @@ export function useEdgeHover(): void {
const state = useStore.getState()
if (!state.open) return
if (state.sliderActive || state.edgeTransition?.active) return
- if (isTypingInCardMenu(state)) return
if (state.dragActive && !state.internalDragReq) return
// If any flyout is open, let it play its exit spring first.
@@ -345,7 +329,6 @@ export function useEdgeHover(): void {
const scheduleClose = (delay = GRACE_MS) => {
const state = useStore.getState()
if (state.sliderActive || state.edgeTransition?.active) return
- if (isTypingInCardMenu(state)) return
if (state.dragActive && !state.internalDragReq) return
if (graceTimer !== undefined) return // already closing
@@ -447,7 +430,7 @@ export function useEdgeHover(): void {
const isInsideBlade = () => {
const state = useStore.getState()
if (state.sliderActive || state.edgeTransition?.active) return true
- if (state.cardMenu && cardMenuHolds(state.cardMenu, state.cardMenuRect, cursorInWindow(state, lastClient.current), windowHasKeyboard())) return true
+ if (state.cardMenu && cardMenuHolds(state.cardMenu, state.cardMenuRect, cursorInWindow(state, lastClient.current))) return true
const timeSincePositionChange = state.sliderReleasedTime > 0 ? Date.now() - state.sliderReleasedTime : Infinity
if (timeSincePositionChange < 1750) return true
@@ -572,8 +555,8 @@ export function useEdgeHover(): void {
if (!drag) setEdgeDragPull(0)
}
- // The card menu (or its label editor) is part of the shelf while open.
- if (state.open && state.cardMenu && cardMenuHolds(state.cardMenu, state.cardMenuRect, cursorInWindow(state, data), windowHasKeyboard())) {
+ // The card menu (or its note editor) is part of the shelf while the pointer is on it.
+ if (state.open && state.cardMenu && cardMenuHolds(state.cardMenu, state.cardMenuRect, cursorInWindow(state, data))) {
const now = Date.now()
if (now - lastSetInteractiveRef.current > 2000) {
lastSetInteractiveRef.current = now
diff --git a/src/hooks/useFilteredItems.ts b/src/hooks/useFilteredItems.ts
index 0d810a4..8d58cf2 100644
--- a/src/hooks/useFilteredItems.ts
+++ b/src/hooks/useFilteredItems.ts
@@ -9,25 +9,26 @@ import { useStore } from '../store/appStore'
import type { ClipboardItemDto, TypeFilter } from '../../shared/types'
import { basename, isImagePath } from '../lib/format'
import { parseColor } from '../lib/colorUtils'
-import { matchesTagFilters, metaMatchesText, parseQuery, type ParsedQuery } from '../lib/tagQuery'
+import { matchesWords, queryWords, searchText, type SearchText, type SearchWord } from '../lib/search'
-function contentMatches(it: ClipboardItemDto, needle: string): boolean {
- switch (it.data.kind) {
- case 'text':
- return it.data.text.toLowerCase().includes(needle)
- case 'files':
- return it.data.paths.some((p) => basename(p).toLowerCase().includes(needle))
- case 'image':
- case 'image-collection':
- // No text of their own: found only through a label or tag.
- return false
+// Each item's searchable text, folded once per item object (items are
+// replaced, never mutated, when they change), so typing doesn't redo it.
+const textCache = new WeakMap<ClipboardItemDto, SearchText>()
+
+function itemText(it: ClipboardItemDto): SearchText {
+ let text = textCache.get(it)
+ if (!text) {
+ const d = it.data
+ // Images have no text of their own: they are found through their note.
+ const content = d.kind === 'text' ? d.text : d.kind === 'files' ? d.paths.map((p) => basename(p)).join('\n') : ''
+ text = searchText([content, it.note])
+ textCache.set(it, text)
}
+ return text
}
-export function matches(it: ClipboardItemDto, q: ParsedQuery): boolean {
- if (!matchesTagFilters(it, q.tags)) return false
- if (!q.text) return true
- return contentMatches(it, q.text) || metaMatchesText(it, q.text)
+export function matches(it: ClipboardItemDto, words: readonly SearchWord[]): boolean {
+ return words.length === 0 || matchesWords(itemText(it), words)
}
/**
@@ -92,9 +93,9 @@ export function useFilteredItems(): GroupedItems {
}
})
- const parsed = parseQuery(query)
+ const words = queryWords(query)
for (const it of filteredByTutorial) {
- if (!matches(it, parsed)) continue
+ if (!matches(it, words)) continue
if (!itemMatchesTypeFilter(it, typeFilter)) continue
;(it.pinned ? pinned : recent).push(it)
}
diff --git a/src/i18n/translations.ts b/src/i18n/translations.ts
index 96d2efa..b5a3a64 100644
--- a/src/i18n/translations.ts
+++ b/src/i18n/translations.ts
@@ -184,13 +184,13 @@ export interface TranslationKeys {
clearAll?: string
clearAllConfirm?: string
}
- /** Card right-click menu and the label / tags editor. */
+ /** Card right-click menu and the note editor. */
menu?: {
title?: string
paste?: string
pastePlain?: string
- addLabel?: string
- editLabel?: string
+ addNote?: string
+ editNote?: string
openLink?: string
copyCleanLink?: string
copyAs?: string
@@ -200,13 +200,10 @@ export interface TranslationKeys {
saveToDownloads?: string
preview?: string
closePreview?: string
- label?: string
- labelPlaceholder?: string
- tags?: string
- tagPlaceholder?: string
- removeTag?: string
- usedBefore?: string
- removeAll?: string
+ note?: string
+ notePlaceholder?: string
+ noteHint?: string
+ removeNote?: string
cancel?: string
save?: string
}
@@ -350,8 +347,7 @@ export interface TranslationKeys {
mergeImagesFull?: string
mergeFilesFull?: string
mergeIncompatible?: string
- labelPinned?: string
- labelFailed?: string
+ noteFailed?: string
savedToDownloads?: string
savedManyToDownloads?: string
saveImagesFailed?: string
@@ -767,8 +763,8 @@ export const en: TranslationKeys = {
"title": "Item actions",
"paste": "Paste",
"pastePlain": "Paste as plain text",
- "addLabel": "Add label & tags…",
- "editLabel": "Edit label & tags…",
+ "addNote": "Add note…",
+ "editNote": "Edit note…",
"openLink": "Open link",
"copyCleanLink": "Copy clean link",
"copyAs": "Copy as",
@@ -778,13 +774,10 @@ export const en: TranslationKeys = {
"saveToDownloads": "Save to Downloads",
"preview": "Preview",
"closePreview": "Close preview",
- "label": "Label",
- "labelPlaceholder": "e.g. Office Wi-Fi",
- "tags": "Tags",
- "tagPlaceholder": "Add a tag…",
- "removeTag": "Remove #{tag}",
- "usedBefore": "Used before",
- "removeAll": "Remove all",
+ "note": "Note",
+ "notePlaceholder": "e.g. Office Wi-Fi password",
+ "noteHint": "Search finds it by these words.",
+ "removeNote": "Remove note",
"cancel": "Cancel",
"save": "Save"
},
@@ -910,8 +903,7 @@ export const en: TranslationKeys = {
"current": "Current"
},
"toast": {
- "labelPinned": "Pinned so it's kept",
- "labelFailed": "Could not save the label. Please try again.",
+ "noteFailed": "Could not save the note. Please try again.",
"savedToDownloads": "Saved to Downloads: {name}",
"savedManyToDownloads": "Saved {count} images to Downloads",
"saveImagesFailed": "Could not save the image",
@@ -1172,8 +1164,8 @@ export const es: TranslationKeys = {
"title": "Acciones del elemento",
"paste": "Pegar",
"pastePlain": "Pegar como texto sin formato",
- "addLabel": "Añadir nombre y etiquetas…",
- "editLabel": "Editar nombre y etiquetas…",
+ "addNote": "Añadir nota…",
+ "editNote": "Editar nota…",
"openLink": "Abrir enlace",
"copyCleanLink": "Copiar enlace limpio",
"copyAs": "Copiar como",
@@ -1183,13 +1175,10 @@ export const es: TranslationKeys = {
"saveToDownloads": "Guardar en Descargas",
"preview": "Vista previa",
"closePreview": "Cerrar vista previa",
- "label": "Nombre",
- "labelPlaceholder": "p. ej. Wi-Fi de la oficina",
- "tags": "Etiquetas",
- "tagPlaceholder": "Añadir etiqueta…",
- "removeTag": "Quitar #{tag}",
- "usedBefore": "Usadas antes",
- "removeAll": "Quitar todo",
+ "note": "Nota",
+ "notePlaceholder": "p. ej. Contraseña del Wi-Fi de la oficina",
+ "noteHint": "La búsqueda lo encuentra con estas palabras.",
+ "removeNote": "Quitar nota",
"cancel": "Cancelar",
"save": "Guardar"
},
@@ -1314,8 +1303,7 @@ export const es: TranslationKeys = {
"current": "Actual"
},
"toast": {
- "labelPinned": "Fijado para conservarlo",
- "labelFailed": "No se pudo guardar el nombre. Inténtalo de nuevo.",
+ "noteFailed": "No se pudo guardar la nota. Inténtalo de nuevo.",
"savedToDownloads": "Guardado en Descargas: {name}",
"savedManyToDownloads": "{count} imágenes guardadas en Descargas",
"saveImagesFailed": "No se pudo guardar la imagen",
@@ -1576,8 +1564,8 @@ export const fr: TranslationKeys = {
"title": "Actions de l’élément",
"paste": "Coller",
"pastePlain": "Coller en texte brut",
- "addLabel": "Ajouter un nom et des tags…",
- "editLabel": "Modifier le nom et les tags…",
+ "addNote": "Ajouter une note…",
+ "editNote": "Modifier la note…",
"openLink": "Ouvrir le lien",
"copyCleanLink": "Copier le lien nettoyé",
"copyAs": "Copier en",
@@ -1587,13 +1575,10 @@ export const fr: TranslationKeys = {
"saveToDownloads": "Enregistrer dans Téléchargements",
"preview": "Aperçu",
"closePreview": "Fermer l’aperçu",
- "label": "Nom",
- "labelPlaceholder": "ex. Wi-Fi du bureau",
- "tags": "Tags",
- "tagPlaceholder": "Ajouter un tag…",
- "removeTag": "Retirer #{tag}",
- "usedBefore": "Déjà utilisés",
- "removeAll": "Tout retirer",
+ "note": "Note",
+ "notePlaceholder": "ex. Mot de passe Wi-Fi du bureau",
+ "noteHint": "La recherche le retrouve avec ces mots.",
+ "removeNote": "Retirer la note",
"cancel": "Annuler",
"save": "Enregistrer"
},
@@ -1718,8 +1703,7 @@ export const fr: TranslationKeys = {
"current": "Actuel"
},
"toast": {
- "labelPinned": "Épinglé pour le conserver",
- "labelFailed": "Impossible d’enregistrer le nom. Réessayez.",
+ "noteFailed": "Impossible d’enregistrer la note. Réessayez.",
"savedToDownloads": "Enregistré dans Téléchargements : {name}",
"savedManyToDownloads": "{count} images enregistrées dans Téléchargements",
"saveImagesFailed": "Impossible d’enregistrer l’image",
@@ -1980,8 +1964,8 @@ export const de: TranslationKeys = {
"title": "Element-Aktionen",
"paste": "Einfügen",
"pastePlain": "Als reinen Text einfügen",
- "addLabel": "Name & Tags hinzufügen…",
- "editLabel": "Name & Tags bearbeiten…",
+ "addNote": "Notiz hinzufügen…",
+ "editNote": "Notiz bearbeiten…",
"openLink": "Link öffnen",
"copyCleanLink": "Bereinigten Link kopieren",
"copyAs": "Kopieren als",
@@ -1991,13 +1975,10 @@ export const de: TranslationKeys = {
"saveToDownloads": "In Downloads speichern",
"preview": "Vorschau",
"closePreview": "Vorschau schließen",
- "label": "Name",
- "labelPlaceholder": "z. B. Büro-WLAN",
- "tags": "Tags",
- "tagPlaceholder": "Tag hinzufügen…",
- "removeTag": "#{tag} entfernen",
- "usedBefore": "Bereits verwendet",
- "removeAll": "Alle entfernen",
+ "note": "Notiz",
+ "notePlaceholder": "z. B. WLAN-Passwort im Büro",
+ "noteHint": "Die Suche findet es über diese Wörter.",
+ "removeNote": "Notiz entfernen",
"cancel": "Abbrechen",
"save": "Speichern"
},
@@ -2122,8 +2103,7 @@ export const de: TranslationKeys = {
"current": "Aktuell"
},
"toast": {
- "labelPinned": "Angeheftet, damit es erhalten bleibt",
- "labelFailed": "Name konnte nicht gespeichert werden. Bitte erneut versuchen.",
+ "noteFailed": "Notiz konnte nicht gespeichert werden. Bitte erneut versuchen.",
"savedToDownloads": "In Downloads gespeichert: {name}",
"savedManyToDownloads": "{count} Bilder in Downloads gespeichert",
"saveImagesFailed": "Bild konnte nicht gespeichert werden",
@@ -2384,8 +2364,8 @@ export const it: TranslationKeys = {
"title": "Azioni elemento",
"paste": "Incolla",
"pastePlain": "Incolla come testo semplice",
- "addLabel": "Aggiungi nome e tag…",
- "editLabel": "Modifica nome e tag…",
+ "addNote": "Aggiungi nota…",
+ "editNote": "Modifica nota…",
"openLink": "Apri link",
"copyCleanLink": "Copia link pulito",
"copyAs": "Copia come",
@@ -2395,13 +2375,10 @@ export const it: TranslationKeys = {
"saveToDownloads": "Salva in Download",
"preview": "Anteprima",
"closePreview": "Chiudi anteprima",
- "label": "Nome",
- "labelPlaceholder": "es. Wi-Fi dell’ufficio",
- "tags": "Tag",
- "tagPlaceholder": "Aggiungi un tag…",
- "removeTag": "Rimuovi #{tag}",
- "usedBefore": "Già usati",
- "removeAll": "Rimuovi tutto",
+ "note": "Nota",
+ "notePlaceholder": "es. Password Wi-Fi dell’ufficio",
+ "noteHint": "La ricerca lo trova con queste parole.",
+ "removeNote": "Rimuovi nota",
"cancel": "Annulla",
"save": "Salva"
},
@@ -2526,8 +2503,7 @@ export const it: TranslationKeys = {
"current": "Corrente"
},
"toast": {
- "labelPinned": "Fissato per conservarlo",
- "labelFailed": "Impossibile salvare il nome. Riprova.",
+ "noteFailed": "Impossibile salvare la nota. Riprova.",
"savedToDownloads": "Salvato in Download: {name}",
"savedManyToDownloads": "{count} immagini salvate in Download",
"saveImagesFailed": "Impossibile salvare l’immagine",
@@ -2788,8 +2764,8 @@ export const pt: TranslationKeys = {
"title": "Ações do item",
"paste": "Colar",
"pastePlain": "Colar como texto simples",
- "addLabel": "Adicionar nome e tags…",
- "editLabel": "Editar nome e tags…",
+ "addNote": "Adicionar nota…",
+ "editNote": "Editar nota…",
"openLink": "Abrir link",
"copyCleanLink": "Copiar link limpo",
"copyAs": "Copiar como",
@@ -2799,13 +2775,10 @@ export const pt: TranslationKeys = {
"saveToDownloads": "Salvar em Downloads",
"preview": "Pré-visualizar",
"closePreview": "Fechar pré-visualização",
- "label": "Nome",
- "labelPlaceholder": "ex.: Wi-Fi do escritório",
- "tags": "Tags",
- "tagPlaceholder": "Adicionar tag…",
- "removeTag": "Remover #{tag}",
- "usedBefore": "Usadas antes",
- "removeAll": "Remover tudo",
+ "note": "Nota",
+ "notePlaceholder": "ex.: Senha do Wi-Fi do escritório",
+ "noteHint": "A busca encontra com estas palavras.",
+ "removeNote": "Remover nota",
"cancel": "Cancelar",
"save": "Salvar"
},
@@ -2930,8 +2903,7 @@ export const pt: TranslationKeys = {
"current": "Atual"
},
"toast": {
- "labelPinned": "Fixado para ser mantido",
- "labelFailed": "Não foi possível salvar o nome. Tente novamente.",
+ "noteFailed": "Não foi possível salvar a nota. Tente novamente.",
"savedToDownloads": "Salvo em Downloads: {name}",
"savedManyToDownloads": "{count} imagens salvas em Downloads",
"saveImagesFailed": "Não foi possível salvar a imagem",
@@ -3192,8 +3164,8 @@ export const ru: TranslationKeys = {
"title": "Действия с элементом",
"paste": "Вставить",
"pastePlain": "Вставить как обычный текст",
- "addLabel": "Добавить название и теги…",
- "editLabel": "Изменить название и теги…",
+ "addNote": "Добавить заметку…",
+ "editNote": "Изменить заметку…",
"openLink": "Открыть ссылку",
"copyCleanLink": "Копировать чистую ссылку",
"copyAs": "Копировать как",
@@ -3203,13 +3175,10 @@ export const ru: TranslationKeys = {
"saveToDownloads": "Сохранить в «Загрузки»",
"preview": "Просмотр",
"closePreview": "Закрыть просмотр",
- "label": "Название",
- "labelPlaceholder": "напр. Wi-Fi в офисе",
- "tags": "Теги",
- "tagPlaceholder": "Добавить тег…",
- "removeTag": "Удалить #{tag}",
- "usedBefore": "Использованные ранее",
- "removeAll": "Удалить всё",
+ "note": "Заметка",
+ "notePlaceholder": "напр. Пароль от Wi-Fi в офисе",
+ "noteHint": "Поиск найдёт это по этим словам.",
+ "removeNote": "Удалить заметку",
"cancel": "Отмена",
"save": "Сохранить"
},
@@ -3334,8 +3303,7 @@ export const ru: TranslationKeys = {
"current": "Текущий"
},
"toast": {
- "labelPinned": "Закреплено, чтобы не потерялось",
- "labelFailed": "Не удалось сохранить название. Попробуйте ещё раз.",
+ "noteFailed": "Не удалось сохранить заметку. Попробуйте ещё раз.",
"savedToDownloads": "Сохранено в «Загрузки»: {name}",
"savedManyToDownloads": "Сохранено изображений в «Загрузки»: {count}",
"saveImagesFailed": "Не удалось сохранить изображение",
@@ -3596,8 +3564,8 @@ export const ja: TranslationKeys = {
"title": "項目の操作",
"paste": "貼り付け",
"pastePlain": "プレーンテキストとして貼り付け",
- "addLabel": "名前とタグを追加…",
- "editLabel": "名前とタグを編集…",
+ "addNote": "メモを追加…",
+ "editNote": "メモを編集…",
"openLink": "リンクを開く",
"copyCleanLink": "クリーンなリンクをコピー",
"copyAs": "形式を指定してコピー",
@@ -3607,13 +3575,10 @@ export const ja: TranslationKeys = {
"saveToDownloads": "ダウンロードに保存",
"preview": "プレビュー",
"closePreview": "プレビューを閉じる",
- "label": "名前",
- "labelPlaceholder": "例: オフィスの Wi-Fi",
- "tags": "タグ",
- "tagPlaceholder": "タグを追加…",
- "removeTag": "#{tag} を削除",
- "usedBefore": "使用済み",
- "removeAll": "すべて削除",
+ "note": "メモ",
+ "notePlaceholder": "例:オフィスの Wi-Fi パスワード",
+ "noteHint": "これらの言葉で検索できます。",
+ "removeNote": "メモを削除",
"cancel": "キャンセル",
"save": "保存"
},
@@ -3738,8 +3703,7 @@ export const ja: TranslationKeys = {
"current": "現在"
},
"toast": {
- "labelPinned": "保持するためにピン留めしました",
- "labelFailed": "名前を保存できませんでした。もう一度お試しください。",
+ "noteFailed": "メモを保存できませんでした。もう一度お試しください。",
"savedToDownloads": "ダウンロードに保存しました: {name}",
"savedManyToDownloads": "{count} 枚の画像をダウンロードに保存しました",
"saveImagesFailed": "画像を保存できませんでした",
@@ -4000,8 +3964,8 @@ export const ko: TranslationKeys = {
"title": "항목 작업",
"paste": "붙여넣기",
"pastePlain": "일반 텍스트로 붙여넣기",
- "addLabel": "이름 및 태그 추가…",
- "editLabel": "이름 및 태그 편집…",
+ "addNote": "메모 추가…",
+ "editNote": "메모 편집…",
"openLink": "링크 열기",
"copyCleanLink": "깔끔한 링크 복사",
"copyAs": "다른 형식으로 복사",
@@ -4011,13 +3975,10 @@ export const ko: TranslationKeys = {
"saveToDownloads": "다운로드에 저장",
"preview": "미리 보기",
"closePreview": "미리 보기 닫기",
- "label": "이름",
- "labelPlaceholder": "예: 사무실 Wi-Fi",
- "tags": "태그",
- "tagPlaceholder": "태그 추가…",
- "removeTag": "#{tag} 제거",
- "usedBefore": "이전에 사용함",
- "removeAll": "모두 제거",
+ "note": "메모",
+ "notePlaceholder": "예: 사무실 Wi-Fi 비밀번호",
+ "noteHint": "이 단어들로 검색할 수 있습니다.",
+ "removeNote": "메모 삭제",
"cancel": "취소",
"save": "저장"
},
@@ -4142,8 +4103,7 @@ export const ko: TranslationKeys = {
"current": "현재"
},
"toast": {
- "labelPinned": "보관되도록 고정했습니다",
- "labelFailed": "이름을 저장하지 못했습니다. 다시 시도하세요.",
+ "noteFailed": "메모를 저장하지 못했습니다. 다시 시도하세요.",
"savedToDownloads": "다운로드에 저장됨: {name}",
"savedManyToDownloads": "이미지 {count}개를 다운로드에 저장했습니다",
"saveImagesFailed": "이미지를 저장하지 못했습니다",
@@ -4404,8 +4364,8 @@ export const zhCN: TranslationKeys = {
"title": "项目操作",
"paste": "粘贴",
"pastePlain": "粘贴为纯文本",
- "addLabel": "添加名称和标签…",
- "editLabel": "编辑名称和标签…",
+ "addNote": "添加备注…",
+ "editNote": "编辑备注…",
"openLink": "打开链接",
"copyCleanLink": "复制干净链接",
"copyAs": "复制为",
@@ -4415,13 +4375,10 @@ export const zhCN: TranslationKeys = {
"saveToDownloads": "保存到“下载”",
"preview": "预览",
"closePreview": "关闭预览",
- "label": "名称",
- "labelPlaceholder": "例如:办公室 Wi-Fi",
- "tags": "标签",
- "tagPlaceholder": "添加标签…",
- "removeTag": "移除 #{tag}",
- "usedBefore": "用过的",
- "removeAll": "全部移除",
+ "note": "备注",
+ "notePlaceholder": "例如:办公室 Wi-Fi 密码",
+ "noteHint": "搜索这些词即可找到它。",
+ "removeNote": "删除备注",
"cancel": "取消",
"save": "保存"
},
@@ -4546,8 +4503,7 @@ export const zhCN: TranslationKeys = {
"current": "当前"
},
"toast": {
- "labelPinned": "已固定,以免被删除",
- "labelFailed": "无法保存名称,请重试。",
+ "noteFailed": "无法保存备注,请重试。",
"savedToDownloads": "已保存到“下载”:{name}",
"savedManyToDownloads": "已将 {count} 张图片保存到“下载”",
"saveImagesFailed": "无法保存图片",
@@ -4808,8 +4764,8 @@ export const zhTW: TranslationKeys = {
"title": "項目動作",
"paste": "貼上",
"pastePlain": "以純文字貼上",
- "addLabel": "新增名稱與標籤…",
- "editLabel": "編輯名稱與標籤…",
+ "addNote": "新增備註…",
+ "editNote": "編輯備註…",
"openLink": "開啟連結",
"copyCleanLink": "複製乾淨連結",
"copyAs": "複製為",
@@ -4819,13 +4775,10 @@ export const zhTW: TranslationKeys = {
"saveToDownloads": "儲存到「下載」",
"preview": "預覽",
"closePreview": "關閉預覽",
- "label": "名稱",
- "labelPlaceholder": "例如:辦公室 Wi-Fi",
- "tags": "標籤",
- "tagPlaceholder": "新增標籤…",
- "removeTag": "移除 #{tag}",
- "usedBefore": "用過的",
- "removeAll": "全部移除",
+ "note": "備註",
+ "notePlaceholder": "例如:辦公室 Wi-Fi 密碼",
+ "noteHint": "搜尋這些字詞即可找到它。",
+ "removeNote": "移除備註",
"cancel": "取消",
"save": "儲存"
},
@@ -4950,8 +4903,7 @@ export const zhTW: TranslationKeys = {
"current": "目前"
},
"toast": {
- "labelPinned": "已釘選,以免被刪除",
- "labelFailed": "無法儲存名稱,請再試一次。",
+ "noteFailed": "無法儲存備註,請再試一次。",
"savedToDownloads": "已儲存到「下載」:{name}",
"savedManyToDownloads": "已將 {count} 張圖片儲存到「下載」",
"saveImagesFailed": "無法儲存圖片",
@@ -5212,8 +5164,8 @@ export const hi: TranslationKeys = {
"title": "आइटम क्रियाएँ",
"paste": "पेस्ट करें",
"pastePlain": "सादे टेक्स्ट के रूप में पेस्ट करें",
- "addLabel": "नाम और टैग जोड़ें…",
- "editLabel": "नाम और टैग बदलें…",
+ "addNote": "नोट जोड़ें…",
+ "editNote": "नोट बदलें…",
"openLink": "लिंक खोलें",
"copyCleanLink": "साफ़ लिंक कॉपी करें",
"copyAs": "इस रूप में कॉपी करें",
@@ -5223,13 +5175,10 @@ export const hi: TranslationKeys = {
"saveToDownloads": "डाउनलोड्स में सेव करें",
"preview": "प्रीव्यू",
"closePreview": "प्रीव्यू बंद करें",
- "label": "नाम",
- "labelPlaceholder": "जैसे ऑफ़िस वाई-फ़ाई",
- "tags": "टैग",
- "tagPlaceholder": "टैग जोड़ें…",
- "removeTag": "#{tag} हटाएँ",
- "usedBefore": "पहले इस्तेमाल किए गए",
- "removeAll": "सब हटाएँ",
+ "note": "नोट",
+ "notePlaceholder": "जैसे: ऑफ़िस वाई-फ़ाई पासवर्ड",
+ "noteHint": "खोज इन शब्दों से इसे ढूँढ लेगी।",
+ "removeNote": "नोट हटाएँ",
"cancel": "रद्द करें",
"save": "सेव करें"
},
@@ -5354,8 +5303,7 @@ export const hi: TranslationKeys = {
"current": "वर्तमान"
},
"toast": {
- "labelPinned": "पिन किया गया ताकि यह बना रहे",
- "labelFailed": "नाम सेव नहीं हो सका। फिर से कोशिश करें।",
+ "noteFailed": "नोट सेव नहीं हो सका। फिर से कोशिश करें।",
"savedToDownloads": "डाउनलोड्स में सेव किया गया: {name}",
"savedManyToDownloads": "{count} इमेज डाउनलोड्स में सेव की गईं",
"saveImagesFailed": "इमेज सेव नहीं हो सकी",
@@ -5616,8 +5564,8 @@ export const ar: TranslationKeys = {
"title": "إجراءات العنصر",
"paste": "لصق",
"pastePlain": "لصق كنص عادي",
- "addLabel": "إضافة اسم ووسوم…",
- "editLabel": "تعديل الاسم والوسوم…",
+ "addNote": "إضافة ملاحظة…",
+ "editNote": "تعديل الملاحظة…",
"openLink": "فتح الرابط",
"copyCleanLink": "نسخ رابط نظيف",
"copyAs": "نسخ بصيغة",
@@ -5627,13 +5575,10 @@ export const ar: TranslationKeys = {
"saveToDownloads": "حفظ في التنزيلات",
"preview": "معاينة",
"closePreview": "إغلاق المعاينة",
- "label": "الاسم",
- "labelPlaceholder": "مثل: Wi-Fi المكتب",
- "tags": "الوسوم",
- "tagPlaceholder": "إضافة وسم…",
- "removeTag": "إزالة #{tag}",
- "usedBefore": "مستخدمة سابقًا",
- "removeAll": "إزالة الكل",
+ "note": "ملاحظة",
+ "notePlaceholder": "مثال: كلمة مرور Wi-Fi المكتب",
+ "noteHint": "سيعثر عليه البحث بهذه الكلمات.",
+ "removeNote": "إزالة الملاحظة",
"cancel": "إلغاء",
"save": "حفظ"
},
@@ -5758,8 +5703,7 @@ export const ar: TranslationKeys = {
"current": "الحالي"
},
"toast": {
- "labelPinned": "تم التثبيت للاحتفاظ به",
- "labelFailed": "تعذّر حفظ الاسم. حاول مرة أخرى.",
+ "noteFailed": "تعذّر حفظ الملاحظة. حاول مرة أخرى.",
"savedToDownloads": "تم الحفظ في التنزيلات: {name}",
"savedManyToDownloads": "تم حفظ {count} صور في التنزيلات",
"saveImagesFailed": "تعذّر حفظ الصورة",
@@ -6020,8 +5964,8 @@ export const fa: TranslationKeys = {
"title": "عملیات مورد",
"paste": "جای‌گذاری",
"pastePlain": "جای‌گذاری به‌صورت متن ساده",
- "addLabel": "افزودن نام و برچسب…",
- "editLabel": "ویرایش نام و برچسب…",
+ "addNote": "افزودن یادداشت…",
+ "editNote": "ویرایش یادداشت…",
"openLink": "باز کردن پیوند",
"copyCleanLink": "کپی پیوند تمیز",
"copyAs": "کپی به‌صورت",
@@ -6031,13 +5975,10 @@ export const fa: TranslationKeys = {
"saveToDownloads": "ذخیره در دانلودها",
"preview": "پیش‌نمایش",
"closePreview": "بستن پیش‌نمایش",
- "label": "نام",
- "labelPlaceholder": "مثلاً Wi-Fi دفتر",
- "tags": "برچسب‌ها",
- "tagPlaceholder": "افزودن برچسب…",
- "removeTag": "حذف #{tag}",
- "usedBefore": "استفاده‌شده",
- "removeAll": "حذف همه",
+ "note": "یادداشت",
+ "notePlaceholder": "مثلاً رمز Wi-Fi دفتر",
+ "noteHint": "جست‌وجو آن را با این کلمه‌ها پیدا می‌کند.",
+ "removeNote": "حذف یادداشت",
"cancel": "لغو",
"save": "ذخیره"
},
@@ -6162,8 +6103,7 @@ export const fa: TranslationKeys = {
"current": "فعلی"
},
"toast": {
- "labelPinned": "سنجاق شد تا نگه داشته شود",
- "labelFailed": "ذخیرهٔ نام ممکن نشد. دوباره تلاش کنید.",
+ "noteFailed": "ذخیرهٔ یادداشت ممکن نشد. دوباره تلاش کنید.",
"savedToDownloads": "در دانلودها ذخیره شد: {name}",
"savedManyToDownloads": "{count} تصویر در دانلودها ذخیره شد",
"saveImagesFailed": "ذخیرهٔ تصویر ممکن نشد",
@@ -6424,8 +6364,8 @@ export const bn: TranslationKeys = {
"title": "আইটেমের কাজ",
"paste": "পেস্ট করুন",
"pastePlain": "সাধারণ টেক্সট হিসেবে পেস্ট করুন",
- "addLabel": "নাম ও ট্যাগ যোগ করুন…",
- "editLabel": "নাম ও ট্যাগ সম্পাদনা করুন…",
+ "addNote": "নোট যোগ করুন…",
+ "editNote": "নোট সম্পাদনা করুন…",
"openLink": "লিঙ্ক খুলুন",
"copyCleanLink": "পরিষ্কার লিঙ্ক কপি করুন",
"copyAs": "যেভাবে কপি করবেন",
@@ -6435,13 +6375,10 @@ export const bn: TranslationKeys = {
"saveToDownloads": "ডাউনলোডসে সেভ করুন",
"preview": "প্রিভিউ",
"closePreview": "প্রিভিউ বন্ধ করুন",
- "label": "নাম",
- "labelPlaceholder": "যেমন অফিসের ওয়াই-ফাই",
- "tags": "ট্যাগ",
- "tagPlaceholder": "ট্যাগ যোগ করুন…",
- "removeTag": "#{tag} সরান",
- "usedBefore": "আগে ব্যবহৃত",
- "removeAll": "সব সরান",
+ "note": "নোট",
+ "notePlaceholder": "যেমন: অফিসের ওয়াই-ফাই পাসওয়ার্ড",
+ "noteHint": "এই শব্দগুলো দিয়ে খুঁজলেই পাওয়া যাবে।",
+ "removeNote": "নোট সরান",
"cancel": "বাতিল",
"save": "সেভ করুন"
},
@@ -6566,8 +6503,7 @@ export const bn: TranslationKeys = {
"current": "বর্তমান"
},
"toast": {
- "labelPinned": "রাখার জন্য পিন করা হয়েছে",
- "labelFailed": "নাম সেভ করা যায়নি। আবার চেষ্টা করুন।",
+ "noteFailed": "নোট সেভ করা যায়নি। আবার চেষ্টা করুন।",
"savedToDownloads": "ডাউনলোডসে সেভ হয়েছে: {name}",
"savedManyToDownloads": "{count}টি ছবি ডাউনলোডসে সেভ হয়েছে",
"saveImagesFailed": "ছবি সেভ করা যায়নি",
@@ -6828,8 +6764,8 @@ export const tr: TranslationKeys = {
"title": "Öğe işlemleri",
"paste": "Yapıştır",
"pastePlain": "Düz metin olarak yapıştır",
- "addLabel": "Ad ve etiket ekle…",
- "editLabel": "Adı ve etiketleri düzenle…",
+ "addNote": "Not ekle…",
+ "editNote": "Notu düzenle…",
"openLink": "Bağlantıyı aç",
"copyCleanLink": "Temiz bağlantıyı kopyala",
"copyAs": "Şu biçimde kopyala",
@@ -6839,13 +6775,10 @@ export const tr: TranslationKeys = {
"saveToDownloads": "İndirilenler'e kaydet",
"preview": "Önizleme",
"closePreview": "Önizlemeyi kapat",
- "label": "Ad",
- "labelPlaceholder": "ör. Ofis Wi-Fi",
- "tags": "Etiketler",
- "tagPlaceholder": "Etiket ekle…",
- "removeTag": "#{tag} kaldır",
- "usedBefore": "Daha önce kullanılanlar",
- "removeAll": "Tümünü kaldır",
+ "note": "Not",
+ "notePlaceholder": "ör. Ofis Wi-Fi şifresi",
+ "noteHint": "Arama bu kelimelerle bulur.",
+ "removeNote": "Notu kaldır",
"cancel": "İptal",
"save": "Kaydet"
},
@@ -6970,8 +6903,7 @@ export const tr: TranslationKeys = {
"current": "Geçerli"
},
"toast": {
- "labelPinned": "Saklanması için sabitlendi",
- "labelFailed": "Ad kaydedilemedi. Lütfen tekrar deneyin.",
+ "noteFailed": "Not kaydedilemedi. Lütfen tekrar deneyin.",
"savedToDownloads": "İndirilenler'e kaydedildi: {name}",
"savedManyToDownloads": "{count} görsel İndirilenler'e kaydedildi",
"saveImagesFailed": "Görsel kaydedilemedi",
@@ -7232,8 +7164,8 @@ export const vi: TranslationKeys = {
"title": "Thao tác mục",
"paste": "Dán",
"pastePlain": "Dán dạng văn bản thuần",
- "addLabel": "Thêm tên và thẻ…",
- "editLabel": "Sửa tên và thẻ…",
+ "addNote": "Thêm ghi chú…",
+ "editNote": "Sửa ghi chú…",
"openLink": "Mở liên kết",
"copyCleanLink": "Sao chép liên kết sạch",
"copyAs": "Sao chép dạng",
@@ -7243,13 +7175,10 @@ export const vi: TranslationKeys = {
"saveToDownloads": "Lưu vào Tải xuống",
"preview": "Xem trước",
"closePreview": "Đóng xem trước",
- "label": "Tên",
- "labelPlaceholder": "vd. Wi-Fi văn phòng",
- "tags": "Thẻ",
- "tagPlaceholder": "Thêm thẻ…",
- "removeTag": "Xóa #{tag}",
- "usedBefore": "Đã dùng trước đây",
- "removeAll": "Xóa tất cả",
+ "note": "Ghi chú",
+ "notePlaceholder": "vd: Mật khẩu Wi-Fi văn phòng",
+ "noteHint": "Tìm kiếm sẽ thấy nó qua những từ này.",
+ "removeNote": "Xóa ghi chú",
"cancel": "Hủy",
"save": "Lưu"
},
@@ -7374,8 +7303,7 @@ export const vi: TranslationKeys = {
"current": "Hiện tại"
},
"toast": {
- "labelPinned": "Đã ghim để giữ lại",
- "labelFailed": "Không thể lưu tên. Vui lòng thử lại.",
+ "noteFailed": "Không thể lưu ghi chú. Vui lòng thử lại.",
"savedToDownloads": "Đã lưu vào Tải xuống: {name}",
"savedManyToDownloads": "Đã lưu {count} ảnh vào Tải xuống",
"saveImagesFailed": "Không thể lưu ảnh",
@@ -7636,8 +7564,8 @@ export const pl: TranslationKeys = {
"title": "Akcje elementu",
"paste": "Wklej",
"pastePlain": "Wklej jako zwykły tekst",
- "addLabel": "Dodaj nazwę i tagi…",
- "editLabel": "Edytuj nazwę i tagi…",
+ "addNote": "Dodaj notatkę…",
+ "editNote": "Edytuj notatkę…",
"openLink": "Otwórz link",
"copyCleanLink": "Kopiuj czysty link",
"copyAs": "Kopiuj jako",
@@ -7647,13 +7575,10 @@ export const pl: TranslationKeys = {
"saveToDownloads": "Zapisz w Pobranych",
"preview": "Podgląd",
"closePreview": "Zamknij podgląd",
- "label": "Nazwa",
- "labelPlaceholder": "np. Wi-Fi w biurze",
- "tags": "Tagi",
- "tagPlaceholder": "Dodaj tag…",
- "removeTag": "Usuń #{tag}",
- "usedBefore": "Używane wcześniej",
- "removeAll": "Usuń wszystko",
+ "note": "Notatka",
+ "notePlaceholder": "np. Hasło do Wi-Fi w biurze",
+ "noteHint": "Wyszukiwanie znajdzie to po tych słowach.",
+ "removeNote": "Usuń notatkę",
"cancel": "Anuluj",
"save": "Zapisz"
},
@@ -7778,8 +7703,7 @@ export const pl: TranslationKeys = {
"current": "Bieżący"
},
"toast": {
- "labelPinned": "Przypięto, aby zostało zachowane",
- "labelFailed": "Nie udało się zapisać nazwy. Spróbuj ponownie.",
+ "noteFailed": "Nie udało się zapisać notatki. Spróbuj ponownie.",
"savedToDownloads": "Zapisano w Pobranych: {name}",
"savedManyToDownloads": "Zapisane obrazy w Pobranych: {count}",
"saveImagesFailed": "Nie udało się zapisać obrazu",
@@ -8040,8 +7964,8 @@ export const nl: TranslationKeys = {
"title": "Itemacties",
"paste": "Plakken",
"pastePlain": "Plakken als platte tekst",
- "addLabel": "Naam en tags toevoegen…",
- "editLabel": "Naam en tags bewerken…",
+ "addNote": "Notitie toevoegen…",
+ "editNote": "Notitie bewerken…",
"openLink": "Link openen",
"copyCleanLink": "Opgeschoonde link kopiëren",
"copyAs": "Kopiëren als",
@@ -8051,13 +7975,10 @@ export const nl: TranslationKeys = {
"saveToDownloads": "Opslaan in Downloads",
"preview": "Voorbeeld",
"closePreview": "Voorbeeld sluiten",
- "label": "Naam",
- "labelPlaceholder": "bijv. Wifi op kantoor",
- "tags": "Tags",
- "tagPlaceholder": "Tag toevoegen…",
- "removeTag": "#{tag} verwijderen",
- "usedBefore": "Eerder gebruikt",
- "removeAll": "Alles verwijderen",
+ "note": "Notitie",
+ "notePlaceholder": "bijv. Wifi-wachtwoord kantoor",
+ "noteHint": "Zoeken vindt het met deze woorden.",
+ "removeNote": "Notitie verwijderen",
"cancel": "Annuleren",
"save": "Opslaan"
},
@@ -8182,8 +8103,7 @@ export const nl: TranslationKeys = {
"current": "Huidig"
},
"toast": {
- "labelPinned": "Vastgezet zodat het bewaard blijft",
- "labelFailed": "Naam kon niet worden opgeslagen. Probeer het opnieuw.",
+ "noteFailed": "Notitie kon niet worden opgeslagen. Probeer het opnieuw.",
"savedToDownloads": "Opgeslagen in Downloads: {name}",
"savedManyToDownloads": "{count} afbeeldingen opgeslagen in Downloads",
"saveImagesFailed": "Afbeelding kon niet worden opgeslagen",
@@ -8444,8 +8364,8 @@ export const sv: TranslationKeys = {
"title": "Objektåtgärder",
"paste": "Klistra in",
"pastePlain": "Klistra in som oformaterad text",
- "addLabel": "Lägg till namn och taggar…",
- "editLabel": "Redigera namn och taggar…",
+ "addNote": "Lägg till anteckning…",
+ "editNote": "Redigera anteckning…",
"openLink": "Öppna länk",
"copyCleanLink": "Kopiera ren länk",
"copyAs": "Kopiera som",
@@ -8455,13 +8375,10 @@ export const sv: TranslationKeys = {
"saveToDownloads": "Spara i Hämtade filer",
"preview": "Förhandsgranska",
"closePreview": "Stäng förhandsgranskning",
- "label": "Namn",
- "labelPlaceholder": "t.ex. Kontorets wifi",
- "tags": "Taggar",
- "tagPlaceholder": "Lägg till tagg…",
- "removeTag": "Ta bort #{tag}",
- "usedBefore": "Använda tidigare",
- "removeAll": "Ta bort alla",
+ "note": "Anteckning",
+ "notePlaceholder": "t.ex. Wi-Fi-lösenord på kontoret",
+ "noteHint": "Sökningen hittar den med de här orden.",
+ "removeNote": "Ta bort anteckning",
"cancel": "Avbryt",
"save": "Spara"
},
@@ -8586,8 +8503,7 @@ export const sv: TranslationKeys = {
"current": "Aktuell"
},
"toast": {
- "labelPinned": "Fäst så att den sparas",
- "labelFailed": "Det gick inte att spara namnet. Försök igen.",
+ "noteFailed": "Det gick inte att spara anteckningen. Försök igen.",
"savedToDownloads": "Sparad i Hämtade filer: {name}",
"savedManyToDownloads": "{count} bilder sparade i Hämtade filer",
"saveImagesFailed": "Det gick inte att spara bilden",
@@ -8848,8 +8764,8 @@ export const id: TranslationKeys = {
"title": "Tindakan item",
"paste": "Tempel",
"pastePlain": "Tempel sebagai teks biasa",
- "addLabel": "Tambah nama & tag…",
- "editLabel": "Edit nama & tag…",
+ "addNote": "Tambah catatan…",
+ "editNote": "Edit catatan…",
"openLink": "Buka tautan",
"copyCleanLink": "Salin tautan bersih",
"copyAs": "Salin sebagai",
@@ -8859,13 +8775,10 @@ export const id: TranslationKeys = {
"saveToDownloads": "Simpan ke Unduhan",
"preview": "Pratinjau",
"closePreview": "Tutup pratinjau",
- "label": "Nama",
- "labelPlaceholder": "mis. Wi-Fi kantor",
- "tags": "Tag",
- "tagPlaceholder": "Tambah tag…",
- "removeTag": "Hapus #{tag}",
- "usedBefore": "Pernah dipakai",
- "removeAll": "Hapus semua",
+ "note": "Catatan",
+ "notePlaceholder": "mis. Kata sandi Wi-Fi kantor",
+ "noteHint": "Pencarian akan menemukannya lewat kata-kata ini.",
+ "removeNote": "Hapus catatan",
"cancel": "Batal",
"save": "Simpan"
},
@@ -8990,8 +8903,7 @@ export const id: TranslationKeys = {
"current": "Saat ini"
},
"toast": {
- "labelPinned": "Disematkan agar tetap tersimpan",
- "labelFailed": "Gagal menyimpan nama. Coba lagi.",
+ "noteFailed": "Gagal menyimpan catatan. Coba lagi.",
"savedToDownloads": "Disimpan ke Unduhan: {name}",
"savedManyToDownloads": "{count} gambar disimpan ke Unduhan",
"saveImagesFailed": "Gagal menyimpan gambar",
@@ -9252,8 +9164,8 @@ export const uk: TranslationKeys = {
"title": "Дії з елементом",
"paste": "Вставити",
"pastePlain": "Вставити як звичайний текст",
- "addLabel": "Додати назву й теги…",
- "editLabel": "Змінити назву й теги…",
+ "addNote": "Додати нотатку…",
+ "editNote": "Змінити нотатку…",
"openLink": "Відкрити посилання",
"copyCleanLink": "Копіювати чисте посилання",
"copyAs": "Копіювати як",
@@ -9263,13 +9175,10 @@ export const uk: TranslationKeys = {
"saveToDownloads": "Зберегти в «Завантаження»",
"preview": "Перегляд",
"closePreview": "Закрити перегляд",
- "label": "Назва",
- "labelPlaceholder": "напр. Wi-Fi в офісі",
- "tags": "Теги",
- "tagPlaceholder": "Додати тег…",
- "removeTag": "Прибрати #{tag}",
- "usedBefore": "Використані раніше",
- "removeAll": "Прибрати все",
+ "note": "Нотатка",
+ "notePlaceholder": "напр. Пароль від Wi-Fi в офісі",
+ "noteHint": "Пошук знайде це за цими словами.",
+ "removeNote": "Прибрати нотатку",
"cancel": "Скасувати",
"save": "Зберегти"
},
@@ -9394,8 +9303,7 @@ export const uk: TranslationKeys = {
"current": "Поточний"
},
"toast": {
- "labelPinned": "Закріплено, щоб не загубилося",
- "labelFailed": "Не вдалося зберегти назву. Спробуйте ще раз.",
+ "noteFailed": "Не вдалося зберегти нотатку. Спробуйте ще раз.",
"savedToDownloads": "Збережено в «Завантаження»: {name}",
"savedManyToDownloads": "Збережено зображень у «Завантаження»: {count}",
"saveImagesFailed": "Не вдалося зберегти зображення",
@@ -9656,8 +9564,8 @@ export const el: TranslationKeys = {
"title": "Ενέργειες στοιχείου",
"paste": "Επικόλληση",
"pastePlain": "Επικόλληση ως απλό κείμενο",
- "addLabel": "Προσθήκη ονόματος και ετικετών…",
- "editLabel": "Επεξεργασία ονόματος και ετικετών…",
+ "addNote": "Προσθήκη σημείωσης…",
+ "editNote": "Επεξεργασία σημείωσης…",
"openLink": "Άνοιγμα συνδέσμου",
"copyCleanLink": "Αντιγραφή καθαρού συνδέσμου",
"copyAs": "Αντιγραφή ως",
@@ -9667,13 +9575,10 @@ export const el: TranslationKeys = {
"saveToDownloads": "Αποθήκευση στις Λήψεις",
"preview": "Προεπισκόπηση",
"closePreview": "Κλείσιμο προεπισκόπησης",
- "label": "Όνομα",
- "labelPlaceholder": "π.χ. Wi-Fi γραφείου",
- "tags": "Ετικέτες",
- "tagPlaceholder": "Προσθήκη ετικέτας…",
- "removeTag": "Αφαίρεση #{tag}",
- "usedBefore": "Έχουν χρησιμοποιηθεί",
- "removeAll": "Αφαίρεση όλων",
+ "note": "Σημείωση",
+ "notePlaceholder": "π.χ. Κωδικός Wi-Fi γραφείου",
+ "noteHint": "Η αναζήτηση το βρίσκει με αυτές τις λέξεις.",
+ "removeNote": "Αφαίρεση σημείωσης",
"cancel": "Ακύρωση",
"save": "Αποθήκευση"
},
@@ -9798,8 +9703,7 @@ export const el: TranslationKeys = {
"current": "Τρέχον"
},
"toast": {
- "labelPinned": "Καρφιτσώθηκε για να διατηρηθεί",
- "labelFailed": "Δεν ήταν δυνατή η αποθήκευση του ονόματος. Δοκιμάστε ξανά.",
+ "noteFailed": "Δεν ήταν δυνατή η αποθήκευση της σημείωσης. Δοκιμάστε ξανά.",
"savedToDownloads": "Αποθηκεύτηκε στις Λήψεις: {name}",
"savedManyToDownloads": "Αποθηκεύτηκαν {count} εικόνες στις Λήψεις",
"saveImagesFailed": "Δεν ήταν δυνατή η αποθήκευση της εικόνας",
@@ -10060,8 +9964,8 @@ export const cs: TranslationKeys = {
"title": "Akce položky",
"paste": "Vložit",
"pastePlain": "Vložit jako prostý text",
- "addLabel": "Přidat název a štítky…",
- "editLabel": "Upravit název a štítky…",
+ "addNote": "Přidat poznámku…",
+ "editNote": "Upravit poznámku…",
"openLink": "Otevřít odkaz",
"copyCleanLink": "Kopírovat čistý odkaz",
"copyAs": "Kopírovat jako",
@@ -10071,13 +9975,10 @@ export const cs: TranslationKeys = {
"saveToDownloads": "Uložit do Stažených souborů",
"preview": "Náhled",
"closePreview": "Zavřít náhled",
- "label": "Název",
- "labelPlaceholder": "např. Wi-Fi v kanceláři",
- "tags": "Štítky",
- "tagPlaceholder": "Přidat štítek…",
- "removeTag": "Odebrat #{tag}",
- "usedBefore": "Dříve použité",
- "removeAll": "Odebrat vše",
+ "note": "Poznámka",
+ "notePlaceholder": "např. Heslo k Wi-Fi v kanceláři",
+ "noteHint": "Vyhledávání to najde podle těchto slov.",
+ "removeNote": "Odebrat poznámku",
"cancel": "Zrušit",
"save": "Uložit"
},
@@ -10202,8 +10103,7 @@ export const cs: TranslationKeys = {
"current": "Aktuální"
},
"toast": {
- "labelPinned": "Připnuto, aby se zachovalo",
- "labelFailed": "Název se nepodařilo uložit. Zkuste to znovu.",
+ "noteFailed": "Poznámku se nepodařilo uložit. Zkuste to znovu.",
"savedToDownloads": "Uloženo do Stažených souborů: {name}",
"savedManyToDownloads": "Uložené obrázky ve Stažených souborech: {count}",
"saveImagesFailed": "Obrázek se nepodařilo uložit",
@@ -10464,8 +10364,8 @@ export const ro: TranslationKeys = {
"title": "Acțiuni element",
"paste": "Lipește",
"pastePlain": "Lipește ca text simplu",
- "addLabel": "Adaugă nume și etichete…",
- "editLabel": "Editează numele și etichetele…",
+ "addNote": "Adaugă o notă…",
+ "editNote": "Editează nota…",
"openLink": "Deschide linkul",
"copyCleanLink": "Copiază linkul curat",
"copyAs": "Copiază ca",
@@ -10475,13 +10375,10 @@ export const ro: TranslationKeys = {
"saveToDownloads": "Salvează în Descărcări",
"preview": "Previzualizare",
"closePreview": "Închide previzualizarea",
- "label": "Nume",
- "labelPlaceholder": "ex. Wi-Fi birou",
- "tags": "Etichete",
- "tagPlaceholder": "Adaugă o etichetă…",
- "removeTag": "Elimină #{tag}",
- "usedBefore": "Folosite anterior",
- "removeAll": "Elimină tot",
+ "note": "Notă",
+ "notePlaceholder": "ex. Parola Wi-Fi de la birou",
+ "noteHint": "Căutarea îl găsește după aceste cuvinte.",
+ "removeNote": "Elimină nota",
"cancel": "Anulează",
"save": "Salvează"
},
@@ -10606,8 +10503,7 @@ export const ro: TranslationKeys = {
"current": "Curent"
},
"toast": {
- "labelPinned": "Fixat ca să fie păstrat",
- "labelFailed": "Numele nu a putut fi salvat. Încearcă din nou.",
+ "noteFailed": "Nota nu a putut fi salvată. Încearcă din nou.",
"savedToDownloads": "Salvat în Descărcări: {name}",
"savedManyToDownloads": "{count} imagini salvate în Descărcări",
"saveImagesFailed": "Imaginea nu a putut fi salvată",
@@ -10868,8 +10764,8 @@ export const hu: TranslationKeys = {
"title": "Elemműveletek",
"paste": "Beillesztés",
"pastePlain": "Beillesztés egyszerű szövegként",
- "addLabel": "Név és címkék hozzáadása…",
- "editLabel": "Név és címkék szerkesztése…",
+ "addNote": "Jegyzet hozzáadása…",
+ "editNote": "Jegyzet szerkesztése…",
"openLink": "Hivatkozás megnyitása",
"copyCleanLink": "Tiszta hivatkozás másolása",
"copyAs": "Másolás mint",
@@ -10879,13 +10775,10 @@ export const hu: TranslationKeys = {
"saveToDownloads": "Mentés a Letöltésekbe",
"preview": "Előnézet",
"closePreview": "Előnézet bezárása",
- "label": "Név",
- "labelPlaceholder": "pl. Irodai Wi-Fi",
- "tags": "Címkék",
- "tagPlaceholder": "Címke hozzáadása…",
- "removeTag": "#{tag} eltávolítása",
- "usedBefore": "Korábban használt",
- "removeAll": "Összes eltávolítása",
+ "note": "Jegyzet",
+ "notePlaceholder": "pl. Irodai Wi-Fi jelszó",
+ "noteHint": "A keresés ezekkel a szavakkal megtalálja.",
+ "removeNote": "Jegyzet eltávolítása",
"cancel": "Mégse",
"save": "Mentés"
},
@@ -11010,8 +10903,7 @@ export const hu: TranslationKeys = {
"current": "Jelenlegi"
},
"toast": {
- "labelPinned": "Rögzítve, hogy megmaradjon",
- "labelFailed": "A nevet nem sikerült menteni. Próbáld újra.",
+ "noteFailed": "A jegyzetet nem sikerült menteni. Próbáld újra.",
"savedToDownloads": "Mentve a Letöltésekbe: {name}",
"savedManyToDownloads": "{count} kép mentve a Letöltésekbe",
"saveImagesFailed": "A képet nem sikerült menteni",
@@ -11272,8 +11164,8 @@ export const da: TranslationKeys = {
"title": "Elementhandlinger",
"paste": "Indsæt",
"pastePlain": "Indsæt som ren tekst",
- "addLabel": "Tilføj navn og tags…",
- "editLabel": "Rediger navn og tags…",
+ "addNote": "Tilføj note…",
+ "editNote": "Rediger note…",
"openLink": "Åbn link",
"copyCleanLink": "Kopiér rent link",
"copyAs": "Kopiér som",
@@ -11283,13 +11175,10 @@ export const da: TranslationKeys = {
"saveToDownloads": "Gem i Overførsler",
"preview": "Eksempel",
"closePreview": "Luk eksempel",
- "label": "Navn",
- "labelPlaceholder": "f.eks. Kontorets wi-fi",
- "tags": "Tags",
- "tagPlaceholder": "Tilføj tag…",
- "removeTag": "Fjern #{tag}",
- "usedBefore": "Brugt før",
- "removeAll": "Fjern alle",
+ "note": "Note",
+ "notePlaceholder": "f.eks. Wi-Fi-kode på kontoret",
+ "noteHint": "Søgningen finder den med disse ord.",
+ "removeNote": "Fjern note",
"cancel": "Annuller",
"save": "Gem"
},
@@ -11414,8 +11303,7 @@ export const da: TranslationKeys = {
"current": "Nuværende"
},
"toast": {
- "labelPinned": "Fastgjort, så det bevares",
- "labelFailed": "Navnet kunne ikke gemmes. Prøv igen.",
+ "noteFailed": "Noten kunne ikke gemmes. Prøv igen.",
"savedToDownloads": "Gemt i Overførsler: {name}",
"savedManyToDownloads": "{count} billeder gemt i Overførsler",
"saveImagesFailed": "Billedet kunne ikke gemmes",
@@ -11676,8 +11564,8 @@ export const fi: TranslationKeys = {
"title": "Kohteen toiminnot",
"paste": "Liitä",
"pastePlain": "Liitä pelkkänä tekstinä",
- "addLabel": "Lisää nimi ja tunnisteet…",
- "editLabel": "Muokkaa nimeä ja tunnisteita…",
+ "addNote": "Lisää muistiinpano…",
+ "editNote": "Muokkaa muistiinpanoa…",
"openLink": "Avaa linkki",
"copyCleanLink": "Kopioi siistitty linkki",
"copyAs": "Kopioi muodossa",
@@ -11687,13 +11575,10 @@ export const fi: TranslationKeys = {
"saveToDownloads": "Tallenna Ladatut tiedostot -kansioon",
"preview": "Esikatselu",
"closePreview": "Sulje esikatselu",
- "label": "Nimi",
- "labelPlaceholder": "esim. Toimiston Wi-Fi",
- "tags": "Tunnisteet",
- "tagPlaceholder": "Lisää tunniste…",
- "removeTag": "Poista #{tag}",
- "usedBefore": "Aiemmin käytetyt",
- "removeAll": "Poista kaikki",
+ "note": "Muistiinpano",
+ "notePlaceholder": "esim. Toimiston Wi-Fi-salasana",
+ "noteHint": "Haku löytää sen näillä sanoilla.",
+ "removeNote": "Poista muistiinpano",
"cancel": "Peruuta",
"save": "Tallenna"
},
@@ -11818,8 +11703,7 @@ export const fi: TranslationKeys = {
"current": "Nykyinen"
},
"toast": {
- "labelPinned": "Kiinnitetty, jotta se säilyy",
- "labelFailed": "Nimeä ei voitu tallentaa. Yritä uudelleen.",
+ "noteFailed": "Muistiinpanoa ei voitu tallentaa. Yritä uudelleen.",
"savedToDownloads": "Tallennettu Ladatut tiedostot -kansioon: {name}",
"savedManyToDownloads": "{count} kuvaa tallennettu Ladatut tiedostot -kansioon",
"saveImagesFailed": "Kuvaa ei voitu tallentaa",
@@ -12080,8 +11964,8 @@ export const th: TranslationKeys = {
"title": "การทำงานกับรายการ",
"paste": "วาง",
"pastePlain": "วางเป็นข้อความธรรมดา",
- "addLabel": "เพิ่มชื่อและแท็ก…",
- "editLabel": "แก้ไขชื่อและแท็ก…",
+ "addNote": "เพิ่มโน้ต…",
+ "editNote": "แก้ไขโน้ต…",
"openLink": "เปิดลิงก์",
"copyCleanLink": "คัดลอกลิงก์ที่สะอาด",
"copyAs": "คัดลอกเป็น",
@@ -12091,13 +11975,10 @@ export const th: TranslationKeys = {
"saveToDownloads": "บันทึกไปที่ดาวน์โหลด",
"preview": "แสดงตัวอย่าง",
"closePreview": "ปิดตัวอย่าง",
- "label": "ชื่อ",
- "labelPlaceholder": "เช่น Wi-Fi ที่ทำงาน",
- "tags": "แท็ก",
- "tagPlaceholder": "เพิ่มแท็ก…",
- "removeTag": "ลบ #{tag}",
- "usedBefore": "เคยใช้แล้ว",
- "removeAll": "ลบทั้งหมด",
+ "note": "โน้ต",
+ "notePlaceholder": "เช่น รหัส Wi-Fi ที่ออฟฟิศ",
+ "noteHint": "ค้นหาด้วยคำเหล่านี้ก็จะเจอ",
+ "removeNote": "ลบโน้ต",
"cancel": "ยกเลิก",
"save": "บันทึก"
},
@@ -12222,8 +12103,7 @@ export const th: TranslationKeys = {
"current": "ปัจจุบัน"
},
"toast": {
- "labelPinned": "ปักหมุดไว้เพื่อเก็บรักษา",
- "labelFailed": "บันทึกชื่อไม่สำเร็จ โปรดลองอีกครั้ง",
+ "noteFailed": "บันทึกโน้ตไม่สำเร็จ โปรดลองอีกครั้ง",
"savedToDownloads": "บันทึกไปที่ดาวน์โหลดแล้ว: {name}",
"savedManyToDownloads": "บันทึกรูปภาพ {count} รูปไปที่ดาวน์โหลดแล้ว",
"saveImagesFailed": "บันทึกรูปภาพไม่สำเร็จ",
@@ -12484,8 +12364,8 @@ export const he: TranslationKeys = {
"title": "פעולות פריט",
"paste": "הדבקה",
"pastePlain": "הדבקה כטקסט פשוט",
- "addLabel": "הוספת שם ותגיות…",
- "editLabel": "עריכת שם ותגיות…",
+ "addNote": "הוספת הערה…",
+ "editNote": "עריכת הערה…",
"openLink": "פתיחת קישור",
"copyCleanLink": "העתקת קישור נקי",
"copyAs": "העתקה בתור",
@@ -12495,13 +12375,10 @@ export const he: TranslationKeys = {
"saveToDownloads": "שמירה בהורדות",
"preview": "תצוגה מקדימה",
"closePreview": "סגירת תצוגה מקדימה",
- "label": "שם",
- "labelPlaceholder": "לדוגמה: Wi-Fi במשרד",
- "tags": "תגיות",
- "tagPlaceholder": "הוספת תגית…",
- "removeTag": "הסרת #{tag}",
- "usedBefore": "בשימוש בעבר",
- "removeAll": "הסרת הכול",
+ "note": "הערה",
+ "notePlaceholder": "למשל: סיסמת ה-Wi-Fi במשרד",
+ "noteHint": "החיפוש ימצא את זה לפי המילים האלה.",
+ "removeNote": "הסרת הערה",
"cancel": "ביטול",
"save": "שמירה"
},
@@ -12626,8 +12503,7 @@ export const he: TranslationKeys = {
"current": "נוכחי"
},
"toast": {
- "labelPinned": "הוצמד כדי שיישמר",
- "labelFailed": "לא ניתן היה לשמור את השם. נסו שוב.",
+ "noteFailed": "לא ניתן היה לשמור את ההערה. נסו שוב.",
"savedToDownloads": "נשמר בהורדות: {name}",
"savedManyToDownloads": "{count} תמונות נשמרו בהורדות",
"saveImagesFailed": "לא ניתן היה לשמור את התמונה",
@@ -12888,8 +12764,8 @@ export const no: TranslationKeys = {
"title": "Elementhandlinger",
"paste": "Lim inn",
"pastePlain": "Lim inn som ren tekst",
- "addLabel": "Legg til navn og tagger…",
- "editLabel": "Rediger navn og tagger…",
+ "addNote": "Legg til notat…",
+ "editNote": "Rediger notat…",
"openLink": "Åpne lenke",
"copyCleanLink": "Kopier ren lenke",
"copyAs": "Kopier som",
@@ -12899,13 +12775,10 @@ export const no: TranslationKeys = {
"saveToDownloads": "Lagre i Nedlastinger",
"preview": "Forhåndsvis",
"closePreview": "Lukk forhåndsvisning",
- "label": "Navn",
- "labelPlaceholder": "f.eks. Wi-Fi på kontoret",
- "tags": "Tagger",
- "tagPlaceholder": "Legg til tagg…",
- "removeTag": "Fjern #{tag}",
- "usedBefore": "Brukt før",
- "removeAll": "Fjern alle",
+ "note": "Notat",
+ "notePlaceholder": "f.eks. Wi-Fi-passord på kontoret",
+ "noteHint": "Søket finner det med disse ordene.",
+ "removeNote": "Fjern notat",
"cancel": "Avbryt",
"save": "Lagre"
},
@@ -13030,8 +12903,7 @@ export const no: TranslationKeys = {
"current": "Gjeldende"
},
"toast": {
- "labelPinned": "Festet slik at det beholdes",
- "labelFailed": "Kunne ikke lagre navnet. Prøv igjen.",
+ "noteFailed": "Kunne ikke lagre notatet. Prøv igjen.",
"savedToDownloads": "Lagret i Nedlastinger: {name}",
"savedManyToDownloads": "{count} bilder lagret i Nedlastinger",
"saveImagesFailed": "Kunne ikke lagre bildet",
diff --git a/src/lib/itemSignature.ts b/src/lib/itemSignature.ts
index f0efa63..29d7dd1 100644
--- a/src/lib/itemSignature.ts
+++ b/src/lib/itemSignature.ts
@@ -49,15 +49,14 @@ export function itemRenderKey(item: ClipboardItemDto): string {
}
}
- // The label and tags are drawn on the card, so a rename alone must re-render.
+ // The note is drawn on the card, so editing it alone must re-render.
key += `|m|${itemMetaKey(item)}`
renderKeyCache.set(item, key)
return key
}
-/** Label + tags as one comparable string ('' when the item has neither). */
-export function itemMetaKey(item: Pick<ClipboardItemDto, 'label' | 'tags'>): string {
- if (!item.label && !item.tags?.length) return ''
- return `${item.label ?? ''}\u0001${(item.tags ?? []).join('\u0002')}`
+/** The note as a comparable string ('' when the item has none). */
+export function itemMetaKey(item: Pick<ClipboardItemDto, 'note'>): string {
+ return item.note ?? ''
}
diff --git a/src/lib/keyboardFocus.ts b/src/lib/keyboardFocus.ts
index bff0118..27c3abd 100644
--- a/src/lib/keyboardFocus.ts
+++ b/src/lib/keyboardFocus.ts
@@ -5,7 +5,7 @@
* app). A field that needs typing calls acquireKeyboard() on pointer-down —
* a NOACTIVATE window may never fire a focus event from a plain click — and
* releaseKeyboard() on every exit. Holders are counted (searchFocus.ts), so
- * search and the label editor can hand over to each other.
+ * search and the note editor can hand over to each other.
*
* Giving focus back is deferred a moment and cancelled if anyone takes it
* again meanwhile. Without that, a release immediately followed by an
diff --git a/src/lib/search.ts b/src/lib/search.ts
new file mode 100644
index 0000000..4534dc4
--- /dev/null
+++ b/src/lib/search.ts
@@ -0,0 +1,57 @@
+/**
+ * Shelf search: every word typed must appear somewhere in the item, in any
+ * order, across what it holds (text, file names) and the user's note.
+ *
+ * "acme invoice" finds a note "Invoice for Acme, March"
+ * "wifi office" finds "Office Wi-Fi password"
+ *
+ * Matching ignores case and accents ("resume" finds "Résumé"), and a word
+ * also matches with punctuation and spaces taken out on both sides, so
+ * "wifi" finds "Wi-Fi" and "e-mail" finds "email".
+ */
+
+/** Lowercase, accents removed. */
+export function foldText(s: string): string {
+ return s.normalize('NFD').replace(/\p{M}+/gu, '').toLowerCase()
+}
+
+/** Only the letters and digits of a folded string. */
+function packText(s: string): string {
+ return s.replace(/[^\p{L}\p{N}]+/gu, '')
+}
+
+export interface SearchWord {
+ /** The word folded. */
+ word: string
+ /** Its letters and digits only ('' for a word that is all punctuation). */
+ packed: string
+}
+
+/** The words of a query ([] for an empty one). */
+export function queryWords(query: string): SearchWord[] {
+ return foldText(query)
+ .split(/\s+/)
+ .filter(Boolean)
+ .map((word) => ({ word, packed: packText(word) }))
+}
+
+export interface SearchText {
+ folded: string
+ packed: string
+}
+
+/** An item's searchable text, folded once. */
+export function searchText(parts: ReadonlyArray<string | undefined>): SearchText {
+ const folded = foldText(parts.filter(Boolean).join('\n'))
+ return { folded, packed: packText(folded) }
+}
+
+/** True when every word is found in the text. */
+export function matchesWords(text: SearchText, words: readonly SearchWord[]): boolean {
+ for (const w of words) {
+ if (text.folded.includes(w.word)) continue
+ if (w.packed && text.packed.includes(w.packed)) continue
+ return false
+ }
+ return true
+}
diff --git a/src/lib/tagQuery.ts b/src/lib/tagQuery.ts
deleted file mode 100644
index 862955a..0000000
--- a/src/lib/tagQuery.ts
+++ /dev/null
@@ -1,92 +0,0 @@
-/**
- * Search over labels and tags.
- *
- * A query is split into `#tag` filters and plain text:
- * "invoice" -> text match (content, file names, label, tags)
- * "#work" -> items with a tag starting with "work"
- * "#work #client-a" -> items with both
- * "#work invoice" -> tag "work..." AND text "invoice"
- * A query without any `#word` behaves exactly as before: one substring.
- */
-import { normalizeTag } from '../../shared/itemMeta'
-
-export interface ParsedQuery {
- /** Lowercased plain-text part ('' when only tags were typed). */
- text: string
- /** Normalized tag prefixes from `#word` tokens. */
- tags: string[]
-}
-
-export function parseQuery(raw: string): ParsedQuery {
- const q = raw.trim()
- if (!q.includes('#')) return { text: q.toLowerCase(), tags: [] }
- const tags: string[] = []
- const words: string[] = []
- for (const token of q.split(/\s+/)) {
- if (token.startsWith('#')) {
- const tag = normalizeTag(token)
- if (tag && !tags.includes(tag)) tags.push(tag)
- } else if (token) {
- words.push(token)
- }
- }
- return { text: words.join(' ').toLowerCase(), tags }
-}
-
-/** Label/tag part of a text search (the content part lives with the item kinds). */
-export function metaMatchesText(item: { label?: string; tags?: readonly string[] }, needle: string): boolean {
- if (!needle) return true
- if (item.label && item.label.toLowerCase().includes(needle)) return true
- const bare = needle.startsWith('#') ? needle.slice(1) : needle
- return !!bare && !!item.tags?.some((tag) => tag.includes(bare))
-}
-
-/** Every `#tag` filter must match one of the item's tags by prefix. */
-export function matchesTagFilters(item: { tags?: readonly string[] }, filters: readonly string[]): boolean {
- if (filters.length === 0) return true
- const tags = item.tags
- if (!tags || tags.length === 0) return false
- return filters.every((f) => tags.some((tag) => tag.startsWith(f)))
-}
-
-/** How many items use each tag. */
-export function tagCounts(items: ReadonlyArray<{ tags?: readonly string[] }>): Map<string, number> {
- const counts = new Map<string, number>()
- for (const it of items) {
- if (!it.tags) continue
- for (const tag of it.tags) counts.set(tag, (counts.get(tag) ?? 0) + 1)
- }
- return counts
-}
-
-/** Most-used tags first (then A-Z) whose name starts with `prefix`. */
-export function suggestTags(
- counts: ReadonlyMap<string, number>,
- prefix: string,
- opts: { exclude?: readonly string[]; limit?: number } = {}
-): Array<{ tag: string; count: number }> {
- const p = prefix ? normalizeTag(prefix) ?? '' : ''
- const exclude = new Set(opts.exclude ?? [])
- const out: Array<{ tag: string; count: number }> = []
- for (const [tag, count] of counts) {
- if (exclude.has(tag)) continue
- if (p && !tag.startsWith(p)) continue
- out.push({ tag, count })
- }
- out.sort((a, b) => b.count - a.count || a.tag.localeCompare(b.tag))
- return out.slice(0, opts.limit ?? 8)
-}
-
-/**
- * When the last thing typed is a `#word` (or a lone `#`), the part after
- * '#' that tag suggestions should complete; otherwise null.
- */
-export function activeTagPrefix(query: string): string | null {
- const m = /(?:^|\s)#([^\s#]*)$/.exec(query)
- return m ? m[1] : null
-}
-
-/** Replace the trailing `#word` of the query with `#tag ` (suggestion click). */
-export function completeTag(query: string, tag: string): string {
- return query.replace(/(^|\s)#[^\s#]*$/, `$1#${tag} `)
-}
diff --git a/src/store/appStore.ts b/src/store/appStore.ts
index c67d601..9222901 100644
--- a/src/store/appStore.ts
+++ b/src/store/appStore.ts
@@ -13,12 +13,18 @@ import { t } from '../i18n'
import { loadRecents } from '../lib/emoji/prefs'
import type { ClipboardItemDto, Settings, DragRequest } from '../../shared/types'
import { DEFAULT_SETTINGS } from '../../shared/types'
-import { normalizeLabel, normalizeTags, type ItemMetaPatch } from '../../shared/itemMeta'
+import { isKept, normalizeNote, type ItemMetaPatch } from '../../shared/itemMeta'
import { itemMetaKey } from '../lib/itemSignature'
import { playEdgeRetractSound, playEdgeBeaconAppearSound, playEdgeExpandSound, playButtonClickSound } from '../lib/soundEffects'
let flareTimer: ReturnType<typeof setTimeout> | null = null
+/** Saves the open note editor (registered by CardMenu while it is mounted). */
+let cardEditorCommit: (() => void) | null = null
+export function registerCardEditorCommit(commit: (() => void) | null): void {
+ cardEditorCommit = commit
+}
+
/**
* Version dismissed this run. Session-only (never persisted): quitting and
* relaunching clears it, so a skipped update prompts again next launch —
@@ -53,8 +59,6 @@ export interface CardMenuState {
x: number
y: number
mode: 'menu' | 'edit'
- /** Editor field that gets the caret first. */
- focus?: 'label' | 'tags'
}
/** Grace after the card menu closes before hover-close may shut the shelf. */
@@ -199,11 +203,11 @@ interface AppState {
cardMenuStayUntil: number
clearCardMenuStay: () => void
openCardMenu: (itemId: string, x: number, y: number) => void
- /** Turn the open menu into the label / tags editor. */
- editCardMeta: (focus?: 'label' | 'tags') => void
+ /** Turn the open menu into the note editor. */
+ editCardMeta: () => void
closeCardMenu: () => void
setCardMenuRect: (rect: CardMenuRect | null) => void
- /** Save a label / tags (main normalizes; a label or tag also pins). */
+ /** Save or remove a note (main normalizes). */
setItemMeta: (id: string, patch: ItemMetaPatch) => Promise<void>
/** Put derived text (clean link, color format, path) on the clipboard without a new card. */
copyText: (text: string, opts?: { quiet?: boolean }) => Promise<boolean>
@@ -507,6 +511,13 @@ export const useStore = create<AppState>((set, get) => ({
setQuery: (query) => set({ query }),
setOpen: (open) => {
+ // The shelf closing with the note editor open (the pointer left it, the
+ // hotkey, the tray) keeps what was typed, like a click outside does.
+ if (!open && get().cardMenu?.mode === 'edit') {
+ try {
+ cardEditorCommit?.()
+ } catch { /* ignore */ }
+ }
set({ open })
if (!open) {
// Release any focused control inside the blade. Without this, a button
@@ -516,7 +527,7 @@ export const useStore = create<AppState>((set, get) => ({
// compiling under the DOM-less node tsconfig.)
const active = (globalThis as { document?: { activeElement?: { blur?: () => void } } }).document?.activeElement
try { active?.blur?.() } catch { /* ignore */ }
- // If a text field (search, label editor) held temporary OS
+ // If a text field (search, note editor) held temporary OS
// focusability + paused hotkey through a close path that skipped its
// blur (tray toggle, cursor leave), restore both now, exactly once.
// No-op when no field ever took the keyboard.
@@ -627,7 +638,7 @@ export const useStore = create<AppState>((set, get) => ({
async clear(ids?: string[]) {
if (!ids || ids.length === 0) {
const previousItems = get().items
- set({ items: previousItems.filter((it) => it.pinned) })
+ set({ items: previousItems.filter((it) => isKept(it)) })
try {
const items = await edge.clearItems()
const current = get().items
@@ -688,10 +699,10 @@ export const useStore = create<AppState>((set, get) => ({
openCardMenu: (itemId, x, y) => {
set({ cardMenu: { itemId, x, y, mode: 'menu' }, cardMenuRect: null })
},
- editCardMeta: (focus = 'label') => {
+ editCardMeta: () => {
const menu = get().cardMenu
if (!menu) return
- set({ cardMenu: { ...menu, mode: 'edit', focus } })
+ set({ cardMenu: { ...menu, mode: 'edit' } })
},
closeCardMenu: () => {
if (!get().cardMenu && !get().cardMenuRect) return
@@ -710,31 +721,23 @@ export const useStore = create<AppState>((set, get) => ({
async setItemMeta(id, patch) {
const before = get().items.find((it) => it.id === id)
if (!before) return
- // Optimistic: show the cleaned values at once; main sends the stored truth.
- const label = 'label' in patch ? normalizeLabel(patch.label) : before.label
- const tags = 'tags' in patch ? normalizeTags(patch.tags) : before.tags
- const named = !!label || !!tags?.length
+ // Optimistic: show the cleaned note at once; main sends the stored truth.
+ const note = 'note' in patch ? normalizeNote(patch.note) : before.note
set({
items: get().items.map((it) => {
if (it.id !== id) return it
- const next: ClipboardItemDto = { ...it, pinned: it.pinned || named }
- if (label) next.label = label
- else delete next.label
- if (tags?.length) next.tags = tags
- else delete next.tags
+ const next: ClipboardItemDto = { ...it }
+ if (note) next.note = note
+ else delete next.note
return next
})
})
try {
const items = await edge.setItemMeta(id, patch)
set({ items })
- const after = items.find((it) => it.id === id)
- if (after && !before.pinned && after.pinned) {
- get().pushToast({ id: `meta-pin-${Date.now()}`, message: t('toast.labelPinned'), tone: 'info' })
- }
} catch {
set({ items: get().items.map((it) => (it.id === id ? before : it)) })
- get().pushToast({ id: `meta-${Date.now()}`, message: t('toast.labelFailed'), tone: 'error' })
+ get().pushToast({ id: `meta-${Date.now()}`, message: t('toast.noteFailed'), tone: 'error' })
}
},
diff --git a/src/styles/cardMenu.css b/src/styles/cardMenu.css
index 6fa37c8..8afaf07 100644
--- a/src/styles/cardMenu.css
+++ b/src/styles/cardMenu.css
@@ -205,15 +205,17 @@ html[data-motion='reduce'] .card-meta-editor {
color: rgba(255, 255, 255, 0.55);
}
-.card-meta-count {
- font-weight: 500;
+/* What the note is for, under the field. */
+.card-meta-hint {
+ padding: 0 2px;
+ font-size: calc(11px * var(--font-scale, 1));
+ line-height: 1.35;
color: rgba(255, 255, 255, 0.4);
}
/* Fields: borderless pills like the search box; hover and focus lift the
fill a step (no ring). */
-.card-meta-input,
-.card-meta-tags {
+.card-meta-input {
box-sizing: border-box;
width: 100%;
border: none;
@@ -221,8 +223,7 @@ html[data-motion='reduce'] .card-meta-editor {
transition: background-color var(--dur-fast) var(--ease-out);
}
-.card-meta-input:hover,
-.card-meta-tags:hover {
+.card-meta-input:hover {
background: rgba(255, 255, 255, 0.08);
}
@@ -240,122 +241,19 @@ html[data-motion='reduce'] .card-meta-editor {
-webkit-user-select: text;
}
-.card-meta-input::placeholder,
-.card-meta-tag-input::placeholder {
+.card-meta-input::placeholder {
color: var(--text-tertiary);
font-weight: 400;
}
-.card-meta-input::selection,
-.card-meta-tag-input::selection {
+.card-meta-input::selection {
background: rgba(255, 255, 255, 0.28);
}
-.card-meta-input:focus,
-.card-meta-tags:focus-within {
+.card-meta-input:focus {
background: rgba(255, 255, 255, 0.11);
}
-/* Wraps to more lines when there are many tags, so a fixed radius (a pill
- while it is one line high) instead of 999px. */
-.card-meta-tags {
- display: flex;
- flex-wrap: wrap;
- align-items: center;
- gap: 4px;
- min-height: 32px;
- padding: 4px 5px;
- border-radius: 16px;
- cursor: text;
-}
-
-.card-meta-chip {
- display: inline-flex;
- align-items: center;
- gap: 2px;
- height: 22px;
- max-width: 100%;
- padding: 0 3px 0 8px;
- border-radius: 999px;
- background: rgba(255, 255, 255, 0.12);
- color: #ffffff;
- font-size: calc(11.5px * var(--font-scale, 1));
- font-weight: 600;
- box-sizing: border-box;
-}
-
-.card-meta-chip-text {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-
-.card-meta-chip-remove {
- display: inline-flex;
- align-items: center;
- justify-content: center;
- flex-shrink: 0;
- width: 16px;
- height: 16px;
- padding: 0;
- border: none;
- border-radius: 50%;
- background: transparent;
- color: rgba(255, 255, 255, 0.6);
- cursor: pointer;
-}
-
-.card-meta-chip-remove:hover {
- background: rgba(255, 255, 255, 0.18);
- color: #ffffff;
-}
-
-.card-meta-tag-input {
- flex: 1;
- min-width: 56px;
- height: 22px;
- padding: 0 4px;
- border: none;
- background: transparent;
- color: #ffffff;
- font-family: var(--font-ui);
- font-size: calc(12px * var(--font-scale, 1));
- font-weight: 500;
- outline: none;
- user-select: text;
- -webkit-user-select: text;
-}
-
-.card-meta-suggest {
- display: flex;
- flex-wrap: wrap;
- gap: 4px;
-}
-
-.card-meta-suggestion {
- height: 22px;
- max-width: 100%;
- padding: 0 8px;
- border: none;
- border-radius: 999px;
- background: rgba(255, 255, 255, 0.08);
- color: rgba(255, 255, 255, 0.82);
- font-family: var(--font-ui);
- font-size: calc(11px * var(--font-scale, 1));
- font-weight: 600;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- cursor: pointer;
- transition: background 0.12s ease, color 0.12s ease;
-}
-
-/* Same as the #tag suggestion chips under the search box. */
-.card-meta-suggestion:hover {
- background: var(--act-on);
- color: var(--act-on-ink);
-}
-
.card-meta-actions {
display: flex;
align-items: center;
@@ -391,9 +289,7 @@ html[data-motion='reduce'] .card-meta-editor {
transform: scale(0.96);
}
-.card-meta-btn:focus-visible,
-.card-meta-chip-remove:focus-visible,
-.card-meta-suggestion:focus-visible {
+.card-meta-btn:focus-visible {
outline: 2px solid rgba(255, 255, 255, 0.45);
outline-offset: 2px;
}
diff --git a/src/styles/item.css b/src/styles/item.css
index 39d0661..f22518a 100644
--- a/src/styles/item.css
+++ b/src/styles/item.css
@@ -3140,12 +3140,13 @@ html[data-motion='reduce'] .item.is-drag-source::after {
}
/* ------------------------------------------------------------------ */
-/* Label + tags (user metadata) */
+/* Note (user metadata) */
/* ------------------------------------------------------------------ */
-/* Side-dock text cards: the label is a title line above the content
- (cards there are content-height, so this simply adds one line). */
-.item-label {
+/* Text, link, code and color cards: the note is one line above the
+ content. Side-dock cards are content-height, so this simply adds a line;
+ fixed-height top-dock cards give it a line of their content (below). */
+.item-note {
padding: 11px 16px 0 16px;
font-family: var(--font-ui);
font-size: calc(12px * var(--font-scale, 1));
@@ -3156,12 +3157,32 @@ html[data-motion='reduce'] .item.is-drag-source::after {
overflow: hidden;
text-overflow: ellipsis;
}
-.item-label + .item-content {
+.item-note + .item-content {
padding-top: 4px;
}
-/* Fixed-height cards (top dock, image and file cards): the label takes the
- place of the small detail text in the bottom line, so nothing grows. */
+/* Top dock: the note line plus one line less of content keeps the content
+ clear of the hover pill's band above the bottom row. */
+.list.horizontal .item-note {
+ padding: 8px 14px 0 14px;
+}
+.list.horizontal .item-note + .item-content {
+ padding-top: 2px;
+}
+.list.horizontal .item-note + .item-content .preview {
+ -webkit-line-clamp: 4;
+}
+.list.horizontal .item-note + .item-content .link-card-body {
+ -webkit-line-clamp: 2;
+}
+/* code: 4 of its 16.1px lines instead of 5 */
+.list.horizontal .item-note + .item-content .code-card-preview {
+ height: 65px;
+ max-height: 65px;
+}
+
+/* Image and file cards: the note takes the place of the file or source name
+ in the bottom line, so nothing grows. */
.meta-label {
min-width: 0;
flex-shrink: 1;
@@ -3172,58 +3193,23 @@ html[data-motion='reduce'] .item.is-drag-source::after {
color: rgba(255, 255, 255, 0.9);
}
-.meta-tag {
- flex-shrink: 0;
- max-width: 96px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- font-size: calc(10.5px * var(--font-scale, 1));
- font-weight: 600;
- color: rgba(255, 255, 255, 0.72);
- background: rgba(255, 255, 255, 0.08);
- padding: 0.5px 5px;
- border-radius: 4px;
- letter-spacing: 0.01em;
-}
-
-.meta-tag-more {
- flex-shrink: 0;
- font-size: calc(10.5px * var(--font-scale, 1));
- font-weight: 600;
- color: rgba(255, 255, 255, 0.5);
-}
-
-.item.is-color-card.is-light-color .item-label {
+.item.is-color-card.is-light-color .item-note {
color: rgba(0, 0, 0, 0.86);
}
-.item.is-color-card.is-light-color .meta-label,
-.item.is-color-card.is-light-color .meta-tag,
-.item.is-color-card.is-light-color .meta-tag-more {
+.item.is-color-card.is-light-color .meta-label {
color: rgba(0, 0, 0, 0.7) !important;
}
-.item.is-color-card.is-light-color .meta-tag {
- background: rgba(0, 0, 0, 0.08);
-}
-.item.is-color-card.is-dark-color .meta-label,
-.item.is-color-card.is-dark-color .meta-tag,
-.item.is-color-card.is-dark-color .meta-tag-more {
+.item.is-color-card.is-dark-color .meta-label {
color: rgba(255, 255, 255, 0.82) !important;
}
-.item.is-color-card.is-dark-color .meta-tag {
- background: rgba(255, 255, 255, 0.12);
-}
/* The card whose right-click menu is open keeps its hover look. */
.item.menu-target:not(.is-color-card) {
background: var(--bg-card-hover);
}
-/* Preview flyout: the item's label and every tag above the content. */
+/* Preview flyout: the whole note above the content. */
.flyout-meta-head {
- display: flex;
- flex-direction: column;
- gap: 8px;
margin-bottom: 14px;
}
.flyout-meta-label {
@@ -3234,20 +3220,3 @@ html[data-motion='reduce'] .item.is-drag-source::after {
color: #ffffff;
word-break: break-word;
}
-.flyout-meta-tags {
- display: flex;
- flex-wrap: wrap;
- gap: 5px;
-}
-.flyout-meta-tag {
- height: 22px;
- display: inline-flex;
- align-items: center;
- padding: 0 9px;
- border-radius: 999px;
- background: rgba(255, 255, 255, 0.08);
- color: rgba(255, 255, 255, 0.82);
- font-family: var(--font-ui);
- font-size: calc(11.5px * var(--font-scale, 1));
- font-weight: 600;
-}
diff --git a/src/styles/panel.css b/src/styles/panel.css
index c86d0b0..8b247b1 100644
--- a/src/styles/panel.css
+++ b/src/styles/panel.css
@@ -1400,62 +1400,3 @@ rect.dashed-outline-shape {
stroke-dashoffset: 0;
transition: none;
}
-
-/* Tag suggestions under the search while it ends in "#word". Chips never
- take focus, so typing stays in the search box. */
-.tag-suggest {
- display: flex;
- flex-wrap: nowrap;
- gap: 5px;
- margin: -2px var(--pad) 6px;
- overflow: hidden;
- position: relative;
- z-index: 1;
-}
-.tag-suggest.is-horizontal {
- position: absolute;
- top: 4px;
- left: 50%;
- transform: translateX(-50%);
- max-width: calc(100% - 32px);
- margin: 0;
- padding: 4px;
- border-radius: var(--radius-pill);
- /* Blade surface, no drop shadow; the hairline keeps the strip's edge
- visible over the cards it floats above. */
- background: #000000;
- box-shadow: inset 0 0 0 1px var(--edge-strong);
- z-index: 30;
-}
-.tag-suggest-chip {
- display: inline-flex;
- align-items: center;
- gap: 5px;
- flex-shrink: 0;
- max-width: 140px;
- height: 24px;
- padding: 0 9px;
- border: none;
- border-radius: var(--radius-pill);
- background: var(--bg-card);
- color: rgba(255, 255, 255, 0.82);
- font-family: var(--font-ui);
- font-size: calc(11.5px * var(--font-scale, 1));
- font-weight: 600;
- cursor: pointer;
- transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
-}
-.tag-suggest-chip:hover {
- background: var(--act-on);
- color: var(--act-on-ink);
-}
-.tag-suggest-name {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-.tag-suggest-count {
- font-size: calc(10px * var(--font-scale, 1));
- font-weight: 600;
- opacity: 0.55;
-}
diff --git a/tests/cardMenu.test.ts b/tests/cardMenu.test.ts
index 530e71d..19c04f7 100644
--- a/tests/cardMenu.test.ts
+++ b/tests/cardMenu.test.ts
@@ -2,7 +2,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { readFileSync } from 'node:fs'
import { join } from 'node:path'
import type { ClipboardItemDto } from '../shared/types'
-import { activeTagPrefix, completeTag, matchesTagFilters, metaMatchesText, parseQuery, suggestTags, tagCounts } from '../src/lib/tagQuery'
+import { queryWords } from '../src/lib/search'
import { matches } from '../src/hooks/useFilteredItems'
import { colorFormats } from '../src/lib/colorUtils'
import { externalHref, stripTracking } from '../src/lib/urlPreview'
@@ -32,52 +32,41 @@ const imageItem = (id: string, extra: Partial<ClipboardItemDto> = {}): Clipboard
...extra
})
-describe('search over labels and tags', () => {
- it('a query without #tags is one substring, as before', () => {
- expect(parseQuery(' Hello World ')).toEqual({ text: 'hello world', tags: [] })
- expect(parseQuery('')).toEqual({ text: '', tags: [] })
+describe('search: every word, any order, across content and note', () => {
+ const find = (item: ClipboardItemDto, q: string) => matches(item, queryWords(q))
+
+ it('finds a card by its note, words in any order', () => {
+ const img = imageItem('g', { note: 'Invoice for Acme, March' })
+ expect(find(img, 'acme invoice')).toBe(true)
+ expect(find(img, 'march')).toBe(true)
+ expect(find(img, 'acme april')).toBe(false)
+ // images have no text of their own: only a note finds them
+ expect(find(imageItem('x'), 'anything')).toBe(false)
})
- it('#words become tag filters, the rest stays text', () => {
- expect(parseQuery('#Work invoice #client-a')).toEqual({ text: 'invoice', tags: ['work', 'client-a'] })
- expect(parseQuery('#')).toEqual({ text: '', tags: [] })
+ it('content and note count together', () => {
+ const t = textItem('n', 'correct-horse-battery-staple', { note: 'Office Wi-Fi password' })
+ expect(find(t, 'wifi office')).toBe(true) // hyphen ignored
+ expect(find(t, 'horse password')).toBe(true) // one word from each
+ expect(find(t, 'WI-FI')).toBe(true)
+ expect(find(t, 'printer')).toBe(false)
})
- it('finds images by label, text by label or tag, keeps content search', () => {
- const img = imageItem('g', { label: 'Invoice March', tags: ['finance'] })
- const note = textItem('n', 'agenda', { label: 'Meeting', tags: ['work', 'team'] })
+ it('ignores case and accents; plain search still works', () => {
+ expect(find(textItem('r', 'Mon Résumé final'), 'resume')).toBe(true)
+ expect(find(textItem('e', 'send an email'), 'e-mail')).toBe(true)
const plain = textItem('p', 'just some words')
- expect(matches(img, parseQuery('invoice'))).toBe(true)
- expect(matches(img, parseQuery('finance'))).toBe(true)
- expect(matches(imageItem('x'), parseQuery('anything'))).toBe(false)
- expect(matches(note, parseQuery('meet'))).toBe(true)
- expect(matches(note, parseQuery('agenda'))).toBe(true)
- expect(matches(note, parseQuery('#wo'))).toBe(true)
- expect(matches(note, parseQuery('#work #team'))).toBe(true)
- expect(matches(note, parseQuery('#work #finance'))).toBe(false)
- expect(matches(note, parseQuery('#work agenda'))).toBe(true)
- expect(matches(note, parseQuery('#work nothing'))).toBe(false)
- expect(matches(plain, parseQuery('some words'))).toBe(true)
- expect(matches(plain, parseQuery('#work'))).toBe(false)
- expect(matches(plain, parseQuery(''))).toBe(true)
- })
-
- it('tag helpers', () => {
- expect(matchesTagFilters({ tags: ['work'] }, [])).toBe(true)
- expect(matchesTagFilters({}, ['w'])).toBe(false)
- expect(metaMatchesText({ tags: ['wifi'] }, '#wi')).toBe(true)
- expect(metaMatchesText({ tags: ['wifi'] }, '#')).toBe(false)
- const counts = tagCounts([{ tags: ['work', 'wifi'] }, { tags: ['work'] }, {}, { tags: ['team'] }])
- expect([...counts]).toEqual([['work', 2], ['wifi', 1], ['team', 1]])
- expect(suggestTags(counts, '')).toEqual([{ tag: 'work', count: 2 }, { tag: 'team', count: 1 }, { tag: 'wifi', count: 1 }])
- expect(suggestTags(counts, '#W', { exclude: ['work'] })).toEqual([{ tag: 'wifi', count: 1 }])
- expect(suggestTags(counts, '', { limit: 1 })).toHaveLength(1)
- expect(activeTagPrefix('invoice #wo')).toBe('wo')
- expect(activeTagPrefix('#')).toBe('')
- expect(activeTagPrefix('#work ')).toBeNull()
- expect(activeTagPrefix('a#b')).toBeNull()
- expect(completeTag('invoice #wo', 'work')).toBe('invoice #work ')
- expect(completeTag('#', 'team')).toBe('#team ')
+ expect(find(plain, 'some words')).toBe(true)
+ expect(find(plain, 'words just')).toBe(true)
+ expect(find(plain, '')).toBe(true)
+ expect(find(plain, ' ')).toBe(true)
+ expect(find(plain, '#')).toBe(false)
+ })
+
+ it('file cards are found by file name', () => {
+ const f: ClipboardItemDto = { id: 'f', data: { kind: 'files', paths: ['C:/Docs/Quarterly report.pdf'] }, capturedAt: 1, hitCount: 1, pinned: false }
+ expect(find(f, 'report quarterly')).toBe(true)
+ expect(find(f, 'docs')).toBe(false) // the folder is not part of the name
})
})
@@ -138,10 +127,31 @@ describe('menu helpers', () => {
expect(cardMenuHolds({ mode: 'menu' }, rect, { x: 310, y: 405 })).toBe(true) // small margin
expect(cardMenuHolds({ mode: 'menu' }, rect, { x: 500, y: 250 })).toBe(false)
expect(cardMenuHolds({ mode: 'menu' }, null, { x: 150, y: 250 })).toBe(false)
- expect(cardMenuHolds({ mode: 'edit' }, rect, { x: 900, y: 900 }, true)).toBe(true)
- // editor open but the shelf never got the keyboard: only its own box holds
- expect(cardMenuHolds({ mode: 'edit' }, rect, { x: 900, y: 900 }, false)).toBe(false)
- expect(cardMenuHolds({ mode: 'edit' }, rect, { x: 150, y: 250 }, false)).toBe(true)
+ // the note editor holds only where it is, typing or not: pointer gone -> the shelf may close
+ expect(cardMenuHolds({ mode: 'edit' }, rect, { x: 900, y: 900 })).toBe(false)
+ expect(cardMenuHolds({ mode: 'edit' }, rect, { x: 150, y: 250 })).toBe(true)
+ expect(cardMenuHolds({ mode: 'edit' }, rect, { x: 310, y: 405 })).toBe(true)
+ expect(cardMenuHolds({ mode: 'edit' }, null, { x: 150, y: 250 })).toBe(false)
+ // and nothing in the close path waits for the editor any more
+ const hover = read('src/hooks/useEdgeHover.ts')
+ expect(hover).not.toContain('isTypingInCardMenu')
+ expect(hover).not.toContain('windowHasKeyboard')
+ })
+
+ it('closing the shelf with the note editor open saves what was typed, then gives the keyboard back', () => {
+ const store = read('src/store/appStore.ts')
+ const setOpen = store.slice(store.indexOf(' setOpen: (open) => {'), store.indexOf(' setSettingsOpen: (settingsOpen) =>'))
+ // save first (while the editor still exists), then release the keyboard, then clear the menu
+ const commit = setOpen.indexOf('cardEditorCommit?.()')
+ const release = setOpen.indexOf('releaseAllKeyboard()')
+ const clear = setOpen.indexOf('cardMenu: null')
+ expect(commit).toBeGreaterThan(0)
+ expect(setOpen).toContain("if (!open && get().cardMenu?.mode === 'edit') {")
+ expect(release).toBeGreaterThan(commit)
+ expect(clear).toBeGreaterThan(release)
+ const menu = read('src/components/CardMenu.tsx')
+ expect(menu).toContain('registerCardEditorCommit(() => commitRef.current?.())')
+ expect(menu).toContain('return () => registerCardEditorCommit(null)')
})
it('maps the work-area cursor into window pixels for each dock', () => {
@@ -177,23 +187,30 @@ describe('keyboard focus holders', () => {
})
})
-describe('cards re-render on a label / tag change', () => {
- it('render key and meta key include label and tags', () => {
+describe('cards re-render on a note change', () => {
+ it('render key and meta key include the note', () => {
const a = textItem('a', 'x')
- const b = textItem('a', 'x', { label: 'L' })
- const c = textItem('a', 'x', { label: 'L', tags: ['t'] })
+ const b = textItem('a', 'x', { note: 'N' })
+ const c = textItem('a', 'x', { note: 'N2' })
expect(itemMetaKey(a)).toBe('')
expect(itemRenderKey(a)).not.toBe(itemRenderKey(b))
expect(itemRenderKey(b)).not.toBe(itemRenderKey(c))
- expect(itemRenderKey(c)).toBe(itemRenderKey(textItem('a', 'x', { label: 'L', tags: ['t'] })))
+ expect(itemRenderKey(c)).toBe(itemRenderKey(textItem('a', 'x', { note: 'N2' })))
})
})
-describe('store: card menu and label saving', () => {
+describe('store: card menu and note saving', () => {
let setItemMeta: ReturnType<typeof vi.fn>
beforeEach(() => {
- setItemMeta = vi.fn(async (id: string, meta: { label?: string | null; tags?: string[] | null }) =>
- useStore.getState().items.map((it) => (it.id === id ? { ...it, label: meta.label ?? undefined, tags: meta.tags ?? undefined, pinned: true } : it))
+ setItemMeta = vi.fn(async (id: string, meta: { note?: string | null }) =>
+ useStore.getState().items.map((it) => {
+ if (it.id !== id) return it
+ const next = { ...it }
+ const note = meta.note?.trim().replace(/\s+/g, ' ')
+ if (note) next.note = note
+ else delete next.note
+ return next
+ })
)
;(globalThis as any).window = {
edge: {
@@ -211,18 +228,18 @@ describe('store: card menu and label saving', () => {
delete (globalThis as any).window
})
- it('a label-only change from main is applied (not skipped as "unchanged")', () => {
- const items = useStore.getState().items.map((it) => (it.id === 'a' ? { ...it, label: 'New' } : it))
+ it('a note-only change from main is applied (not skipped as "unchanged")', () => {
+ const items = useStore.getState().items.map((it) => (it.id === 'a' ? { ...it, note: 'New' } : it))
useStore.getState().setItems(items)
- expect(useStore.getState().items[0].label).toBe('New')
+ expect(useStore.getState().items[0].note).toBe('New')
})
it('opens, switches to the editor, and closes with every view change', () => {
const s = () => useStore.getState()
s().openCardMenu('a', 10, 20)
expect(s().cardMenu).toEqual({ itemId: 'a', x: 10, y: 20, mode: 'menu' })
- s().editCardMeta('tags')
- expect(s().cardMenu).toMatchObject({ mode: 'edit', focus: 'tags' })
+ s().editCardMeta()
+ expect(s().cardMenu).toEqual({ itemId: 'a', x: 10, y: 20, mode: 'edit' })
s().setCardMenuRect({ left: 1, top: 2, right: 3, bottom: 4 })
s().setOpen(false)
expect(s().cardMenu).toBeNull()
@@ -239,18 +256,21 @@ describe('store: card menu and label saving', () => {
expect(s().cardMenu).toBeNull()
})
- it('saves through main, shows the cleaned value at once, and says when it pinned', async () => {
- const pending = useStore.getState().setItemMeta('a', { label: ' Office Wi-Fi ', tags: ['#Work'] })
- expect(useStore.getState().items[0]).toMatchObject({ label: 'Office Wi-Fi', tags: ['work'], pinned: true })
+ it('saves through main and shows the cleaned note at once, without pinning or a toast', async () => {
+ const pending = useStore.getState().setItemMeta('a', { note: ' Office Wi-Fi ' })
+ expect(useStore.getState().items[0]).toMatchObject({ note: 'Office Wi-Fi', pinned: false })
await pending
- expect(setItemMeta).toHaveBeenCalledWith('a', { label: ' Office Wi-Fi ', tags: ['#Work'] })
- expect(useStore.getState().toasts.map((t) => t.message)).toContain("Pinned so it's kept")
+ expect(setItemMeta).toHaveBeenCalledWith('a', { note: ' Office Wi-Fi ' })
+ expect(useStore.getState().items[0]).toMatchObject({ note: 'Office Wi-Fi', pinned: false })
+ expect(useStore.getState().toasts).toHaveLength(0)
+ await useStore.getState().setItemMeta('a', { note: null })
+ expect('note' in useStore.getState().items[0]).toBe(false)
})
it('rolls back and reports when saving fails', async () => {
setItemMeta.mockRejectedValueOnce(new Error('down'))
- await useStore.getState().setItemMeta('b', { label: 'X' })
- expect(useStore.getState().items[1].label).toBeUndefined()
+ await useStore.getState().setItemMeta('b', { note: 'X' })
+ expect(useStore.getState().items[1].note).toBeUndefined()
expect(useStore.getState().items[1].pinned).toBe(false)
expect(useStore.getState().toasts.some((t) => t.tone === 'error')).toBe(true)
})
@@ -289,20 +309,20 @@ describe('wiring', () => {
expect(read('electron/main/window.ts')).toContain('if (isSafeExternalUrl(details.url))')
})
- it('cards open the menu on right-click and show labels / tags', () => {
+ it('cards open the menu on right-click and show the note', () => {
const card = read('src/components/ClipboardItem.tsx')
expect(card).toContain('onContextMenu={handleContextMenu}')
expect(card).toContain('s.openCardMenu(item.id, e.clientX, e.clientY)')
expect(card).toContain("if (e.button !== 0) return // right-click opens the menu; nothing to stage")
- expect(card).toContain('<div className="item-label" title={item.label}>{item.label}</div>')
+ expect(card).toContain('<div className="item-note" title={item.note}>{item.note}</div>')
+ expect(card).not.toMatch(/item\.label\b|item\.tags\b|MetaTags/)
expect(card).toContain("if (target.closest('.card-menu')) return")
const panel = read('src/components/Panel.tsx')
expect(panel).toContain('<CardMenu />')
- expect(panel).toContain('<TagSuggest isHorizontal={false} />')
- expect(panel).toContain('<TagSuggest isHorizontal />')
+ expect(panel).not.toContain('TagSuggest')
})
- it('search and the label editor share the keyboard hand-over', () => {
+ it('search and the note editor share the keyboard hand-over', () => {
expect(read('src/components/ShelfSearch.tsx')).toContain("acquireKeyboard('search')")
expect(read('src/components/ShelfSearch.tsx')).toContain("releaseKeyboard('search')")
const menu = read('src/components/CardMenu.tsx')
@@ -314,12 +334,15 @@ describe('wiring', () => {
const src = read('src/i18n/translations.ts')
const dictionaries = src.match(/export const \w+: TranslationKeys = \{/g)?.length ?? 0
expect(dictionaries).toBe(31)
- for (const key of ['title', 'paste', 'pastePlain', 'addLabel', 'editLabel', 'openLink', 'copyCleanLink', 'copyAs', 'showInFolder', 'copyPath', 'copyPaths', 'saveToDownloads', 'preview', 'closePreview', 'label', 'labelPlaceholder', 'tags', 'tagPlaceholder', 'removeTag', 'usedBefore', 'removeAll', 'cancel', 'save', 'labelPinned', 'labelFailed', 'savedToDownloads', 'savedManyToDownloads', 'saveImagesFailed']) {
+ for (const key of ['title', 'paste', 'pastePlain', 'addNote', 'editNote', 'openLink', 'copyCleanLink', 'copyAs', 'showInFolder', 'copyPath', 'copyPaths', 'saveToDownloads', 'preview', 'closePreview', 'note', 'notePlaceholder', 'noteHint', 'removeNote', 'cancel', 'save', 'noteFailed', 'savedToDownloads', 'savedManyToDownloads', 'saveImagesFailed']) {
expect(src.split(`"${key}":`).length - 1, key).toBeGreaterThanOrEqual(dictionaries)
}
expect(src.split('"menu": {').length - 1).toBe(dictionaries)
+ // the label / tags strings are gone everywhere
+ for (const key of ['addLabel', 'editLabel', 'labelPlaceholder', 'tagPlaceholder', 'removeTag', 'usedBefore', 'labelPinned', 'labelFailed']) {
+ expect(src.includes(`"${key}":`), key).toBe(false)
+ }
// placeholders survive translation
- expect(src.split('#{tag}').length - 1).toBe(dictionaries)
expect(src.split('"savedToDownloads": "').length - 1).toBe(dictionaries)
for (const m of src.matchAll(/"savedToDownloads": "([^"]*)"/g)) expect(m[1]).toContain('{name}')
for (const m of src.matchAll(/"savedManyToDownloads": "([^"]*)"/g)) expect(m[1]).toContain('{count}')
@@ -349,7 +372,7 @@ describe('keyboard hand-over is race-free', () => {
expect(focusWindow.mock.calls).toEqual([[true]])
})
- it('search hands over to the label editor without a focus flip', () => {
+ it('search hands over to the note editor without a focus flip', () => {
void acquireKeyboard('search')
releaseKeyboard('search') // input blurs as the editor opens
vi.advanceTimersByTime(KEYBOARD_RELEASE_DELAY_MS - 10)
diff --git a/tests/itemMeta.test.ts b/tests/itemMeta.test.ts
index 5cdf0f8..cd7b52e 100644
--- a/tests/itemMeta.test.ts
+++ b/tests/itemMeta.test.ts
@@ -22,66 +22,44 @@ vi.mock('node:os', async (importOriginal) => {
import { ItemStore } from '../electron/store/ItemStore'
import { PATHS } from '../electron/store/paths'
-import {
- LABEL_MAX,
- TAGS_MAX,
- TAG_MAX_LEN,
- combineTags,
- hasItemMeta,
- normalizeLabel,
- normalizeTag,
- normalizeTags
-} from '../shared/itemMeta'
-import { fileBaseFromLabel, saveItemImages, uniqueDest } from '../electron/main/saveImages'
+import { NOTE_MAX, isKept, joinNotes, normalizeNote, noteFromLegacy } from '../shared/itemMeta'
+import { fileBaseFromNote, saveItemImages, uniqueDest } from '../electron/main/saveImages'
import { isSafeExternalUrl } from '../electron/main/externalUrl'
import type { ClipboardItem } from '../shared/types'
-describe('label / tag normalization (shared, used by main for every write)', () => {
- it('labels become one trimmed line, capped without splitting characters', () => {
- expect(normalizeLabel(' Office\n\tWi-Fi password ')).toBe('Office Wi-Fi password')
- expect(normalizeLabel('a\u0000b')).toBe('a b')
- expect(normalizeLabel(' ')).toBeUndefined()
- expect(normalizeLabel(42)).toBeUndefined()
- expect(normalizeLabel(null)).toBeUndefined()
- const long = '😀'.repeat(LABEL_MAX + 10)
- const cut = normalizeLabel(long)!
- expect(Array.from(cut)).toHaveLength(LABEL_MAX)
+describe('note normalization (shared, used by main for every write)', () => {
+ it('a note is one trimmed line, capped without splitting characters', () => {
+ expect(normalizeNote(' Office\n\tWi-Fi password ')).toBe('Office Wi-Fi password')
+ expect(normalizeNote('a\u0000b')).toBe('a b')
+ expect(normalizeNote(' ')).toBeUndefined()
+ expect(normalizeNote(42)).toBeUndefined()
+ expect(normalizeNote(null)).toBeUndefined()
+ const long = '😀'.repeat(NOTE_MAX + 10)
+ const cut = normalizeNote(long)!
+ expect(Array.from(cut)).toHaveLength(NOTE_MAX)
expect(cut.endsWith('😀')).toBe(true) // no half surrogate pair
})
- it('tags are one lowercase word in any language', () => {
- expect(normalizeTag('#Work')).toBe('work')
- expect(normalizeTag('##client a')).toBe('client-a')
- expect(normalizeTag(' Client A ')).toBe('client-a')
- expect(normalizeTag('ÜBER-größe')).toBe('über-größe')
- expect(normalizeTag('काम')).toBe('काम')
- expect(normalizeTag('日本語')).toBe('日本語')
- expect(normalizeTag('c++')).toBe('c++')
- expect(normalizeTag('v1.2')).toBe('v1.2')
- expect(normalizeTag('a!@$%^&*()b')).toBe('ab')
- expect(normalizeTag('--x--')).toBe('x')
- expect(normalizeTag('#')).toBeUndefined()
- expect(normalizeTag('!!!')).toBeUndefined()
- expect(normalizeTag(undefined)).toBeUndefined()
- expect(Array.from(normalizeTag('a'.repeat(50))!)).toHaveLength(TAG_MAX_LEN)
- expect(normalizeTag('abcdefghijklmnopqrstuvw-xyz')).toBe('abcdefghijklmnopqrstuvw') // no trailing '-'
- })
-
- it('tag lists are cleaned, de-duplicated and capped', () => {
- expect(normalizeTags(['Work', '#work', 'wifi', '', '!!', 'a', 'b', 'c', 'd'])).toEqual(['work', 'wifi', 'a', 'b', 'c'])
- expect(normalizeTags(['x', 'y', 'z', 'p', 'q', 'r'])).toHaveLength(TAGS_MAX)
- expect(normalizeTags([])).toBeUndefined()
- expect(normalizeTags('work')).toBeUndefined()
- expect(combineTags(['work'], ['wifi', 'work'])).toEqual(['work', 'wifi'])
- expect(combineTags(undefined, undefined)).toBeUndefined()
- expect(hasItemMeta({})).toBe(false)
- expect(hasItemMeta({ tags: [] })).toBe(false)
- expect(hasItemMeta({ label: 'x' })).toBe(true)
- expect(hasItemMeta({ tags: ['x'] })).toBe(true)
+ it('two notes join once each; an old label + tags become one note', () => {
+ expect(joinNotes('Invoice', 'Acme')).toBe('Invoice · Acme')
+ expect(joinNotes('Same', 'same')).toBe('Same')
+ expect(joinNotes(undefined, 'Only')).toBe('Only')
+ expect(joinNotes(undefined, undefined)).toBeUndefined()
+ expect(noteFromLegacy('Wifi password', ['home', 'network'])).toBe('Wifi password · home network')
+ expect(noteFromLegacy(undefined, ['#work'])).toBe('work')
+ expect(noteFromLegacy('Only label', 'nope')).toBe('Only label')
+ expect(noteFromLegacy(' ', [])).toBeUndefined()
+ })
+
+ it('pinned or noted items are kept', () => {
+ expect(isKept({})).toBe(false)
+ expect(isKept({ pinned: true })).toBe(true)
+ expect(isKept({ note: 'x' })).toBe(true)
+ expect(isKept({ pinned: false, note: '' })).toBe(false)
})
})
-describe('ItemStore label / tags', () => {
+describe('ItemStore notes', () => {
beforeEach(() => {
const stamp = `${Date.now()}-${Math.random().toString(16).slice(2)}`
fsRoots.userData = join(tmpdir(), `ed-meta-${stamp}`)
@@ -97,60 +75,67 @@ describe('ItemStore label / tags', () => {
const text = (t: string) => ({ kind: 'text' as const, text: t, isUrl: false })
- it('saves cleaned values, pins the item, and survives a restart', () => {
+ it('saves the cleaned note without pinning, and it survives a restart', () => {
const store = new ItemStore()
store.add(text('secret'), 50)
const id = store.list()[0].id
- expect(store.setMeta(id, { label: ' Office Wi-Fi ', tags: ['#Work', 'work', 'Home Net'] })).toBe(true)
+ expect(store.setMeta(id, { note: ' Office Wi-Fi ' })).toBe(true)
const it = store.get(id)!
- expect(it.label).toBe('Office Wi-Fi')
- expect(it.tags).toEqual(['work', 'home-net'])
- expect(it.pinned).toBe(true)
- expect(store.toDto()[0]).toMatchObject({ label: 'Office Wi-Fi', tags: ['work', 'home-net'] })
+ expect(it.note).toBe('Office Wi-Fi')
+ expect(it.pinned).toBe(false)
+ expect(store.toDto()[0]).toMatchObject({ note: 'Office Wi-Fi', pinned: false })
store.persistSync()
const reopened = new ItemStore()
reopened.load()
- expect(reopened.get(id)).toMatchObject({ label: 'Office Wi-Fi', tags: ['work', 'home-net'], pinned: true })
+ expect(reopened.get(id)).toMatchObject({ note: 'Office Wi-Fi', pinned: false })
})
- it('a partial patch keeps the other field; clearing removes the fields but keeps the pin', () => {
+ it('removing the note removes the field and leaves the pin alone', () => {
const store = new ItemStore()
store.add(text('a'), 50)
const id = store.list()[0].id
- store.setMeta(id, { label: 'Name', tags: ['x'] })
- store.setMeta(id, { tags: ['y'] })
- expect(store.get(id)).toMatchObject({ label: 'Name', tags: ['y'] })
- store.setMeta(id, { label: null, tags: null })
+ store.setPinned(id, true)
+ store.setMeta(id, { note: 'Name' })
+ store.setMeta(id, {})
+ expect(store.get(id)?.note).toBe('Name')
+ store.setMeta(id, { note: null })
const it = store.get(id)!
- expect('label' in it).toBe(false)
- expect('tags' in it).toBe(false)
+ expect('note' in it).toBe(false)
expect(it.pinned).toBe(true)
- expect(store.setMeta('missing', { label: 'x' })).toBe(false)
+ expect(store.setMeta('missing', { note: 'x' })).toBe(false)
})
- it('a labelled item is kept by the history limit (it is pinned)', () => {
+ it('a noted item is kept by the history limit, auto-delete and clear', () => {
const store = new ItemStore()
store.add(text('keep me'), 3)
const keep = store.list()[0].id
- store.setMeta(keep, { label: 'Keep' })
+ store.setMeta(keep, { note: 'Keep' })
for (let i = 0; i < 10; i++) store.add(text(`filler ${i}`), 3)
- expect(store.get(keep)?.label).toBe('Keep')
- })
-
- it('copying the same content again keeps its label and tags', () => {
+ expect(store.get(keep)?.note).toBe('Keep')
+ expect(store.get(keep)?.pinned).toBe(false)
+ // auto-delete: everything is older than the cutoff, only the noted item stays
+ ;(store.list() as ClipboardItem[]).forEach((it) => { it.capturedAt = 1 })
+ store.pruneExpired(1)
+ expect(store.list().map((x) => x.id)).toEqual([keep])
+ store.add(text('fresh'), 50)
+ store.clearUnpinned()
+ expect(store.list().map((x) => x.id)).toEqual([keep])
+ })
+
+ it('copying the same content again keeps its note', () => {
const store = new ItemStore()
store.add(text('same'), 50)
const id = store.list()[0].id
- store.setMeta(id, { label: 'L', tags: ['t'] })
+ store.setMeta(id, { note: 'N' })
store.add(text('other'), 50)
store.add(text('same'), 50)
- expect(store.list()[0]).toMatchObject({ id, label: 'L', tags: ['t'], hitCount: 2 })
+ expect(store.list()[0]).toMatchObject({ id, note: 'N', hitCount: 2 })
store.touch(id)
- expect(store.get(id)).toMatchObject({ label: 'L', tags: ['t'] })
+ expect(store.get(id)).toMatchObject({ note: 'N' })
})
- it('merging keeps the target label (or takes the source one) and combines tags', () => {
+ it('merging joins both notes on the target', () => {
const store = new ItemStore()
const files = (p: string) => ({ kind: 'files' as const, paths: [join(fsRoots.home, p)] })
for (const p of ['a.txt', 'b.txt', 'c.txt']) writeFileSync(join(fsRoots.home, p), p)
@@ -158,31 +143,32 @@ describe('ItemStore label / tags', () => {
store.add(files('b.txt'), 50)
store.add(files('c.txt'), 50)
const [c, b, a] = store.list().map((x) => x.id)
- store.setMeta(a, { label: 'Source A', tags: ['alpha', 'shared'] })
- store.setMeta(b, { tags: ['beta', 'shared'] })
- store.setPinned(b, false)
+ store.setMeta(a, { note: 'Source A' })
expect(store.merge(a, b).ok).toBe(true)
expect(store.get(a)).toBeUndefined()
- expect(store.get(b)).toMatchObject({ label: 'Source A', tags: ['beta', 'shared', 'alpha'], pinned: true })
- store.setMeta(c, { label: 'Target C' })
+ expect(store.get(b)).toMatchObject({ note: 'Source A', pinned: false })
+ store.setMeta(c, { note: 'Target C' })
expect(store.merge(b, c).ok).toBe(true)
- expect(store.get(c)?.label).toBe('Target C')
+ expect(store.get(c)?.note).toBe('Target C · Source A')
})
- it('load cleans hand-edited values instead of trusting them', () => {
- const dirty = {
+ it('load turns an old label + tags into one note (pin kept) and cleans hand-edited notes', () => {
+ const saved = {
items: [
- { id: 'x1', data: { kind: 'text', text: 'hi', isUrl: false }, capturedAt: 1, hitCount: 1, pinned: true, label: ` ${'L'.repeat(200)} `, tags: ['#A', 'a', 5, 'b c'] },
- { id: 'x2', data: { kind: 'text', text: 'yo', isUrl: false }, capturedAt: 1, hitCount: 1, pinned: false, label: ' ', tags: 'nope' }
+ { id: 'x1', data: { kind: 'text', text: 'hi', isUrl: false }, capturedAt: 1, hitCount: 1, pinned: true, label: 'Wifi password', tags: ['home', 'network'] },
+ { id: 'x2', data: { kind: 'text', text: 'yo', isUrl: false }, capturedAt: 1, hitCount: 1, pinned: false, label: ' ', tags: 'nope' },
+ { id: 'x3', data: { kind: 'text', text: 'zz', isUrl: false }, capturedAt: 1, hitCount: 1, pinned: false, note: ` ${'N'.repeat(300)} ` }
]
}
- writeFileSync(PATHS.indexFile(), JSON.stringify(dirty))
+ writeFileSync(PATHS.indexFile(), JSON.stringify(saved))
const store = new ItemStore()
store.load()
- expect(Array.from(store.get('x1')!.label!)).toHaveLength(LABEL_MAX)
- expect(store.get('x1')!.tags).toEqual(['a', 'b-c'])
+ expect(store.get('x1')).toMatchObject({ note: 'Wifi password · home network', pinned: true })
+ expect('label' in store.get('x1')!).toBe(false)
+ expect('tags' in store.get('x1')!).toBe(false)
+ expect('note' in store.get('x2')!).toBe(false)
expect('label' in store.get('x2')!).toBe(false)
- expect('tags' in store.get('x2')!).toBe(false)
+ expect(Array.from(store.get('x3')!.note!)).toHaveLength(NOTE_MAX)
})
it('the DTO tells the renderer when a text item has html, without sending the html', () => {
@@ -201,12 +187,12 @@ describe('save images to Downloads', () => {
beforeEach(() => mkdirSync(dir, { recursive: true }))
afterEach(() => rmSync(dir, { recursive: true, force: true }))
- it('turns a label into a safe Windows file name', () => {
- expect(fileBaseFromLabel('Invoice: March/April?')).toBe('Invoice_ March_April_')
- expect(fileBaseFromLabel(' report. ')).toBe('report')
- expect(fileBaseFromLabel('CON')).toBe('CON_')
- expect(fileBaseFromLabel('...')).toBe('Image')
- expect(Array.from(fileBaseFromLabel('x'.repeat(300))).length).toBe(120)
+ it('turns a note into a safe Windows file name', () => {
+ expect(fileBaseFromNote('Invoice: March/April?')).toBe('Invoice_ March_April_')
+ expect(fileBaseFromNote(' report. ')).toBe('report')
+ expect(fileBaseFromNote('CON')).toBe('CON_')
+ expect(fileBaseFromNote('...')).toBe('Image')
+ expect(Array.from(fileBaseFromNote('x'.repeat(300))).length).toBe(120)
})
it('never overwrites: name, name (2), name (3)', () => {
@@ -217,7 +203,7 @@ describe('save images to Downloads', () => {
expect(uniqueDest(dir, 'a', 'png')).toBe(join(dir, 'a (3).png'))
})
- it('copies originals under the label (numbered for a collection) or the default name', () => {
+ it('copies originals under the note (numbered for a collection) or the default name', () => {
const src = join(dir, 'src')
mkdirSync(src)
writeFileSync(join(src, 'i1.png'), 'one')
@@ -229,8 +215,8 @@ describe('save images to Downloads', () => {
defaultName: (_at: number, ext: string, _img: unknown, n: number) => `Screenshot X (${n}).${ext}`
}
const img = (id: string) => ({ imageId: id, width: 1, height: 1, bytes: 3, ext: 'png' })
- const labelled: ClipboardItem = { id: 'a', label: 'Trip', capturedAt: 0, hitCount: 1, pinned: true, data: { kind: 'image-collection', images: [img('i1'), img('i2'), img('gone')] } }
- const saved = saveItemImages(labelled, deps)
+ const noted: ClipboardItem = { id: 'a', note: 'Trip', capturedAt: 0, hitCount: 1, pinned: false, data: { kind: 'image-collection', images: [img('i1'), img('i2'), img('gone')] } }
+ const saved = saveItemImages(noted, deps)
expect(saved).toEqual([join(out, 'Trip (1).png'), join(out, 'Trip (2).png')])
expect(readFileSync(saved[1], 'utf8')).toBe('two')
const plain: ClipboardItem = { id: 'b', capturedAt: 0, hitCount: 1, pinned: false, data: { kind: 'image', ...img('i1') } }