@pie-players/pie-tool-annotation-toolbar 0.3.73 → 0.3.74
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/README.md +11 -9
- package/dist/tool-annotation-toolbar.js +1737 -8404
- package/package.json +9 -9
- package/dist/rolldown-runtime--eTHp1Qs.js +0 -20
- package/dist/sre-kwoc_SMV.js +0 -17637
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Annotation Toolbar
|
|
2
2
|
|
|
3
|
-
A text selection toolbar for highlighting and annotating text in
|
|
3
|
+
A text selection toolbar for highlighting and annotating text in PIE assessment players. Uses modern CSS Custom Highlight API for zero DOM mutation and optimal performance.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
@@ -147,16 +147,18 @@ The annotation toolbar includes a "Read" button that uses the TTS service to rea
|
|
|
147
147
|
The toolbar uses `ttsService.speakRange()` instead of `ttsService.speak()` to ensure accurate word highlighting:
|
|
148
148
|
|
|
149
149
|
```typescript
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
150
|
+
ttsSpeaking = true;
|
|
151
|
+
try {
|
|
152
|
+
// speakRange() calculates text offset for accurate highlighting.
|
|
153
|
+
// contentRoot: the item or passage scope element, else the document element.
|
|
154
|
+
await ttsService.speakRange(selectedRange, { contentRoot });
|
|
155
|
+
} finally {
|
|
156
|
+
ttsSpeaking = false;
|
|
157
|
+
}
|
|
158
158
|
```
|
|
159
159
|
|
|
160
|
+
`speakRange` resolves when reading ends and rejects on a playback error.
|
|
161
|
+
|
|
160
162
|
**Why this matters:**
|
|
161
163
|
|
|
162
164
|
- User selects text in the middle of a paragraph
|