11import Data from '../BootstrapBlazor/modules/data.js'
22import EventHandler from "../BootstrapBlazor/modules/event-handler.js"
3- import { default as EmbedPDF , DocumentManagerPlugin } from './embedpdf.js'
3+ import EmbedPDF from './embedpdf.js'
44import { getTheme , registerBootstrapBlazorModule } from '../BootstrapBlazor/modules/utility.js'
55
66export async function init ( id , invoke , options ) {
@@ -10,7 +10,7 @@ export async function init(id, invoke, options) {
1010 }
1111
1212 const target = el . querySelector ( '.pdf-viewer' ) ;
13- const { src, tabBar, theme, lang, currentPage, scrollDirection , pageGap } = options ;
13+ const { src, tabBar, theme, lang, currentPage, scrollStrategy , pageGap } = options ;
1414 const wasmUrl = `${ location . origin } /_content/BootstrapBlazor.EmbedPDF/pdfium.wasm` ;
1515
1616 let preference = theme ;
@@ -38,7 +38,7 @@ export async function init(id, invoke, options) {
3838 fallbackLocale : 'en'
3939 } ,
4040 scroll : {
41- defaultStrategy : scrollDirection ,
41+ defaultStrategy : scrollStrategy ,
4242 defaultPageGap : currentPageGap
4343 }
4444 } ) ;
@@ -97,6 +97,17 @@ export async function setLocale(id, locale) {
9797 }
9898}
9999
100+ export async function setScrollStrategy ( id , strategy ) {
101+ const pdf = Data . get ( id ) ;
102+ const { viewer } = pdf ;
103+
104+ if ( viewer ) {
105+ const registry = await viewer . registry ;
106+ const scroll = registry . getPlugin ( 'scroll' ) . provides ( ) ;
107+ scroll . setScrollStrategy ( strategy ) ;
108+ }
109+ }
110+
100111export function dispose ( id ) {
101112 const pdf = Data . get ( id ) ;
102113 Data . remove ( id ) ;
0 commit comments