Commit graph

52 commits

Author SHA1 Message Date
saberzero1
b6d7e80865
fix: use SPA navigation for Enter key instead of full page reload 2026-05-24 17:22:52 +02:00
saberzero1
bf319becff
fix: prefer heading matches over body text in scroll-to-search-term
Previously, scrollToSearchTerm always scrolled to the first DOM occurrence
of the search term. Now it checks headings first, then body text, so
navigating from a search result that matched a heading correctly scrolls
to that heading instead of an earlier body occurrence.
2026-05-24 16:56:12 +02:00
saberzero1
285d90a15c
fix: preserve highlight spans in search results while sanitizing other HTML
Title and content use innerHTML with a whitelist that only allows <span>
tags (used by the highlight function). All other HTML is stripped.
Tags use pre-escaped content from highlightTags with trusted structural markup.
2026-05-24 16:46:46 +02:00
saberzero1
d0b64d99ea
fix: sanitize search result innerHTML to prevent XSS 2026-05-24 16:21:07 +02:00
saberzero1
6940ceb2d6
feat: listen for content-index-updated to incrementally index new entries
Subscribe to the content-index-updated CustomEvent and incrementally add
newly-patched entries to the FlexSearch index. The existing indexInitialized
memoization is preserved -- no full rebuild, just additive inserts via
index.addAsync(), plus updates to idDataMap, contentData, and allTags.

This enables runtime extension of the search index by other plugins. The
primary consumer is @quartz-community/encrypted-pages, which patches the
resolved fetchData object with decrypted entries from its shadow content
index and dispatches content-index-updated so users can find and open
decrypted pages via search within the same browser session.

Non-fatal: the listener swallows errors from the in-place fetchData read
and continues with whatever content-index data was loaded originally.
2026-04-11 13:49:38 +02:00
saberzero1
1a6b49d662
i18n: add translations for 30 locales from Quartz v4 2026-04-04 01:35:51 +02:00
saberzero1
24fa5d9477
i18n: add translations for 30 locales from Quartz v4 2026-04-04 01:35:48 +02:00
saberzero1
2207e2d57e
i18n: add translations for 30 locales from Quartz v4 2026-04-04 01:35:45 +02:00
saberzero1
81863399cd
i18n: add translations for 30 locales from Quartz v4 2026-04-04 01:35:42 +02:00
saberzero1
dfac501077
i18n: add translations for 30 locales from Quartz v4 2026-04-04 01:35:39 +02:00
saberzero1
3c51a807e3
i18n: add translations for 30 locales from Quartz v4 2026-04-04 01:35:36 +02:00
saberzero1
915e17c55a
i18n: add translations for 30 locales from Quartz v4 2026-04-04 01:35:34 +02:00
saberzero1
de0cabf85e
i18n: add translations for 30 locales from Quartz v4 2026-04-04 01:35:30 +02:00
saberzero1
0d23699969
i18n: add translations for 30 locales from Quartz v4 2026-04-04 01:35:27 +02:00
saberzero1
1d503d49d9
i18n: add translations for 30 locales from Quartz v4 2026-04-04 01:35:24 +02:00
saberzero1
905d179132
i18n: add translations for 30 locales from Quartz v4 2026-04-04 01:35:21 +02:00
saberzero1
6d52c3ef22
i18n: add translations for 30 locales from Quartz v4 2026-04-04 01:35:15 +02:00
saberzero1
fc5b228c98
i18n: add translations for 30 locales from Quartz v4 2026-04-04 01:35:11 +02:00
saberzero1
e76ad13509
refactor: use shared classNames from @quartz-community/utils 2026-04-03 19:17:34 +02:00
saberzero1
fa489e37d6
fix: boost sidebar z-index to 9999 when search opens to ensure modal is above all content 2026-03-30 00:36:49 +02:00
saberzero1
14b1e9e7e4
fix: resolve callout z-index overlay and scroll-to-term across element boundaries
- Set sidebar z-index to auto when search opens to break stacking context
  that trapped the fixed search modal behind page content
- Rewrite scroll-to-search-term to search textContent of block-level
  elements and walk text nodes to build cross-element Range, handling
  terms that span multiple inline elements
2026-03-30 00:32:19 +02:00
saberzero1
871c7aafb9
feat: scroll to search term on destination page after navigation
Store search term in sessionStorage when clicking a result, then on
page load find the first matching text, highlight it with a fade-out
animation, and scroll it into view.
2026-03-30 00:22:01 +02:00
saberzero1
93c2c43b21
fix: use direct scrollTop on preview container instead of scrollIntoView 2026-03-30 00:17:55 +02:00
saberzero1
8ee304a73a
fix: defer scroll-to-highlight with requestAnimationFrame for proper layout timing 2026-03-30 00:11:04 +02:00
saberzero1
20db57310a
fix: hide card description on desktop with preview, scroll focused results into view 2026-03-30 00:01:13 +02:00
saberzero1
4cfc4b2110
feat: overhaul search with multi-tag support, autocomplete, and quality fixes
- Fix highlight() trim bug: slice tokenized text array, correct window math
- Fix memory leak: use event delegation instead of per-element listeners
- Fix XSS: escape content with escapeHTML before innerHTML insertion
- Add multi-tag search (#tag1 #tag2 query) with AND filtering
- Add tag autocomplete dropdown with keyboard navigation
- Add inline ghost text for selected tag suggestion
- Add configurable result ordering via fieldPriority option
- Add scroll-to-highlight in preview panel
- Add ARIA attributes (listbox, option, aria-expanded, aria-label)
- Add error handling in fetchContent (try/catch, !res.ok check)
- Add 150ms debounce on preview updates
- Add index initialization guard for tag dropdown
- Use parallel index filling (Promise.all)
- Remove debug console.log statements
- Restore button refocus after hiding search
- Use CSS custom property for z-index management
- Add max-height constraint for mobile results
- Update all 6 locales with ellipsis placeholder and tag search strings
- Export SearchField type
2026-03-29 15:44:17 +02:00
saberzero1
efe696e1d5
fix: resolve links correctly on subdirectory deployments
Use resolveBasePath() from @quartz-community/utils/path to prepend the
base path when navigating via search results. Fixes links resolving to
the domain root instead of the subdirectory.
2026-03-18 11:50:34 +01:00
saberzero1
d17eab96c5
fix: use fetchData global for path-prefixed deployments
- Update types/globals.d.ts with centralized type declarations
- Use fetchData global instead of hardcoded /static/contentIndex.json
- Revert @quartz-community/types from file:../types to github:quartz-community/types
- Add .prettierignore, update .eslintrc.json with triple-slash-reference override
- Remove duplicate scripts.d.ts/styles.d.ts
2026-03-16 18:54:25 +01:00
saberzero1
e9c10e521b
feat: add render event listener for in-place DOM re-initialization 2026-03-12 19:45:41 +01:00
saberzero1
934927432b
Migrate types to use @quartz-community/types exports
Replace ambient quartz-compat.d.ts declarations with direct imports
from @quartz-community/types. Remove node_modules path from tsconfig
include array.
2026-02-13 13:18:29 +01:00
saberzero1
54b33d6fb4
fix: active class 2026-02-09 22:40:11 +01:00
saberzero1
77f45d31ab
fix: double event listeners 2026-02-09 21:44:54 +01:00
saberzero1
727a7d0ae7
fix: double event listeners 2026-02-09 21:30:36 +01:00
saberzero1
75e83fccfe
chore: updated dependencies 2026-02-09 21:23:31 +01:00
saberzero1
3babf6fd42
fix: use util function on nav 2026-02-09 20:55:13 +01:00
saberzero1
1e00f2e97e
fix: add FlexSearch types to resolve ts-expect-error in host repos
- Add @types/flexsearch devDependency for proper type checking
- Remove @ts-expect-error directive now that types are available
- Fixes unused directive error when plugin is installed in Quartz
2026-02-09 13:09:07 +01:00
saberzero1
28eea49e76
fix: resolve CI failures by fixing lint config and test setup
- Update .eslintrc.json to ignore inline scripts and type declarations
- Change @ts-ignore to @ts-expect-error in Search.tsx
- Configure vitest aliases to mock scss and inline script imports
- Create proper test mocks and search.test.ts
- Remove template test files (emitter, filter, transformer, helpers)
- Fix formatting in search.scss
2026-02-09 12:58:51 +01:00
saberzero1
c997522a5f
feat: use @quartz-community/utils for shared utilities
- Add @quartz-community/utils dependency
- Update tsup config to bundle inline scripts with esbuild
- Import removeAllChildren and normalizeRelativeURLs from utils
- Re-export removeAllChildren from util.ts for backward compatibility
- Remove unused template dependencies
2026-02-09 12:45:22 +01:00
saberzero1
af008ed45f
Fix fetchData bug and define types locally 2026-02-08 13:44:01 +01:00
saberzero1
0131923f00
Define SearchOptions locally instead of importing from types package 2026-02-08 11:03:54 +01:00
saberzero1
0f6bf5a640
Refactor Search to match Quartz original structure with separate CSS and script files 2026-02-08 10:58:58 +01:00
saberzero1
e3b491b0a5
Add @quartz-community/types dependency 2026-02-07 20:40:10 +01:00
saberzero1
c15bcce565
fix: use docsById mapping for efficient lookup and add tags to results 2026-02-07 14:08:14 +01:00
saberzero1
d87c160716
fix: lookup documents by ID since FlexSearch returns IDs not docs 2026-02-07 13:35:48 +01:00
saberzero1
f199daae11
debug: add detailed logging to understand FlexSearch result structure 2026-02-07 13:30:35 +01:00
saberzero1
3ea1ea6369
fix: remove duplicate init and handle both FlexSearch result structures 2026-02-07 13:27:28 +01:00
saberzero1
1a547e2087
fix: add comprehensive logging to debug search issues 2026-02-07 13:25:02 +01:00
saberzero1
756769c895
fix: add null checks for search results and content data 2026-02-07 13:19:05 +01:00
saberzero1
d5b4de2074
fix: avoid regex escaping by using string-based highlighting 2026-02-07 13:15:57 +01:00
saberzero1
f68250809f
fix: fix regex escaping in inline script 2026-02-07 13:14:35 +01:00