@seafile/sdoc-editor 0.1.102 → 0.1.104
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/comment-delete-shadow.js +37 -0
- package/dist/basic-sdk/comment/comment/comment-item-content.js +36 -65
- package/dist/basic-sdk/comment/comment/comment-item-reply.js +25 -45
- package/dist/basic-sdk/comment/comment/comment-item-wrapper.js +26 -4
- package/dist/basic-sdk/comment/comment/comment-list.css +16 -0
- package/dist/basic-sdk/comment/comment/editor-comment.js +4 -1
- package/dist/basic-sdk/comment/comment/global-comment.js +13 -12
- package/dist/basic-sdk/comment/reducer/comment-reducer.js +3 -3
- package/dist/basic-sdk/extension/constants/font.js +7 -1
- package/dist/basic-sdk/extension/constants/index.js +3 -2
- package/dist/basic-sdk/extension/plugins/font/helpers.js +17 -4
- package/package.json +1 -1
- package/dist/basic-sdk/comment/dialogs/delete-comment-dialog.js +0 -33
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { withTranslation } from 'react-i18next';
|
|
3
|
+
import { Button } from 'reactstrap';
|
|
4
|
+
var CommentDeleteShadow = function CommentDeleteShadow(_ref) {
|
|
5
|
+
var type = _ref.type,
|
|
6
|
+
setIsShowDeleteModal = _ref.setIsShowDeleteModal,
|
|
7
|
+
deleteConfirm = _ref.deleteConfirm,
|
|
8
|
+
t = _ref.t;
|
|
9
|
+
var onDeleteCancel = useCallback(function (event) {
|
|
10
|
+
event.stopPropagation();
|
|
11
|
+
setIsShowDeleteModal(false);
|
|
12
|
+
}, [setIsShowDeleteModal]);
|
|
13
|
+
var onDeleteConfirm = useCallback(function (event) {
|
|
14
|
+
event.stopPropagation();
|
|
15
|
+
deleteConfirm();
|
|
16
|
+
}, [deleteConfirm]);
|
|
17
|
+
var message = type === 'comment' ? 'comment' : 'reply';
|
|
18
|
+
var content = t("Are_you_sure_to_delete_this_".concat(message));
|
|
19
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
20
|
+
className: "comment-delete-shadow"
|
|
21
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
22
|
+
className: "delete-tip"
|
|
23
|
+
}, content), /*#__PURE__*/React.createElement("div", {
|
|
24
|
+
className: "delete-control"
|
|
25
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
26
|
+
color: "secondary",
|
|
27
|
+
className: "mr-2",
|
|
28
|
+
onClick: onDeleteCancel
|
|
29
|
+
}, t('Cancel')), /*#__PURE__*/React.createElement(Button, {
|
|
30
|
+
color: "primary",
|
|
31
|
+
onClick: onDeleteConfirm
|
|
32
|
+
}, t('Confirm'))));
|
|
33
|
+
};
|
|
34
|
+
CommentDeleteShadow.defaultProps = {
|
|
35
|
+
type: 'comment'
|
|
36
|
+
};
|
|
37
|
+
export default withTranslation('sdoc-editor')(CommentDeleteShadow);
|
|
@@ -1,54 +1,34 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
-
import React, {
|
|
3
|
+
import React, { useCallback, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { withTranslation } from 'react-i18next';
|
|
5
|
-
import {
|
|
5
|
+
import { Dropdown, DropdownItem, DropdownMenu, DropdownToggle, UncontrolledTooltip } from 'reactstrap';
|
|
6
6
|
import dayjs from 'dayjs';
|
|
7
7
|
import CommentEditor from './comment-editor';
|
|
8
|
-
import DeleteCommentDialog from '../dialogs/delete-comment-dialog';
|
|
9
8
|
var CommentItem = function CommentItem(_ref) {
|
|
10
9
|
var isActive = _ref.isActive,
|
|
11
10
|
container = _ref.container,
|
|
12
11
|
comment = _ref.comment,
|
|
13
12
|
updateComment = _ref.updateComment,
|
|
14
13
|
updateCommentState = _ref.updateCommentState,
|
|
15
|
-
|
|
14
|
+
onDeleteComment = _ref.onDeleteComment,
|
|
16
15
|
t = _ref.t;
|
|
17
|
-
var popoverRef = useRef(null);
|
|
18
16
|
var _useState = useState(false),
|
|
19
17
|
_useState2 = _slicedToArray(_useState, 2),
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
var onMouseEnter = useCallback(function () {
|
|
23
|
-
if (!isActive) return;
|
|
24
|
-
setMouseOver(true);
|
|
25
|
-
}, [isActive]);
|
|
26
|
-
var onMouseLeave = useCallback(function () {
|
|
27
|
-
if (!isActive) return;
|
|
28
|
-
setMouseOver(false);
|
|
29
|
-
}, [isActive]);
|
|
30
|
-
|
|
31
|
-
// const [isShowItemMenu, setIsShowItemMenu] = useState(false);
|
|
18
|
+
isDropdownOpen = _useState2[0],
|
|
19
|
+
setDropdownOpen = _useState2[1];
|
|
32
20
|
var _useState3 = useState(false),
|
|
33
21
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
34
22
|
isEditing = _useState4[0],
|
|
35
23
|
setIsEditing = _useState4[1];
|
|
36
|
-
var onEditToggle = useCallback(function () {
|
|
24
|
+
var onEditToggle = useCallback(function (event) {
|
|
25
|
+
event.stopPropagation();
|
|
37
26
|
setIsEditing(true);
|
|
38
|
-
popoverRef.current.toggle();
|
|
39
27
|
}, []);
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
var onDeleteToggle = useCallback(function () {
|
|
45
|
-
setIsShowDeleteDialog(true);
|
|
46
|
-
popoverRef.current.toggle();
|
|
47
|
-
}, []);
|
|
48
|
-
var _deleteComment = useCallback(function () {
|
|
49
|
-
deleteComment(comment.id);
|
|
50
|
-
setIsShowDeleteDialog(false);
|
|
51
|
-
}, [comment.id, deleteComment]);
|
|
28
|
+
var onDeleteToggle = useCallback(function (event) {
|
|
29
|
+
event.stopPropagation();
|
|
30
|
+
onDeleteComment(true);
|
|
31
|
+
}, [onDeleteComment]);
|
|
52
32
|
var updateContent = useCallback(function (content) {
|
|
53
33
|
var commentId = comment.id;
|
|
54
34
|
if (comment.comment !== content) {
|
|
@@ -71,20 +51,19 @@ var CommentItem = function CommentItem(_ref) {
|
|
|
71
51
|
};
|
|
72
52
|
updateCommentState(commentId, newComment);
|
|
73
53
|
}, [comment.id, updateCommentState]);
|
|
74
|
-
var markAsResolved = useCallback(function () {
|
|
54
|
+
var markAsResolved = useCallback(function (event) {
|
|
55
|
+
event.stopPropagation();
|
|
75
56
|
updateCommentResolved(true);
|
|
76
57
|
}, [updateCommentResolved]);
|
|
77
|
-
var resubmit = useCallback(function () {
|
|
58
|
+
var resubmit = useCallback(function (event) {
|
|
59
|
+
event.stopPropagation();
|
|
78
60
|
updateCommentResolved(false);
|
|
79
|
-
popoverRef.current.toggle();
|
|
80
61
|
}, [updateCommentResolved]);
|
|
81
62
|
var menuId = useMemo(function () {
|
|
82
63
|
return "comment_".concat(comment.id);
|
|
83
64
|
}, [comment]);
|
|
84
|
-
return /*#__PURE__*/React.createElement(
|
|
85
|
-
className: "comment-item"
|
|
86
|
-
onMouseEnter: onMouseEnter,
|
|
87
|
-
onMouseLeave: onMouseLeave
|
|
65
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
66
|
+
className: "comment-item"
|
|
88
67
|
}, /*#__PURE__*/React.createElement("div", {
|
|
89
68
|
className: "comment-header"
|
|
90
69
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -100,7 +79,7 @@ var CommentItem = function CommentItem(_ref) {
|
|
|
100
79
|
className: "name"
|
|
101
80
|
}, comment.user_name), /*#__PURE__*/React.createElement("span", {
|
|
102
81
|
className: "time"
|
|
103
|
-
}, dayjs(comment.updated_at).format('MM-DD HH:mm')))),
|
|
82
|
+
}, dayjs(comment.updated_at).format('MM-DD HH:mm')))), isActive && /*#__PURE__*/React.createElement("div", {
|
|
104
83
|
className: "d-flex"
|
|
105
84
|
}, !comment.resolved && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
106
85
|
className: "comment-operation mr-2",
|
|
@@ -116,44 +95,36 @@ var CommentItem = function CommentItem(_ref) {
|
|
|
116
95
|
},
|
|
117
96
|
fade: false,
|
|
118
97
|
placement: "bottom"
|
|
119
|
-
}, t('Resolved_tip'))), /*#__PURE__*/React.createElement(
|
|
120
|
-
|
|
98
|
+
}, t('Resolved_tip'))), /*#__PURE__*/React.createElement(Dropdown, {
|
|
99
|
+
isOpen: isDropdownOpen,
|
|
100
|
+
toggle: function toggle() {
|
|
101
|
+
return setDropdownOpen(!isDropdownOpen);
|
|
102
|
+
}
|
|
103
|
+
}, /*#__PURE__*/React.createElement(DropdownToggle, {
|
|
104
|
+
tag: "div",
|
|
121
105
|
className: "comment-operation"
|
|
122
106
|
}, /*#__PURE__*/React.createElement("i", {
|
|
123
107
|
className: "sdocfont sdoc-more-options"
|
|
124
|
-
})), /*#__PURE__*/React.createElement(
|
|
125
|
-
ref: popoverRef,
|
|
126
|
-
trigger: "legacy",
|
|
127
|
-
target: menuId,
|
|
128
|
-
placement: "bottom-end",
|
|
129
|
-
hideArrow: true,
|
|
108
|
+
})), /*#__PURE__*/React.createElement(DropdownMenu, {
|
|
130
109
|
container: container
|
|
131
|
-
}, /*#__PURE__*/React.createElement(
|
|
132
|
-
|
|
133
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
134
|
-
className: "sdoc-popover-menu"
|
|
135
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
136
|
-
className: "sdoc-popover-menu__item",
|
|
110
|
+
}, /*#__PURE__*/React.createElement(DropdownItem, {
|
|
111
|
+
tag: "div",
|
|
137
112
|
onClick: onEditToggle
|
|
138
|
-
}, t('Edit')), /*#__PURE__*/React.createElement(
|
|
139
|
-
|
|
113
|
+
}, t('Edit')), /*#__PURE__*/React.createElement(DropdownItem, {
|
|
114
|
+
tag: "div",
|
|
140
115
|
onClick: onDeleteToggle
|
|
141
|
-
}, t('Delete')), !comment.resolved && /*#__PURE__*/React.createElement(
|
|
142
|
-
|
|
116
|
+
}, t('Delete')), !comment.resolved && /*#__PURE__*/React.createElement(DropdownItem, {
|
|
117
|
+
tag: "div",
|
|
143
118
|
onClick: markAsResolved
|
|
144
|
-
}, t('Mark_as_Resolved')), comment.resolved && /*#__PURE__*/React.createElement(
|
|
145
|
-
|
|
119
|
+
}, t('Mark_as_Resolved')), comment.resolved && /*#__PURE__*/React.createElement(DropdownItem, {
|
|
120
|
+
tag: "div",
|
|
146
121
|
onClick: resubmit
|
|
147
|
-
}, t('Resubmit'))))))
|
|
122
|
+
}, t('Resubmit')))))), /*#__PURE__*/React.createElement("div", {
|
|
148
123
|
className: "comment-content"
|
|
149
124
|
}, isEditing && /*#__PURE__*/React.createElement(CommentEditor, {
|
|
150
125
|
content: comment.comment,
|
|
151
126
|
updateContent: updateContent,
|
|
152
127
|
setIsEditing: setIsEditing
|
|
153
|
-
}), !isEditing && /*#__PURE__*/React.createElement(React.Fragment, null, comment.comment)))
|
|
154
|
-
type: 'comment',
|
|
155
|
-
deleteConfirm: _deleteComment,
|
|
156
|
-
setIsShowDeleteModal: setIsShowDeleteDialog
|
|
157
|
-
}));
|
|
128
|
+
}), !isEditing && /*#__PURE__*/React.createElement(React.Fragment, null, comment.comment)));
|
|
158
129
|
};
|
|
159
130
|
export default withTranslation('sdoc-editor')(CommentItem);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
-
import React, {
|
|
2
|
+
import React, { useCallback, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { withTranslation } from 'react-i18next';
|
|
4
|
-
import { PopoverBody, UncontrolledPopover } from 'reactstrap';
|
|
4
|
+
import { Dropdown, DropdownItem, DropdownMenu, DropdownToggle, PopoverBody, UncontrolledPopover } from 'reactstrap';
|
|
5
5
|
import dayjs from 'dayjs';
|
|
6
6
|
import context from '../../../context';
|
|
7
7
|
import CommentEditor from './comment-editor';
|
|
8
|
-
import
|
|
8
|
+
import CommentDeleteShadow from './comment-delete-shadow';
|
|
9
9
|
var CommentItemReply = function CommentItemReply(_ref) {
|
|
10
10
|
var isActive = _ref.isActive,
|
|
11
11
|
container = _ref.container,
|
|
@@ -13,36 +13,25 @@ var CommentItemReply = function CommentItemReply(_ref) {
|
|
|
13
13
|
deleteReply = _ref.deleteReply,
|
|
14
14
|
updateReply = _ref.updateReply,
|
|
15
15
|
t = _ref.t;
|
|
16
|
-
var popoverRef = useRef(null);
|
|
17
16
|
var _useState = useState(false),
|
|
18
17
|
_useState2 = _slicedToArray(_useState, 2),
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var onMouseEnter = useCallback(function () {
|
|
22
|
-
if (!isActive) return;
|
|
23
|
-
setMouseOver(true);
|
|
24
|
-
}, [isActive]);
|
|
25
|
-
var onMouseLeave = useCallback(function () {
|
|
26
|
-
if (!isActive) return;
|
|
27
|
-
setMouseOver(false);
|
|
28
|
-
}, [isActive]);
|
|
29
|
-
|
|
30
|
-
// const [isShowItemMenu, setIsShowItemMenu] = useState(false);
|
|
18
|
+
isDropdownOpen = _useState2[0],
|
|
19
|
+
setDropdownOpen = _useState2[1];
|
|
31
20
|
var _useState3 = useState(false),
|
|
32
21
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
33
22
|
isEditing = _useState4[0],
|
|
34
23
|
setIsEditing = _useState4[1];
|
|
35
|
-
var onEditToggle = useCallback(function () {
|
|
24
|
+
var onEditToggle = useCallback(function (event) {
|
|
25
|
+
event.stopPropagation();
|
|
36
26
|
setIsEditing(true);
|
|
37
|
-
popoverRef.current.toggle();
|
|
38
27
|
}, []);
|
|
39
28
|
var _useState5 = useState(false),
|
|
40
29
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
41
30
|
isShowDeleteDialog = _useState6[0],
|
|
42
31
|
setIsShowDeleteDialog = _useState6[1];
|
|
43
|
-
var onDeleteToggle = useCallback(function () {
|
|
32
|
+
var onDeleteToggle = useCallback(function (event) {
|
|
33
|
+
event.stopPropagation();
|
|
44
34
|
setIsShowDeleteDialog(true);
|
|
45
|
-
popoverRef.current.toggle();
|
|
46
35
|
}, []);
|
|
47
36
|
var _deleteReply = useCallback(function () {
|
|
48
37
|
deleteReply(reply.id);
|
|
@@ -59,14 +48,9 @@ var CommentItemReply = function CommentItemReply(_ref) {
|
|
|
59
48
|
}
|
|
60
49
|
setIsEditing(false);
|
|
61
50
|
}, [reply, updateReply]);
|
|
62
|
-
var menuId = useMemo(function () {
|
|
63
|
-
return "reply_".concat(reply.id);
|
|
64
|
-
}, [reply]);
|
|
65
51
|
var user = context.getUserInfo();
|
|
66
|
-
return /*#__PURE__*/React.createElement(
|
|
67
|
-
className: "comment-item"
|
|
68
|
-
onMouseEnter: onMouseEnter,
|
|
69
|
-
onMouseLeave: onMouseLeave
|
|
52
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
53
|
+
className: "comment-item"
|
|
70
54
|
}, /*#__PURE__*/React.createElement("div", {
|
|
71
55
|
className: "comment-header"
|
|
72
56
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -82,35 +66,31 @@ var CommentItemReply = function CommentItemReply(_ref) {
|
|
|
82
66
|
className: "name"
|
|
83
67
|
}, reply.user_name), /*#__PURE__*/React.createElement("span", {
|
|
84
68
|
className: "time"
|
|
85
|
-
}, dayjs(reply.updated_at).format('MM-DD HH:mm')))),
|
|
86
|
-
|
|
69
|
+
}, dayjs(reply.updated_at).format('MM-DD HH:mm')))), isActive && user.username === reply.author && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Dropdown, {
|
|
70
|
+
isOpen: isDropdownOpen,
|
|
71
|
+
toggle: function toggle() {
|
|
72
|
+
return setDropdownOpen(!isDropdownOpen);
|
|
73
|
+
}
|
|
74
|
+
}, /*#__PURE__*/React.createElement(DropdownToggle, {
|
|
75
|
+
tag: "div",
|
|
87
76
|
className: "comment-operation"
|
|
88
77
|
}, /*#__PURE__*/React.createElement("i", {
|
|
89
78
|
className: "sdocfont sdoc-more-options"
|
|
90
|
-
})), /*#__PURE__*/React.createElement(
|
|
91
|
-
ref: popoverRef,
|
|
92
|
-
trigger: "legacy",
|
|
93
|
-
target: menuId,
|
|
94
|
-
placement: "bottom-end",
|
|
95
|
-
hideArrow: true,
|
|
79
|
+
})), /*#__PURE__*/React.createElement(DropdownMenu, {
|
|
96
80
|
container: container
|
|
97
|
-
}, /*#__PURE__*/React.createElement(
|
|
98
|
-
|
|
99
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
100
|
-
className: "sdoc-popover-menu"
|
|
101
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
102
|
-
className: "sdoc-popover-menu__item",
|
|
81
|
+
}, /*#__PURE__*/React.createElement(DropdownItem, {
|
|
82
|
+
tag: "div",
|
|
103
83
|
onClick: onEditToggle
|
|
104
|
-
}, t('Edit')), /*#__PURE__*/React.createElement(
|
|
105
|
-
|
|
84
|
+
}, t('Edit')), /*#__PURE__*/React.createElement(DropdownItem, {
|
|
85
|
+
tag: "div",
|
|
106
86
|
onClick: onDeleteToggle
|
|
107
|
-
}, t('Delete'))))))
|
|
87
|
+
}, t('Delete')))))), /*#__PURE__*/React.createElement("div", {
|
|
108
88
|
className: "comment-content"
|
|
109
89
|
}, isEditing && /*#__PURE__*/React.createElement(CommentEditor, {
|
|
110
90
|
content: reply.reply,
|
|
111
91
|
updateContent: updateContent,
|
|
112
92
|
setIsEditing: setIsEditing
|
|
113
|
-
}), !isEditing && /*#__PURE__*/React.createElement(React.Fragment, null, reply.reply))
|
|
93
|
+
}), !isEditing && /*#__PURE__*/React.createElement(React.Fragment, null, reply.reply)), isShowDeleteDialog && isActive && /*#__PURE__*/React.createElement(CommentDeleteShadow, {
|
|
114
94
|
type: "reply",
|
|
115
95
|
deleteConfirm: _deleteReply,
|
|
116
96
|
setIsShowDeleteModal: setIsShowDeleteDialog
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
1
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
3
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
4
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
4
|
-
import React, { useCallback, useRef } from 'react';
|
|
5
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
5
6
|
import dayjs from 'dayjs';
|
|
6
7
|
import classNames from 'classnames';
|
|
7
8
|
import context from '../../../context';
|
|
@@ -10,6 +11,7 @@ import CommentItemContent from './comment-item-content';
|
|
|
10
11
|
import CommentItemReply from './comment-item-reply';
|
|
11
12
|
import CommentEditor from './comment-editor';
|
|
12
13
|
import CommentItemResolvedReply from './comment-item-resolved-reply';
|
|
14
|
+
import CommentDeleteShadow from './comment-delete-shadow';
|
|
13
15
|
export default function CommentItemWrapper(_ref) {
|
|
14
16
|
var container = _ref.container,
|
|
15
17
|
isActive = _ref.isActive,
|
|
@@ -296,6 +298,22 @@ export default function CommentItemWrapper(_ref) {
|
|
|
296
298
|
var onItemClick = useCallback(function () {
|
|
297
299
|
onCommentClick(comment);
|
|
298
300
|
}, [comment, onCommentClick]);
|
|
301
|
+
var _useState = useState(false),
|
|
302
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
303
|
+
isShowDeleteDialog = _useState2[0],
|
|
304
|
+
setIsShowDeleteDialog = _useState2[1];
|
|
305
|
+
var onDeleteComment = useCallback(function () {
|
|
306
|
+
setIsShowDeleteDialog(true);
|
|
307
|
+
}, []);
|
|
308
|
+
var _deleteComment = useCallback(function () {
|
|
309
|
+
deleteComment(comment.id);
|
|
310
|
+
setIsShowDeleteDialog(false);
|
|
311
|
+
}, [comment.id, deleteComment]);
|
|
312
|
+
useEffect(function () {
|
|
313
|
+
if (!isActive) {
|
|
314
|
+
setIsShowDeleteDialog(false);
|
|
315
|
+
}
|
|
316
|
+
}, [isActive]);
|
|
299
317
|
var className = classNames('comment-ui-container', {
|
|
300
318
|
'active': isActive,
|
|
301
319
|
'sdoc-resolved': comment.resolved
|
|
@@ -313,9 +331,9 @@ export default function CommentItemWrapper(_ref) {
|
|
|
313
331
|
container: container,
|
|
314
332
|
isActive: isActive,
|
|
315
333
|
comment: comment,
|
|
316
|
-
deleteComment: deleteComment,
|
|
317
334
|
updateComment: updateComment,
|
|
318
|
-
updateCommentState: updateCommentState
|
|
335
|
+
updateCommentState: updateCommentState,
|
|
336
|
+
onDeleteComment: onDeleteComment
|
|
319
337
|
}), comment.replies && comment.replies.length > 0 && comment.replies.map(function (reply) {
|
|
320
338
|
var type = reply.type;
|
|
321
339
|
// type is reply | comment
|
|
@@ -339,7 +357,11 @@ export default function CommentItemWrapper(_ref) {
|
|
|
339
357
|
}, /*#__PURE__*/React.createElement(CommentEditor, {
|
|
340
358
|
placeholder: tip,
|
|
341
359
|
insertContent: insertContent
|
|
342
|
-
}))
|
|
360
|
+
})), isShowDeleteDialog && isActive && /*#__PURE__*/React.createElement(CommentDeleteShadow, {
|
|
361
|
+
type: 'comment',
|
|
362
|
+
deleteConfirm: _deleteComment,
|
|
363
|
+
setIsShowDeleteModal: setIsShowDeleteDialog
|
|
364
|
+
}));
|
|
343
365
|
}
|
|
344
366
|
CommentItemWrapper.defaultProps = {
|
|
345
367
|
container: 'sdoc-comment-list-container'
|
|
@@ -32,6 +32,22 @@
|
|
|
32
32
|
cursor: pointer;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
.sdoc-comment-list-container .comment-delete-shadow {
|
|
36
|
+
position: absolute;
|
|
37
|
+
inset: 0;
|
|
38
|
+
background-color: rgba(0, 0, 0, .7);
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
align-items: center;
|
|
42
|
+
padding-top: 10px;
|
|
43
|
+
color: #fff;
|
|
44
|
+
z-index: 1;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.sdoc-comment-list-container .comment-delete-shadow .delete-tip {
|
|
48
|
+
margin-bottom: 10px;
|
|
49
|
+
}
|
|
50
|
+
|
|
35
51
|
.sdoc-comment-list-container .comment-ui-container.active .comment-item:hover {
|
|
36
52
|
background: #fafafa;
|
|
37
53
|
}
|
|
@@ -30,7 +30,10 @@ var EditorComment = function EditorComment() {
|
|
|
30
30
|
var element_comments_map = useCommentContext().commentsInfo.element_comments_map;
|
|
31
31
|
useEffect(function () {
|
|
32
32
|
var comments = element_comments_map[selectionElement === null || selectionElement === void 0 ? void 0 : selectionElement.id];
|
|
33
|
-
var
|
|
33
|
+
var unresolvedComments = comments && comments.filter(function (item) {
|
|
34
|
+
return !item.resolved;
|
|
35
|
+
});
|
|
36
|
+
var hasComments = unresolvedComments && unresolvedComments.length > 0;
|
|
34
37
|
if (hasComments) {
|
|
35
38
|
setIsShowComments(true);
|
|
36
39
|
setComments(comments);
|
|
@@ -8,20 +8,29 @@ import { withTranslation } from 'react-i18next';
|
|
|
8
8
|
import GlobalCommentHeader from './global-comment-header';
|
|
9
9
|
var GlobalComment = function GlobalComment(_ref) {
|
|
10
10
|
var t = _ref.t;
|
|
11
|
+
var _useState = useState(false),
|
|
12
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
13
|
+
activeComment = _useState2[0],
|
|
14
|
+
setActiveComment = _useState2[1];
|
|
15
|
+
var onCommentClick = useCallback(function (comment) {
|
|
16
|
+
if (activeComment && activeComment.id === comment.id) return;
|
|
17
|
+
setActiveComment(comment);
|
|
18
|
+
}, [activeComment]);
|
|
11
19
|
var commentRef = useRef(null);
|
|
12
20
|
var _useCommentList = useCommentList(),
|
|
13
21
|
commentList = _useCommentList.commentList,
|
|
14
22
|
commentType = _useCommentList.commentType,
|
|
15
23
|
setCommentType = _useCommentList.setCommentType;
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
isShowCommentList =
|
|
19
|
-
setShowCommentList =
|
|
24
|
+
var _useState3 = useState(false),
|
|
25
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
26
|
+
isShowCommentList = _useState4[0],
|
|
27
|
+
setShowCommentList = _useState4[1];
|
|
20
28
|
useEffect(function () {
|
|
21
29
|
var toggleOuterSide = function toggleOuterSide(e) {
|
|
22
30
|
var commentWrapper = commentRef.current;
|
|
23
31
|
var clickIsInComment = commentWrapper && commentWrapper.contains(e.target) && commentWrapper !== e.target;
|
|
24
32
|
if (clickIsInComment) return;
|
|
33
|
+
setActiveComment(null);
|
|
25
34
|
setShowCommentList(false);
|
|
26
35
|
};
|
|
27
36
|
var eventBus = EventBus.getInstance();
|
|
@@ -34,14 +43,6 @@ var GlobalComment = function GlobalComment(_ref) {
|
|
|
34
43
|
document.removeEventListener('click', toggleOuterSide, true);
|
|
35
44
|
};
|
|
36
45
|
}, [isShowCommentList]);
|
|
37
|
-
var _useState3 = useState(false),
|
|
38
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
39
|
-
activeComment = _useState4[0],
|
|
40
|
-
setActiveComment = _useState4[1];
|
|
41
|
-
var onCommentClick = useCallback(function (comment) {
|
|
42
|
-
if (activeComment && activeComment.id === comment.id) return;
|
|
43
|
-
setActiveComment(comment);
|
|
44
|
-
}, [activeComment]);
|
|
45
46
|
var contentRef = useRef(null);
|
|
46
47
|
var updateScrollPosition = useCallback(function () {
|
|
47
48
|
var resolvedDom = document.querySelector('.sdoc-resolved');
|
|
@@ -111,7 +111,7 @@ export var commentReducer = function commentReducer(state, action) {
|
|
|
111
111
|
element_comments_map[element_id] = [];
|
|
112
112
|
}
|
|
113
113
|
element_comments_map[element_id] = [].concat(_toConsumableArray(element_comments_map[element_id]), [comment]);
|
|
114
|
-
var _commentList = [comment].concat(_toConsumableArray(comment_list));
|
|
114
|
+
var _commentList = [deepCopy(comment)].concat(_toConsumableArray(comment_list));
|
|
115
115
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
116
116
|
element_comments_map: _objectSpread({}, element_comments_map),
|
|
117
117
|
comment_list: _commentList
|
|
@@ -130,7 +130,7 @@ export var commentReducer = function commentReducer(state, action) {
|
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
132
|
var _commentList2 = _comment_list.filter(function (item) {
|
|
133
|
-
return item.id
|
|
133
|
+
return item.id !== comment_id;
|
|
134
134
|
});
|
|
135
135
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
136
136
|
element_comments_map: _objectSpread({}, _element_comments_map),
|
|
@@ -207,7 +207,7 @@ export var commentReducer = function commentReducer(state, action) {
|
|
|
207
207
|
reply = _action$payload5.reply;
|
|
208
208
|
_element_comments_map4[_element_id4] = _element_comments_map4[_element_id4].map(function (item) {
|
|
209
209
|
if (item.id === _comment_id3) {
|
|
210
|
-
item.replies = [].concat(_toConsumableArray(item.replies), [reply]);
|
|
210
|
+
item.replies = [].concat(_toConsumableArray(item.replies), [deepCopy(reply)]);
|
|
211
211
|
return item;
|
|
212
212
|
}
|
|
213
213
|
return item;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
var _HEADER_FONT_SIZE;
|
|
3
|
+
import * as ELEMENT_TYPE from './element-type';
|
|
4
|
+
|
|
1
5
|
// font family
|
|
2
6
|
var SERIF = 'serif';
|
|
3
7
|
var SANS_SERIF = 'sans-serif';
|
|
@@ -588,4 +592,6 @@ export var FONT = [
|
|
|
588
592
|
'zh-cn': 1
|
|
589
593
|
}
|
|
590
594
|
} // 楷体
|
|
591
|
-
];
|
|
595
|
+
];
|
|
596
|
+
|
|
597
|
+
export var HEADER_FONT_SIZE = (_HEADER_FONT_SIZE = {}, _defineProperty(_HEADER_FONT_SIZE, ELEMENT_TYPE.HEADER1, 32), _defineProperty(_HEADER_FONT_SIZE, ELEMENT_TYPE.HEADER2, 28), _defineProperty(_HEADER_FONT_SIZE, ELEMENT_TYPE.HEADER3, 24), _defineProperty(_HEADER_FONT_SIZE, ELEMENT_TYPE.HEADER4, 18), _defineProperty(_HEADER_FONT_SIZE, ELEMENT_TYPE.HEADER5, 16), _defineProperty(_HEADER_FONT_SIZE, ELEMENT_TYPE.HEADER6, 14), _HEADER_FONT_SIZE);
|
|
@@ -5,7 +5,7 @@ import * as ELEMENT_TYPE from './element-type';
|
|
|
5
5
|
import { BLOCKQUOTE, HEADER, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, PARAGRAPH, BOLD, ITALIC, UNDERLINE, STRIKETHROUGH, SUPERSCRIPT, SUBSCRIPT, ORDERED_LIST, UNORDERED_LIST, LIST_ITEM, LIST_LIC, CHECK_LIST, CHECK_LIST_ITEM, LINK, HTML, CODE_BLOCK, CODE_LINE, IMAGE, TABLE, TABLE_CELL, TABLE_ROW, FORMULA, COLUMN, TEXT_STYLE, TEXT_STYLE_MORE, BOLD_ITALIC, TEXT_ALIGN, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTER, CLEAR_FORMAT, COLOR, HIGHLIGHT_COLOR } from './element-type';
|
|
6
6
|
import KEYBOARD from './keyboard';
|
|
7
7
|
import { DEFAULT_COLORS, STANDARD_COLORS, DEFAULT_RECENT_USED_LIST, DEFAULT_FONT_COLOR, RECENT_USED_HIGHLIGHT_COLORS_KEY, RECENT_USED_FONT_COLORS_KEY, RECENT_USED_TABLE_CELL_BG_COLORS_KEY, DEFAULT_LAST_USED_FONT_COLOR, DEFAULT_LAST_USED_HIGHLIGHT_COLOR, DEFAULT_LAST_USED_TABLE_CELL_BG_COLOR } from './color';
|
|
8
|
-
import { SPECIAL_FONT_SIZE_NAME, DEFAULT_COMMON_FONT_SIZE, FONT_SIZE, DEFAULT_FONT, FONT, GOOGLE_FONT_CLASS, RECENT_USED_FONTS_KEY } from './font';
|
|
8
|
+
import { SPECIAL_FONT_SIZE_NAME, DEFAULT_COMMON_FONT_SIZE, FONT_SIZE, DEFAULT_FONT, FONT, GOOGLE_FONT_CLASS, RECENT_USED_FONTS_KEY, HEADER_FONT_SIZE } from './font';
|
|
9
9
|
|
|
10
10
|
// history
|
|
11
11
|
export var UNDO = 'undo';
|
|
@@ -132,6 +132,7 @@ export var MENUS_CONFIG_MAP = (_MENUS_CONFIG_MAP = {}, _defineProperty(_MENUS_CO
|
|
|
132
132
|
iconClass: 'sdocfont sdoc-format-clear',
|
|
133
133
|
text: 'Clear_format'
|
|
134
134
|
}), _MENUS_CONFIG_MAP);
|
|
135
|
+
export var HEADERS = [HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6];
|
|
135
136
|
export var HEADER_TITLE_MAP = (_HEADER_TITLE_MAP = {}, _defineProperty(_HEADER_TITLE_MAP, HEADER1, 'Header_one'), _defineProperty(_HEADER_TITLE_MAP, HEADER2, 'Header_two'), _defineProperty(_HEADER_TITLE_MAP, HEADER3, 'Header_three'), _defineProperty(_HEADER_TITLE_MAP, HEADER4, 'Header_four'), _defineProperty(_HEADER_TITLE_MAP, HEADER5, 'Header_five'), _defineProperty(_HEADER_TITLE_MAP, HEADER6, 'Header_six'), _defineProperty(_HEADER_TITLE_MAP, PARAGRAPH, 'Paragraph'), _HEADER_TITLE_MAP);
|
|
136
137
|
export var DIFF_TYPE = {
|
|
137
138
|
ADD: 'add',
|
|
@@ -155,4 +156,4 @@ export var HEADER_TYPE_ARRAY = ['header1', 'header2', 'header3', 'header4', 'hea
|
|
|
155
156
|
export var LIST_TYPE_ARRAY = ['unordered_list', 'ordered_list'];
|
|
156
157
|
export var TRANSPARENT = 'transparent';
|
|
157
158
|
export var CLIPBOARD_FORMAT_KEY = 'x-slate-fragment';
|
|
158
|
-
export { BLOCKQUOTE, HEADER, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, PARAGRAPH, BOLD, ITALIC, UNDERLINE, STRIKETHROUGH, SUPERSCRIPT, SUBSCRIPT, ORDERED_LIST, UNORDERED_LIST, LIST_ITEM, LIST_LIC, CHECK_LIST, CHECK_LIST_ITEM, LINK, HTML, CODE_BLOCK, CODE_LINE, IMAGE, TABLE, TABLE_CELL, TABLE_ROW, FORMULA, COLUMN, TEXT_STYLE, TEXT_STYLE_MORE, BOLD_ITALIC, TEXT_ALIGN, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTER, ELEMENT_TYPE, KEYBOARD, DEFAULT_COLORS, STANDARD_COLORS, DEFAULT_RECENT_USED_LIST, CLEAR_FORMAT, DEFAULT_FONT_COLOR, RECENT_USED_HIGHLIGHT_COLORS_KEY, RECENT_USED_FONT_COLORS_KEY, RECENT_USED_TABLE_CELL_BG_COLORS_KEY, DEFAULT_LAST_USED_FONT_COLOR, DEFAULT_LAST_USED_HIGHLIGHT_COLOR, DEFAULT_LAST_USED_TABLE_CELL_BG_COLOR, SPECIAL_FONT_SIZE_NAME, DEFAULT_COMMON_FONT_SIZE, FONT_SIZE, DEFAULT_FONT, FONT, GOOGLE_FONT_CLASS, RECENT_USED_FONTS_KEY };
|
|
159
|
+
export { BLOCKQUOTE, HEADER, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, PARAGRAPH, BOLD, ITALIC, UNDERLINE, STRIKETHROUGH, SUPERSCRIPT, SUBSCRIPT, ORDERED_LIST, UNORDERED_LIST, LIST_ITEM, LIST_LIC, CHECK_LIST, CHECK_LIST_ITEM, LINK, HTML, CODE_BLOCK, CODE_LINE, IMAGE, TABLE, TABLE_CELL, TABLE_ROW, FORMULA, COLUMN, TEXT_STYLE, TEXT_STYLE_MORE, BOLD_ITALIC, TEXT_ALIGN, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTER, ELEMENT_TYPE, KEYBOARD, DEFAULT_COLORS, STANDARD_COLORS, DEFAULT_RECENT_USED_LIST, CLEAR_FORMAT, DEFAULT_FONT_COLOR, RECENT_USED_HIGHLIGHT_COLORS_KEY, RECENT_USED_FONT_COLORS_KEY, RECENT_USED_TABLE_CELL_BG_COLORS_KEY, DEFAULT_LAST_USED_FONT_COLOR, DEFAULT_LAST_USED_HIGHLIGHT_COLOR, DEFAULT_LAST_USED_TABLE_CELL_BG_COLOR, SPECIAL_FONT_SIZE_NAME, DEFAULT_COMMON_FONT_SIZE, FONT_SIZE, DEFAULT_FONT, FONT, GOOGLE_FONT_CLASS, RECENT_USED_FONTS_KEY, HEADER_FONT_SIZE };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
2
|
import { Editor, Element } from '@seafile/slate';
|
|
3
|
-
import { CODE_BLOCK, DEFAULT_COMMON_FONT_SIZE, IMAGE, FONT_SIZE, SPECIAL_FONT_SIZE_NAME, DEFAULT_FONT, GOOGLE_FONT_CLASS, FONT } from '../../constants';
|
|
4
|
-
import { focusEditor } from '../../core';
|
|
3
|
+
import { CODE_BLOCK, DEFAULT_COMMON_FONT_SIZE, IMAGE, FONT_SIZE, SPECIAL_FONT_SIZE_NAME, DEFAULT_FONT, GOOGLE_FONT_CLASS, FONT, HEADER_FONT_SIZE, HEADERS } from '../../constants';
|
|
4
|
+
import { focusEditor, getParentNode } from '../../core';
|
|
5
5
|
import context from '../../../../context';
|
|
6
6
|
import { isMac } from '../../../../utils';
|
|
7
7
|
export var isMenuDisabled = function isMenuDisabled(editor) {
|
|
@@ -31,13 +31,26 @@ export var getFontSize = function getFontSize(editor) {
|
|
|
31
31
|
var _Editor$nodes3 = Editor.nodes(editor, {
|
|
32
32
|
at: Editor.unhangRange(editor, selection),
|
|
33
33
|
match: function match(n) {
|
|
34
|
-
|
|
34
|
+
if (!Editor.isEditor(n) && !Element.isElement(n)) {
|
|
35
|
+
// console.log(n) && n['font-size']
|
|
36
|
+
if (n['font-size']) return true;
|
|
37
|
+
var _parentNode = getParentNode(editor.children, n.id);
|
|
38
|
+
if (_parentNode && HEADERS.includes(_parentNode.type)) {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
return false;
|
|
35
44
|
}
|
|
36
45
|
}),
|
|
37
46
|
_Editor$nodes4 = _slicedToArray(_Editor$nodes3, 1),
|
|
38
47
|
match = _Editor$nodes4[0];
|
|
39
48
|
if (!match) return DEFAULT_COMMON_FONT_SIZE;
|
|
40
|
-
|
|
49
|
+
var matched = match[0];
|
|
50
|
+
if (matched['font-size']) return matched['font-size'];
|
|
51
|
+
var parentNode = getParentNode(editor.children, matched.id);
|
|
52
|
+
if (HEADERS.includes(parentNode.type)) return HEADER_FONT_SIZE[parentNode.type];
|
|
53
|
+
return DEFAULT_COMMON_FONT_SIZE;
|
|
41
54
|
};
|
|
42
55
|
export var setFontSize = function setFontSize(editor, value) {
|
|
43
56
|
Editor.addMark(editor, 'font-size', value);
|
package/package.json
CHANGED
|
@@ -1,33 +0,0 @@
|
|
|
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 type = _ref.type,
|
|
6
|
-
setIsShowDeleteModal = _ref.setIsShowDeleteModal,
|
|
7
|
-
deleteConfirm = _ref.deleteConfirm,
|
|
8
|
-
t = _ref.t;
|
|
9
|
-
var message = type === 'comment' ? 'comment' : 'reply';
|
|
10
|
-
var title = t("Delete_".concat(message));
|
|
11
|
-
var content = t("Are_you_sure_to_delete_this_".concat(message));
|
|
12
|
-
return /*#__PURE__*/React.createElement(Modal, {
|
|
13
|
-
className: "comment-delete-modal",
|
|
14
|
-
isOpen: true,
|
|
15
|
-
centered: true
|
|
16
|
-
}, /*#__PURE__*/React.createElement(ModalHeader, {
|
|
17
|
-
toggle: function toggle() {
|
|
18
|
-
setIsShowDeleteModal(false);
|
|
19
|
-
}
|
|
20
|
-
}, title), /*#__PURE__*/React.createElement(ModalBody, null, content), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
|
|
21
|
-
color: "secondary",
|
|
22
|
-
onClick: function onClick() {
|
|
23
|
-
setIsShowDeleteModal(false);
|
|
24
|
-
}
|
|
25
|
-
}, t('Cancel')), /*#__PURE__*/React.createElement(Button, {
|
|
26
|
-
color: "primary",
|
|
27
|
-
onClick: deleteConfirm
|
|
28
|
-
}, t('Confirm'))));
|
|
29
|
-
};
|
|
30
|
-
DeleteCommentDialog.defaultProps = {
|
|
31
|
-
type: 'comment'
|
|
32
|
-
};
|
|
33
|
-
export default withTranslation('sdoc-editor')(DeleteCommentDialog);
|