TTS: split document into ranges of block elements

This commit is contained in:
John Factotum
2023-10-01 01:18:43 +08:00
parent cea9375561
commit ecefeb86e1
3 changed files with 253 additions and 101 deletions
+1 -1
View File
@@ -793,7 +793,7 @@ export class Paginator extends HTMLElement {
}
#selectAnchor() {
const { defaultView } = this.#view.document
if (this.#anchor instanceof defaultView.Range) {
if (this.#anchor.startContainer) {
const sel = defaultView.getSelection()
sel.removeAllRanges()
sel.addRange(this.#anchor)