增加冲突自动合并提醒

This commit is contained in:
xiaoqi.cxq 2022-10-13 13:22:42 +08:00
parent 480875a5ec
commit 867315a19d
2 changed files with 6 additions and 0 deletions

View File

@ -186,6 +186,8 @@ function mergeContent(serverContent, clientContent, lastMergedContent = {}) {
clientContent.comments,
lastMergedContent.comments,
),
// 服务端和本地都变更了
mergeFlag: isServerTextChanges && isClientTextChanges,
};
restoreDiscussionOffsets(result, markerKeys);
return result;

View File

@ -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;