Closed farling42 closed 1 year ago
The pdfjs viewer.html runs in its own iframe, so getting events into/out of the iframe might be more difficult.
// Get contents of the iframe containing the PDFJS viewer.html
let window = game.journal.getName('OLBH Rulebook').sheet._element.find('iframe')[0].contentWindow;
let inputs = window.document.body.getElementsByTagName('input')
// Set the "NAME" of the Cypher Character Sheet to "Thomas"
for (let elem of inputs) if (elem.name == "Name") elem.value = "Thomas"
// Get the contents of the "Name" field
for (let elem of inputs) if (elem.name == "Name") console.log(elem.value)
Handle passing user changes back to the Actor with inputelem.addEventListener('change', (event) => {});
on each of the fields.
Test with :
ui.pdfpager.configureInputs(game.journal.getName('OLBH Rulebook'),game.journal.getName('OLBH Rulebook').sheet._element.find('iframe')[0])
Need to set an iframe.onload
function to link in the field editing hooks (probably in render_inner).
Need to hook onto an event which will fire when viewer.html has finished loading the page, since iframe.onload fires as soon as viewer.html starts.
Two ways of working in 0.12.0
See PDFoundry classes, although some might not work on V10?
See ActorViewer at https://djphoenix719.github.io/PDFoundry/modules/api.html