@seafile/sdoc-editor 0.1.68-beta1 → 0.1.69-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/api/seafile-api.js
CHANGED
|
@@ -12,6 +12,17 @@ var SeafileAPI = /*#__PURE__*/function () {
|
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
14
|
_createClass(SeafileAPI, [{
|
|
15
|
+
key: "_sendPostRequest",
|
|
16
|
+
value: function _sendPostRequest(url, form) {
|
|
17
|
+
if (form.getHeaders) {
|
|
18
|
+
return this.req.post(url, form, {
|
|
19
|
+
headers: form.getHeaders()
|
|
20
|
+
});
|
|
21
|
+
} else {
|
|
22
|
+
return this.req.post(url, form);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}, {
|
|
15
26
|
key: "getImageFileNameWithTimestamp",
|
|
16
27
|
value: function getImageFileNameWithTimestamp(file) {
|
|
17
28
|
var d = Date.now();
|
|
@@ -41,6 +52,15 @@ var SeafileAPI = /*#__PURE__*/function () {
|
|
|
41
52
|
var url = '/api/v2.1/seadoc/publish-revision/' + docUuid + '/';
|
|
42
53
|
return this.req.post(url);
|
|
43
54
|
}
|
|
55
|
+
}, {
|
|
56
|
+
key: "startRevise",
|
|
57
|
+
value: function startRevise(repoID, path) {
|
|
58
|
+
var url = '/api/v2.1/seadoc/revisions/';
|
|
59
|
+
var form = new FormData();
|
|
60
|
+
form.append('p', path);
|
|
61
|
+
form.append('repo_id', repoID);
|
|
62
|
+
return this._sendPostRequest(url, form);
|
|
63
|
+
}
|
|
44
64
|
}]);
|
|
45
65
|
return SeafileAPI;
|
|
46
66
|
}();
|
|
@@ -58,7 +58,7 @@ var CommentItem = function CommentItem(_ref) {
|
|
|
58
58
|
onMouseLeave: onMouseLeave
|
|
59
59
|
}, /*#__PURE__*/React.createElement("div", {
|
|
60
60
|
className: "comment-header"
|
|
61
|
-
}, /*#__PURE__*/React.createElement("
|
|
61
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
62
62
|
className: "comment-author"
|
|
63
63
|
}, /*#__PURE__*/React.createElement("span", {
|
|
64
64
|
className: "comment-author__avatar"
|
|
@@ -67,7 +67,7 @@ var CommentItem = function CommentItem(_ref) {
|
|
|
67
67
|
src: comment.avatar_url
|
|
68
68
|
})), /*#__PURE__*/React.createElement("span", {
|
|
69
69
|
className: "comment-author__name"
|
|
70
|
-
}, comment.user_name)), isActive && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("
|
|
70
|
+
}, comment.user_name)), isActive && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
71
71
|
id: menuId,
|
|
72
72
|
className: "comment-operation"
|
|
73
73
|
}, /*#__PURE__*/React.createElement("i", {
|
|
@@ -61,7 +61,8 @@
|
|
|
61
61
|
background: #fafafa;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
.sdoc-comment-container .comment-item .comment-header
|
|
64
|
+
.sdoc-comment-container .comment-item .comment-header,
|
|
65
|
+
.sdoc-comment-container .comment-item .comment-author {
|
|
65
66
|
display: flex;
|
|
66
67
|
justify-content: space-between;
|
|
67
68
|
align-items: center;
|
|
@@ -75,6 +76,8 @@
|
|
|
75
76
|
|
|
76
77
|
.sdoc-comment-container .comment-header .comment-author__avatar {
|
|
77
78
|
margin-right: 10px;
|
|
79
|
+
display: flex;
|
|
80
|
+
align-items: center;
|
|
78
81
|
}
|
|
79
82
|
|
|
80
83
|
.sdoc-comment-container .comment-header .comment-author__avatar img {
|
|
@@ -89,6 +92,7 @@
|
|
|
89
92
|
}
|
|
90
93
|
|
|
91
94
|
.sdoc-comment-container .comment-header .comment-operation {
|
|
95
|
+
line-height: 20px;
|
|
92
96
|
font-size: 20px;
|
|
93
97
|
color: rgb(70, 77, 90);
|
|
94
98
|
width: 20px;
|
|
@@ -10,6 +10,7 @@ var RevisionOperations = function RevisionOperations(_ref) {
|
|
|
10
10
|
var isPublished = context.getSetting('isPublished');
|
|
11
11
|
var repoID = context.getSetting('repoID');
|
|
12
12
|
var siteRoot = context.getSetting('siteRoot');
|
|
13
|
+
var filePath = context.getSetting('docPath');
|
|
13
14
|
var viewChanges = useCallback(function (event) {
|
|
14
15
|
event.stopPropagation();
|
|
15
16
|
event.nativeEvent.stopImmediatePropagation();
|
|
@@ -29,8 +30,22 @@ var RevisionOperations = function RevisionOperations(_ref) {
|
|
|
29
30
|
|
|
30
31
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
31
32
|
}, []);
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
var startRevise = useCallback(function () {
|
|
34
|
+
context.startRevise().then(function (res) {
|
|
35
|
+
window.location.href = "".concat(siteRoot, "lib/").concat(repoID, "/file/").concat(filePath);
|
|
36
|
+
}).catch(function (error) {
|
|
37
|
+
toaster.danger(t('Error'));
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
41
|
+
}, []);
|
|
42
|
+
var startReviseBtn = /*#__PURE__*/React.createElement(Button, {
|
|
43
|
+
color: "success",
|
|
44
|
+
className: "mr-4",
|
|
45
|
+
onClick: startRevise
|
|
46
|
+
}, t('View_changes'));
|
|
47
|
+
if (!isSdocRevision) return startReviseBtn;
|
|
48
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, startReviseBtn, !isPublished && revisionURL && /*#__PURE__*/React.createElement(Button, {
|
|
34
49
|
color: "success",
|
|
35
50
|
className: "mr-4",
|
|
36
51
|
onClick: viewChanges
|
package/dist/context.js
CHANGED
|
@@ -125,6 +125,13 @@ var Context = /*#__PURE__*/function () {
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
// revision
|
|
128
|
+
}, {
|
|
129
|
+
key: "startRevise",
|
|
130
|
+
value: function startRevise() {
|
|
131
|
+
var repoID = this.getSetting('repoID');
|
|
132
|
+
var filePath = this.getSetting('docPath');
|
|
133
|
+
return this.api.startRevise(repoID, filePath);
|
|
134
|
+
}
|
|
128
135
|
}, {
|
|
129
136
|
key: "publishSdocRevision",
|
|
130
137
|
value: function publishSdocRevision() {
|