赞
踩
不行,key1打开的不能编辑。因为看开始的第2点,哈哈。
初步试验代码:
- //历史版本保留1个月。比如Unix时间戳(Unix timestamp)expires=1524547423
- var onRequestHistory = function() {
- // var changes=[{
- // "created":"2018-03-10 14:22:15",
- // "user":{"id":"8","name":"qin8.xc"}
- // }];
- // alert(changes[0].created);
- docEditor.refreshHistory({
- "currentVersion": 2,
- "history": [
- {
- "changes": [{{.changes1}}], //the changes from the history object returned after saving the document
- "created": "2018-03-9 10:15:55",
- "key": "{{.Key}}",//1521951775531484800这里影响历史版本切换
- "serverVersion": "{{.serverVersion1}}", //the serverVersion from the history object returned after saving the document
- "user": {
- "id": "7",
- "name": "qin.xc"
- },
- "version": 1
- },
- {
- "changes": [{{.changes2}}],
- "created": "2018-03-10 14:11:35",
- "key": "1521951775531484800",//
- "user": {
- "id": "8",
- "name": "qin8.xc"
- },
- "version": 2
- },
- {
- "changes": [{{.changes2}}],
- "created": "2018-03-11 14:11:35",
- "key": "1521803509579508900",//当前版本
- "user": {
- "id": "9",
- "name": "qin9.xc"
- },
- "version": 3
- },
- ]
- });
- };
-
- var onRequestHistoryClose = function() {
- document.location.reload();
- };
- var onRequestHistoryData = function(event) {
- var version = event.data;
- docEditor.setHistoryData({
- //下面这里存变化的位置——一个文档附件对应一个这个地址,每次更新??
- "changesUrl": "http://192.168.99.100:9000/cache/files/1521953170330601700_4540/changes.zip/changes.zip?md5=w6DItkSwyBJkuHDl_CiZZQ==&expires=1524547423&disposition=attachment&ooname=output.zip", //the changesUrl from the JSON object returned after saving the document
- "key": "",
- "previous": {
- "key": "",//这里不影响版本切换
- "url": ""//http://192.168.99.100:9000/cache/files/1521953170330601700_4540/output.docx/output.docx?md5=eSwnrSSumTeMuh59IoXhCQ==&expires=1524547423&disposition=attachment&ooname=output.docx这里影响版本
- },
- "url": "",
- "version":4 //version
- })
- };
-
- window.docEditor = new DocsAPI.DocEditor("placeholder",
- {
- "events": {
- "onRequestHistory": onRequestHistory,
- "onRequestHistoryClose": onRequestHistoryClose,
- "onRequestHistoryData": onRequestHistoryData,
- },
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。