vomebook commited on
Commit ·
9e4c392
1
Parent(s): b9c9d8c
fix(reader): rename the speech title helper to satisfy the state guard
Browse filesreader-speech.mjs declared a module-level 'title' helper. The architecture
contract forbids top-level title state in the composed Reader source, so the
helper is now readerSpeechTitle. Behavior is unchanged.
static/reader/ui/reader-speech.mjs
CHANGED
|
@@ -62,7 +62,7 @@ export function createReaderSpeech(readerContext) {
|
|
| 62 |
const speech = () => globalThis.CCRDSpeech;
|
| 63 |
const mode = () => readerContext.capability?.mode || "";
|
| 64 |
const documentId = () => "reader:" + (readerContext.sourceUrl || readerContext.contentUrl || location.search);
|
| 65 |
-
const
|
| 66 |
|
| 67 |
// ---- Per-format unit sources -------------------------------------------
|
| 68 |
function foliateSections() {
|
|
@@ -395,7 +395,7 @@ export function createReaderSpeech(readerContext) {
|
|
| 395 |
function publish(next) {
|
| 396 |
adapter = next;
|
| 397 |
speech()?.previewLoaded({
|
| 398 |
-
id: documentId(), title:
|
| 399 |
tools: document.querySelector(".reader-actions"), buttonClass: "icon-button preview-speech-btn"
|
| 400 |
});
|
| 401 |
}
|
|
|
|
| 62 |
const speech = () => globalThis.CCRDSpeech;
|
| 63 |
const mode = () => readerContext.capability?.mode || "";
|
| 64 |
const documentId = () => "reader:" + (readerContext.sourceUrl || readerContext.contentUrl || location.search);
|
| 65 |
+
const readerSpeechTitle = () => document.querySelector("#title")?.textContent?.trim() || document.title || "朗读";
|
| 66 |
|
| 67 |
// ---- Per-format unit sources -------------------------------------------
|
| 68 |
function foliateSections() {
|
|
|
|
| 395 |
function publish(next) {
|
| 396 |
adapter = next;
|
| 397 |
speech()?.previewLoaded({
|
| 398 |
+
id: documentId(), title: readerSpeechTitle(), adapter: next, host: document.body,
|
| 399 |
tools: document.querySelector(".reader-actions"), buttonClass: "icon-button preview-speech-btn"
|
| 400 |
});
|
| 401 |
}
|