From a75471117f1f016677f6d1ac6c5ff187ef06db98 Mon Sep 17 00:00:00 2001 From: hole-thu Date: Wed, 24 Jun 2026 21:37:00 +0800 Subject: [PATCH] Fix search highlight --- src/Common.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Common.js b/src/Common.js index 49a4793..dda0693 100644 --- a/src/Common.js +++ b/src/Common.js @@ -232,8 +232,12 @@ export class HighlightedMarkdown extends Component { ); } catch (e) {} } else { - let search_kws = props.search_param - .split(/[\s()+-]+/) + let search_kws = ( + props.search_param.match(/"[^"]*"|[^\s()+:"[\]-]+/g) || [] + ) + .map((s) => + s.startsWith('"') ? s.slice(1, -1) : s.split('^')[0], + ) .filter((s) => s); if (search_kws.length) { search_re = new RegExp(