wip: insert bookmark and locate bookmark
This commit is contained in:
parent
5fd187eb0d
commit
92af7405c6
@ -95,6 +95,12 @@ onMounted(async () => {
|
||||
case 'SaveFile':
|
||||
handleSaveFile()
|
||||
break
|
||||
case 'AddBookmark':
|
||||
handleAddBookmark(data)
|
||||
break
|
||||
case 'LocateBookmark':
|
||||
handleLocateBookmark(data)
|
||||
break
|
||||
}
|
||||
// WOPI Client发送消息
|
||||
switch (MessageId) {
|
||||
@ -359,6 +365,62 @@ function handleSaveFile() {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 第三方调用者在选中文字或光标位置处插入书签
|
||||
* @param data
|
||||
*/
|
||||
function handleAddBookmark(data: any) {
|
||||
try {
|
||||
const bookmarkName = data.content.Payload.bookmarkName
|
||||
if (!bookmarkName)
|
||||
return
|
||||
sendMessageToWopiClient({
|
||||
MessageId: 'CallPythonScript',
|
||||
SendTime: Date.now(),
|
||||
ScriptFile: 'BookmarkOP.py',
|
||||
Function: 'InsertBookmark',
|
||||
Values: {
|
||||
params: {
|
||||
type: 'string',
|
||||
value: bookmarkName,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
catch (e) {
|
||||
console.error(e)
|
||||
createMessage.error('执行失败,请查看控制台日志!')
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 定位书签
|
||||
* @param data
|
||||
*/
|
||||
function handleLocateBookmark(data: any) {
|
||||
try {
|
||||
const bookmarkName = data.content.Payload.bookmarkName
|
||||
if (!bookmarkName)
|
||||
return
|
||||
sendMessageToWopiClient({
|
||||
MessageId: 'CallPythonScript',
|
||||
SendTime: Date.now(),
|
||||
ScriptFile: 'BookmarkOP.py',
|
||||
Function: 'LocateBookmark',
|
||||
Values: {
|
||||
params: {
|
||||
type: 'string',
|
||||
value: bookmarkName,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
catch (e) {
|
||||
console.error(e)
|
||||
createMessage.error('执行失败,请查看控制台日志!')
|
||||
}
|
||||
}
|
||||
|
||||
function logEvent(e: MessageEvent) {
|
||||
console.log('=============receive message start=======')
|
||||
console.log(typeof e.data)
|
||||
|
Loading…
Reference in New Issue
Block a user