@seafile/sdoc-editor 0.2.6 → 0.2.8
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 +8 -0
- package/dist/basic-sdk/extension/plugins/code-block/helpers.js +12 -0
- package/dist/basic-sdk/extension/plugins/code-block/render-elem.js +3 -0
- package/dist/basic-sdk/extension/plugins/table/helpers.js +1 -6
- package/dist/basic-sdk/extension/plugins/table/render/index.js +11 -2
- package/dist/basic-sdk/extension/toolbar/side-toolbar/index.js +2 -0
- package/dist/components/doc-operations/more-operations.js +2 -0
- package/dist/components/doc-operations/revision-operations/index.js +2 -1
- package/dist/components/doc-operations/revision-operations/more-revision-operations/index.css +1 -7
- package/dist/components/doc-operations/revision-operations/more-revision-operations/index.js +2 -0
- package/dist/components/doc-operations/revision-operations/revisions/revisions-dialog/index.css +12 -0
- package/dist/components/doc-operations/revision-operations/revisions/revisions-dialog/index.js +94 -12
- package/dist/components/doc-operations/revision-operations/revisions/revisions-dialog/revision-operation/index.css +20 -0
- package/dist/components/doc-operations/revision-operations/revisions/revisions-dialog/revision-operation/index.js +58 -0
- package/dist/components/tip-dialog/index.js +6 -3
- package/dist/components/toast/toastManager.js +1 -1
- package/dist/constants/index.js +4 -3
- package/dist/context.js +6 -0
- package/package.json +1 -1
- package/public/locales/cs/sdoc-editor.json +9 -1
- package/public/locales/de/sdoc-editor.json +9 -1
- package/public/locales/en/sdoc-editor.json +5 -1
- package/public/locales/es/sdoc-editor.json +9 -1
- package/public/locales/fr/sdoc-editor.json +9 -1
- package/public/locales/it/sdoc-editor.json +9 -1
- package/public/locales/ru/sdoc-editor.json +10 -2
- package/public/locales/zh_CN/sdoc-editor.json +5 -1
package/dist/api/seafile-api.js
CHANGED
|
@@ -9,6 +9,12 @@ var SeafileAPI = /*#__PURE__*/function () {
|
|
|
9
9
|
var url = 'api/v2.1/seadoc/revision/' + docUuid + '/';
|
|
10
10
|
return _this.req.delete(url);
|
|
11
11
|
};
|
|
12
|
+
this.deleteSdocOtherRevision = function (docUuid, revisionId) {
|
|
13
|
+
var url = 'api/v2.1/seadoc/delete-revision/' + docUuid + '/' + revisionId + '/';
|
|
14
|
+
// let formData = new FormData();
|
|
15
|
+
// formData.append('revision_id', revisionId);
|
|
16
|
+
return _this.req.delete(url);
|
|
17
|
+
};
|
|
12
18
|
this.req = axios.create({
|
|
13
19
|
baseURL: server,
|
|
14
20
|
headers: {
|
|
@@ -51,6 +57,8 @@ var SeafileAPI = /*#__PURE__*/function () {
|
|
|
51
57
|
var url = '/api/v2.1/seadoc/download-image/' + docUuid + '/' + encodeURIComponent(imageName);
|
|
52
58
|
return this.req.get(url);
|
|
53
59
|
}
|
|
60
|
+
|
|
61
|
+
// revision
|
|
54
62
|
}, {
|
|
55
63
|
key: "startRevise",
|
|
56
64
|
value: function startRevise(repoID, fileUuid, path) {
|
|
@@ -90,13 +90,25 @@ export var changeToCodeBlock = function changeToCodeBlock(editor) {
|
|
|
90
90
|
mode: 'highest',
|
|
91
91
|
at: [path[0] + 1]
|
|
92
92
|
});
|
|
93
|
+
Transforms.select(editor, [path[0] + 1, 0, 0]);
|
|
93
94
|
return;
|
|
94
95
|
}
|
|
95
96
|
var atPath = path ? [path[0]] : editor.selection;
|
|
97
|
+
var atPoint = path ? {
|
|
98
|
+
anchor: {
|
|
99
|
+
offset: 0,
|
|
100
|
+
path: [path[0], 0, 0]
|
|
101
|
+
},
|
|
102
|
+
focus: {
|
|
103
|
+
offset: 0,
|
|
104
|
+
path: [path[0], 0, 0]
|
|
105
|
+
}
|
|
106
|
+
} : editor.selection;
|
|
96
107
|
Transforms.insertNodes(editor, newCodeBlockNode, {
|
|
97
108
|
mode: 'highest',
|
|
98
109
|
at: atPath
|
|
99
110
|
});
|
|
111
|
+
Transforms.select(editor, atPoint);
|
|
100
112
|
};
|
|
101
113
|
export var changeToPlainText = function changeToPlainText(editor) {
|
|
102
114
|
var elem = getSelectCodeElem(editor);
|
|
@@ -4,6 +4,7 @@ import React, { useCallback, useEffect, useState, useRef } from 'react';
|
|
|
4
4
|
import { ReactEditor, useReadOnly } from '@seafile/slate-react';
|
|
5
5
|
import { Transforms } from '@seafile/slate';
|
|
6
6
|
import EventBus from '../../../utils/event-bus';
|
|
7
|
+
import { focusEditor } from '../../core';
|
|
7
8
|
import { useScrollContext } from '../../../hooks/use-scroll-context';
|
|
8
9
|
import CodeBlockHoverMenu from './hover-menu';
|
|
9
10
|
import { setClipboardData } from './helpers';
|
|
@@ -64,6 +65,8 @@ var CodeBlock = function CodeBlock(_ref) {
|
|
|
64
65
|
Transforms.removeNodes(editor, {
|
|
65
66
|
at: path
|
|
66
67
|
});
|
|
68
|
+
focusEditor(editor);
|
|
69
|
+
Transforms.select(editor, editor.selection);
|
|
67
70
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
68
71
|
}, []);
|
|
69
72
|
var onFocusCodeBlock = useCallback(function (e) {
|
|
@@ -279,15 +279,10 @@ export var removeTable = function removeTable(editor, path) {
|
|
|
279
279
|
tablePath = _getSelectedInfo3.tablePath;
|
|
280
280
|
validPath = tablePath;
|
|
281
281
|
}
|
|
282
|
-
var tableIndex = validPath[validPath.length - 1];
|
|
283
|
-
var tableParentPath = validPath.slice(0, validPath.length - 1);
|
|
284
|
-
var targetNodeIndex = tableIndex >= 1 ? tableIndex - 1 : 1;
|
|
285
|
-
var targetNodePath = [].concat(_toConsumableArray(tableParentPath), [targetNodeIndex]);
|
|
286
282
|
editor.reSetTableSelectedRange();
|
|
287
283
|
Transforms.removeNodes(editor, {
|
|
288
|
-
at:
|
|
284
|
+
at: validPath
|
|
289
285
|
});
|
|
290
|
-
focusEditor(editor, targetNodePath);
|
|
291
286
|
};
|
|
292
287
|
export var removeTableElement = function removeTableElement(editor, type) {
|
|
293
288
|
var _getSelectedInfo4 = getSelectedInfo(editor),
|
|
@@ -152,9 +152,18 @@ var Table = function Table(_ref) {
|
|
|
152
152
|
var setSelectedRangeByClick = useCallback(function (range) {
|
|
153
153
|
setSelectedRange(range);
|
|
154
154
|
setTableSelectedRange(editor, range);
|
|
155
|
-
|
|
155
|
+
var maxRowIndex = range.maxRowIndex,
|
|
156
|
+
maxColIndex = range.maxColIndex;
|
|
157
|
+
var selection = {
|
|
158
|
+
offset: 0,
|
|
159
|
+
path: [].concat(_toConsumableArray(path), [maxRowIndex, maxColIndex, 0])
|
|
160
|
+
};
|
|
161
|
+
Transforms.setSelection(editor, {
|
|
162
|
+
anchor: selection,
|
|
163
|
+
focus: selection
|
|
164
|
+
});
|
|
156
165
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
157
|
-
}, []);
|
|
166
|
+
}, [editor, path]);
|
|
158
167
|
var tableContainerClassName = classnames('sdoc-table-container position-relative', attributes.className, className, {
|
|
159
168
|
'sdoc-table-selected': isSelected,
|
|
160
169
|
'sdoc-table-selected-range': !ObjectUtils.isSameObject(selectedRange, EMPTY_SELECTED_RANGE)
|
|
@@ -3,6 +3,7 @@ import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import { ReactEditor, useSlateStatic } from '@seafile/slate-react';
|
|
5
5
|
import EventBus from '../../../utils/event-bus';
|
|
6
|
+
import { focusEditor } from '../../core';
|
|
6
7
|
import { useScrollContext } from '../../../hooks/use-scroll-context';
|
|
7
8
|
import { INTERNAL_EVENT } from '../../../constants';
|
|
8
9
|
import { getDomTopHeight, setSelection, isVoidNode } from './helpers';
|
|
@@ -56,6 +57,7 @@ var SideToolbar = function SideToolbar() {
|
|
|
56
57
|
return function () {
|
|
57
58
|
if (observerRefValue) {
|
|
58
59
|
observerRefValue.removeEventListener('scroll', onReset);
|
|
60
|
+
focusEditor(editor);
|
|
59
61
|
}
|
|
60
62
|
};
|
|
61
63
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -32,9 +32,11 @@ var MoreOperations = function MoreOperations(_ref) {
|
|
|
32
32
|
}, /*#__PURE__*/React.createElement("i", {
|
|
33
33
|
className: "sdocfont sdoc-menu"
|
|
34
34
|
})), /*#__PURE__*/React.createElement(DropdownMenu, {
|
|
35
|
+
className: "sdoc-dropdown-menu",
|
|
35
36
|
right: true
|
|
36
37
|
}, dropdownItems.map(function (item, index) {
|
|
37
38
|
return /*#__PURE__*/React.createElement(DropdownItem, {
|
|
39
|
+
className: "sdoc-dropdown-menu-item",
|
|
38
40
|
tag: "a",
|
|
39
41
|
href: item.URL,
|
|
40
42
|
key: index
|
|
@@ -199,7 +199,8 @@ var RevisionOperations = function RevisionOperations(_ref) {
|
|
|
199
199
|
}), isShowTip && /*#__PURE__*/React.createElement(TipDialog, {
|
|
200
200
|
tipType: tipType,
|
|
201
201
|
onSubmit: onSubmit,
|
|
202
|
-
onClose: onClose
|
|
202
|
+
onClose: onClose,
|
|
203
|
+
zIndex: 1072
|
|
203
204
|
}));
|
|
204
205
|
};
|
|
205
206
|
export default RevisionOperations;
|
package/dist/components/doc-operations/revision-operations/more-revision-operations/index.css
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
.sdoc-more-revision-operations-dropdown .dropdown-item {
|
|
26
26
|
padding: 12px;
|
|
27
|
-
|
|
27
|
+
height: 64px;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
.sdoc-more-revision-operations-dropdown .sdoc-more-revision-operation {
|
|
@@ -51,9 +51,3 @@
|
|
|
51
51
|
width: 100%;
|
|
52
52
|
white-space: break-spaces;
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
.sdoc-more-revision-operations-dropdown .dropdown-item:hover .sdoc-more-revision-operation,
|
|
56
|
-
.sdoc-more-revision-operations-dropdown .dropdown-item:hover .sdoc-more-revision-operation-title-name,
|
|
57
|
-
.sdoc-more-revision-operations-dropdown .dropdown-item:hover .sdoc-more-revision-operation-describe {
|
|
58
|
-
color: #fff;
|
|
59
|
-
}
|
package/dist/components/doc-operations/revision-operations/more-revision-operations/index.js
CHANGED
|
@@ -39,8 +39,10 @@ var MoreRevisionOperations = function MoreRevisionOperations(_ref) {
|
|
|
39
39
|
}), /*#__PURE__*/React.createElement("span", {
|
|
40
40
|
className: "sdocfont sdoc-".concat(isDropdownOpen ? 'caret-up' : 'drop-down')
|
|
41
41
|
})), /*#__PURE__*/React.createElement(DropdownMenu, {
|
|
42
|
+
className: "sdoc-dropdown-menu",
|
|
42
43
|
right: true
|
|
43
44
|
}, /*#__PURE__*/React.createElement(DropdownItem, {
|
|
45
|
+
className: "sdoc-dropdown-menu-item",
|
|
44
46
|
onClick: startRevise
|
|
45
47
|
}, /*#__PURE__*/React.createElement("div", {
|
|
46
48
|
className: "sdoc-more-revision-operation"
|
package/dist/components/doc-operations/revision-operations/revisions/revisions-dialog/index.css
CHANGED
|
@@ -60,6 +60,10 @@
|
|
|
60
60
|
border-bottom: 1px solid rgba(0, 40, 100, 0.12);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
.revisions-dialog .revisions-body .sdoc-revision.operating {
|
|
64
|
+
background-color: #f5f5f5;
|
|
65
|
+
}
|
|
66
|
+
|
|
63
67
|
.revisions-dialog .revisions-body .sdoc-revision:hover {
|
|
64
68
|
cursor: pointer;
|
|
65
69
|
background-color: #f5f5f5;
|
|
@@ -112,3 +116,11 @@
|
|
|
112
116
|
.revisions-dialog .sdoc-revision.loading:hover {
|
|
113
117
|
background-color: unset;
|
|
114
118
|
}
|
|
119
|
+
|
|
120
|
+
.revisions-dialog .sdoc-revision-operations {
|
|
121
|
+
height: 100%;
|
|
122
|
+
width: 100%;
|
|
123
|
+
display: flex;
|
|
124
|
+
align-items: center;
|
|
125
|
+
justify-content: center;
|
|
126
|
+
}
|
package/dist/components/doc-operations/revision-operations/revisions/revisions-dialog/index.js
CHANGED
|
@@ -3,12 +3,17 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
3
3
|
import React, { useState, useEffect, useCallback, useRef } from 'react';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { Modal, ModalHeader, ModalBody } from 'reactstrap';
|
|
6
|
+
import classnames from 'classnames';
|
|
6
7
|
import CommonLoading from '../../../../common-loading';
|
|
7
8
|
import context from '../../../../../context';
|
|
8
9
|
import { Revision } from '../../../../../model';
|
|
9
10
|
import { getErrorMsg } from '../../../../../utils';
|
|
10
11
|
import toaster from '../../../../toast';
|
|
12
|
+
import RevisionOperation from './revision-operation';
|
|
13
|
+
import { eventStopPropagation } from '../../../../../basic-sdk/utils/mouse-event';
|
|
14
|
+
import TipDialog from '../../../../tip-dialog';
|
|
11
15
|
import './index.css';
|
|
16
|
+
import { TIP_CONTENT, TIP_TYPE } from '../../../../../constants';
|
|
12
17
|
var RevisionsDialog = function RevisionsDialog(_ref) {
|
|
13
18
|
var _revisionListRef$curr;
|
|
14
19
|
var updateRevisionsCount = _ref.updateRevisionsCount,
|
|
@@ -39,6 +44,18 @@ var RevisionsDialog = function RevisionsDialog(_ref) {
|
|
|
39
44
|
var perPage = 25;
|
|
40
45
|
var repoID = context.getSetting('repoID');
|
|
41
46
|
var siteRoot = context.getSetting('siteRoot');
|
|
47
|
+
var _useState11 = useState(''),
|
|
48
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
49
|
+
activeRevisionId = _useState12[0],
|
|
50
|
+
setActiveRevision = _useState12[1];
|
|
51
|
+
var _useState13 = useState(''),
|
|
52
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
53
|
+
operatingRevisionId = _useState14[0],
|
|
54
|
+
setOperatingRevision = _useState14[1];
|
|
55
|
+
var _useState15 = useState(false),
|
|
56
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
57
|
+
showDeleteTipDialog = _useState16[0],
|
|
58
|
+
setShowDeleteTipDialog = _useState16[1];
|
|
42
59
|
|
|
43
60
|
// did mount
|
|
44
61
|
useEffect(function () {
|
|
@@ -72,7 +89,9 @@ var RevisionsDialog = function RevisionsDialog(_ref) {
|
|
|
72
89
|
|
|
73
90
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
74
91
|
}, [revisions, page, perPage]);
|
|
75
|
-
var openRevision = useCallback(function (revisionId) {
|
|
92
|
+
var openRevision = useCallback(function (event, revisionId) {
|
|
93
|
+
eventStopPropagation(event);
|
|
94
|
+
if (event.target.className.includes('sdoc-revision-operation-toggle')) return;
|
|
76
95
|
window.location.href = "".concat(siteRoot, "lib/").concat(repoID, "/revisions/").concat(revisionId, "/");
|
|
77
96
|
|
|
78
97
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -94,6 +113,35 @@ var RevisionsDialog = function RevisionsDialog(_ref) {
|
|
|
94
113
|
|
|
95
114
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
96
115
|
}, [(_revisionListRef$curr = revisionListRef.current) === null || _revisionListRef$curr === void 0 ? void 0 : _revisionListRef$curr.clientHeight, isLoading, hasMore]);
|
|
116
|
+
var onDeleteOtherRevision = useCallback(function () {
|
|
117
|
+
setShowDeleteTipDialog(true);
|
|
118
|
+
}, []);
|
|
119
|
+
var closeDeleteTipDialog = useCallback(function () {
|
|
120
|
+
setOperatingRevision('');
|
|
121
|
+
setShowDeleteTipDialog(false);
|
|
122
|
+
}, []);
|
|
123
|
+
var deleteOtherRevision = useCallback(function () {
|
|
124
|
+
var revisionIndex = revisions.findIndex(function (revision) {
|
|
125
|
+
return revision.id === operatingRevisionId;
|
|
126
|
+
});
|
|
127
|
+
if (revisionIndex === -1) {
|
|
128
|
+
closeDeleteTipDialog();
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
var revision = revisions[revisionIndex];
|
|
132
|
+
context.deleteSdocOtherRevision(revision.id).then(function (res) {
|
|
133
|
+
var newRevisions = revisions.slice(0);
|
|
134
|
+
newRevisions.splice(revisionIndex, 1);
|
|
135
|
+
updateRevisionsCount(newRevisions.length);
|
|
136
|
+
setRevisions(newRevisions);
|
|
137
|
+
closeDeleteTipDialog();
|
|
138
|
+
toaster.success(t('Delete_Successfully'));
|
|
139
|
+
}).catch(function (error) {
|
|
140
|
+
toaster.danger(t('Delete_failed'));
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
144
|
+
}, [operatingRevisionId, revisions, closeDeleteTipDialog]);
|
|
97
145
|
var renderContent = useCallback(function () {
|
|
98
146
|
if (page === 1 && isLoading) {
|
|
99
147
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -117,25 +165,41 @@ var RevisionsDialog = function RevisionsDialog(_ref) {
|
|
|
117
165
|
}, t('ID')), /*#__PURE__*/React.createElement("div", {
|
|
118
166
|
className: "sdoc-revision-user-header",
|
|
119
167
|
style: {
|
|
120
|
-
width: '
|
|
168
|
+
width: '25%'
|
|
121
169
|
}
|
|
122
170
|
}, t('Creator')), /*#__PURE__*/React.createElement("div", {
|
|
123
171
|
className: "sdoc-revision-time-header",
|
|
124
172
|
style: {
|
|
125
173
|
width: '30%'
|
|
126
174
|
}
|
|
127
|
-
}, t('Created_time'))
|
|
175
|
+
}, t('Created_time')), /*#__PURE__*/React.createElement("div", {
|
|
176
|
+
className: "sdoc-revision-time-header",
|
|
177
|
+
style: {
|
|
178
|
+
width: '5%'
|
|
179
|
+
}
|
|
180
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
128
181
|
className: "sdoc-revisions-content",
|
|
129
182
|
onScroll: onScroll
|
|
130
183
|
}, /*#__PURE__*/React.createElement("div", {
|
|
131
184
|
className: "sdoc-revisions-list",
|
|
132
185
|
ref: revisionListRef
|
|
133
186
|
}, revisions.map(function (revision) {
|
|
187
|
+
var revisionId = revision.id;
|
|
188
|
+
var isOperating = operatingRevisionId === revisionId;
|
|
189
|
+
var isActive = activeRevisionId === revisionId;
|
|
134
190
|
return /*#__PURE__*/React.createElement("div", {
|
|
135
|
-
className: "sdoc-revision",
|
|
136
191
|
key: revision.id,
|
|
137
|
-
|
|
138
|
-
|
|
192
|
+
className: classnames('sdoc-revision', {
|
|
193
|
+
'operating': isOperating
|
|
194
|
+
}),
|
|
195
|
+
onClick: function onClick(event) {
|
|
196
|
+
return openRevision(event, revisionId);
|
|
197
|
+
},
|
|
198
|
+
onMouseEnter: function onMouseEnter() {
|
|
199
|
+
return setActiveRevision(revisionId);
|
|
200
|
+
},
|
|
201
|
+
onMouseLeave: function onMouseLeave() {
|
|
202
|
+
return setActiveRevision('');
|
|
139
203
|
}
|
|
140
204
|
}, /*#__PURE__*/React.createElement("div", {
|
|
141
205
|
className: "sdoc-revision-name",
|
|
@@ -144,24 +208,35 @@ var RevisionsDialog = function RevisionsDialog(_ref) {
|
|
|
144
208
|
}
|
|
145
209
|
}, /*#__PURE__*/React.createElement("div", {
|
|
146
210
|
className: "sdoc-revision-name-content"
|
|
147
|
-
}, t('Revision') + ' ' +
|
|
211
|
+
}, t('Revision') + ' ' + revisionId)), /*#__PURE__*/React.createElement("div", {
|
|
148
212
|
className: "sdoc-revision-user",
|
|
149
213
|
style: {
|
|
150
|
-
width: '
|
|
214
|
+
width: '25%'
|
|
151
215
|
}
|
|
152
216
|
}, revision.nickname), /*#__PURE__*/React.createElement("div", {
|
|
153
217
|
className: "sdoc-revision-time",
|
|
154
218
|
style: {
|
|
155
219
|
width: '30%'
|
|
156
220
|
}
|
|
157
|
-
}, revision.createdTime)
|
|
221
|
+
}, revision.createdTime), /*#__PURE__*/React.createElement("div", {
|
|
222
|
+
className: "sdoc-revision-operations",
|
|
223
|
+
style: {
|
|
224
|
+
width: '5%'
|
|
225
|
+
}
|
|
226
|
+
}, /*#__PURE__*/React.createElement(RevisionOperation, {
|
|
227
|
+
isActive: isActive,
|
|
228
|
+
isOperating: isOperating,
|
|
229
|
+
revision: revision,
|
|
230
|
+
updateOperatingRevision: setOperatingRevision,
|
|
231
|
+
onDeleteOtherRevision: onDeleteOtherRevision
|
|
232
|
+
})));
|
|
158
233
|
}), isLoading && /*#__PURE__*/React.createElement("div", {
|
|
159
234
|
className: "sdoc-revision loading"
|
|
160
235
|
}, /*#__PURE__*/React.createElement(CommonLoading, null)))));
|
|
161
236
|
|
|
162
237
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
163
|
-
}, [page, revisions, isLoading, errorMessage]);
|
|
164
|
-
return /*#__PURE__*/React.createElement(Modal, {
|
|
238
|
+
}, [page, revisions, isLoading, errorMessage, activeRevisionId, operatingRevisionId]);
|
|
239
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Modal, {
|
|
165
240
|
isOpen: true,
|
|
166
241
|
toggle: toggle,
|
|
167
242
|
className: "revisions-dialog"
|
|
@@ -169,6 +244,13 @@ var RevisionsDialog = function RevisionsDialog(_ref) {
|
|
|
169
244
|
toggle: toggle
|
|
170
245
|
}, t('Revision')), /*#__PURE__*/React.createElement(ModalBody, {
|
|
171
246
|
className: "revisions-body"
|
|
172
|
-
}, renderContent()))
|
|
247
|
+
}, renderContent())), showDeleteTipDialog && /*#__PURE__*/React.createElement(TipDialog, {
|
|
248
|
+
tipType: TIP_TYPE.DELETE_REVISION,
|
|
249
|
+
onSubmit: deleteOtherRevision,
|
|
250
|
+
onClose: closeDeleteTipDialog,
|
|
251
|
+
zIndex: 1071
|
|
252
|
+
}, t(TIP_CONTENT[TIP_TYPE.DELETE_REVISION], {
|
|
253
|
+
content: "".concat(t('Revision'), " ").concat(operatingRevisionId)
|
|
254
|
+
})));
|
|
173
255
|
};
|
|
174
256
|
export default RevisionsDialog;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.sdoc-revision-operation-toggle {
|
|
2
|
+
display: none;
|
|
3
|
+
font-size: 16px;
|
|
4
|
+
color: #999;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.revisions-body .sdoc-revision:hover .sdoc-revision-operation-toggle,
|
|
8
|
+
.revisions-dialog .revisions-body .sdoc-revision.operating .sdoc-revision-operation-toggle {
|
|
9
|
+
display: inline-block;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.sdoc-revision-operation-toggle:hover {
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
color: #333;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.sdoc-revision-menu-popover .popover {
|
|
18
|
+
margin-top: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import React, { useCallback, useRef, useState } from 'react';
|
|
3
|
+
import { UncontrolledPopover } from 'reactstrap';
|
|
4
|
+
import DropdownMenuItem from '../../../../../../basic-sdk/extension/commons/dropdown-menu-item';
|
|
5
|
+
import { eventStopPropagation } from '../../../../../../basic-sdk/utils/mouse-event';
|
|
6
|
+
import './index.css';
|
|
7
|
+
var RevisionOperation = function RevisionOperation(_ref) {
|
|
8
|
+
var isActive = _ref.isActive,
|
|
9
|
+
isOperating = _ref.isOperating,
|
|
10
|
+
revision = _ref.revision,
|
|
11
|
+
updateOperatingRevision = _ref.updateOperatingRevision,
|
|
12
|
+
onDeleteOtherRevision = _ref.onDeleteOtherRevision;
|
|
13
|
+
var targetId = "sdoc-revision-".concat(revision.id);
|
|
14
|
+
var popoverRef = useRef(null);
|
|
15
|
+
var _useState = useState(false),
|
|
16
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
17
|
+
isPopoverShow = _useState2[0],
|
|
18
|
+
setPopoverShow = _useState2[1];
|
|
19
|
+
var toggle = useCallback(function () {
|
|
20
|
+
popoverRef.current.toggle();
|
|
21
|
+
var nextPopoverShow = !isPopoverShow;
|
|
22
|
+
setPopoverShow(nextPopoverShow);
|
|
23
|
+
updateOperatingRevision(nextPopoverShow ? revision.id : '');
|
|
24
|
+
}, [isPopoverShow, updateOperatingRevision, revision]);
|
|
25
|
+
var deleteRevision = useCallback(function (event) {
|
|
26
|
+
eventStopPropagation(event);
|
|
27
|
+
onDeleteOtherRevision();
|
|
28
|
+
popoverRef.current.toggle();
|
|
29
|
+
}, [onDeleteOtherRevision]);
|
|
30
|
+
if (!isActive && !isOperating) return null;
|
|
31
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("i", {
|
|
32
|
+
className: "sdocfont sdoc-more sdoc-revision-operation-toggle",
|
|
33
|
+
id: targetId
|
|
34
|
+
}), /*#__PURE__*/React.createElement(UncontrolledPopover, {
|
|
35
|
+
target: targetId,
|
|
36
|
+
className: "sdoc-menu-popover sdoc-dropdown-menu sdoc-revision-menu-popover",
|
|
37
|
+
trigger: "legacy",
|
|
38
|
+
placement: "bottom-start",
|
|
39
|
+
hideArrow: true,
|
|
40
|
+
toggle: toggle,
|
|
41
|
+
fade: false,
|
|
42
|
+
modifiers: {
|
|
43
|
+
preventOverflow: {
|
|
44
|
+
boundariesElement: document.body
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
ref: popoverRef
|
|
48
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
49
|
+
className: "sdoc-dropdown-menu-container"
|
|
50
|
+
}, /*#__PURE__*/React.createElement(DropdownMenuItem, {
|
|
51
|
+
onClick: deleteRevision,
|
|
52
|
+
menuConfig: {
|
|
53
|
+
iconClass: 'sdocfont sdoc-delete',
|
|
54
|
+
text: 'Delete'
|
|
55
|
+
}
|
|
56
|
+
}))));
|
|
57
|
+
};
|
|
58
|
+
export default RevisionOperation;
|
|
@@ -12,7 +12,10 @@ var TipDialog = function TipDialog(_ref) {
|
|
|
12
12
|
var className = _ref.className,
|
|
13
13
|
tipType = _ref.tipType,
|
|
14
14
|
onClose = _ref.onClose,
|
|
15
|
-
propsOnSubmit = _ref.onSubmit
|
|
15
|
+
propsOnSubmit = _ref.onSubmit,
|
|
16
|
+
_ref$zIndex = _ref.zIndex,
|
|
17
|
+
zIndex = _ref$zIndex === void 0 ? 1071 : _ref$zIndex,
|
|
18
|
+
children = _ref.children;
|
|
16
19
|
var _useTranslation = useTranslation(),
|
|
17
20
|
t = _useTranslation.t;
|
|
18
21
|
var _useState = useState(),
|
|
@@ -46,7 +49,7 @@ var TipDialog = function TipDialog(_ref) {
|
|
|
46
49
|
return /*#__PURE__*/React.createElement(Modal, {
|
|
47
50
|
isOpen: true,
|
|
48
51
|
autoFocus: false,
|
|
49
|
-
zIndex:
|
|
52
|
+
zIndex: zIndex,
|
|
50
53
|
returnFocusAfterClose: false,
|
|
51
54
|
toggle: closeDialog,
|
|
52
55
|
className: classnames('sdoc-tip-dialog', className),
|
|
@@ -55,7 +58,7 @@ var TipDialog = function TipDialog(_ref) {
|
|
|
55
58
|
toggle: NOT_CLOSE_DIALOG_TIP_TYPE.includes(tipType) ? undefined : closeDialog
|
|
56
59
|
}, t(TIP_TITLE[tipType])), /*#__PURE__*/React.createElement(ModalBody, {
|
|
57
60
|
className: "sdoc-tip-body"
|
|
58
|
-
}, /*#__PURE__*/React.createElement(TipContent, {
|
|
61
|
+
}, children ? children : /*#__PURE__*/React.createElement(TipContent, {
|
|
59
62
|
tipType: tipType
|
|
60
63
|
})), !NOT_CLOSE_DIALOG_TIP_TYPE.includes(tipType) && /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
|
|
61
64
|
color: "secondary",
|
package/dist/constants/index.js
CHANGED
|
@@ -23,7 +23,8 @@ export var TIP_TYPE = {
|
|
|
23
23
|
HAS_CONFLICT_BEFORE_VIEW_CHANGES: 'has_conflict_before_view_changes',
|
|
24
24
|
HAS_BEEN_REMOVED: 'has_been_removed',
|
|
25
25
|
CHECKING: 'checking',
|
|
26
|
-
PUBLISHING: 'publishing'
|
|
26
|
+
PUBLISHING: 'publishing',
|
|
27
|
+
DELETE_REVISION: 'delete_revision'
|
|
27
28
|
};
|
|
28
|
-
export var TIP_TITLE = (_TIP_TITLE = {}, _defineProperty(_TIP_TITLE, TIP_TYPE.DELETE_NO_CHANGES_REVISION, 'Tip'), _defineProperty(_TIP_TITLE, TIP_TYPE.MERGE, 'Tip'), _defineProperty(_TIP_TITLE, TIP_TYPE.HAS_CONFLICT_BEFORE_PUBLISH, 'Tip'), _defineProperty(_TIP_TITLE, TIP_TYPE.HAS_BEEN_PUBLISHED, 'Tip'), _defineProperty(_TIP_TITLE, TIP_TYPE.HAS_BEEN_REPLACED, 'Tip'), _defineProperty(_TIP_TITLE, TIP_TYPE.HAS_CONFLICT_BEFORE_VIEW_CHANGES, 'Tip'), _defineProperty(_TIP_TITLE, TIP_TYPE.HAS_BEEN_REMOVED, 'Tip'), _defineProperty(_TIP_TITLE, TIP_TYPE.CHECKING, 'Tip'), _defineProperty(_TIP_TITLE, TIP_TYPE.PUBLISHING, 'Tip'), _TIP_TITLE);
|
|
29
|
-
export var TIP_CONTENT = (_TIP_CONTENT = {}, _defineProperty(_TIP_CONTENT, TIP_TYPE.DELETE_NO_CHANGES_REVISION, 'Rebase_delete_no_change_revision_tip'), _defineProperty(_TIP_CONTENT, TIP_TYPE.MERGE, 'Merge_tip'), _defineProperty(_TIP_CONTENT, TIP_TYPE.HAS_CONFLICT_BEFORE_PUBLISH, 'Has_conflict_before_publish_tip'), _defineProperty(_TIP_CONTENT, TIP_TYPE.HAS_BEEN_PUBLISHED, 'Has_been_published_tip'), _defineProperty(_TIP_CONTENT, TIP_TYPE.HAS_BEEN_REPLACED, 'Has_been_replaced_tip'), _defineProperty(_TIP_CONTENT, TIP_TYPE.HAS_CONFLICT_BEFORE_VIEW_CHANGES, 'Has_conflict_before_view_changes_tip'), _defineProperty(_TIP_CONTENT, TIP_TYPE.HAS_BEEN_REMOVED, 'Has_been_removed_tip'), _defineProperty(_TIP_CONTENT, TIP_TYPE.CHECKING, 'Checking'), _defineProperty(_TIP_CONTENT, TIP_TYPE.PUBLISHING, 'Publishing'), _TIP_CONTENT);
|
|
29
|
+
export var TIP_TITLE = (_TIP_TITLE = {}, _defineProperty(_TIP_TITLE, TIP_TYPE.DELETE_NO_CHANGES_REVISION, 'Tip'), _defineProperty(_TIP_TITLE, TIP_TYPE.MERGE, 'Tip'), _defineProperty(_TIP_TITLE, TIP_TYPE.HAS_CONFLICT_BEFORE_PUBLISH, 'Tip'), _defineProperty(_TIP_TITLE, TIP_TYPE.HAS_BEEN_PUBLISHED, 'Tip'), _defineProperty(_TIP_TITLE, TIP_TYPE.HAS_BEEN_REPLACED, 'Tip'), _defineProperty(_TIP_TITLE, TIP_TYPE.HAS_CONFLICT_BEFORE_VIEW_CHANGES, 'Tip'), _defineProperty(_TIP_TITLE, TIP_TYPE.HAS_BEEN_REMOVED, 'Tip'), _defineProperty(_TIP_TITLE, TIP_TYPE.CHECKING, 'Tip'), _defineProperty(_TIP_TITLE, TIP_TYPE.PUBLISHING, 'Tip'), _defineProperty(_TIP_TITLE, TIP_TYPE.DELETE_REVISION, 'Delete_revision'), _TIP_TITLE);
|
|
30
|
+
export var TIP_CONTENT = (_TIP_CONTENT = {}, _defineProperty(_TIP_CONTENT, TIP_TYPE.DELETE_NO_CHANGES_REVISION, 'Rebase_delete_no_change_revision_tip'), _defineProperty(_TIP_CONTENT, TIP_TYPE.MERGE, 'Merge_tip'), _defineProperty(_TIP_CONTENT, TIP_TYPE.HAS_CONFLICT_BEFORE_PUBLISH, 'Has_conflict_before_publish_tip'), _defineProperty(_TIP_CONTENT, TIP_TYPE.HAS_BEEN_PUBLISHED, 'Has_been_published_tip'), _defineProperty(_TIP_CONTENT, TIP_TYPE.HAS_BEEN_REPLACED, 'Has_been_replaced_tip'), _defineProperty(_TIP_CONTENT, TIP_TYPE.HAS_CONFLICT_BEFORE_VIEW_CHANGES, 'Has_conflict_before_view_changes_tip'), _defineProperty(_TIP_CONTENT, TIP_TYPE.HAS_BEEN_REMOVED, 'Has_been_removed_tip'), _defineProperty(_TIP_CONTENT, TIP_TYPE.CHECKING, 'Checking'), _defineProperty(_TIP_CONTENT, TIP_TYPE.PUBLISHING, 'Publishing'), _defineProperty(_TIP_CONTENT, TIP_TYPE.DELETE_REVISION, 'Delete_tip'), _TIP_CONTENT);
|
package/dist/context.js
CHANGED
|
@@ -204,6 +204,12 @@ var Context = /*#__PURE__*/function () {
|
|
|
204
204
|
var docUuid = this.getSetting('docUuid');
|
|
205
205
|
return this.api.deleteSdocRevision(docUuid);
|
|
206
206
|
}
|
|
207
|
+
}, {
|
|
208
|
+
key: "deleteSdocOtherRevision",
|
|
209
|
+
value: function deleteSdocOtherRevision(revisionId) {
|
|
210
|
+
var docUuid = this.getSetting('docUuid');
|
|
211
|
+
return this.api.deleteSdocOtherRevision(docUuid, revisionId);
|
|
212
|
+
}
|
|
207
213
|
}, {
|
|
208
214
|
key: "getRevisionBaseVersionContent",
|
|
209
215
|
value: function getRevisionBaseVersionContent() {
|
package/package.json
CHANGED
|
@@ -378,5 +378,13 @@
|
|
|
378
378
|
"Has_been_removed_tip": "Document has been removed, please view other documents.",
|
|
379
379
|
"Revision_created": "Revision {{id}} created",
|
|
380
380
|
"Checking": "Checking...",
|
|
381
|
-
"Publishing": "Publishing..."
|
|
381
|
+
"Publishing": "Publishing...",
|
|
382
|
+
"Inline": "Inline",
|
|
383
|
+
"Block": "Block",
|
|
384
|
+
"Full_screen_mode": "Full screen mode",
|
|
385
|
+
"Image_border": "Image border",
|
|
386
|
+
"Delete_revision": "Delete revision",
|
|
387
|
+
"Delete_tip": "Are you sure you want to delete {{content}} ?",
|
|
388
|
+
"Delete_Successfully": "Delete Successfully",
|
|
389
|
+
"Delete_failed": "Smazání se nezdařilo"
|
|
382
390
|
}
|
|
@@ -378,5 +378,13 @@
|
|
|
378
378
|
"Has_been_removed_tip": "Document has been removed, please view other documents.",
|
|
379
379
|
"Revision_created": "Revision {{id}} created",
|
|
380
380
|
"Checking": "Checking...",
|
|
381
|
-
"Publishing": "Publishing..."
|
|
381
|
+
"Publishing": "Publishing...",
|
|
382
|
+
"Inline": "Inline",
|
|
383
|
+
"Block": "Block",
|
|
384
|
+
"Full_screen_mode": "Full screen mode",
|
|
385
|
+
"Image_border": "Image border",
|
|
386
|
+
"Delete_revision": "Delete revision",
|
|
387
|
+
"Delete_tip": "Are you sure you want to delete {{content}} ?",
|
|
388
|
+
"Delete_Successfully": "Delete Successfully",
|
|
389
|
+
"Delete_failed": "Löschen fehlgeschlagen"
|
|
382
390
|
}
|
|
@@ -382,5 +382,9 @@
|
|
|
382
382
|
"Inline": "Inline",
|
|
383
383
|
"Block": "Block",
|
|
384
384
|
"Full_screen_mode": "Full screen mode",
|
|
385
|
-
"Image_border": "Image border"
|
|
385
|
+
"Image_border": "Image border",
|
|
386
|
+
"Delete_revision": "Delete revision",
|
|
387
|
+
"Delete_tip": "Are you sure you want to delete {{content}} ?",
|
|
388
|
+
"Delete_Successfully": "Delete Successfully",
|
|
389
|
+
"Delete_failed": "Delete failed"
|
|
386
390
|
}
|
|
@@ -378,5 +378,13 @@
|
|
|
378
378
|
"Has_been_removed_tip": "Document has been removed, please view other documents.",
|
|
379
379
|
"Revision_created": "Revision {{id}} created",
|
|
380
380
|
"Checking": "Checking...",
|
|
381
|
-
"Publishing": "Publishing..."
|
|
381
|
+
"Publishing": "Publishing...",
|
|
382
|
+
"Inline": "Inline",
|
|
383
|
+
"Block": "Block",
|
|
384
|
+
"Full_screen_mode": "Full screen mode",
|
|
385
|
+
"Image_border": "Image border",
|
|
386
|
+
"Delete_revision": "Delete revision",
|
|
387
|
+
"Delete_tip": "Are you sure you want to delete {{content}} ?",
|
|
388
|
+
"Delete_Successfully": "Delete Successfully",
|
|
389
|
+
"Delete_failed": "Eliminar falló"
|
|
382
390
|
}
|
|
@@ -378,5 +378,13 @@
|
|
|
378
378
|
"Has_been_removed_tip": "Document has been removed, please view other documents.",
|
|
379
379
|
"Revision_created": "Revision {{id}} created",
|
|
380
380
|
"Checking": "Checking...",
|
|
381
|
-
"Publishing": "Publishing..."
|
|
381
|
+
"Publishing": "Publishing...",
|
|
382
|
+
"Inline": "Inline",
|
|
383
|
+
"Block": "Block",
|
|
384
|
+
"Full_screen_mode": "Full screen mode",
|
|
385
|
+
"Image_border": "Image border",
|
|
386
|
+
"Delete_revision": "Delete revision",
|
|
387
|
+
"Delete_tip": "Are you sure you want to delete {{content}} ?",
|
|
388
|
+
"Delete_Successfully": "Delete Successfully",
|
|
389
|
+
"Delete_failed": "Échec de la suppression"
|
|
382
390
|
}
|
|
@@ -378,5 +378,13 @@
|
|
|
378
378
|
"Has_been_removed_tip": "Document has been removed, please view other documents.",
|
|
379
379
|
"Revision_created": "Revision {{id}} created",
|
|
380
380
|
"Checking": "Checking...",
|
|
381
|
-
"Publishing": "Publishing..."
|
|
381
|
+
"Publishing": "Publishing...",
|
|
382
|
+
"Inline": "Inline",
|
|
383
|
+
"Block": "Block",
|
|
384
|
+
"Full_screen_mode": "Full screen mode",
|
|
385
|
+
"Image_border": "Image border",
|
|
386
|
+
"Delete_revision": "Delete revision",
|
|
387
|
+
"Delete_tip": "Are you sure you want to delete {{content}} ?",
|
|
388
|
+
"Delete_Successfully": "Delete Successfully",
|
|
389
|
+
"Delete_failed": "Rimozione fallita"
|
|
382
390
|
}
|
|
@@ -367,7 +367,7 @@
|
|
|
367
367
|
"Link_file": "Ссылка на файл",
|
|
368
368
|
"Keep_my_modification": "Сохранить мою модификацию",
|
|
369
369
|
"Keep_other_modification": "Сохранить чужую модификацию",
|
|
370
|
-
"Keep_both_modification": "
|
|
370
|
+
"Keep_both_modification": "Сохранить обе модификации",
|
|
371
371
|
"Tip": "Совет",
|
|
372
372
|
"Rebase_delete_no_change_revision_tip": "Редакция не внесла никаких изменений по сравнению с исходным документом. Вы хотите удалить эту редакцию?",
|
|
373
373
|
"Has_been_replaced_tip": "Содержимое документа было заменено. Обновите страницу.",
|
|
@@ -378,5 +378,13 @@
|
|
|
378
378
|
"Has_been_removed_tip": "Документ удален, посмотрите другие документы.",
|
|
379
379
|
"Revision_created": "Версия {{id}} создана",
|
|
380
380
|
"Checking": "Проверка...",
|
|
381
|
-
"Publishing": "Публикация..."
|
|
381
|
+
"Publishing": "Публикация...",
|
|
382
|
+
"Inline": "Встроенный",
|
|
383
|
+
"Block": "Блок",
|
|
384
|
+
"Full_screen_mode": "Полноэкранный режим",
|
|
385
|
+
"Image_border": "Граница изображения",
|
|
386
|
+
"Delete_revision": "Delete revision",
|
|
387
|
+
"Delete_tip": "Are you sure you want to delete {{content}} ?",
|
|
388
|
+
"Delete_Successfully": "Delete Successfully",
|
|
389
|
+
"Delete_failed": "Не удалось удалить"
|
|
382
390
|
}
|
|
@@ -382,5 +382,9 @@
|
|
|
382
382
|
"Inline": "嵌入行内",
|
|
383
383
|
"Block": "独占一行",
|
|
384
384
|
"Full_screen_mode": "全屏查看",
|
|
385
|
-
"Image_border": "图片边框"
|
|
385
|
+
"Image_border": "图片边框",
|
|
386
|
+
"Delete_revision": "删除修订稿",
|
|
387
|
+
"Delete_tip": "确定要删除 {{content}} 吗?",
|
|
388
|
+
"Delete_Successfully": "删除成功",
|
|
389
|
+
"Delete_failed": "删除失败"
|
|
386
390
|
}
|