Get rect in reader instead of view

Also expose index in `loaded` event
This commit is contained in:
John Factotum
2022-10-25 05:55:57 +00:00
committed by GitHub
parent d63905346c
commit 6977ac005d
2 changed files with 7 additions and 9 deletions
+3 -2
View File
@@ -1,5 +1,5 @@
/* global zip: false, fflate: false */
import { View } from './view.js'
import { View, getPosition } from './view.js'
import { createTOCView } from './ui/tree.js'
import { createMenu } from './ui/menu.js'
import { createPopover } from './ui/popover.js'
@@ -234,7 +234,8 @@ class Reader {
if (tocItem?.href) this.#tocView?.setCurrentHref?.(tocItem.href)
}
#onReference(obj) {
const { content, pos: { point, dir } } = obj
const { content, element } = obj
const { point, dir } = getPosition(element)
const iframe = document.createElement('iframe')
iframe.sandbox = 'allow-same-origin'
iframe.srcdoc = content