wip: file open callback

This commit is contained in:
zzs 2025-03-25 09:56:25 +08:00
parent d3b4b92a85
commit 00de3193da

View File

@ -130,6 +130,9 @@ onMounted(async () => {
case 'Action_Save_Resp':
handleUserSaveOp()
break
case 'App_LoadingStatus':
handleDocumentReady(data)
break
}
})
})
@ -237,6 +240,7 @@ async function downloadAndSendCurrentEditFile() {
* @param data
*/
async function handleFileBinary(data: any) {
isPostMessageRead.value = false
const { name, type, buffer } = data.Payload
const blob = base64ToBlob(buffer, type)
const uploadResult = await uploadOneFile({
@ -305,6 +309,8 @@ function sendMessageToWopiClient(data: any) {
/**
* 发送消息给第三方调用者
* 用于转发部分WopiClient回调
*
* ignore忽略类型
*/
function sendMessageToCaller(data: any, ignore: boolean = false) {
console.log('已向第三方调用者发送消息')
@ -556,6 +562,21 @@ function handleSendModifyStatus() {
}, true)
}
/**
* 文件加载完成
*/
function handleDocumentReady(data: any) {
const Values = data?.Values
const Status = Values?.Status as string
if (Status === 'Document_Loaded') {
sendMessageToCaller({
ActionId: 'DocumentLoaded',
Payload: null,
Timestamp: Date.now(),
}, true)
}
}
function logEvent(e: MessageEvent) {
console.log('=============receive message start=======')
console.log(typeof e.data)