@seafile/sdoc-editor 0.5.48 → 0.5.49
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/assets/css/sdoc-editor-plugins.css +1 -1
- package/dist/basic-sdk/comment/components/comment-item-content.js +1 -1
- package/dist/basic-sdk/comment/components/comment-item-reply.js +6 -5
- package/dist/basic-sdk/comment/components/comment-item-resolved-reply.js +1 -1
- package/dist/basic-sdk/comment/components/comment-item-wrapper.js +1 -1
- package/dist/basic-sdk/comment/components/comment-list.css +10 -3
- package/dist/basic-sdk/comment/components/elements-comment-count/element-comment-count.js +4 -2
- package/dist/basic-sdk/comment/helper.js +2 -2
- package/dist/basic-sdk/extension/plugins/index.js +1 -1
- package/dist/basic-sdk/extension/plugins/list/render-elem.js +2 -2
- package/dist/basic-sdk/extension/render/render-comment-editor-element.js +7 -2
- package/dist/basic-sdk/extension/toolbar/comment-editor-toolbar/index.js +4 -0
- package/package.json +1 -1
|
@@ -71,7 +71,7 @@ const CommentItem = _ref => {
|
|
|
71
71
|
updateCommentResolved(false);
|
|
72
72
|
}, [updateCommentResolved]);
|
|
73
73
|
const menuId = useMemo(() => "comment_".concat(comment.id), [comment]);
|
|
74
|
-
return /*#__PURE__*/React.createElement("
|
|
74
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
75
75
|
className: "comment-item"
|
|
76
76
|
}, /*#__PURE__*/React.createElement("div", {
|
|
77
77
|
className: "comment-header"
|
|
@@ -20,7 +20,7 @@ const CommentItemReply = _ref => {
|
|
|
20
20
|
const {
|
|
21
21
|
notificationsInfo
|
|
22
22
|
} = useNotificationContext();
|
|
23
|
-
const
|
|
23
|
+
const itemRef = useRef(null);
|
|
24
24
|
const isUnseen = notificationsInfo.notifications_map["sdoc_notification_".concat(reply.comment_id, "_").concat(reply.id)] ? true : false;
|
|
25
25
|
const [isEditing, setIsEditing] = useState(false);
|
|
26
26
|
const [editorContent, setEditorContent] = useState('');
|
|
@@ -36,7 +36,8 @@ const CommentItemReply = _ref => {
|
|
|
36
36
|
}, []);
|
|
37
37
|
const transferHtml = async mdString => {
|
|
38
38
|
const htmlString = await processor.process(mdString);
|
|
39
|
-
|
|
39
|
+
const formatHtml = String(htmlString).replace(/\n */g, '');
|
|
40
|
+
setEditorContent(formatHtml);
|
|
40
41
|
};
|
|
41
42
|
useEffect(() => {
|
|
42
43
|
transferHtml(reply.reply);
|
|
@@ -57,9 +58,9 @@ const CommentItemReply = _ref => {
|
|
|
57
58
|
setIsEditing(false);
|
|
58
59
|
}, [reply, updateReply]);
|
|
59
60
|
const user = context.getUserInfo();
|
|
60
|
-
return /*#__PURE__*/React.createElement("
|
|
61
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
61
62
|
className: "comment-item",
|
|
62
|
-
ref:
|
|
63
|
+
ref: itemRef
|
|
63
64
|
}, /*#__PURE__*/React.createElement("div", {
|
|
64
65
|
className: "comment-header"
|
|
65
66
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -112,7 +113,7 @@ const CommentItemReply = _ref => {
|
|
|
112
113
|
updateContent: updateContent,
|
|
113
114
|
setIsEditing: setIsEditing
|
|
114
115
|
}), isShowDeleteDialog && isActive && /*#__PURE__*/React.createElement(CommentDeletePopover, {
|
|
115
|
-
parentDom:
|
|
116
|
+
parentDom: itemRef.current,
|
|
116
117
|
type: "reply",
|
|
117
118
|
deleteConfirm: _deleteReply,
|
|
118
119
|
setIsShowDeleteModal: setIsShowDeleteDialog,
|
|
@@ -6,7 +6,7 @@ const CommentItemResolvedReply = _ref => {
|
|
|
6
6
|
reply,
|
|
7
7
|
t
|
|
8
8
|
} = _ref;
|
|
9
|
-
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("
|
|
9
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
10
10
|
className: "comment-item"
|
|
11
11
|
}, /*#__PURE__*/React.createElement("div", {
|
|
12
12
|
className: "comment-header"
|
|
@@ -244,7 +244,7 @@ const CommentItemWrapper = _ref => {
|
|
|
244
244
|
className: "sdocfont sdoc-comment-quote mr-2"
|
|
245
245
|
}), /*#__PURE__*/React.createElement("div", {
|
|
246
246
|
className: "comment-item-selected-text"
|
|
247
|
-
}, Node.string(element))), /*#__PURE__*/React.createElement("
|
|
247
|
+
}, Node.string(element))), /*#__PURE__*/React.createElement("div", {
|
|
248
248
|
ref: listRef,
|
|
249
249
|
className: "comment-item-list"
|
|
250
250
|
}, /*#__PURE__*/React.createElement(CommentItemContent, {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
margin-top: 5px;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
.sdoc-comment-list-container
|
|
6
|
+
.sdoc-comment-list-container .article.sdoc-comment-editor {
|
|
7
7
|
font-size: 14px;
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -57,12 +57,11 @@
|
|
|
57
57
|
overflow-y: auto;
|
|
58
58
|
margin: 0;
|
|
59
59
|
padding: 0;
|
|
60
|
-
list-style: none;
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
.sdoc-comment-list-container .comment-item {
|
|
64
63
|
position: relative;
|
|
65
|
-
padding: 16px
|
|
64
|
+
padding: 16px 16px 0;
|
|
66
65
|
cursor: pointer;
|
|
67
66
|
}
|
|
68
67
|
|
|
@@ -369,3 +368,11 @@
|
|
|
369
368
|
.sdoc-article-container .sdoc-comment-list-container .comment-ui-container.active {
|
|
370
369
|
padding: 16px;
|
|
371
370
|
}
|
|
371
|
+
|
|
372
|
+
/* Override seafile ui */
|
|
373
|
+
.sdoc-comment-list-container .btn {
|
|
374
|
+
height: 30px;
|
|
375
|
+
line-height: 15px;
|
|
376
|
+
font-size: 14px;
|
|
377
|
+
font-weight: 500;
|
|
378
|
+
}
|
|
@@ -4,6 +4,7 @@ import { getElementCommentCountTop } from '../../helper';
|
|
|
4
4
|
import { eventStopPropagation } from '../../../utils/mouse-event';
|
|
5
5
|
import { focusToCommentElement } from '../../utils';
|
|
6
6
|
import { Z_INDEX } from '../../../constants';
|
|
7
|
+
import { useScrollContext } from '../../../hooks/use-scroll-context';
|
|
7
8
|
const ElementCommentCount = _ref => {
|
|
8
9
|
let {
|
|
9
10
|
elementId,
|
|
@@ -13,16 +14,17 @@ const ElementCommentCount = _ref => {
|
|
|
13
14
|
} = _ref;
|
|
14
15
|
const element = getNodeById(editor.children, elementId);
|
|
15
16
|
const [top, setTop] = useState(-9999);
|
|
17
|
+
const scrollRef = useScrollContext();
|
|
16
18
|
const onClick = useCallback(event => {
|
|
17
19
|
eventStopPropagation(event);
|
|
18
20
|
focusToCommentElement(editor, element);
|
|
19
21
|
}, [editor, element]);
|
|
20
22
|
useEffect(() => {
|
|
21
23
|
if (!element) return;
|
|
22
|
-
const scrollTop = 0;
|
|
24
|
+
const scrollTop = scrollRef.current.scrollTop || 0;
|
|
23
25
|
const newTop = getElementCommentCountTop(editor, element, scrollTop);
|
|
24
26
|
setTop(newTop);
|
|
25
|
-
}, [editor, elementId, element, isElementSelected]);
|
|
27
|
+
}, [editor, elementId, element, isElementSelected, scrollRef]);
|
|
26
28
|
if (!element) return null;
|
|
27
29
|
let style = {
|
|
28
30
|
top
|
|
@@ -18,7 +18,7 @@ export const getCursorPosition = () => {
|
|
|
18
18
|
let range = getSelectionRange();
|
|
19
19
|
if (range) {
|
|
20
20
|
const rect = range.getBoundingClientRect();
|
|
21
|
-
const headerHeight =
|
|
21
|
+
const headerHeight = 93;
|
|
22
22
|
x = rect.x || 0;
|
|
23
23
|
y = rect.y - headerHeight + (rect.height - 24) / 2 || 0;
|
|
24
24
|
}
|
|
@@ -59,5 +59,5 @@ export const getElementCommentCountTop = (editor, element, scrollTop) => {
|
|
|
59
59
|
if (!minY) minY = y;
|
|
60
60
|
minY = Math.min(minY, y);
|
|
61
61
|
});
|
|
62
|
-
return minY -
|
|
62
|
+
return minY - 93 + scrollTop; // 100: header height(56) + toolbar height(37)
|
|
63
63
|
};
|
|
@@ -18,6 +18,6 @@ import CalloutPlugin from './callout';
|
|
|
18
18
|
import SearchReplacePlugin from './search-replace';
|
|
19
19
|
import MentionPlugin from './mention';
|
|
20
20
|
const Plugins = [MarkDownPlugin, HtmlPlugin, HeaderPlugin, LinkPlugin, BlockquotePlugin, ListPlugin, CheckListPlugin, CodeBlockPlugin, ImagePlugin, TablePlugin, TextPlugin, TextAlignPlugin, FontPlugin, SdocLinkPlugin, ParagraphPlugin, FileLinkPlugin, CalloutPlugin, SearchReplacePlugin];
|
|
21
|
-
const CommentPlugins = [
|
|
21
|
+
const CommentPlugins = [MarkDownPlugin, HtmlPlugin, ParagraphPlugin, TextPlugin, ListPlugin, ImagePlugin, LinkPlugin, MentionPlugin, BlockquotePlugin];
|
|
22
22
|
export default Plugins;
|
|
23
23
|
export { MarkDownPlugin, HeaderPlugin, LinkPlugin, BlockquotePlugin, ListPlugin, CheckListPlugin, CodeBlockPlugin, ImagePlugin, TablePlugin, TextPlugin, HtmlPlugin, TextAlignPlugin, FontPlugin, SdocLinkPlugin, ParagraphPlugin, FileLinkPlugin, CalloutPlugin, SearchReplacePlugin, MentionPlugin, CommentPlugins };
|
|
@@ -33,12 +33,12 @@ const renderListItem = (props, editor) => {
|
|
|
33
33
|
default:
|
|
34
34
|
className = '';
|
|
35
35
|
}
|
|
36
|
-
const
|
|
36
|
+
const isBold = element.children[0].children.every(item => item.bold === true);
|
|
37
37
|
return /*#__PURE__*/React.createElement("li", Object.assign({
|
|
38
38
|
"data-id": element.id
|
|
39
39
|
}, attributes, {
|
|
40
40
|
className: classnames(className, {
|
|
41
|
-
'sdoc-li-
|
|
41
|
+
'sdoc-li-bold': isBold
|
|
42
42
|
})
|
|
43
43
|
}), children);
|
|
44
44
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import { useReadOnly, useSlateStatic } from '@seafile/slate-react';
|
|
3
|
-
import { LINK, LIST_ITEM, ORDERED_LIST, PARAGRAPH, UNORDERED_LIST, IMAGE, IMAGE_BLOCK, MENTION, MENTION_TEMP } from '../constants';
|
|
4
|
-
import { LinkPlugin, ListPlugin, ImagePlugin, ParagraphPlugin, MentionPlugin } from '../plugins';
|
|
3
|
+
import { LINK, LIST_ITEM, ORDERED_LIST, PARAGRAPH, UNORDERED_LIST, IMAGE, IMAGE_BLOCK, MENTION, MENTION_TEMP, BLOCKQUOTE } from '../constants';
|
|
4
|
+
import { LinkPlugin, ListPlugin, ImagePlugin, ParagraphPlugin, MentionPlugin, BlockquotePlugin } from '../plugins';
|
|
5
5
|
import { getParentNode } from '../core';
|
|
6
6
|
const RenderCommentEditorCustomRenderElement = props => {
|
|
7
7
|
const editor = useSlateStatic();
|
|
@@ -73,6 +73,11 @@ const RenderCommentEditorCustomRenderElement = props => {
|
|
|
73
73
|
const [, renderMentionTemporaryInput] = MentionPlugin.renderElements;
|
|
74
74
|
return renderMentionTemporaryInput(props, editor);
|
|
75
75
|
}
|
|
76
|
+
case BLOCKQUOTE:
|
|
77
|
+
{
|
|
78
|
+
const [renderBlockquote] = BlockquotePlugin.renderElements;
|
|
79
|
+
return renderBlockquote(props, editor);
|
|
80
|
+
}
|
|
76
81
|
default:
|
|
77
82
|
{
|
|
78
83
|
const [renderParagraph] = ParagraphPlugin.renderElements;
|
|
@@ -8,6 +8,7 @@ import ImageMenu from '../../plugins/image/menu';
|
|
|
8
8
|
import EventBus from '../../../utils/event-bus';
|
|
9
9
|
import LinkMenu from '../../plugins/link/menu';
|
|
10
10
|
import PostCommentBtn from './post-comment';
|
|
11
|
+
import QuoteMenu from '../../plugins/blockquote/menu';
|
|
11
12
|
const CommentEditorToolbar = _ref => {
|
|
12
13
|
let {
|
|
13
14
|
editor,
|
|
@@ -25,6 +26,9 @@ const CommentEditorToolbar = _ref => {
|
|
|
25
26
|
}, /*#__PURE__*/React.createElement(CommentEditorTextStyleMenuList, {
|
|
26
27
|
editor: editor,
|
|
27
28
|
readonly: readonly
|
|
29
|
+
}), /*#__PURE__*/React.createElement(QuoteMenu, {
|
|
30
|
+
editor: editor,
|
|
31
|
+
readonly: readonly
|
|
28
32
|
}), /*#__PURE__*/React.createElement(ListMenu, {
|
|
29
33
|
editor: editor,
|
|
30
34
|
type: UNORDERED_LIST,
|