@seafile/sdoc-editor 0.2.5-beta2 → 0.2.6
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 +0 -8
- package/dist/basic-sdk/extension/plugins/list/helpers.js +46 -6
- package/dist/components/doc-operations/revision-operations/index.js +1 -2
- package/dist/components/doc-operations/revision-operations/revisions/revisions-dialog/index.css +0 -12
- package/dist/components/doc-operations/revision-operations/revisions/revisions-dialog/index.js +12 -94
- package/dist/components/tip-dialog/index.js +3 -6
- package/dist/constants/index.js +3 -4
- package/dist/context.js +0 -6
- package/package.json +1 -1
- package/public/locales/en/sdoc-editor.json +1 -3
- package/public/locales/zh_CN/sdoc-editor.json +1 -3
- package/dist/components/doc-operations/revision-operations/revisions/revisions-dialog/revision-operation/index.css +0 -20
- package/dist/components/doc-operations/revision-operations/revisions/revisions-dialog/revision-operation/index.js +0 -57
package/dist/api/seafile-api.js
CHANGED
|
@@ -9,12 +9,6 @@ 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
|
-
};
|
|
18
12
|
this.req = axios.create({
|
|
19
13
|
baseURL: server,
|
|
20
14
|
headers: {
|
|
@@ -57,8 +51,6 @@ var SeafileAPI = /*#__PURE__*/function () {
|
|
|
57
51
|
var url = '/api/v2.1/seadoc/download-image/' + docUuid + '/' + encodeURIComponent(imageName);
|
|
58
52
|
return this.req.get(url);
|
|
59
53
|
}
|
|
60
|
-
|
|
61
|
-
// revision
|
|
62
54
|
}, {
|
|
63
55
|
key: "startRevise",
|
|
64
56
|
value: function startRevise(repoID, fileUuid, path) {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
2
|
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
3
|
-
import { Editor, Element } from '@seafile/slate';
|
|
4
|
-
import { CHECK_LIST_ITEM, CODE_BLOCK, CODE_LINE, PARAGRAPH, TABLE } from '../../constants';
|
|
5
|
-
import {
|
|
3
|
+
import { Editor, Element, Node, Range, Text } from '@seafile/slate';
|
|
4
|
+
import { CHECK_LIST_ITEM, CODE_BLOCK, CODE_LINE, LIST_ITEM, PARAGRAPH, TABLE } from '../../constants';
|
|
5
|
+
import { isRangeAcrossBlocks } from '../../core';
|
|
6
6
|
import { toggleList } from './transforms';
|
|
7
|
+
import { getListTypes } from './queries';
|
|
7
8
|
export var isMenuDisabled = function isMenuDisabled(editor, readonly) {
|
|
8
9
|
if (readonly) return true;
|
|
9
10
|
if (editor.selection == null) return true;
|
|
@@ -35,9 +36,48 @@ export var isMenuDisabled = function isMenuDisabled(editor, readonly) {
|
|
|
35
36
|
return false;
|
|
36
37
|
};
|
|
37
38
|
export var getListType = function getListType(editor, type) {
|
|
38
|
-
var
|
|
39
|
-
if (!
|
|
40
|
-
|
|
39
|
+
var selection = editor.selection;
|
|
40
|
+
if (!selection) return;
|
|
41
|
+
var selectedListNodeEntry;
|
|
42
|
+
if (Range.isCollapsed(selection)) {
|
|
43
|
+
var _Editor$nodes = Editor.nodes(editor, {
|
|
44
|
+
match: function match(node) {
|
|
45
|
+
return getListTypes().includes(node.type);
|
|
46
|
+
},
|
|
47
|
+
mode: 'lowest'
|
|
48
|
+
}),
|
|
49
|
+
_Editor$nodes2 = _slicedToArray(_Editor$nodes, 1),
|
|
50
|
+
nodeEntry = _Editor$nodes2[0];
|
|
51
|
+
selectedListNodeEntry = nodeEntry;
|
|
52
|
+
} else {
|
|
53
|
+
var anchor = selection.anchor,
|
|
54
|
+
focus = selection.focus;
|
|
55
|
+
var commonNodeEntry = Node.common(editor, anchor.path, focus.path);
|
|
56
|
+
// Select condition:
|
|
57
|
+
// 1. Select in one list
|
|
58
|
+
// 2. Select in one list item
|
|
59
|
+
// 3. Select in one line
|
|
60
|
+
if (getListTypes().includes(commonNodeEntry[0].type)) {
|
|
61
|
+
// Select in one list
|
|
62
|
+
selectedListNodeEntry = commonNodeEntry;
|
|
63
|
+
} else if (commonNodeEntry[0].type === LIST_ITEM) {
|
|
64
|
+
// Select in one list item
|
|
65
|
+
selectedListNodeEntry = Editor.parent(editor, commonNodeEntry[1]);
|
|
66
|
+
} else if (Text.isText(commonNodeEntry[0])) {
|
|
67
|
+
// Select in one line
|
|
68
|
+
var _Editor$nodes3 = Editor.nodes(editor, {
|
|
69
|
+
at: commonNodeEntry[1],
|
|
70
|
+
match: function match(node) {
|
|
71
|
+
return getListTypes().includes(node.type);
|
|
72
|
+
},
|
|
73
|
+
mode: 'lowest'
|
|
74
|
+
}),
|
|
75
|
+
_Editor$nodes4 = _slicedToArray(_Editor$nodes3, 1),
|
|
76
|
+
_nodeEntry2 = _Editor$nodes4[0];
|
|
77
|
+
selectedListNodeEntry = _nodeEntry2;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return selectedListNodeEntry ? selectedListNodeEntry[0].type : PARAGRAPH;
|
|
41
81
|
};
|
|
42
82
|
export var setListType = function setListType(editor, type) {
|
|
43
83
|
toggleList(editor, type);
|
|
@@ -199,8 +199,7 @@ var RevisionOperations = function RevisionOperations(_ref) {
|
|
|
199
199
|
}), isShowTip && /*#__PURE__*/React.createElement(TipDialog, {
|
|
200
200
|
tipType: tipType,
|
|
201
201
|
onSubmit: onSubmit,
|
|
202
|
-
onClose: onClose
|
|
203
|
-
zIndex: 1072
|
|
202
|
+
onClose: onClose
|
|
204
203
|
}));
|
|
205
204
|
};
|
|
206
205
|
export default RevisionOperations;
|
package/dist/components/doc-operations/revision-operations/revisions/revisions-dialog/index.css
CHANGED
|
@@ -60,10 +60,6 @@
|
|
|
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
|
-
|
|
67
63
|
.revisions-dialog .revisions-body .sdoc-revision:hover {
|
|
68
64
|
cursor: pointer;
|
|
69
65
|
background-color: #f5f5f5;
|
|
@@ -116,11 +112,3 @@
|
|
|
116
112
|
.revisions-dialog .sdoc-revision.loading:hover {
|
|
117
113
|
background-color: unset;
|
|
118
114
|
}
|
|
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,17 +3,12 @@ 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';
|
|
7
6
|
import CommonLoading from '../../../../common-loading';
|
|
8
7
|
import context from '../../../../../context';
|
|
9
8
|
import { Revision } from '../../../../../model';
|
|
10
9
|
import { getErrorMsg } from '../../../../../utils';
|
|
11
10
|
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';
|
|
15
11
|
import './index.css';
|
|
16
|
-
import { TIP_CONTENT, TIP_TYPE } from '../../../../../constants';
|
|
17
12
|
var RevisionsDialog = function RevisionsDialog(_ref) {
|
|
18
13
|
var _revisionListRef$curr;
|
|
19
14
|
var updateRevisionsCount = _ref.updateRevisionsCount,
|
|
@@ -44,18 +39,6 @@ var RevisionsDialog = function RevisionsDialog(_ref) {
|
|
|
44
39
|
var perPage = 25;
|
|
45
40
|
var repoID = context.getSetting('repoID');
|
|
46
41
|
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];
|
|
59
42
|
|
|
60
43
|
// did mount
|
|
61
44
|
useEffect(function () {
|
|
@@ -89,9 +72,7 @@ var RevisionsDialog = function RevisionsDialog(_ref) {
|
|
|
89
72
|
|
|
90
73
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
91
74
|
}, [revisions, page, perPage]);
|
|
92
|
-
var openRevision = useCallback(function (
|
|
93
|
-
eventStopPropagation(event);
|
|
94
|
-
if (event.target.className.includes('sdoc-revision-operation-toggle')) return;
|
|
75
|
+
var openRevision = useCallback(function (revisionId) {
|
|
95
76
|
window.location.href = "".concat(siteRoot, "lib/").concat(repoID, "/revisions/").concat(revisionId, "/");
|
|
96
77
|
|
|
97
78
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -113,35 +94,6 @@ var RevisionsDialog = function RevisionsDialog(_ref) {
|
|
|
113
94
|
|
|
114
95
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
115
96
|
}, [(_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
|
-
console.log(revisions);
|
|
125
|
-
var revisionIndex = revisions.findIndex(function (revision) {
|
|
126
|
-
return revision.id === operatingRevisionId;
|
|
127
|
-
});
|
|
128
|
-
if (revisionIndex === -1) {
|
|
129
|
-
closeDeleteTipDialog();
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
var revision = revisions[revisionIndex];
|
|
133
|
-
context.deleteSdocOtherRevision(revision.id).then(function (res) {
|
|
134
|
-
var newRevisions = revisions.slice(0);
|
|
135
|
-
newRevisions.splice(revisionIndex, 1);
|
|
136
|
-
updateRevisionsCount(newRevisions.length);
|
|
137
|
-
setRevisions(newRevisions);
|
|
138
|
-
closeDeleteTipDialog();
|
|
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]);
|
|
145
97
|
var renderContent = useCallback(function () {
|
|
146
98
|
if (page === 1 && isLoading) {
|
|
147
99
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -165,41 +117,25 @@ var RevisionsDialog = function RevisionsDialog(_ref) {
|
|
|
165
117
|
}, t('ID')), /*#__PURE__*/React.createElement("div", {
|
|
166
118
|
className: "sdoc-revision-user-header",
|
|
167
119
|
style: {
|
|
168
|
-
width: '
|
|
120
|
+
width: '30%'
|
|
169
121
|
}
|
|
170
122
|
}, t('Creator')), /*#__PURE__*/React.createElement("div", {
|
|
171
123
|
className: "sdoc-revision-time-header",
|
|
172
124
|
style: {
|
|
173
125
|
width: '30%'
|
|
174
126
|
}
|
|
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", {
|
|
127
|
+
}, t('Created_time'))), /*#__PURE__*/React.createElement("div", {
|
|
181
128
|
className: "sdoc-revisions-content",
|
|
182
129
|
onScroll: onScroll
|
|
183
130
|
}, /*#__PURE__*/React.createElement("div", {
|
|
184
131
|
className: "sdoc-revisions-list",
|
|
185
132
|
ref: revisionListRef
|
|
186
133
|
}, revisions.map(function (revision) {
|
|
187
|
-
var revisionId = revision.id;
|
|
188
|
-
var isOperating = operatingRevisionId === revisionId;
|
|
189
|
-
var isActive = activeRevisionId === revisionId;
|
|
190
134
|
return /*#__PURE__*/React.createElement("div", {
|
|
135
|
+
className: "sdoc-revision",
|
|
191
136
|
key: revision.id,
|
|
192
|
-
|
|
193
|
-
|
|
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('');
|
|
137
|
+
onClick: function onClick() {
|
|
138
|
+
return openRevision(revision.id);
|
|
203
139
|
}
|
|
204
140
|
}, /*#__PURE__*/React.createElement("div", {
|
|
205
141
|
className: "sdoc-revision-name",
|
|
@@ -208,35 +144,24 @@ var RevisionsDialog = function RevisionsDialog(_ref) {
|
|
|
208
144
|
}
|
|
209
145
|
}, /*#__PURE__*/React.createElement("div", {
|
|
210
146
|
className: "sdoc-revision-name-content"
|
|
211
|
-
}, t('Revision') + ' ' +
|
|
147
|
+
}, t('Revision') + ' ' + revision.id)), /*#__PURE__*/React.createElement("div", {
|
|
212
148
|
className: "sdoc-revision-user",
|
|
213
149
|
style: {
|
|
214
|
-
width: '
|
|
150
|
+
width: '30%'
|
|
215
151
|
}
|
|
216
152
|
}, revision.nickname), /*#__PURE__*/React.createElement("div", {
|
|
217
153
|
className: "sdoc-revision-time",
|
|
218
154
|
style: {
|
|
219
155
|
width: '30%'
|
|
220
156
|
}
|
|
221
|
-
}, revision.createdTime)
|
|
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
|
-
})));
|
|
157
|
+
}, revision.createdTime));
|
|
233
158
|
}), isLoading && /*#__PURE__*/React.createElement("div", {
|
|
234
159
|
className: "sdoc-revision loading"
|
|
235
160
|
}, /*#__PURE__*/React.createElement(CommonLoading, null)))));
|
|
236
161
|
|
|
237
162
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
238
|
-
}, [page, revisions, isLoading, errorMessage
|
|
239
|
-
return /*#__PURE__*/React.createElement(
|
|
163
|
+
}, [page, revisions, isLoading, errorMessage]);
|
|
164
|
+
return /*#__PURE__*/React.createElement(Modal, {
|
|
240
165
|
isOpen: true,
|
|
241
166
|
toggle: toggle,
|
|
242
167
|
className: "revisions-dialog"
|
|
@@ -244,13 +169,6 @@ var RevisionsDialog = function RevisionsDialog(_ref) {
|
|
|
244
169
|
toggle: toggle
|
|
245
170
|
}, t('Revision')), /*#__PURE__*/React.createElement(ModalBody, {
|
|
246
171
|
className: "revisions-body"
|
|
247
|
-
}, renderContent()))
|
|
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
|
-
})));
|
|
172
|
+
}, renderContent()));
|
|
255
173
|
};
|
|
256
174
|
export default RevisionsDialog;
|
|
@@ -12,10 +12,7 @@ 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
|
|
16
|
-
_ref$zIndex = _ref.zIndex,
|
|
17
|
-
zIndex = _ref$zIndex === void 0 ? 1071 : _ref$zIndex,
|
|
18
|
-
children = _ref.children;
|
|
15
|
+
propsOnSubmit = _ref.onSubmit;
|
|
19
16
|
var _useTranslation = useTranslation(),
|
|
20
17
|
t = _useTranslation.t;
|
|
21
18
|
var _useState = useState(),
|
|
@@ -49,7 +46,7 @@ var TipDialog = function TipDialog(_ref) {
|
|
|
49
46
|
return /*#__PURE__*/React.createElement(Modal, {
|
|
50
47
|
isOpen: true,
|
|
51
48
|
autoFocus: false,
|
|
52
|
-
zIndex:
|
|
49
|
+
zIndex: 1071,
|
|
53
50
|
returnFocusAfterClose: false,
|
|
54
51
|
toggle: closeDialog,
|
|
55
52
|
className: classnames('sdoc-tip-dialog', className),
|
|
@@ -58,7 +55,7 @@ var TipDialog = function TipDialog(_ref) {
|
|
|
58
55
|
toggle: NOT_CLOSE_DIALOG_TIP_TYPE.includes(tipType) ? undefined : closeDialog
|
|
59
56
|
}, t(TIP_TITLE[tipType])), /*#__PURE__*/React.createElement(ModalBody, {
|
|
60
57
|
className: "sdoc-tip-body"
|
|
61
|
-
},
|
|
58
|
+
}, /*#__PURE__*/React.createElement(TipContent, {
|
|
62
59
|
tipType: tipType
|
|
63
60
|
})), !NOT_CLOSE_DIALOG_TIP_TYPE.includes(tipType) && /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
|
|
64
61
|
color: "secondary",
|
package/dist/constants/index.js
CHANGED
|
@@ -23,8 +23,7 @@ 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'
|
|
27
|
-
DELETE_REVISION: 'delete_revision'
|
|
26
|
+
PUBLISHING: 'publishing'
|
|
28
27
|
};
|
|
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'),
|
|
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'),
|
|
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);
|
package/dist/context.js
CHANGED
|
@@ -204,12 +204,6 @@ 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
|
-
}
|
|
213
207
|
}, {
|
|
214
208
|
key: "getRevisionBaseVersionContent",
|
|
215
209
|
value: function getRevisionBaseVersionContent() {
|
package/package.json
CHANGED
|
@@ -382,7 +382,5 @@
|
|
|
382
382
|
"Inline": "Inline",
|
|
383
383
|
"Block": "Block",
|
|
384
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}}?"
|
|
385
|
+
"Image_border": "Image border"
|
|
388
386
|
}
|
|
@@ -1,20 +0,0 @@
|
|
|
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
|
-
|
|
@@ -1,57 +0,0 @@
|
|
|
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
|
-
}, [onDeleteOtherRevision]);
|
|
29
|
-
if (!isActive && !isOperating) return null;
|
|
30
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("i", {
|
|
31
|
-
className: "sdocfont sdoc-more sdoc-revision-operation-toggle",
|
|
32
|
-
id: targetId
|
|
33
|
-
}), /*#__PURE__*/React.createElement(UncontrolledPopover, {
|
|
34
|
-
target: targetId,
|
|
35
|
-
className: "sdoc-menu-popover sdoc-dropdown-menu sdoc-revision-menu-popover",
|
|
36
|
-
trigger: "legacy",
|
|
37
|
-
placement: "bottom-start",
|
|
38
|
-
hideArrow: true,
|
|
39
|
-
toggle: toggle,
|
|
40
|
-
fade: false,
|
|
41
|
-
modifiers: {
|
|
42
|
-
preventOverflow: {
|
|
43
|
-
boundariesElement: document.body
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
ref: popoverRef
|
|
47
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
48
|
-
className: "sdoc-dropdown-menu-container"
|
|
49
|
-
}, /*#__PURE__*/React.createElement(DropdownMenuItem, {
|
|
50
|
-
onClick: deleteRevision,
|
|
51
|
-
menuConfig: {
|
|
52
|
-
iconClass: 'sdocfont sdoc-delete',
|
|
53
|
-
text: 'Delete'
|
|
54
|
-
}
|
|
55
|
-
}))));
|
|
56
|
-
};
|
|
57
|
-
export default RevisionOperation;
|