From 867315a19d4655fbc1940ab4cc863c639c71b66c Mon Sep 17 00:00:00 2001 From: "xiaoqi.cxq" Date: Thu, 13 Oct 2022 13:22:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=86=B2=E7=AA=81=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=90=88=E5=B9=B6=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/diffUtils.js | 2 ++ src/services/syncSvc.js | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/services/diffUtils.js b/src/services/diffUtils.js index 082faad3..2bc1b19b 100644 --- a/src/services/diffUtils.js +++ b/src/services/diffUtils.js @@ -186,6 +186,8 @@ function mergeContent(serverContent, clientContent, lastMergedContent = {}) { clientContent.comments, lastMergedContent.comments, ), + // 服务端和本地都变更了 + mergeFlag: isServerTextChanges && isClientTextChanges, }; restoreDiscussionOffsets(result, markerKeys); return result; diff --git a/src/services/syncSvc.js b/src/services/syncSvc.js index 4cc6f7ba..3029851f 100644 --- a/src/services/syncSvc.js +++ b/src/services/syncSvc.js @@ -424,6 +424,10 @@ const syncFile = async (fileId, syncContext = new SyncContext()) => { lastMergedContent = syncedContent.historyData[syncHistoryItem[LAST_MERGED]]; } mergedContent = diffUtils.mergeContent(serverContent, clientContent, lastMergedContent); + if (mergedContent.mergeFlag) { + const file = store.state.file.itemsById[syncLocation.fileId]; + store.dispatch('notification/info', `${file.name} 存在冲突已自动合并,请注意合并结果!`); + } } if (!mergedContent) { return;