mirror of
https://github.com/john-okeefe/foliate-js.git
synced 2026-09-09 11:29:14 -04:00
Add methods for clearing selections
This commit is contained in:
@@ -653,6 +653,10 @@ export class Paginator {
|
|||||||
const $style = this.#styleMap.get(this.#view?.document)
|
const $style = this.#styleMap.get(this.#view?.document)
|
||||||
if ($style) $style.textContent = style
|
if ($style) $style.textContent = style
|
||||||
}
|
}
|
||||||
|
deselect() {
|
||||||
|
const sel = this.#view.document.defaultView.getSelection()
|
||||||
|
sel.removeAllRanges()
|
||||||
|
}
|
||||||
async #setAnchor(anchor, select) {
|
async #setAnchor(anchor, select) {
|
||||||
this.#anchor = anchor
|
this.#anchor = anchor
|
||||||
await this.#scrollToAnchor(select)
|
await this.#scrollToAnchor(select)
|
||||||
|
|||||||
@@ -280,6 +280,9 @@ export class View {
|
|||||||
console.error(`Could not go to ${target}`)
|
console.error(`Could not go to ${target}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
deselect() {
|
||||||
|
return this.renderer?.deselect()
|
||||||
|
}
|
||||||
async getTOCItemOf(target) {
|
async getTOCItemOf(target) {
|
||||||
try {
|
try {
|
||||||
const { index, anchor } = await this.resolveNavigation(target)
|
const { index, anchor } = await this.resolveNavigation(target)
|
||||||
|
|||||||
Reference in New Issue
Block a user