Commit Graph
3 Commits
Author SHA1 Message Date
mirivlad 077d25a269 fix: keyboard layout map, picker type tabs as filters, add unit tests
1. Fix RU_TO_EN keyboard map in keyboardLayout.ts:
   - ч was mapped to 'c' (wrong), now correctly 'x'
   - с was mapped to 'v' (wrong), now correctly 'c'
   - ю was mapped to '.' (wrong), now correctly ','
   - Full rewrite with standard QWERTY/ЙЦУКЕН positional mapping
   - Examples: dthcnfr→верстак, руддщ→hello, цщкдв→world all correct now

2. Root cause of search breaking after 3-4 chars:
   Old map had ч:'c', с:'v' swapped. So dthcnfr → 'верчиак' (wrong).
   Each character was mapped to wrong Cyrillic equivalent.

3. Add unit tests: keyboardLayout.test.js (39 tests, node-runner):
   - EN→RU: dthcnfr, ghbdtn, ntcn
   - RU→EN: руддщ, цщкдв, ышеш
   - Unicode safety: Latin c (U+0063) ≠ Cyrillic с (U+0441)
   - expandKeyboardVariants for mixed inputs
   - Edge cases: empty, single char, mixed case, numbers

4. InternalLinkPicker type tabs → filters (not search modes):
   - Store rawResults (all) + filtered results by activeType
   - Switching type tab no longer clears query or triggers new search
   - Just filters existing rawResults by selected type
   - Shows 'Нет результатов для этого типа' when filtered empty

5. Both GlobalSearch and InternalLinkPicker use same expandKeyboardVariants()

All tests PASS, full build OK.
2026-06-15 11:37:35 +08:00
mirivlad 88eb99e9af fix: verstak:// links in preview, case-insensitive search, keyboard layout swap
1. Fix verstak:// links rendered as blocked/strikethrough in markdown preview:
   - Changed href from 'javascript:void(0)' to hash-based '#verstak-type-id'
   - DOMPurify no longer strips the link; click handler uses data-verstak-href
   - CSS already handles .md-link--internal with cyan color, no strikethrough

2. Add markdown label escaping for internal link picker:
   - New escapeMarkdownLabel() in markdown.ts escapes [ ] ( )
   - Applied in InternalLinkPicker.selectResult() before inserting markdown

3. Fix case-insensitive search for RU/EN:
   - Add title_lower column (migration 019) populated by Go strings.ToLower
   - BackfillTitleLower() runs after migrations to populate existing rows
   - Search() now queries title_lower with Go-level lowercase (Unicode-aware)
   - insertNode() and UpdateTitle() populate title_lower automatically
   - New migration 019 + BackfillTitleLower in storage.go
   - Tests: TestSearchCaseInsensitive, TestSearchFindsCreatedNode

4. Add keyboard layout swap search support:
   - New keyboardLayout.ts utility with RU↔EN QWERTY mapping
   - expandKeyboardVariants() generates original + swapped + lowercased variants
   - InternalLinkPicker.search() queries all variants in parallel, deduplicates by ID
   - Examples: dthcnfr → верстак, руддщ → hello

Files changed:
- markdown.ts: hash href + escapeMarkdownLabel export
- InternalLinkPicker.svelte: label escaping + layout swap search
- keyboardLayout.ts: new RU/EN layout swap utility
- repository.go: title_lower in Search/insertNode/UpdateTitle
- storage.go: migration019 + BackfillTitleLower
- migrations_019.sql.go: new migration
- search_test.go, repository_test.go: new tests
2026-06-15 10:39:44 +08:00
mirivlad 7521eea109 feat: full Internal Link Picker with search and type filter
Replace broken ObjectPickerModal and manual modal with proper
InternalLinkPicker component:

- Search field with debounced SearchNodes API calls
- Type tabs: Дело, Заметка, Файл, Секрет (disabled)
- Results list showing title + path, keyboard navigation
- Inserts [Title](verstak://type/id) at cursor position
- No layout breakage — picker is a normal modal via position:fixed
- Escape/Cancel close picker cleanly
- bind:this on NoteEditorPanel → MarkdownEditor.insertText()

Also:
- MarkdownEditor: added public insertText() method + bind:this
- NoteEditorPanel: added bind:this on MarkdownEditor + public insertText()
- Removed manual modal, insertInternalLinkMarkdown(), document.querySelector
2026-06-15 09:57:11 +08:00