@hanology/cham-browser 0.4.82 → 0.4.83
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/package.json
CHANGED
|
@@ -110,22 +110,24 @@ onBeforeUnmount(() => {
|
|
|
110
110
|
@mouseenter="emit('tooltipEnter')"
|
|
111
111
|
@mouseleave="emit('tooltipLeave')"
|
|
112
112
|
>
|
|
113
|
-
<div
|
|
114
|
-
<div class="ann-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
<
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
<div
|
|
122
|
-
<div class="ann-entry
|
|
123
|
-
<
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
<
|
|
127
|
-
|
|
128
|
-
|
|
113
|
+
<div class="ann-card-inner">
|
|
114
|
+
<div v-if="headword" class="ann-card-head" :class="dominantKind()">
|
|
115
|
+
<div class="ann-headword">{{ headword }}</div>
|
|
116
|
+
<div class="ann-badge-count" v-if="annotations.length > 1">{{ t('annotation.noteCount', { count: toChineseNumber(annotations.length) }) }}</div>
|
|
117
|
+
</div>
|
|
118
|
+
<button class="ann-card-close" @click="dismiss" :aria-label="t('action.close')">
|
|
119
|
+
<svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3"><path d="M18 6L6 18M6 6l12 12"/></svg>
|
|
120
|
+
</button>
|
|
121
|
+
<div class="ann-card-scroll">
|
|
122
|
+
<div v-for="ann in annotations" :key="ann.id" class="ann-entry">
|
|
123
|
+
<div class="ann-entry-header">
|
|
124
|
+
<span class="ann-kind" :class="ann.kind">{{ kindLabel(ann) }}</span>
|
|
125
|
+
</div>
|
|
126
|
+
<div class="ann-entry-body">
|
|
127
|
+
<span v-if="layerLabel(ann)" class="ann-layer">{{ layerLabel(ann) }}</span>
|
|
128
|
+
<div v-if="getSegment(ann)" class="ann-pron-h"><PronunciationGroup :segment="getSegment(ann)!" /></div>
|
|
129
|
+
<span v-if="ann.text && ann.kind !== 'pronunciation'" class="ann-text">{{ ann.text }}</span>
|
|
130
|
+
</div>
|
|
129
131
|
</div>
|
|
130
132
|
</div>
|
|
131
133
|
</div>
|
|
@@ -139,12 +139,17 @@ export function useAnnotationTooltip() {
|
|
|
139
139
|
const el = (event.target as HTMLElement).closest('.ann-target') as HTMLElement | null
|
|
140
140
|
const rect = (el ?? event.target as HTMLElement).getBoundingClientRect()
|
|
141
141
|
|
|
142
|
-
// Extract headword text
|
|
142
|
+
// Extract headword text from all .ann-target elements sharing the same data-ann-ids
|
|
143
143
|
if (el) {
|
|
144
|
-
const
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
|
|
144
|
+
const ids = el.getAttribute('data-ann-ids') || ''
|
|
145
|
+
const container = el.closest('.v-scroll-line, .v-scroll-body, .sb-text, .part-block, [class*="section"]') || el.parentElement
|
|
146
|
+
const allTargets = container ? container.querySelectorAll(`.ann-target[data-ann-ids="${ids}"]`) : [el]
|
|
147
|
+
const text = [...allTargets].map(t => {
|
|
148
|
+
const clone = t.cloneNode(true) as HTMLElement
|
|
149
|
+
clone.querySelectorAll('.ann-num, sup, rt, rp').forEach(n => n.remove())
|
|
150
|
+
return clone.textContent?.trim() || ''
|
|
151
|
+
}).join('')
|
|
152
|
+
headword.value = text || el.textContent?.trim() || ''
|
|
148
153
|
} else {
|
|
149
154
|
headword.value = ''
|
|
150
155
|
}
|