@seafile/sdoc-editor 0.1.91 → 0.1.92
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/sdoc-server-api.js +58 -0
- package/dist/api/seafile-api.js +14 -1
- package/dist/basic-sdk/comment/comment/comment-editor.js +53 -0
- package/dist/basic-sdk/comment/{comment-item.js → comment/comment-item-content.js} +29 -14
- package/dist/basic-sdk/comment/comment/comment-item-reply.js +112 -0
- package/dist/basic-sdk/comment/comment/comment-item-wrapper.js +208 -0
- package/dist/basic-sdk/comment/{comment-list.js → comment/comment-list.js} +58 -71
- package/dist/basic-sdk/comment/{comment.js → comment/index.js} +4 -4
- package/dist/basic-sdk/comment/{style.css → comment/style.css} +43 -8
- package/dist/basic-sdk/comment/dialogs/delete-comment-dialog.js +11 -4
- package/dist/basic-sdk/comment/hooks/use-comment-mount.js +5 -1
- package/dist/basic-sdk/comment/reducer/comment-reducer.js +82 -0
- package/dist/basic-sdk/editor.js +3 -4
- package/dist/basic-sdk/extension/commons/color-menu/index.js +6 -5
- package/dist/basic-sdk/extension/plugins/table/helpers.js +85 -30
- package/dist/basic-sdk/extension/plugins/table/menu/active-table-menu/cell-bg-color-menu.js +35 -0
- package/dist/basic-sdk/extension/plugins/table/menu/active-table-menu/cell-text-align-menu.js +43 -0
- package/dist/basic-sdk/extension/plugins/table/menu/active-table-menu/index.js +31 -171
- package/dist/basic-sdk/extension/plugins/table/menu/active-table-menu/remove-table-menu.js +26 -0
- package/dist/basic-sdk/extension/plugins/table/menu/active-table-menu/table-column-menu.js +35 -0
- package/dist/basic-sdk/extension/plugins/table/menu/active-table-menu/table-row-menu.js +35 -0
- package/dist/basic-sdk/extension/plugins/table/popover/table-size-popover/index.js +1 -0
- package/dist/basic-sdk/extension/plugins/text-style/menu/index.js +6 -8
- package/dist/basic-sdk/hooks/use-color-context.js +48 -0
- package/dist/components/common-loading/index.css +54 -0
- package/dist/components/common-loading/index.js +8 -0
- package/dist/components/doc-info/index.js +5 -2
- package/dist/components/doc-operations/revision-operations/index.js +2 -1
- package/dist/components/doc-operations/revision-operations/revisions/index.css +16 -0
- package/dist/components/doc-operations/revision-operations/revisions/index.js +49 -0
- package/dist/components/doc-operations/revision-operations/revisions/revisions-dialog/index.css +120 -0
- package/dist/components/doc-operations/revision-operations/revisions/revisions-dialog/index.js +174 -0
- package/dist/components/doc-operations/style.css +13 -0
- package/dist/context.js +27 -0
- package/dist/model/index.js +2 -0
- package/dist/model/revision.js +35 -0
- package/package.json +1 -1
- package/public/locales/en/sdoc-editor.json +11 -1
- package/public/locales/zh-CN/sdoc-editor.json +11 -1
- package/dist/basic-sdk/comment/comment-editor.js +0 -73
- package/dist/basic-sdk/hooks/use-font-color-context.js +0 -28
- package/dist/basic-sdk/hooks/use-highlight-color-context.js +0 -28
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/** common loading **/
|
|
2
|
+
@-moz-keyframes commonLoading {
|
|
3
|
+
0% {
|
|
4
|
+
-moz-transform: rotate(0deg);
|
|
5
|
+
transform: rotate(0deg);
|
|
6
|
+
}
|
|
7
|
+
100% {
|
|
8
|
+
-moz-transform: rotate(360deg);
|
|
9
|
+
transform: rotate(360deg);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@-webkit-keyframes commonLoading {
|
|
14
|
+
0% {
|
|
15
|
+
-webkit-transform: rotate(0deg);
|
|
16
|
+
transform: rotate(0deg);
|
|
17
|
+
}
|
|
18
|
+
100% {
|
|
19
|
+
-webkit-transform: rotate(360deg);
|
|
20
|
+
transform: rotate(360deg);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@keyframes commonLoading {
|
|
25
|
+
0% {
|
|
26
|
+
-moz-transform: rotate(0deg);
|
|
27
|
+
-ms-transform: rotate(0deg);
|
|
28
|
+
-webkit-transform: rotate(0deg);
|
|
29
|
+
transform: rotate(0deg);
|
|
30
|
+
}
|
|
31
|
+
100% {
|
|
32
|
+
-moz-transform: rotate(360deg);
|
|
33
|
+
-ms-transform: rotate(360deg);
|
|
34
|
+
-webkit-transform: rotate(360deg);
|
|
35
|
+
transform: rotate(360deg);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.common-loading-icon {
|
|
40
|
+
display: inline-block;
|
|
41
|
+
width: 20px;
|
|
42
|
+
height: 20px;
|
|
43
|
+
border: 2px solid #eee;
|
|
44
|
+
border-left-color: #aaa;
|
|
45
|
+
border-radius: 50%;
|
|
46
|
+
-moz-animation: commonLoading 0.9s infinite linear;
|
|
47
|
+
-webkit-animation: commonLoading 0.9s infinite linear;
|
|
48
|
+
animation: commonLoading 0.9s infinite linear;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.common-loading-tip {
|
|
52
|
+
display: block;
|
|
53
|
+
margin: 0 auto;
|
|
54
|
+
}
|
|
@@ -47,18 +47,21 @@ var DocInfo = function DocInfo(_ref) {
|
|
|
47
47
|
}
|
|
48
48
|
var revisionCreatedAt = context.getSetting('revisionCreatedAt');
|
|
49
49
|
var oldDocName = context.getSetting('originFilename');
|
|
50
|
+
var revisionId = context.getSetting('revisionId');
|
|
50
51
|
return /*#__PURE__*/React.createElement("div", {
|
|
51
52
|
className: "doc-info d-flex flex-column align-items-start"
|
|
52
53
|
}, /*#__PURE__*/React.createElement("div", {
|
|
53
54
|
className: "doc-name-container d-flex align-items-center justify-content-start w-100"
|
|
54
55
|
}, /*#__PURE__*/React.createElement("div", {
|
|
55
56
|
className: "doc-name"
|
|
56
|
-
}, oldDocName), /*#__PURE__*/React.createElement(
|
|
57
|
+
}, oldDocName), /*#__PURE__*/React.createElement("div", {
|
|
58
|
+
className: "sdoc-revision-order"
|
|
59
|
+
}, t('Revision') + ' ' + revisionId), /*#__PURE__*/React.createElement(TipMessage, {
|
|
57
60
|
isEditMode: isEditMode
|
|
58
61
|
})), /*#__PURE__*/React.createElement("div", {
|
|
59
62
|
className: "doc-state"
|
|
60
63
|
}, /*#__PURE__*/React.createElement("span", {
|
|
61
64
|
className: "mr-2"
|
|
62
|
-
}, t('
|
|
65
|
+
}, t('Created_at')), /*#__PURE__*/React.createElement("span", null, DateUtils.format(revisionCreatedAt, 'YYYY-MM-DD HH:MM'))));
|
|
63
66
|
};
|
|
64
67
|
export default withTranslation('sdoc-editor')(DocInfo);
|
|
@@ -3,12 +3,13 @@ import context from '../../../context';
|
|
|
3
3
|
import PublishRevision from './publish-button';
|
|
4
4
|
import ViewChanges from './view-changes';
|
|
5
5
|
import MoreRevisionOperations from './more-revision-operations';
|
|
6
|
+
import Revisions from './revisions';
|
|
6
7
|
var RevisionOperations = function RevisionOperations(_ref) {
|
|
7
8
|
var isShowChanges = _ref.isShowChanges,
|
|
8
9
|
toggleViewChanges = _ref.toggleViewChanges;
|
|
9
10
|
var isSdocRevision = context.getSetting('isSdocRevision');
|
|
10
11
|
var isPublished = context.getSetting('isPublished');
|
|
11
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, !isSdocRevision && /*#__PURE__*/React.createElement(MoreRevisionOperations, null), isSdocRevision && /*#__PURE__*/React.createElement(ViewChanges, {
|
|
12
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, !isSdocRevision && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MoreRevisionOperations, null), /*#__PURE__*/React.createElement(Revisions, null)), isSdocRevision && /*#__PURE__*/React.createElement(ViewChanges, {
|
|
12
13
|
isShowChanges: isShowChanges,
|
|
13
14
|
toggleViewChanges: toggleViewChanges
|
|
14
15
|
}), isSdocRevision && !isPublished && /*#__PURE__*/React.createElement(PublishRevision, null));
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.sdoc-revisions-count {
|
|
2
|
+
height: 30px;
|
|
3
|
+
width: fit-content;
|
|
4
|
+
border: 1px solid #E5E5E5;
|
|
5
|
+
border-radius: 3px;
|
|
6
|
+
line-height: 28px;
|
|
7
|
+
text-align: center;
|
|
8
|
+
padding: 0 16px;
|
|
9
|
+
margin-left: 1rem;
|
|
10
|
+
color: #666;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.sdoc-revisions-count:hover {
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
color: #333;
|
|
16
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import context from '../../../../context';
|
|
5
|
+
import RevisionsDialog from './revisions-dialog';
|
|
6
|
+
import { getErrorMsg } from '../../../../utils';
|
|
7
|
+
import toaster from '../../../toast';
|
|
8
|
+
import './index.css';
|
|
9
|
+
var Revisions = function Revisions() {
|
|
10
|
+
var _useTranslation = useTranslation(),
|
|
11
|
+
t = _useTranslation.t;
|
|
12
|
+
var _useState = useState(0),
|
|
13
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
14
|
+
revisionsCount = _useState2[0],
|
|
15
|
+
setRevisionsCount = _useState2[1];
|
|
16
|
+
var _useState3 = useState(false),
|
|
17
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
18
|
+
isShowRevisions = _useState4[0],
|
|
19
|
+
setShowRevisions = _useState4[1];
|
|
20
|
+
|
|
21
|
+
// did mount
|
|
22
|
+
useEffect(function () {
|
|
23
|
+
context.getSdocRevisionsCount().then(function (res) {
|
|
24
|
+
var count = res.data.count;
|
|
25
|
+
setRevisionsCount(count);
|
|
26
|
+
}).catch(function (error) {
|
|
27
|
+
var errorMessage = getErrorMsg(error);
|
|
28
|
+
toaster.danger(t(errorMessage));
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
32
|
+
}, []);
|
|
33
|
+
var showRevisions = useCallback(function () {
|
|
34
|
+
setShowRevisions(true);
|
|
35
|
+
}, []);
|
|
36
|
+
var closeRevisions = useCallback(function () {
|
|
37
|
+
setShowRevisions(false);
|
|
38
|
+
}, []);
|
|
39
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
40
|
+
className: "sdoc-revisions-count",
|
|
41
|
+
onClick: showRevisions
|
|
42
|
+
}, revisionsCount === 0 && /*#__PURE__*/React.createElement(React.Fragment, null, t('No_revisions')), revisionsCount === 1 && /*#__PURE__*/React.createElement(React.Fragment, null, t('1_revision')), revisionsCount > 1 && /*#__PURE__*/React.createElement(React.Fragment, null, t('x_revisions', {
|
|
43
|
+
count: revisionsCount
|
|
44
|
+
}))), isShowRevisions && /*#__PURE__*/React.createElement(RevisionsDialog, {
|
|
45
|
+
updateRevisionsCount: setRevisionsCount,
|
|
46
|
+
toggle: closeRevisions
|
|
47
|
+
}));
|
|
48
|
+
};
|
|
49
|
+
export default Revisions;
|
package/dist/components/doc-operations/revision-operations/revisions/revisions-dialog/index.css
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
.revisions-dialog {
|
|
2
|
+
width: 700px;
|
|
3
|
+
max-width: 700px;
|
|
4
|
+
height: calc(100% - 56px);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.revisions-dialog .modal-content {
|
|
8
|
+
height: 100%;
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.revisions-dialog .revisions-body {
|
|
13
|
+
height: calc(100% - 50px);
|
|
14
|
+
padding: 0;
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.revisions-dialog .sdoc-revisions-container {
|
|
19
|
+
width: 100%;
|
|
20
|
+
height: 100%;
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.revisions-dialog .sdoc-revisions-container .sdoc-revisions-header {
|
|
26
|
+
height: 41px;
|
|
27
|
+
width: calc(100% - 32px);
|
|
28
|
+
border-bottom: 1px solid rgba(0, 40, 100, 0.12);
|
|
29
|
+
margin: 0 16px;
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.revisions-dialog .sdoc-revisions-container .sdoc-revisions-content {
|
|
36
|
+
flex: 1;
|
|
37
|
+
overflow-x: hidden;
|
|
38
|
+
overflow-y: scroll;
|
|
39
|
+
padding: 0 16px 16px 16px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.revisions-dialog .sdoc-revisions-container .sdoc-revisions-list {
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
align-items: center;
|
|
46
|
+
justify-content: center;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.revisions-dialog .sdoc-revisions-container.loading {
|
|
50
|
+
align-items: center;
|
|
51
|
+
justify-content: center;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.revisions-dialog .revisions-body .sdoc-revision {
|
|
55
|
+
height: 41px;
|
|
56
|
+
width: 100%;
|
|
57
|
+
display: flex;
|
|
58
|
+
justify-content: center;
|
|
59
|
+
align-items: flex-start;
|
|
60
|
+
border-bottom: 1px solid rgba(0, 40, 100, 0.12);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.revisions-dialog .revisions-body .sdoc-revision:hover {
|
|
64
|
+
background-color: #f5f5f5;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.revisions-dialog .sdoc-revision-name-header,
|
|
68
|
+
.revisions-dialog .sdoc-revision-user-header,
|
|
69
|
+
.revisions-dialog .sdoc-revision-time-header {
|
|
70
|
+
padding-left: 9px;
|
|
71
|
+
color: #999;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.revisions-dialog .sdoc-revision .sdoc-revision-user {
|
|
75
|
+
height: 100%;
|
|
76
|
+
overflow: hidden;
|
|
77
|
+
display: flex;
|
|
78
|
+
align-items: center;
|
|
79
|
+
padding-left: 9px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.revisions-dialog .sdoc-revision .sdoc-revision-name {
|
|
83
|
+
height: 100%;
|
|
84
|
+
overflow: hidden;
|
|
85
|
+
display: flex;
|
|
86
|
+
align-items: center;
|
|
87
|
+
padding-left: 9px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.revisions-dialog .sdoc-revision .sdoc-revision-name-content {
|
|
91
|
+
max-width: 100%;
|
|
92
|
+
overflow: hidden;
|
|
93
|
+
text-overflow: ellipsis;
|
|
94
|
+
white-space: nowrap;
|
|
95
|
+
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.revisions-dialog .sdoc-revision .sdoc-revision-name-content:hover {
|
|
99
|
+
text-decoration: underline;
|
|
100
|
+
cursor: pointer;
|
|
101
|
+
color: #ff8000;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.revisions-dialog .sdoc-revision .sdoc-revision-time {
|
|
105
|
+
height: 100%;
|
|
106
|
+
padding-left: 9px;
|
|
107
|
+
overflow: hidden;
|
|
108
|
+
display: flex;
|
|
109
|
+
align-items: center;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.revisions-dialog .revisions-body .sdoc-revision.loading {
|
|
113
|
+
height: 40px;
|
|
114
|
+
align-items: center;
|
|
115
|
+
border-bottom: none;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.revisions-dialog .sdoc-revision.loading:hover {
|
|
119
|
+
background-color: unset;
|
|
120
|
+
}
|
package/dist/components/doc-operations/revision-operations/revisions/revisions-dialog/index.js
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import React, { useState, useEffect, useCallback, useRef } from 'react';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { Modal, ModalHeader, ModalBody } from 'reactstrap';
|
|
6
|
+
import CommonLoading from '../../../../common-loading';
|
|
7
|
+
import context from '../../../../../context';
|
|
8
|
+
import { Revision } from '../../../../../model';
|
|
9
|
+
import { getErrorMsg } from '../../../../../utils';
|
|
10
|
+
import toaster from '../../../../toast';
|
|
11
|
+
import './index.css';
|
|
12
|
+
var RevisionsDialog = function RevisionsDialog(_ref) {
|
|
13
|
+
var _revisionListRef$curr;
|
|
14
|
+
var updateRevisionsCount = _ref.updateRevisionsCount,
|
|
15
|
+
toggle = _ref.toggle;
|
|
16
|
+
var revisionListRef = useRef(null);
|
|
17
|
+
var _useTranslation = useTranslation(),
|
|
18
|
+
t = _useTranslation.t;
|
|
19
|
+
var _useState = useState(true),
|
|
20
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
21
|
+
isLoading = _useState2[0],
|
|
22
|
+
setLoading = _useState2[1];
|
|
23
|
+
var _useState3 = useState([]),
|
|
24
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
25
|
+
revisions = _useState4[0],
|
|
26
|
+
setRevisions = _useState4[1];
|
|
27
|
+
var _useState5 = useState(1),
|
|
28
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
29
|
+
page = _useState6[0],
|
|
30
|
+
setPage = _useState6[1];
|
|
31
|
+
var _useState7 = useState(''),
|
|
32
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
33
|
+
errorMessage = _useState8[0],
|
|
34
|
+
setErrorMessage = _useState8[1];
|
|
35
|
+
var _useState9 = useState(true),
|
|
36
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
37
|
+
hasMore = _useState10[0],
|
|
38
|
+
setHasMore = _useState10[1];
|
|
39
|
+
var perPage = 25;
|
|
40
|
+
var repoID = context.getSetting('repoID');
|
|
41
|
+
var siteRoot = context.getSetting('siteRoot');
|
|
42
|
+
|
|
43
|
+
// did mount
|
|
44
|
+
useEffect(function () {
|
|
45
|
+
listRevisions();
|
|
46
|
+
|
|
47
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
48
|
+
}, []);
|
|
49
|
+
var listRevisions = useCallback(function () {
|
|
50
|
+
context.getSdocRevisions(page, perPage).then(function (res) {
|
|
51
|
+
var addedRevisions = res.data.revisions.map(function (revision) {
|
|
52
|
+
return new Revision(revision);
|
|
53
|
+
});
|
|
54
|
+
setLoading(false);
|
|
55
|
+
updateRevisionsCount(res.data.count);
|
|
56
|
+
var newRevisions = [].concat(_toConsumableArray(revisions), _toConsumableArray(addedRevisions));
|
|
57
|
+
setRevisions(newRevisions);
|
|
58
|
+
if (newRevisions.length < res.data.count) {
|
|
59
|
+
setPage(page + 1);
|
|
60
|
+
} else {
|
|
61
|
+
setHasMore(false);
|
|
62
|
+
}
|
|
63
|
+
}).catch(function (error) {
|
|
64
|
+
var errorMessage = getErrorMsg(error);
|
|
65
|
+
if (page === 1) {
|
|
66
|
+
setErrorMessage(errorMessage);
|
|
67
|
+
} else {
|
|
68
|
+
toaster.danger(t(errorMessage));
|
|
69
|
+
}
|
|
70
|
+
setLoading(false);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
74
|
+
}, [revisions, page, perPage]);
|
|
75
|
+
var openRevision = useCallback(function (revisionId) {
|
|
76
|
+
window.location.href = "".concat(siteRoot, "lib/").concat(repoID, "/revisions/").concat(revisionId, "/");
|
|
77
|
+
|
|
78
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
79
|
+
}, []);
|
|
80
|
+
var onScroll = useCallback(function (event) {
|
|
81
|
+
var _event$target = event.target,
|
|
82
|
+
scrollTop = _event$target.scrollTop,
|
|
83
|
+
clientHeight = _event$target.clientHeight;
|
|
84
|
+
var _ref2 = revisionListRef.current || {
|
|
85
|
+
clientHeight: 0
|
|
86
|
+
},
|
|
87
|
+
revisionListHeight = _ref2.clientHeight;
|
|
88
|
+
if (isLoading) return;
|
|
89
|
+
if (!hasMore) return;
|
|
90
|
+
if (scrollTop + clientHeight + 1 >= revisionListHeight) {
|
|
91
|
+
setLoading(true);
|
|
92
|
+
listRevisions();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
96
|
+
}, [(_revisionListRef$curr = revisionListRef.current) === null || _revisionListRef$curr === void 0 ? void 0 : _revisionListRef$curr.clientHeight, isLoading, hasMore]);
|
|
97
|
+
var renderContent = useCallback(function () {
|
|
98
|
+
if (page === 1 && isLoading) {
|
|
99
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
100
|
+
className: "sdoc-revisions-container loading"
|
|
101
|
+
}, /*#__PURE__*/React.createElement(CommonLoading, null));
|
|
102
|
+
}
|
|
103
|
+
if (page === 1 && errorMessage) {
|
|
104
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
105
|
+
className: "sdoc-revisions-container error"
|
|
106
|
+
}, t(errorMessage));
|
|
107
|
+
}
|
|
108
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
109
|
+
className: "sdoc-revisions-container"
|
|
110
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
111
|
+
className: "sdoc-revisions-header"
|
|
112
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
113
|
+
className: "sdoc-revision-name-header",
|
|
114
|
+
style: {
|
|
115
|
+
width: '40%'
|
|
116
|
+
}
|
|
117
|
+
}, t('ID')), /*#__PURE__*/React.createElement("div", {
|
|
118
|
+
className: "sdoc-revision-user-header",
|
|
119
|
+
style: {
|
|
120
|
+
width: '30%'
|
|
121
|
+
}
|
|
122
|
+
}, t('Creator')), /*#__PURE__*/React.createElement("div", {
|
|
123
|
+
className: "sdoc-revision-time-header",
|
|
124
|
+
style: {
|
|
125
|
+
width: '30%'
|
|
126
|
+
}
|
|
127
|
+
}, t('Created_time'))), /*#__PURE__*/React.createElement("div", {
|
|
128
|
+
className: "sdoc-revisions-content",
|
|
129
|
+
onScroll: onScroll
|
|
130
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
131
|
+
className: "sdoc-revisions-list",
|
|
132
|
+
ref: revisionListRef
|
|
133
|
+
}, revisions.map(function (revision) {
|
|
134
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
135
|
+
className: "sdoc-revision",
|
|
136
|
+
key: revision.id
|
|
137
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
138
|
+
className: "sdoc-revision-name",
|
|
139
|
+
style: {
|
|
140
|
+
width: '40%'
|
|
141
|
+
}
|
|
142
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
143
|
+
className: "sdoc-revision-name-content",
|
|
144
|
+
onClick: function onClick() {
|
|
145
|
+
return openRevision(revision.id);
|
|
146
|
+
}
|
|
147
|
+
}, t('Revision') + ' ' + revision.id)), /*#__PURE__*/React.createElement("div", {
|
|
148
|
+
className: "sdoc-revision-user",
|
|
149
|
+
style: {
|
|
150
|
+
width: '30%'
|
|
151
|
+
}
|
|
152
|
+
}, revision.nickname), /*#__PURE__*/React.createElement("div", {
|
|
153
|
+
className: "sdoc-revision-time",
|
|
154
|
+
style: {
|
|
155
|
+
width: '30%'
|
|
156
|
+
}
|
|
157
|
+
}, revision.createdTime));
|
|
158
|
+
}), isLoading && /*#__PURE__*/React.createElement("div", {
|
|
159
|
+
className: "sdoc-revision loading"
|
|
160
|
+
}, /*#__PURE__*/React.createElement(CommonLoading, null)))));
|
|
161
|
+
|
|
162
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
163
|
+
}, [page, revisions, isLoading, errorMessage]);
|
|
164
|
+
return /*#__PURE__*/React.createElement(Modal, {
|
|
165
|
+
isOpen: true,
|
|
166
|
+
toggle: toggle,
|
|
167
|
+
className: "revisions-dialog"
|
|
168
|
+
}, /*#__PURE__*/React.createElement(ModalHeader, {
|
|
169
|
+
toggle: toggle
|
|
170
|
+
}, t('Revision')), /*#__PURE__*/React.createElement(ModalBody, {
|
|
171
|
+
className: "revisions-body"
|
|
172
|
+
}, renderContent()));
|
|
173
|
+
};
|
|
174
|
+
export default RevisionsDialog;
|
|
@@ -26,3 +26,16 @@
|
|
|
26
26
|
width: 300px;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
.doc-info .sdoc-revision-order {
|
|
30
|
+
display: inline-block;
|
|
31
|
+
font-size: 14px;
|
|
32
|
+
color: #888;
|
|
33
|
+
background: #eee;
|
|
34
|
+
padding: 0 8px;
|
|
35
|
+
height: 20px;
|
|
36
|
+
line-height: 20px;
|
|
37
|
+
border-radius: 10px;
|
|
38
|
+
margin-left: 0.5rem;
|
|
39
|
+
cursor: default;
|
|
40
|
+
}
|
|
41
|
+
|
package/dist/context.js
CHANGED
|
@@ -123,6 +123,21 @@ var Context = /*#__PURE__*/function () {
|
|
|
123
123
|
value: function updateComment(commentId, newComment) {
|
|
124
124
|
return this.sdocServerApi.updateComment(commentId, newComment);
|
|
125
125
|
}
|
|
126
|
+
}, {
|
|
127
|
+
key: "insertReply",
|
|
128
|
+
value: function insertReply(commentId, reply) {
|
|
129
|
+
return this.sdocServerApi.insertReply(commentId, reply);
|
|
130
|
+
}
|
|
131
|
+
}, {
|
|
132
|
+
key: "deleteReply",
|
|
133
|
+
value: function deleteReply(commentId, replyId) {
|
|
134
|
+
return this.sdocServerApi.deleteReply(commentId, replyId);
|
|
135
|
+
}
|
|
136
|
+
}, {
|
|
137
|
+
key: "updateReply",
|
|
138
|
+
value: function updateReply(commentId, replyId, newReply) {
|
|
139
|
+
return this.sdocServerApi.updateReply(commentId, replyId, newReply);
|
|
140
|
+
}
|
|
126
141
|
|
|
127
142
|
// revision
|
|
128
143
|
}, {
|
|
@@ -145,6 +160,18 @@ var Context = /*#__PURE__*/function () {
|
|
|
145
160
|
var docUuid = this.getSetting('docUuid');
|
|
146
161
|
return this.api.getSeadocRevisionDownloadLinks(docUuid);
|
|
147
162
|
}
|
|
163
|
+
}, {
|
|
164
|
+
key: "getSdocRevisionsCount",
|
|
165
|
+
value: function getSdocRevisionsCount() {
|
|
166
|
+
var docUuid = this.getSetting('docUuid');
|
|
167
|
+
return this.api.getSdocRevisionsCount(docUuid);
|
|
168
|
+
}
|
|
169
|
+
}, {
|
|
170
|
+
key: "getSdocRevisions",
|
|
171
|
+
value: function getSdocRevisions(page, perPage) {
|
|
172
|
+
var docUuid = this.getSetting('docUuid');
|
|
173
|
+
return this.api.getSdocRevisions(docUuid, page, perPage);
|
|
174
|
+
}
|
|
148
175
|
}]);
|
|
149
176
|
return Context;
|
|
150
177
|
}();
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
+
import { DateUtils } from '../utils';
|
|
4
|
+
var Revision = /*#__PURE__*/_createClass(function Revision(options) {
|
|
5
|
+
_classCallCheck(this, Revision);
|
|
6
|
+
this.id = options.revision_id || '';
|
|
7
|
+
|
|
8
|
+
// file info
|
|
9
|
+
this.repoId = options.repo_id || '';
|
|
10
|
+
this.docUuid = options.doc_uuid || '';
|
|
11
|
+
this.filePath = options.file_path || '';
|
|
12
|
+
this.filename = options.filename || '';
|
|
13
|
+
this.parentPath = options.parent_path || '';
|
|
14
|
+
|
|
15
|
+
// user
|
|
16
|
+
this.nickname = options.nickname || '';
|
|
17
|
+
|
|
18
|
+
// time
|
|
19
|
+
this.createdTime = DateUtils.format(options.created_at || '', 'YYYY-MM-DD HH:MM');
|
|
20
|
+
this.updatedTime = DateUtils.format(options.updated_at || '', 'YYYY-MM-DD HH:MM');
|
|
21
|
+
|
|
22
|
+
// publish
|
|
23
|
+
this.isPublished = options.is_published || false;
|
|
24
|
+
this.publisher = options.publisher || '';
|
|
25
|
+
this.publisherNickname = options.publisher_nickname || '';
|
|
26
|
+
this.publishFileVersion = options.publish_file_version || '';
|
|
27
|
+
|
|
28
|
+
// origin
|
|
29
|
+
this.originDocUuid = options.origin_doc_uuid || '';
|
|
30
|
+
this.originFilePath = options.origin_file_path || '';
|
|
31
|
+
this.originFileVersion = options.origin_file_version || '';
|
|
32
|
+
this.originFilename = options.origin_filename || '';
|
|
33
|
+
this.originParentPath = options.origin_parent_path || '';
|
|
34
|
+
});
|
|
35
|
+
export default Revision;
|
package/package.json
CHANGED
|
@@ -252,7 +252,11 @@
|
|
|
252
252
|
"Auto_wrap": "Auto wrap",
|
|
253
253
|
"Add_comment": "Add comment",
|
|
254
254
|
"Delete_comment": "Delete comment",
|
|
255
|
+
"Delete_reply": "Delete reply",
|
|
255
256
|
"Are_you_sure_to_delete_this_comment": "Are you sure to delete this comment?",
|
|
257
|
+
"Are_you_sure_to_delete_this_reply": "Are you sure to delete this reply?",
|
|
258
|
+
"Enter_a_comment": "Enter a comment",
|
|
259
|
+
"Enter_a_reply": "Enter a reply",
|
|
256
260
|
"Confirm": "Confirm",
|
|
257
261
|
"View_changes": "View changes",
|
|
258
262
|
"Revision": "Revision",
|
|
@@ -308,5 +312,11 @@
|
|
|
308
312
|
"Standard_purple": "Standard purple",
|
|
309
313
|
"Highlight_color": "Highlight",
|
|
310
314
|
"Font_color": "Font color",
|
|
311
|
-
"Default": "Default"
|
|
315
|
+
"Default": "Default",
|
|
316
|
+
"No_revisions": "No revisions",
|
|
317
|
+
"1_revision": "1 revision",
|
|
318
|
+
"x_revisions": "{{count}} revisions",
|
|
319
|
+
"Creator": "Creator",
|
|
320
|
+
"Created_time": "Created time",
|
|
321
|
+
"Created_at": "Created at"
|
|
312
322
|
}
|
|
@@ -252,7 +252,11 @@
|
|
|
252
252
|
"Auto_wrap": "自动换行",
|
|
253
253
|
"Add_comment": "添加评论",
|
|
254
254
|
"Delete_comment": "删除评论",
|
|
255
|
+
"Delete_reply": "删除回复",
|
|
255
256
|
"Are_you_sure_to_delete_this_comment": "你确定要删除这个评论吗?",
|
|
257
|
+
"Are_you_sure_to_delete_this_reply": "你确定要删除这个回复吗?",
|
|
258
|
+
"Enter_a_comment": "输入评论",
|
|
259
|
+
"Enter_a_reply": "输入回复",
|
|
256
260
|
"Confirm": "确定",
|
|
257
261
|
"View_changes": "查看改动",
|
|
258
262
|
"Revision": "修订稿",
|
|
@@ -308,5 +312,11 @@
|
|
|
308
312
|
"Standard_purple": "标准紫",
|
|
309
313
|
"Highlight_color": "突出显示",
|
|
310
314
|
"Font_color": "字体颜色",
|
|
311
|
-
"Default": "默认"
|
|
315
|
+
"Default": "默认",
|
|
316
|
+
"No_revisions": "没有修订稿",
|
|
317
|
+
"1_revision": "1 个修订稿",
|
|
318
|
+
"x_revisions": "{{count}} 个修订稿",
|
|
319
|
+
"Creator": "创建者",
|
|
320
|
+
"Created_time": "创建时间",
|
|
321
|
+
"Created_at": "创建时间"
|
|
312
322
|
}
|