From b3d631eac5df0646c6b5519c1ff6fa4114993761 Mon Sep 17 00:00:00 2001 From: jmal Date: Sat, 8 Jun 2024 14:03:42 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E9=80=82=E9=85=8D=20onlyoffice=20JWT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/office/OnlyOfficeEditor.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/office/OnlyOfficeEditor.vue b/src/components/office/OnlyOfficeEditor.vue index e02d6c9..a88f1b5 100644 --- a/src/components/office/OnlyOfficeEditor.vue +++ b/src/components/office/OnlyOfficeEditor.vue @@ -192,11 +192,15 @@ export default { this.docEditor = new DocsAPI.DocEditor(this.id, this.docEditorConfig) }, onRequestHistoryData(event, historyInfo, url) { - this.docEditor.setHistoryData({ + let historyConfig = { "fileType": this.fileType, "key": `${new Date(historyInfo.metadata.time).getTime()}-${SparkMD5.hash(this.file.id)}`, "url": url, "version": historyInfo.metadata.time, + } + api.getOfficeJwt(historyConfig).then(res => { + historyConfig.token = res.data + this.docEditor.setHistoryData(historyConfig) }) }, onRequestHistory() { @@ -341,6 +345,7 @@ export default { if (this.hasHistoryVersion && !doc.getElementById('box-doc-name-history-btn')) { const toolbar = doc.getElementById('box-doc-name') toolbar.style.justifyContent = 'right' + toolbar.style.padding = '0' let versionButton = document.createElement("button") versionButton.classList.add('btn', 'btn-header') versionButton.setAttribute('id', 'box-doc-name-history-btn')