Compare commits
2 Commits
00de3193da
...
89d9394a0f
Author | SHA1 | Date | |
---|---|---|---|
![]() |
89d9394a0f | ||
![]() |
4476517dcb |
@ -113,6 +113,15 @@ onMounted(async () => {
|
||||
case 'ModifyStatus':
|
||||
handleSendModifyStatus()
|
||||
break
|
||||
case 'ReplaceTextAndInsertTableRow':
|
||||
handleReplaceTextAndInsertTableRow(data)
|
||||
break
|
||||
case 'ReplaceTextAndInsertTableRowWithContentControl':
|
||||
handleReplaceTextAndInsertTableRowWithContentControl(data)
|
||||
break
|
||||
case 'NextEditableZone':
|
||||
handleNextEditableZone()
|
||||
break
|
||||
}
|
||||
// WOPI Client发送消息
|
||||
switch (MessageId) {
|
||||
@ -577,6 +586,82 @@ function handleDocumentReady(data: any) {
|
||||
}
|
||||
}
|
||||
|
||||
function handleReplaceTextAndInsertTableRow(data: any) {
|
||||
const Payload = data.Payload
|
||||
const text = Payload.text
|
||||
const table = Payload.table
|
||||
const tableData: any[] = []
|
||||
for (const tab_obj of table) {
|
||||
tableData.push({
|
||||
location_bookmark_name: tab_obj.bookmarkName,
|
||||
start_row_index: tab_obj.startRowIndex,
|
||||
data: tab_obj.data,
|
||||
})
|
||||
}
|
||||
sendMessageToWopiClient({
|
||||
MessageId: 'CallPythonScript',
|
||||
SendTime: Date.now(),
|
||||
ScriptFile: 'BookmarkOP.py',
|
||||
Function: 'ReplaceTextAndInsertTableRow',
|
||||
Values: {
|
||||
params: {
|
||||
type: 'string',
|
||||
value: JSON.stringify({
|
||||
text,
|
||||
table: tableData,
|
||||
}),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
function handleReplaceTextAndInsertTableRowWithContentControl(data: any) {
|
||||
const Payload = data.Payload
|
||||
const text = Payload.text
|
||||
const table = Payload.table
|
||||
const tableData: any[] = []
|
||||
for (const tab_obj of table) {
|
||||
tableData.push({
|
||||
location_bookmark_name: tab_obj.bookmarkName,
|
||||
start_row_index: tab_obj.startRowIndex,
|
||||
data: tab_obj.data,
|
||||
})
|
||||
}
|
||||
sendMessageToWopiClient({
|
||||
MessageId: 'CallPythonScript',
|
||||
SendTime: Date.now(),
|
||||
ScriptFile: 'BookmarkOP.py',
|
||||
Function: 'ReplaceTextAndInsertTableRowWithContentControl',
|
||||
Values: {
|
||||
params: {
|
||||
type: 'string',
|
||||
value: JSON.stringify({
|
||||
text,
|
||||
table: tableData,
|
||||
}),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
const callCount = ref(0)
|
||||
|
||||
function handleNextEditableZone() {
|
||||
sendMessageToWopiClient({
|
||||
MessageId: 'CallPythonScript',
|
||||
SendTime: Date.now(),
|
||||
ScriptFile: 'BookmarkOP.py',
|
||||
Function: 'NextEditableZone',
|
||||
Values: {
|
||||
params: {
|
||||
type: 'string',
|
||||
value: callCount.value.toString(),
|
||||
},
|
||||
},
|
||||
})
|
||||
callCount.value++
|
||||
}
|
||||
|
||||
function logEvent(e: MessageEvent) {
|
||||
console.log('=============receive message start=======')
|
||||
console.log(typeof e.data)
|
||||
|
Loading…
Reference in New Issue
Block a user