dsh-content-search-ad 0.27.1 → 0.27.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client.js +30 -5
- package/index.js +1 -1
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -19,7 +19,7 @@ window.__ModuleLoader__.load({
|
|
|
19
19
|
/** Locale namespace owned by this plugin. */
|
|
20
20
|
const NS = 'contentSearch'
|
|
21
21
|
/** Plugin version, shown in the panel so a running build can be identified. */
|
|
22
|
-
const PLUGIN_VERSION = '0.27.
|
|
22
|
+
const PLUGIN_VERSION = '0.27.2'
|
|
23
23
|
/** Tab-type identity; the body slot registers under the same key. */
|
|
24
24
|
const TAB_ID = 'dsh-content-search-ad/panel'
|
|
25
25
|
/** Page kind opened by the guide card and the strip's add control. */
|
|
@@ -580,6 +580,24 @@ window.__ModuleLoader__.load({
|
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
582
|
|
|
583
|
+
/** Every text range inside one chat node, so a whole message can be marked. */
|
|
584
|
+
function rangesForNode(node) {
|
|
585
|
+
if (node === undefined || node === null || typeof node.querySelectorAll !== 'function') return []
|
|
586
|
+
const ranges = []
|
|
587
|
+
const walker = document.createTreeWalker(node, NodeFilter.SHOW_TEXT, null)
|
|
588
|
+
let text = walker.nextNode()
|
|
589
|
+
while (text !== null && ranges.length < HIGHLIGHT_MAX_RANGES) {
|
|
590
|
+
const value = text.nodeValue
|
|
591
|
+
if (typeof value === 'string' && value.trim().length > 0) {
|
|
592
|
+
const range = document.createRange()
|
|
593
|
+
range.selectNodeContents(text)
|
|
594
|
+
ranges.push(range)
|
|
595
|
+
}
|
|
596
|
+
text = walker.nextNode()
|
|
597
|
+
}
|
|
598
|
+
return ranges
|
|
599
|
+
}
|
|
600
|
+
|
|
583
601
|
/**
|
|
584
602
|
* Find the occurrence an anchor window describes.
|
|
585
603
|
*
|
|
@@ -1090,18 +1108,25 @@ window.__ModuleLoader__.load({
|
|
|
1090
1108
|
if (typeof anchor !== 'string' || anchor.length < 4) return false
|
|
1091
1109
|
ensureHighlightStyle()
|
|
1092
1110
|
if (!highlightSupported()) return false
|
|
1111
|
+
/** Mark the whole chat node the anchor landed in, not just the window. */
|
|
1112
|
+
const paint = (hit) => {
|
|
1113
|
+
const host = hit.element !== null && typeof hit.element.closest === 'function'
|
|
1114
|
+
? hit.element.closest('[data-chat-node-key]')
|
|
1115
|
+
: null
|
|
1116
|
+
const ranges = host !== null ? rangesForNode(host) : []
|
|
1117
|
+
CSS.highlights.set(ACTIVE_NAME, ranges.length > 0 ? new Highlight(...ranges) : new Highlight(hit.range))
|
|
1118
|
+
revealElement(hit.element)
|
|
1119
|
+
}
|
|
1093
1120
|
const found = findAnchor(indexTranscript(true), anchor)
|
|
1094
1121
|
if (found !== undefined) {
|
|
1095
|
-
|
|
1096
|
-
revealElement(found.element)
|
|
1122
|
+
paint(found)
|
|
1097
1123
|
return true
|
|
1098
1124
|
}
|
|
1099
1125
|
pageToHit(sessionId, seq).then((paged) => {
|
|
1100
1126
|
if (!paged) return
|
|
1101
1127
|
const retry = findAnchor(indexTranscript(true), anchor)
|
|
1102
1128
|
if (retry === undefined) return
|
|
1103
|
-
|
|
1104
|
-
revealElement(retry.element)
|
|
1129
|
+
paint(retry)
|
|
1105
1130
|
}).catch(() => {})
|
|
1106
1131
|
return false
|
|
1107
1132
|
}
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-content-search-ad",
|
|
3
|
-
"version": "0.27.
|
|
3
|
+
"version": "0.27.2",
|
|
4
4
|
"description": "DeepSeek Harness (DSH) plugin: full-text search over every conversation's prose from a right sidebar tab, with a jump-to-match detail view.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "zmq6931",
|