@seafile/sdoc-editor 0.5.26 → 0.5.28
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/layout.css +5 -4
- package/dist/basic-sdk/comment/components/comment-editor.js +24 -10
- package/dist/basic-sdk/comment/components/comment-item-wrapper.js +0 -1
- package/dist/basic-sdk/comment/components/comment-list.css +1 -3
- package/dist/basic-sdk/comment/components/global-comment/global-comment-editor.js +2 -1
- package/dist/basic-sdk/comment/components/global-comment/index.css +3 -2
- package/dist/basic-sdk/editor/sdoc-comment-editor.js +8 -2
- package/dist/basic-sdk/extension/plugins/callout/plugin.js +0 -1
- package/dist/basic-sdk/extension/plugins/text-align/menu/index.js +8 -2
- package/dist/basic-sdk/extension/toolbar/comment-editor-toolbar/index.js +12 -1
- package/dist/basic-sdk/extension/toolbar/comment-editor-toolbar/post-comment/index.js +28 -0
- package/dist/basic-sdk/extension/toolbar/comment-editor-toolbar/post-comment/style.css +7 -0
- package/package.json +1 -1
- package/public/locales/cs/sdoc-editor.json +2 -1
- package/public/locales/de/sdoc-editor.json +2 -1
- package/public/locales/en/sdoc-editor.json +2 -1
- package/public/locales/es/sdoc-editor.json +2 -1
- package/public/locales/fr/sdoc-editor.json +2 -1
- package/public/locales/it/sdoc-editor.json +2 -1
- package/public/locales/ru/sdoc-editor.json +3 -2
- package/public/locales/zh_CN/sdoc-editor.json +2 -1
- package/public/media/sdoc-editor-font/iconfont.eot +0 -0
- package/public/media/sdoc-editor-font/iconfont.svg +2 -0
- package/public/media/sdoc-editor-font/iconfont.ttf +0 -0
- package/public/media/sdoc-editor-font/iconfont.woff +0 -0
- package/public/media/sdoc-editor-font/iconfont.woff2 +0 -0
- package/public/media/sdoc-editor-font.css +4 -0
|
@@ -117,15 +117,16 @@
|
|
|
117
117
|
|
|
118
118
|
.sdoc-comment-editor-toolbar {
|
|
119
119
|
display: flex;
|
|
120
|
-
|
|
121
|
-
position: relative;
|
|
122
|
-
height: 32px;
|
|
120
|
+
justify-content: space-between;
|
|
123
121
|
align-items: center;
|
|
122
|
+
height: 32px;
|
|
124
123
|
user-select: none;
|
|
125
|
-
|
|
124
|
+
border-top: 1px solid #e5e6e8;
|
|
126
125
|
z-index: 102;
|
|
126
|
+
margin: 0 8px;
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
.sdoc-comment-editor-menu-group {
|
|
130
130
|
border-right: none;
|
|
131
|
+
padding-left: 0 !important;
|
|
131
132
|
}
|
|
@@ -14,6 +14,7 @@ import { PARAGRAPH } from '../../extension/constants';
|
|
|
14
14
|
import slateToMdString from '../../../slate-convert/slate-to-md';
|
|
15
15
|
import mdStringToSlate from '../../../slate-convert/md-to-slate';
|
|
16
16
|
import { COMMENT_EDITOR, COMMENT_EDITOR_EDIT_AREA_WIDTH } from '../../constants';
|
|
17
|
+
import { KeyCodes } from '../../../constants';
|
|
17
18
|
const getSubmitTip = (type, content) => {
|
|
18
19
|
if (content) return 'Save';
|
|
19
20
|
return type === 'comment' ? 'Comment' : 'Reply';
|
|
@@ -91,6 +92,24 @@ const CommentEditor = _ref => {
|
|
|
91
92
|
}, [editor, updateValue, addParticipants, userInfo.username, placeholder]);
|
|
92
93
|
const onCancel = useCallback(event => {
|
|
93
94
|
event.stopPropagation();
|
|
95
|
+
const {
|
|
96
|
+
type: eventType,
|
|
97
|
+
keyCode,
|
|
98
|
+
target
|
|
99
|
+
} = event;
|
|
100
|
+
if (eventType === 'keydown' && keyCode !== KeyCodes.Esc) return;
|
|
101
|
+
if (eventType === 'click') {
|
|
102
|
+
const listContainer = window.document.querySelector('#global-comment-list-container');
|
|
103
|
+
const addCommentSideBtn = window.document.querySelector('.comment-add-wrapper');
|
|
104
|
+
const addCommentPopover = window.document.querySelector('.sdoc-doc-comment-editor-container');
|
|
105
|
+
const globalCommentPopover = window.document.querySelector('.comment-ui-container');
|
|
106
|
+
const isClickOnListContainer = listContainer && listContainer.contains(target);
|
|
107
|
+
const isClickOnAddCommentPopover = type === 'comment' && addCommentPopover && addCommentPopover.contains(target);
|
|
108
|
+
const isClickOnAddCommentSideBtn = addCommentSideBtn && addCommentSideBtn.contains(target);
|
|
109
|
+
const isClickOnGlobalCommentPopover = globalCommentPopover && globalCommentPopover.contains(target);
|
|
110
|
+
const isPreventCancel = isClickOnListContainer || isClickOnAddCommentPopover || isClickOnAddCommentSideBtn || isClickOnGlobalCommentPopover;
|
|
111
|
+
if (isPreventCancel) return;
|
|
112
|
+
}
|
|
94
113
|
setIsEditing && setIsEditing(false);
|
|
95
114
|
hiddenComment && hiddenComment(false);
|
|
96
115
|
|
|
@@ -118,16 +137,11 @@ const CommentEditor = _ref => {
|
|
|
118
137
|
}, userInfo.name)), /*#__PURE__*/React.createElement(SdocCommentEditor, {
|
|
119
138
|
editor: editor,
|
|
120
139
|
type: type,
|
|
121
|
-
document: document
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
onClick: onCancel
|
|
127
|
-
}, t('Cancel')), /*#__PURE__*/React.createElement(Button, {
|
|
128
|
-
color: "primary",
|
|
129
|
-
onClick: onSubmit
|
|
130
|
-
}, t(submitTip))));
|
|
140
|
+
document: document,
|
|
141
|
+
onSubmit: onSubmit,
|
|
142
|
+
submitBtnText: t(submitTip),
|
|
143
|
+
onCancel: onCancel
|
|
144
|
+
}));
|
|
131
145
|
};
|
|
132
146
|
CommentEditor.defaultProps = {
|
|
133
147
|
placeholder: 'Enter_a_comment'
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
background-color: #edf2fa;
|
|
9
9
|
border-radius: 8px;
|
|
10
10
|
box-shadow: 0 0 2px rgba(0, 0, 0, .04);
|
|
11
|
-
padding: 16px
|
|
11
|
+
padding: 16px;
|
|
12
12
|
margin-bottom: 10px;
|
|
13
13
|
cursor: pointer;
|
|
14
14
|
}
|
|
@@ -225,7 +225,6 @@
|
|
|
225
225
|
border: 1px solid #ececec;
|
|
226
226
|
border-top-left-radius: 3px;
|
|
227
227
|
border-top-right-radius: 3px;
|
|
228
|
-
margin-bottom: 15px;
|
|
229
228
|
border-radius: 3px;
|
|
230
229
|
}
|
|
231
230
|
|
|
@@ -250,7 +249,6 @@
|
|
|
250
249
|
display: flex;
|
|
251
250
|
flex-direction: column;
|
|
252
251
|
justify-content: center;
|
|
253
|
-
padding: 0 10px;
|
|
254
252
|
cursor: text;
|
|
255
253
|
}
|
|
256
254
|
|
|
@@ -8,7 +8,8 @@ const GlobalCommentEditor = _ref => {
|
|
|
8
8
|
const ref = useRef(null);
|
|
9
9
|
useEffect(() => {
|
|
10
10
|
const hidden = event => {
|
|
11
|
-
|
|
11
|
+
var _ref$current;
|
|
12
|
+
if (!((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.contains(event.target))) {
|
|
12
13
|
hiddenCommentEditor();
|
|
13
14
|
}
|
|
14
15
|
};
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
font-size: 12px;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
.global-comments-popover .comments-panel-body__header .comment-type{
|
|
76
|
+
.global-comments-popover .comments-panel-body__header .comment-type {
|
|
77
77
|
color: #212529;
|
|
78
78
|
font-size: 12px;
|
|
79
79
|
}
|
|
@@ -87,7 +87,8 @@
|
|
|
87
87
|
flex: 1;
|
|
88
88
|
display: flex;
|
|
89
89
|
flex-direction: column;
|
|
90
|
-
padding:
|
|
90
|
+
padding: 16px;
|
|
91
|
+
padding-top: 0px;
|
|
91
92
|
overflow: auto;
|
|
92
93
|
}
|
|
93
94
|
|
|
@@ -20,7 +20,10 @@ const SdocCommentEditor = forwardRef((_ref, ref) => {
|
|
|
20
20
|
editor: propsEditor,
|
|
21
21
|
document,
|
|
22
22
|
isReloading,
|
|
23
|
-
type
|
|
23
|
+
type,
|
|
24
|
+
onSubmit,
|
|
25
|
+
submitBtnText,
|
|
26
|
+
onCancel
|
|
24
27
|
} = _ref;
|
|
25
28
|
const [slateValue, setSlateValue] = useState(document.children);
|
|
26
29
|
const commentEditorContainerRef = useRef(null);
|
|
@@ -113,7 +116,10 @@ const SdocCommentEditor = forwardRef((_ref, ref) => {
|
|
|
113
116
|
slateValue: slateValue,
|
|
114
117
|
updateSlateValue: setSlateValue
|
|
115
118
|
})), /*#__PURE__*/React.createElement(CommentEditorToolbar, {
|
|
116
|
-
editor: validEditor
|
|
119
|
+
editor: validEditor,
|
|
120
|
+
onSubmit: onSubmit,
|
|
121
|
+
submitBtnText: submitBtnText,
|
|
122
|
+
onCancel: onCancel
|
|
117
123
|
}))));
|
|
118
124
|
});
|
|
119
125
|
export default SdocCommentEditor;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React, { useRef, useState, useCallback } from 'react';
|
|
2
2
|
import { UncontrolledPopover } from 'reactstrap';
|
|
3
|
-
import { withTranslation } from 'react-i18next';
|
|
3
|
+
import { useTranslation, withTranslation } from 'react-i18next';
|
|
4
4
|
import classnames from 'classnames';
|
|
5
5
|
import { getAlignType, isMenuDisabled, setAlignType } from '../helpers';
|
|
6
6
|
import { TEXT_ALIGN, MENUS_CONFIG_MAP } from '../../../constants';
|
|
7
|
+
import Tooltip from '../../../../../components/tooltip';
|
|
7
8
|
const TextAlignMenu = _ref => {
|
|
8
9
|
let {
|
|
9
10
|
isRichEditor,
|
|
@@ -15,6 +16,9 @@ const TextAlignMenu = _ref => {
|
|
|
15
16
|
const popoverRef = useRef(null);
|
|
16
17
|
const disabled = isMenuDisabled(editor, readonly);
|
|
17
18
|
const buttonId = 'sdoc-button-text-align';
|
|
19
|
+
const {
|
|
20
|
+
t
|
|
21
|
+
} = useTranslation();
|
|
18
22
|
const toggle = useCallback(event => {
|
|
19
23
|
popoverRef.current.toggle();
|
|
20
24
|
setMenuShow(!isShowMenu);
|
|
@@ -54,7 +58,9 @@ const TextAlignMenu = _ref => {
|
|
|
54
58
|
className: "sdoc-menu-with-dropdown-triangle"
|
|
55
59
|
}, /*#__PURE__*/React.createElement("span", {
|
|
56
60
|
className: caretIconClass
|
|
57
|
-
}))),
|
|
61
|
+
}))), /*#__PURE__*/React.createElement(Tooltip, {
|
|
62
|
+
target: buttonId
|
|
63
|
+
}, t('Alignment_type')), !disabled && /*#__PURE__*/React.createElement(UncontrolledPopover, {
|
|
58
64
|
target: buttonId,
|
|
59
65
|
className: "sdoc-menu-popover sdoc-dropdown-menu",
|
|
60
66
|
trigger: "legacy",
|
|
@@ -7,10 +7,14 @@ import CommentEditorTextStyleMenuList from '../../plugins/text-style/menu/comemn
|
|
|
7
7
|
import ImageMenu from '../../plugins/image/menu';
|
|
8
8
|
import EventBus from '../../../utils/event-bus';
|
|
9
9
|
import LinkMenu from '../../plugins/link/menu';
|
|
10
|
+
import PostCommentBtn from './post-comment';
|
|
10
11
|
const CommentEditorToolbar = _ref => {
|
|
11
12
|
let {
|
|
12
13
|
editor,
|
|
13
|
-
readonly
|
|
14
|
+
readonly,
|
|
15
|
+
onSubmit,
|
|
16
|
+
submitBtnText,
|
|
17
|
+
onCancel
|
|
14
18
|
} = _ref;
|
|
15
19
|
useSelectionUpdate();
|
|
16
20
|
const eventBus = EventBus.getInstance();
|
|
@@ -37,6 +41,13 @@ const CommentEditorToolbar = _ref => {
|
|
|
37
41
|
editor: editor,
|
|
38
42
|
readonly: readonly,
|
|
39
43
|
eventBus: eventBus
|
|
44
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
45
|
+
className: "sdoc-comment-editor-toolbar-right"
|
|
46
|
+
}, /*#__PURE__*/React.createElement(PostCommentBtn, {
|
|
47
|
+
editor: editor,
|
|
48
|
+
onSubmit: onSubmit,
|
|
49
|
+
submitBtnText: submitBtnText,
|
|
50
|
+
onCancel: onCancel
|
|
40
51
|
})));
|
|
41
52
|
};
|
|
42
53
|
CommentEditorToolbar.defaultProps = {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import Tooltip from '../../../../../components/tooltip';
|
|
3
|
+
import './style.css';
|
|
4
|
+
const PostCommentBtn = _ref => {
|
|
5
|
+
let {
|
|
6
|
+
onSubmit,
|
|
7
|
+
submitBtnText,
|
|
8
|
+
onCancel
|
|
9
|
+
} = _ref;
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
document.addEventListener('keydown', onCancel, false);
|
|
12
|
+
document.addEventListener('click', onCancel, false);
|
|
13
|
+
return () => {
|
|
14
|
+
document.removeEventListener('keydown', onCancel, false);
|
|
15
|
+
document.removeEventListener('click', onCancel, false);
|
|
16
|
+
};
|
|
17
|
+
}, [onCancel]);
|
|
18
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
19
|
+
role: "button",
|
|
20
|
+
id: "sdoc-comment-editor-comment-btn"
|
|
21
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
22
|
+
className: "sdocfont sdoc-save sdoc-comment-btn",
|
|
23
|
+
onClick: onSubmit
|
|
24
|
+
}), /*#__PURE__*/React.createElement(Tooltip, {
|
|
25
|
+
target: "sdoc-comment-editor-comment-btn"
|
|
26
|
+
}, submitBtnText));
|
|
27
|
+
};
|
|
28
|
+
export default PostCommentBtn;
|
package/package.json
CHANGED
|
@@ -451,5 +451,6 @@
|
|
|
451
451
|
"Bottom_align": "Bottom",
|
|
452
452
|
"Move_column_count": "Moving {{count}} column(s)",
|
|
453
453
|
"Move_row_count": "Moving {{count}} row(s)",
|
|
454
|
-
"Mark_all_as_read": "Mark all as read"
|
|
454
|
+
"Mark_all_as_read": "Mark all as read",
|
|
455
|
+
"Alignment_type": "Alignment"
|
|
455
456
|
}
|
|
@@ -451,5 +451,6 @@
|
|
|
451
451
|
"Bottom_align": "Bottom",
|
|
452
452
|
"Move_column_count": "Moving {{count}} column(s)",
|
|
453
453
|
"Move_row_count": "Moving {{count}} row(s)",
|
|
454
|
-
"Mark_all_as_read": "Alle als gelesen markieren"
|
|
454
|
+
"Mark_all_as_read": "Alle als gelesen markieren",
|
|
455
|
+
"Alignment_type": "Alignment"
|
|
455
456
|
}
|
|
@@ -451,5 +451,6 @@
|
|
|
451
451
|
"Bottom_align": "Bottom",
|
|
452
452
|
"Move_column_count": "Moving {{count}} column(s)",
|
|
453
453
|
"Move_row_count": "Moving {{count}} row(s)",
|
|
454
|
-
"Mark_all_as_read": "Mark all as read"
|
|
454
|
+
"Mark_all_as_read": "Mark all as read",
|
|
455
|
+
"Alignment_type": "Alignment"
|
|
455
456
|
}
|
|
@@ -451,5 +451,6 @@
|
|
|
451
451
|
"Bottom_align": "Bottom",
|
|
452
452
|
"Move_column_count": "Moving {{count}} column(s)",
|
|
453
453
|
"Move_row_count": "Moving {{count}} row(s)",
|
|
454
|
-
"Mark_all_as_read": "Mark all as read"
|
|
454
|
+
"Mark_all_as_read": "Mark all as read",
|
|
455
|
+
"Alignment_type": "Alignment"
|
|
455
456
|
}
|
|
@@ -451,5 +451,6 @@
|
|
|
451
451
|
"Bottom_align": "Bottom",
|
|
452
452
|
"Move_column_count": "Moving {{count}} column(s)",
|
|
453
453
|
"Move_row_count": "Moving {{count}} row(s)",
|
|
454
|
-
"Mark_all_as_read": "Mark all as read"
|
|
454
|
+
"Mark_all_as_read": "Mark all as read",
|
|
455
|
+
"Alignment_type": "Alignment"
|
|
455
456
|
}
|
|
@@ -451,5 +451,6 @@
|
|
|
451
451
|
"Bottom_align": "Bottom",
|
|
452
452
|
"Move_column_count": "Moving {{count}} column(s)",
|
|
453
453
|
"Move_row_count": "Moving {{count}} row(s)",
|
|
454
|
-
"Mark_all_as_read": "Mark all as read"
|
|
454
|
+
"Mark_all_as_read": "Mark all as read",
|
|
455
|
+
"Alignment_type": "Alignment"
|
|
455
456
|
}
|
|
@@ -400,7 +400,7 @@
|
|
|
400
400
|
"Delete_failed": "Не удалось удалить",
|
|
401
401
|
"Insert_caption": "Вставить подпись",
|
|
402
402
|
"No_collaborators_available": "Нет доступных соавторов",
|
|
403
|
-
"Search_collaborator": "
|
|
403
|
+
"Search_collaborator": "Search collaborator",
|
|
404
404
|
"Doc_comments": "Комментарии к документу",
|
|
405
405
|
"Tag_not_found": "Тег не найден",
|
|
406
406
|
"Create_a_new_tag": "Создать новый тег",
|
|
@@ -451,5 +451,6 @@
|
|
|
451
451
|
"Bottom_align": "Низ",
|
|
452
452
|
"Move_column_count": "Перемещение {{count}} столбцов",
|
|
453
453
|
"Move_row_count": "Перемещение {{count}} строк",
|
|
454
|
-
"Mark_all_as_read": "Отметить все как прочитанное"
|
|
454
|
+
"Mark_all_as_read": "Отметить все как прочитанное",
|
|
455
|
+
"Alignment_type": "Alignment"
|
|
455
456
|
}
|
|
Binary file
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
/>
|
|
15
15
|
<missing-glyph />
|
|
16
16
|
|
|
17
|
+
<glyph glyph-name="sdoc-save" unicode="" d="M972.8 828.8L38.4 448c-51.2-22.4-51.2-51.2 3.2-70.4l227.2-70.4 92.8-288c12.8-38.4 44.8-44.8 70.4-16l118.4 124.8 233.6-179.2c28.8-22.4 60.8-9.6 70.4 28.8L1024 784c6.4 38.4-16 57.6-51.2 44.8zM832 646.4L432 272c-6.4-6.4-12.8-19.2-16-28.8l-19.2-172.8c-3.2-19.2-9.6-19.2-12.8-3.2l-76.8 243.2c-3.2 9.6 0 22.4 9.6 25.6l505.6 320c32 19.2 38.4 16 9.6-9.6z" horiz-adv-x="1025" />
|
|
18
|
+
|
|
17
19
|
<glyph glyph-name="sdoc-center-alignment" unicode="" d="M560 896v-128H832v-320h-272v-128H928v-320H560v-128h-96v128H96V320h368v128H192V768h272V896h96zM832 224H192v-128h640v128zM736 672H288v-128h448V672z" horiz-adv-x="1024" />
|
|
18
20
|
|
|
19
21
|
<glyph glyph-name="sdoc-bottom-alignment" unicode="" d="M0-64v96h1024v-96H0z m448 192V832H128v-704h320z m-96 96H224V736h128v-512z m544-96V640H576v-512h320z m-96 96h-128V544h128v-320z" horiz-adv-x="1024" />
|
|
Binary file
|
|
Binary file
|
|
Binary file
|