@seafile/sdoc-editor 0.1.62 → 0.1.64
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/basic-sdk/comment/comment-item.js +16 -4
- package/dist/basic-sdk/comment/dialogs/delete-comment-dialog.js +26 -0
- package/dist/basic-sdk/editor.js +1 -2
- package/dist/basic-sdk/extension/plugins/text-align/menu/style.css +4 -0
- package/package.json +1 -1
- package/public/locales/en/sdoc-editor.json +4 -1
- package/public/locales/zh-CN/sdoc-editor.json +4 -1
|
@@ -4,6 +4,7 @@ import { withTranslation } from 'react-i18next';
|
|
|
4
4
|
import { PopoverBody, UncontrolledPopover } from 'reactstrap';
|
|
5
5
|
import dayjs from 'dayjs';
|
|
6
6
|
import CommentEditor from './comment-editor';
|
|
7
|
+
import DeleteCommentDialog from './dialogs/delete-comment-dialog';
|
|
7
8
|
var CommentItem = function CommentItem(_ref) {
|
|
8
9
|
var comment = _ref.comment,
|
|
9
10
|
updateComment = _ref.updateComment,
|
|
@@ -30,10 +31,18 @@ var CommentItem = function CommentItem(_ref) {
|
|
|
30
31
|
setIsEditing(true);
|
|
31
32
|
popoverRef.current.toggle();
|
|
32
33
|
}, []);
|
|
34
|
+
var _useState5 = useState(false),
|
|
35
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
36
|
+
isShowDeleteDialog = _useState6[0],
|
|
37
|
+
setIsShowDeleteDialog = _useState6[1];
|
|
33
38
|
var onDeleteToggle = useCallback(function () {
|
|
34
|
-
|
|
39
|
+
setIsShowDeleteDialog(true);
|
|
35
40
|
popoverRef.current.toggle();
|
|
36
|
-
}, [
|
|
41
|
+
}, []);
|
|
42
|
+
var _deleteComment = useCallback(function () {
|
|
43
|
+
deleteComment(comment.id);
|
|
44
|
+
setIsShowDeleteDialog(false);
|
|
45
|
+
}, [comment.id, deleteComment]);
|
|
37
46
|
var _updateComment = useCallback(function (elementId, commentId, newComment) {
|
|
38
47
|
if (newComment.comment !== comment.comment) {
|
|
39
48
|
updateComment(elementId, commentId, newComment);
|
|
@@ -83,11 +92,14 @@ var CommentItem = function CommentItem(_ref) {
|
|
|
83
92
|
onClick: onDeleteToggle
|
|
84
93
|
}, t('delete')))))), !isActive && /*#__PURE__*/React.createElement("span", {
|
|
85
94
|
className: "comment-time"
|
|
86
|
-
}, dayjs(comment.updated_at).format('HH:mm'))), /*#__PURE__*/React.createElement("div", {
|
|
95
|
+
}, dayjs(comment.updated_at).format('MM:DD HH:mm'))), /*#__PURE__*/React.createElement("div", {
|
|
87
96
|
className: "comment-content"
|
|
88
97
|
}, isEditing && /*#__PURE__*/React.createElement(CommentEditor, {
|
|
89
98
|
comment: comment,
|
|
90
99
|
updateComment: _updateComment
|
|
91
|
-
}), !isEditing && /*#__PURE__*/React.createElement(React.Fragment, null, comment.comment)))
|
|
100
|
+
}), !isEditing && /*#__PURE__*/React.createElement(React.Fragment, null, comment.comment))), isShowDeleteDialog && /*#__PURE__*/React.createElement(DeleteCommentDialog, {
|
|
101
|
+
deleteComment: _deleteComment,
|
|
102
|
+
setIsShowDeleteModal: setIsShowDeleteDialog
|
|
103
|
+
}));
|
|
92
104
|
};
|
|
93
105
|
export default withTranslation('sdoc-editor')(CommentItem);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { withTranslation } from 'react-i18next';
|
|
3
|
+
import { Button, ModalHeader, Modal, ModalBody, ModalFooter } from 'reactstrap';
|
|
4
|
+
var DeleteCommentDialog = function DeleteCommentDialog(_ref) {
|
|
5
|
+
var setIsShowDeleteModal = _ref.setIsShowDeleteModal,
|
|
6
|
+
deleteComment = _ref.deleteComment,
|
|
7
|
+
t = _ref.t;
|
|
8
|
+
return /*#__PURE__*/React.createElement(Modal, {
|
|
9
|
+
className: "comment-delete-modal",
|
|
10
|
+
isOpen: true,
|
|
11
|
+
centered: true
|
|
12
|
+
}, /*#__PURE__*/React.createElement(ModalHeader, {
|
|
13
|
+
toggle: function toggle() {
|
|
14
|
+
setIsShowDeleteModal(false);
|
|
15
|
+
}
|
|
16
|
+
}, t('Delete_comment')), /*#__PURE__*/React.createElement(ModalBody, null, t('Are_you_sure_to_delete_this_comment')), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
|
|
17
|
+
color: "secondary",
|
|
18
|
+
onClick: function onClick() {
|
|
19
|
+
setIsShowDeleteModal(false);
|
|
20
|
+
}
|
|
21
|
+
}, t('cancel')), /*#__PURE__*/React.createElement(Button, {
|
|
22
|
+
color: "primary",
|
|
23
|
+
onClick: deleteComment
|
|
24
|
+
}, t('submit'))));
|
|
25
|
+
};
|
|
26
|
+
export default withTranslation('sdoc-editor')(DeleteCommentDialog);
|
package/dist/basic-sdk/editor.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
2
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import { Editable, Slate, ReactEditor } from '@seafile/slate-react';
|
|
3
|
+
import { Editable, Slate } from '@seafile/slate-react';
|
|
5
4
|
import defaultEditor, { renderLeaf, renderElement, Toolbar, ContextMenu } from './extension';
|
|
6
5
|
import { focusEditor } from './extension/core';
|
|
7
6
|
import { withSocketIO } from './socket';
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
display: flex;
|
|
3
3
|
position: relative;
|
|
4
4
|
margin-right: 10px;
|
|
5
|
+
border: 1px solid transparent;
|
|
6
|
+
padding: 1px 0px;
|
|
5
7
|
}
|
|
6
8
|
|
|
7
9
|
.align-menu .align-toggle {
|
|
@@ -9,6 +11,8 @@
|
|
|
9
11
|
display: flex;
|
|
10
12
|
justify-content: space-between;
|
|
11
13
|
align-items: center;
|
|
14
|
+
height: 30px;
|
|
15
|
+
line-height: 30px;
|
|
12
16
|
}
|
|
13
17
|
|
|
14
18
|
.align-menu .align-toggle-disabled {
|
package/package.json
CHANGED
|
@@ -252,5 +252,8 @@
|
|
|
252
252
|
"unstarred": "unstarred",
|
|
253
253
|
"Star": "Star",
|
|
254
254
|
"Unstar": "Unstar",
|
|
255
|
-
"Auto_wrap": "Auto wrap"
|
|
255
|
+
"Auto_wrap": "Auto wrap",
|
|
256
|
+
"Add_comment": "Add comment",
|
|
257
|
+
"Delete_comment": "Delete comment",
|
|
258
|
+
"Are_you_sure_to_delete_this_comment": "Are you sure to delete this comment?"
|
|
256
259
|
}
|
|
@@ -245,5 +245,8 @@
|
|
|
245
245
|
"Insert_below": "在下方插入",
|
|
246
246
|
"Insert_on_the_right": "在右侧插入",
|
|
247
247
|
"Insert_on_the_left": "在左侧插入",
|
|
248
|
-
"Auto_wrap": "自动换行"
|
|
248
|
+
"Auto_wrap": "自动换行",
|
|
249
|
+
"Add_comment": "添加评论",
|
|
250
|
+
"Delete_comment": "删除评论",
|
|
251
|
+
"Are_you_sure_to_delete_this_comment": "你确定要删除这个评论吗?"
|
|
249
252
|
}
|