feat(功能强化): 新增全文搜索与结果定位,优化搜索框及翻页按钮显示
build.yaml / build (push) Successful in 43s

This commit is contained in:
xiaoqidun committed 2026-09-12 22:18:10 +08:00
1 parent 66f0d8a928
commit 2ea937b7be
11 files changed
+641 -19

No files matched your search

+15 -1
View File
@@ -39,6 +39,7 @@ func RunWASM() {
registerCallback("ofdgoDocumentInfo", documentInfo)
registerCallback("ofdgoAttachmentData", attachmentData)
registerCallback("ofdgoRenderPage", renderPage)
registerCallback("ofdgoSearchPage", searchPage)
registerCallback("ofdgoExportFormats", exportFormats)
registerCallback("ofdgoExportPage", exportPage)
registerCallback("ofdgoExportPDF", exportPDF)
@@ -118,7 +119,10 @@ func configureDocument(args []js.Value) (any, error) {
return nil, err
}
}
currentSession.Renderer.RenderAnnotations = args[1].Bool()
if currentSession.Renderer.RenderAnnotations != args[1].Bool() {
currentSession.Renderer.RenderAnnotations = args[1].Bool()
clear(currentSession.textCache)
}
return currentSession.Summary(), nil
}
@@ -181,6 +185,16 @@ func renderPage(args []js.Value) (any, error) {
}), nil
}
// searchPage 搜索OFD页面文字
// 入参: args 浏览器参数
// 返回: any 搜索结果, error 错误信息
func searchPage(args []js.Value) (any, error) {
if currentSession == nil {
return nil, fmt.Errorf("ofd document is not opened")
}
return currentSession.SearchPage(args[0].Int(), args[1].String())
}
// exportFormats 获取导出格式
// 入参: args 浏览器参数
// 返回: any 导出格式, error 错误信息