@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Annotation Toolbar
2
2
 
3
- A text selection toolbar for highlighting and annotating text in the PIEoneer assessment player. Uses modern CSS Custom Highlight API for zero DOM mutation and optimal performance.
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
- // speakRange() calculates text offset for accurate highlighting
151
- await ttsService.speakRange(selectedRange, {
152
- rate: 1.0,
153
- highlightWords: true
154
- }, {
155
- onEnd: () => ttsSpeaking = false,
156
- onError: (err) => ttsSpeaking = false
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