优化协同编辑查看功能,只读用户可以查看在线编辑用户编辑的内容
This commit is contained in:
@@ -81,8 +81,11 @@ public class OnlyServiceAPIImpl implements OnlyServiceAPI {
|
|||||||
return documentEdit(map, collaborativeEditing, clientType);
|
return documentEdit(map, collaborativeEditing, clientType);
|
||||||
}
|
}
|
||||||
if (VIEW.equals(mode)) {
|
if (VIEW.equals(mode)) {
|
||||||
return documentView(map, clientType);
|
return documentView(map, collaborativeEditing, clientType);
|
||||||
}
|
}
|
||||||
|
// if (VIEW.equals(mode)) {
|
||||||
|
// return documentView(map, clientType);
|
||||||
|
// }
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,6 +97,13 @@ public class OnlyServiceAPIImpl implements OnlyServiceAPI {
|
|||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Map documentView(Map<String, Object> map, boolean collaborativeEditing, String clientType) {
|
||||||
|
FileConfig fileConfigDTO = openEditConfig(map, "view", collaborativeEditing, clientType);
|
||||||
|
String json = JSON.toJSONString(fileConfigDTO);
|
||||||
|
Map<String, Object> config = JSON.parseObject(json, Map.class);
|
||||||
|
config.put("type", clientType);
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
private Map documentView(Map<String, Object> map, String clientType) {
|
private Map documentView(Map<String, Object> map, String clientType) {
|
||||||
FileConfig fileConfigDTO = openEditConfig(map, "view", false, clientType);
|
FileConfig fileConfigDTO = openEditConfig(map, "view", false, clientType);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.oo.onlyoffice.core;
|
package com.oo.onlyoffice.core;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.oo.onlyoffice.config.OnlyProperties;
|
import com.oo.onlyoffice.config.OnlyProperties;
|
||||||
import com.oo.onlyoffice.dto.DocumentConfig;
|
import com.oo.onlyoffice.dto.DocumentConfig;
|
||||||
import com.oo.onlyoffice.dto.EditorConfig;
|
import com.oo.onlyoffice.dto.EditorConfig;
|
||||||
@@ -77,8 +78,12 @@ public class FileConfigFactory implements OnlyOfficeConfigFactory {
|
|||||||
editorConfig.setFileCustomization(getFileCustomization(mode, clientType));
|
editorConfig.setFileCustomization(getFileCustomization(mode, clientType));
|
||||||
editorConfig.setFileUser(user);
|
editorConfig.setFileUser(user);
|
||||||
editorConfig.setPlugins(getPlugins());
|
editorConfig.setPlugins(getPlugins());
|
||||||
|
//共同编辑"coEditing"配置:
|
||||||
|
// "coEditing": { "mode": "fast","change": true}
|
||||||
|
JSONObject coEditing = new JSONObject();
|
||||||
|
coEditing.put("mode", "fast");
|
||||||
|
coEditing.put("change", "true");
|
||||||
|
editorConfig.setCoEditing(coEditing);
|
||||||
fileConfigDTO.setEditorConfig(editorConfig);
|
fileConfigDTO.setEditorConfig(editorConfig);
|
||||||
map.put("editorConfig", editorConfig);
|
map.put("editorConfig", editorConfig);
|
||||||
|
|
||||||
|
|||||||
@@ -77,8 +77,23 @@ public class FileHandlerImpl implements FileHandler {
|
|||||||
cache.set(user.getId() + "_" + id, key);
|
cache.set(user.getId() + "_" + id, key);
|
||||||
cache.set("getID_" + key, id);
|
cache.set("getID_" + key, id);
|
||||||
}
|
}
|
||||||
} else {//查看模式
|
} else {
|
||||||
key = id;
|
//查看模式
|
||||||
|
if (collaborativeEditing) {
|
||||||
|
if (cache.get("collaborativeEditing_" + id) != null) {
|
||||||
|
key = (String) cache.get("collaborativeEditing_" + id);
|
||||||
|
} else {
|
||||||
|
key = IdUtil.simpleUUID();
|
||||||
|
cache.set("collaborativeEditing_" + id, key);
|
||||||
|
cache.set("getID_" + key, id);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
key = IdUtil.simpleUUID();
|
||||||
|
FileUser user = SecurityUtils.getUserSession();
|
||||||
|
cache.set(user.getId() + "_" + id, key);
|
||||||
|
cache.set("getID_" + key, id);
|
||||||
|
}
|
||||||
|
// key = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user