@seafile/sdoc-editor 0.5.48 → 0.5.50

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.
Files changed (32) hide show
  1. package/dist/basic-sdk/assets/css/sdoc-editor-plugins.css +1 -1
  2. package/dist/basic-sdk/comment/components/comment-item-content.js +1 -1
  3. package/dist/basic-sdk/comment/components/comment-item-reply.js +6 -5
  4. package/dist/basic-sdk/comment/components/comment-item-resolved-reply.js +1 -1
  5. package/dist/basic-sdk/comment/components/comment-item-wrapper.js +1 -1
  6. package/dist/basic-sdk/comment/components/comment-list.css +10 -3
  7. package/dist/basic-sdk/comment/components/elements-comment-count/element-comment-count.js +4 -2
  8. package/dist/basic-sdk/comment/components/global-comment/index.css +1 -1
  9. package/dist/basic-sdk/comment/helper.js +2 -2
  10. package/dist/basic-sdk/extension/constants/menus-config.js +0 -10
  11. package/dist/basic-sdk/extension/plugins/code-block/prismjs.js +2 -2
  12. package/dist/basic-sdk/extension/plugins/index.js +1 -1
  13. package/dist/basic-sdk/extension/plugins/list/render-elem.js +2 -2
  14. package/dist/basic-sdk/extension/plugins/table/menu/active-table-menu/index.js +0 -20
  15. package/dist/basic-sdk/extension/render/render-comment-editor-element.js +7 -2
  16. package/dist/basic-sdk/extension/toolbar/comment-editor-toolbar/index.js +4 -0
  17. package/dist/basic-sdk/utils/rebase.js +25 -13
  18. package/dist/components/doc-operations/revision-operations/index.js +37 -1
  19. package/dist/constants/index.js +6 -3
  20. package/package.json +1 -1
  21. package/public/locales/cs/sdoc-editor.json +7 -3
  22. package/public/locales/de/sdoc-editor.json +8 -4
  23. package/public/locales/en/sdoc-editor.json +2 -1
  24. package/public/locales/es/sdoc-editor.json +7 -3
  25. package/public/locales/fr/sdoc-editor.json +7 -3
  26. package/public/locales/it/sdoc-editor.json +7 -3
  27. package/public/locales/ru/sdoc-editor.json +8 -4
  28. package/public/locales/zh_CN/sdoc-editor.json +2 -1
  29. package/dist/basic-sdk/extension/plugins/table/menu/active-table-menu/combine-cells.js +0 -32
  30. package/dist/basic-sdk/extension/plugins/table/menu/active-table-menu/remove-table-menu.js +0 -30
  31. package/dist/basic-sdk/extension/plugins/table/menu/active-table-menu/table-column-menu.js +0 -38
  32. package/dist/basic-sdk/extension/plugins/table/menu/active-table-menu/table-row-menu.js +0 -38
@@ -28,7 +28,7 @@
28
28
  padding-left: 1.2em !important;
29
29
  }
30
30
 
31
- .sdoc-editor-container .article .list-container .sdoc-li-blod::marker {
31
+ .sdoc-editor-container .article .list-container .sdoc-li-bold::marker {
32
32
  font-weight: bold;
33
33
  }
34
34
 
@@ -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("li", {
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 liRef = useRef(null);
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
- setEditorContent(String(htmlString));
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("li", {
61
+ return /*#__PURE__*/React.createElement("div", {
61
62
  className: "comment-item",
62
- ref: liRef
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: liRef.current,
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("li", {
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("ul", {
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 .article.sdoc-comment-editor {
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 10px 0;
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
@@ -5,7 +5,7 @@
5
5
  max-width: 620px;
6
6
  border-left: 1px solid #e2e3e6;
7
7
  /* Prevent the image menu from still appearing above the comment drawer when scrolled hidden. */
8
- z-index: 103;
8
+ z-index: 102;
9
9
  }
10
10
 
11
11
  .sdoc-comment-drawer .comments-panel-wrapper {
@@ -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 = 100;
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 - 100 + scrollTop; // 100: header height(56) + toolbar height(44)
62
+ return minY - 93 + scrollTop; // 100: header height(56) + toolbar height(37)
63
63
  };
@@ -86,16 +86,6 @@ export const MENUS_CONFIG_MAP = {
86
86
  iconClass: 'sdocfont sdoc-table',
87
87
  text: 'Insert_table'
88
88
  },
89
- [REMOVE_TABLE]: {
90
- id: "sdoc_".concat(REMOVE_TABLE),
91
- iconClass: 'sdocfont sdoc-delete-table',
92
- text: 'Delete_table'
93
- },
94
- [COMBINE_CELL]: {
95
- id: "sdoc_".concat(COMBINE_CELL),
96
- iconClass: 'sdocfont sdoc-merge-cell',
97
- text: 'Combine_cell'
98
- },
99
89
  [TEXT_STYLE]: [{
100
90
  id: ITALIC,
101
91
  iconClass: 'sdocfont sdoc-italic',
@@ -33,10 +33,10 @@ export const genCodeLangs = () => {
33
33
  value: 'c'
34
34
  }, {
35
35
  text: 'C++',
36
- value: 'cpp'
36
+ value: 'c++'
37
37
  }, {
38
38
  text: 'C#',
39
- value: 'csharp'
39
+ value: 'c#'
40
40
  }, {
41
41
  text: 'Go',
42
42
  value: 'go'
@@ -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 = [TextPlugin, MarkDownPlugin, HtmlPlugin, ListPlugin, ImagePlugin, LinkPlugin, MentionPlugin];
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 isBlod = element.children[0].children.every(item => item.bold === true);
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-blod': isBlod
41
+ 'sdoc-li-bold': isBold
42
42
  })
43
43
  }), children);
44
44
  };
@@ -4,10 +4,6 @@ import { MenuGroup } from '../../../../commons';
4
4
  import { isAllInTable } from '../../helpers';
5
5
  import CellBackgroundColorMenu from './cell-bg-color-menu';
6
6
  import CellTextAlignMenu from './cell-text-align-menu';
7
- import CombineCells from './combine-cells';
8
- import RemoveTable from './remove-table-menu';
9
- import TableColumnMenu from './table-column-menu';
10
- import TableRowMenu from './table-row-menu';
11
7
  import ColumnVerticalAlignmentMenu from './column-vertical-alignment-menu';
12
8
  import './index.css';
13
9
  const ActiveTableMenu = _ref => {
@@ -26,27 +22,11 @@ const ActiveTableMenu = _ref => {
26
22
  }), /*#__PURE__*/React.createElement(ColumnVerticalAlignmentMenu, {
27
23
  editor: editor,
28
24
  readonly: readonly
29
- }), /*#__PURE__*/React.createElement(TableColumnMenu, {
30
- editor: editor,
31
- readonly: readonly
32
- }), /*#__PURE__*/React.createElement(TableRowMenu, {
33
- editor: editor,
34
- readonly: readonly
35
25
  }), /*#__PURE__*/React.createElement(CellBackgroundColorMenu, {
36
26
  editor: editor,
37
27
  isRichEditor: isRichEditor,
38
28
  className: className,
39
29
  readonly: readonly
40
- }), /*#__PURE__*/React.createElement(CombineCells, {
41
- editor: editor,
42
- isRichEditor: isRichEditor,
43
- className: className,
44
- readonly: readonly
45
- }), /*#__PURE__*/React.createElement(RemoveTable, {
46
- editor: editor,
47
- isRichEditor: isRichEditor,
48
- className: className,
49
- readonly: readonly
50
30
  }));
51
31
  };
52
32
  export default withTranslation('sdoc-editor')(ActiveTableMenu);
@@ -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,
@@ -169,9 +169,7 @@ const getMergeElement = (diffElement, baseElement) => {
169
169
  }
170
170
 
171
171
  // The content of the subnode has changed and needs to be solved manually.
172
- const {
173
- content: childrenContent
174
- } = getMergeContent(baseElement, diffElement.children);
172
+ const childrenContent = getMergeContent(baseElement, diffElement.children);
175
173
  return [_objectSpread(_objectSpread({}, newElement), {}, {
176
174
  children: childrenContent
177
175
  })];
@@ -194,11 +192,28 @@ const getMergeContent = (baseContent, diffChanges) => {
194
192
  const mergeElements = getMergeElement(diffElement, baseElement);
195
193
  content.push(...mergeElements);
196
194
  });
197
- const canMerge = !hasConflict(content);
198
- return {
199
- content,
200
- canMerge
201
- };
195
+ return content;
196
+ };
197
+ export const canMerge = (content, reference) => {
198
+ if (hasConflict(content)) return false;
199
+ if (!Array.isArray(reference) || reference.length === 0) return true;
200
+ const {
201
+ map: referenceMap
202
+ } = generateIdMapAndIds(reference);
203
+ let flag = true;
204
+ for (let i = 0; i < content.length; i++) {
205
+ const element = content[i];
206
+ let referenceElement = referenceMap[element.id];
207
+ if (!referenceElement) {
208
+ flag = false;
209
+ break;
210
+ }
211
+ flag = canMerge(element.children, referenceElement.children);
212
+ if (flag === false) {
213
+ break;
214
+ }
215
+ }
216
+ return flag;
202
217
  };
203
218
  export const getRebase = (masterContent, baseContent, revisionContent) => {
204
219
  // master no changes, merged directly
@@ -219,12 +234,9 @@ export const getRebase = (masterContent, baseContent, revisionContent) => {
219
234
  };
220
235
  }
221
236
  const diffChanges = getChanges(masterContent, revisionContent);
222
- const {
223
- canMerge,
224
- content
225
- } = getMergeContent(baseContent, diffChanges);
237
+ const content = getMergeContent(baseContent, diffChanges);
226
238
  return {
227
- canMerge,
239
+ canMerge: canMerge(content, revisionContent.children),
228
240
  isNeedReplaceMaster: true,
229
241
  value: _objectSpread(_objectSpread({}, revisionContent), {}, {
230
242
  children: content,
@@ -32,6 +32,41 @@ const RevisionOperations = _ref => {
32
32
  const {
33
33
  loadDocument
34
34
  } = useDocument();
35
+ useEffect(() => {
36
+ if (isShowChanges) return;
37
+ setShowTip(true);
38
+ setTipType(TIP_TYPE.CHECKING);
39
+ const revisionPromise = loadDocument();
40
+ const baseVersionPromise = context.getRevisionBaseVersionContent();
41
+ const originVersionPromise = context.getSeadocOriginFileContent();
42
+ Promise.all([revisionPromise, baseVersionPromise, originVersionPromise]).then(results => {
43
+ const [revisionContent, baseRes, masterRes] = results;
44
+ const baseContent = JSON.parse(baseRes.data.content);
45
+ const masterContent = JSON.parse(masterRes.data.content);
46
+
47
+ // no changes
48
+ if (masterContent.version === baseContent.version) {
49
+ setShowTip(false);
50
+ setTipType('');
51
+ return;
52
+ }
53
+ const {
54
+ value
55
+ } = getRebase(masterContent, baseContent, revisionContent);
56
+ setMergeValue(value);
57
+ setTipType(TIP_TYPE.SOURCE_DOCUMENT_CHANGED);
58
+ }).catch(error => {
59
+ if (typeof error === 'string') {
60
+ toaster.danger(t(error));
61
+ return;
62
+ }
63
+ toaster.danger(t('Error'));
64
+ setShowTip(false);
65
+ setTipType('');
66
+ });
67
+
68
+ // eslint-disable-next-line react-hooks/exhaustive-deps
69
+ }, []);
35
70
  const onDocumentReplaced = useCallback(() => {
36
71
  if (isShowTip) return;
37
72
  setTipType(TIP_TYPE.HAS_BEEN_REPLACED);
@@ -150,6 +185,7 @@ const RevisionOperations = _ref => {
150
185
  const onSubmit = useCallback(() => {
151
186
  if (tipType === TIP_TYPE.HAS_BEEN_PUBLISHED) {
152
187
  // nothing todo
188
+ return;
153
189
  }
154
190
  if (tipType === TIP_TYPE.DELETE_NO_CHANGES_REVISION) {
155
191
  context.deleteSdocRevision().then(res => {
@@ -161,7 +197,7 @@ const RevisionOperations = _ref => {
161
197
  });
162
198
  return;
163
199
  }
164
- if (tipType === TIP_TYPE.MERGE) {
200
+ if (tipType === TIP_TYPE.MERGE || tipType === TIP_TYPE.SOURCE_DOCUMENT_CHANGED) {
165
201
  const {
166
202
  username
167
203
  } = context.getUserInfo();
@@ -31,7 +31,8 @@ export const TIP_TYPE = {
31
31
  HAS_BEEN_REMOVED: 'has_been_removed',
32
32
  CHECKING: 'checking',
33
33
  PUBLISHING: 'publishing',
34
- DELETE_REVISION: 'delete_revision'
34
+ DELETE_REVISION: 'delete_revision',
35
+ SOURCE_DOCUMENT_CHANGED: 'source_document_changed'
35
36
  };
36
37
  export const TIP_TITLE = {
37
38
  [TIP_TYPE.DELETE_NO_CHANGES_REVISION]: 'Tip',
@@ -43,7 +44,8 @@ export const TIP_TITLE = {
43
44
  [TIP_TYPE.HAS_BEEN_REMOVED]: 'Tip',
44
45
  [TIP_TYPE.CHECKING]: 'Tip',
45
46
  [TIP_TYPE.PUBLISHING]: 'Tip',
46
- [TIP_TYPE.DELETE_REVISION]: 'Delete_revision'
47
+ [TIP_TYPE.DELETE_REVISION]: 'Delete_revision',
48
+ [TIP_TYPE.SOURCE_DOCUMENT_CHANGED]: 'Tip'
47
49
  };
48
50
  export const TIP_CONTENT = {
49
51
  [TIP_TYPE.DELETE_NO_CHANGES_REVISION]: 'Rebase_delete_no_change_revision_tip',
@@ -55,6 +57,7 @@ export const TIP_CONTENT = {
55
57
  [TIP_TYPE.HAS_BEEN_REMOVED]: 'Has_been_removed_tip',
56
58
  [TIP_TYPE.CHECKING]: 'Checking',
57
59
  [TIP_TYPE.PUBLISHING]: 'Publishing',
58
- [TIP_TYPE.DELETE_REVISION]: 'Delete_tip'
60
+ [TIP_TYPE.DELETE_REVISION]: 'Delete_tip',
61
+ [TIP_TYPE.SOURCE_DOCUMENT_CHANGED]: 'Source_document_changed_tip'
59
62
  };
60
63
  export { KeyCodes, TransferTypes };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.5.48",
3
+ "version": "0.5.50",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",
@@ -274,8 +274,8 @@
274
274
  "Delete_reply": "Delete reply",
275
275
  "Are_you_sure_to_delete_this_comment": "Are you sure to delete this comment?",
276
276
  "Are_you_sure_to_delete_this_reply": "Are you sure to delete this reply?",
277
- "Enter_comment_Enter_for_new_line_shift_enter_to_send": "Enter a comment",
278
- "Enter_reply_Enter_for_new_line_Shift_Enter_to_send": "Enter a reply",
277
+ "Enter_comment_Enter_for_new_line_shift_enter_to_send": "Enter comment, Enter for new line, Shift + Enter to send",
278
+ "Enter_reply_Enter_for_new_line_Shift_Enter_to_send": "Enter reply, Enter for new line, Shift + Enter to send",
279
279
  "Reopen_discussion": "Adding a reply will reopen this discussion",
280
280
  "Confirm": "Potvrdit",
281
281
  "View_changes": "View changes",
@@ -452,5 +452,9 @@
452
452
  "Move_column_count": "Moving {{count}} column(s)",
453
453
  "Move_row_count": "Moving {{count}} row(s)",
454
454
  "Mark_all_as_read": "Mark all as read",
455
- "Alignment_type": "Alignment"
455
+ "Alignment_type": "Alignment",
456
+ "Print": "Print",
457
+ "Enter_more_character_start_search": "Enter more characters to start search",
458
+ "Create_file_name_sdoc": "Create {{file_name_sdoc}}",
459
+ "Source_document_changed_tip": "Original document has concurrent modifications. Do you like to merge these modifications to the revision?"
456
460
  }
@@ -59,7 +59,7 @@
59
59
  "Copy_internal_link": "Der interne Link wurde in den Zwischenspeicher kopiert.",
60
60
  "Internal_link_desc": "Interne Links sind Verweise auf Dateien bzw. Ordner, die nur von Benutzer/innen mit mindestens Leserechten für die Dateien bzw. Ordner genutzt werden können. Interne Links eignen sich insbesondere für die interne Kommunikation in Ticket-/CRM-Systemen sowie E-Mails und Chats.",
61
61
  "Share": "Freigeben",
62
- "Share_link": "Share link",
62
+ "Share_link": "Freigabe-Link",
63
63
  "Generate": "Erstellen",
64
64
  "Add_password_protection": "Passwort hinzufügen",
65
65
  "Password": "Passwort",
@@ -274,8 +274,8 @@
274
274
  "Delete_reply": "Delete reply",
275
275
  "Are_you_sure_to_delete_this_comment": "Are you sure to delete this comment?",
276
276
  "Are_you_sure_to_delete_this_reply": "Are you sure to delete this reply?",
277
- "Enter_comment_Enter_for_new_line_shift_enter_to_send": "Enter a comment",
278
- "Enter_reply_Enter_for_new_line_Shift_Enter_to_send": "Enter a reply",
277
+ "Enter_comment_Enter_for_new_line_shift_enter_to_send": "Enter comment, Enter for new line, Shift + Enter to send",
278
+ "Enter_reply_Enter_for_new_line_Shift_Enter_to_send": "Enter reply, Enter for new line, Shift + Enter to send",
279
279
  "Reopen_discussion": "Adding a reply will reopen this discussion",
280
280
  "Confirm": "Bestätigen",
281
281
  "View_changes": "View changes",
@@ -452,5 +452,9 @@
452
452
  "Move_column_count": "Moving {{count}} column(s)",
453
453
  "Move_row_count": "Moving {{count}} row(s)",
454
454
  "Mark_all_as_read": "Alle als gelesen markieren",
455
- "Alignment_type": "Alignment"
455
+ "Alignment_type": "Alignment",
456
+ "Print": "Drucken",
457
+ "Enter_more_character_start_search": "Enter more characters to start search",
458
+ "Create_file_name_sdoc": "Create {{file_name_sdoc}}",
459
+ "Source_document_changed_tip": "Original document has concurrent modifications. Do you like to merge these modifications to the revision?"
456
460
  }
@@ -455,5 +455,6 @@
455
455
  "Alignment_type": "Alignment",
456
456
  "Print": "Print",
457
457
  "Enter_more_character_start_search": "Enter more characters to start search",
458
- "Create_file_name_sdoc": "Create {{file_name_sdoc}}"
458
+ "Create_file_name_sdoc": "Create {{file_name_sdoc}}",
459
+ "Source_document_changed_tip": "Original document has concurrent modifications. Do you like to merge these modifications to the revision?"
459
460
  }
@@ -274,8 +274,8 @@
274
274
  "Delete_reply": "Delete reply",
275
275
  "Are_you_sure_to_delete_this_comment": "Are you sure to delete this comment?",
276
276
  "Are_you_sure_to_delete_this_reply": "Are you sure to delete this reply?",
277
- "Enter_comment_Enter_for_new_line_shift_enter_to_send": "Enter a comment",
278
- "Enter_reply_Enter_for_new_line_Shift_Enter_to_send": "Enter a reply",
277
+ "Enter_comment_Enter_for_new_line_shift_enter_to_send": "Enter comment, Enter for new line, Shift + Enter to send",
278
+ "Enter_reply_Enter_for_new_line_Shift_Enter_to_send": "Enter reply, Enter for new line, Shift + Enter to send",
279
279
  "Reopen_discussion": "Adding a reply will reopen this discussion",
280
280
  "Confirm": "Confirmar",
281
281
  "View_changes": "View changes",
@@ -452,5 +452,9 @@
452
452
  "Move_column_count": "Moving {{count}} column(s)",
453
453
  "Move_row_count": "Moving {{count}} row(s)",
454
454
  "Mark_all_as_read": "Mark all as read",
455
- "Alignment_type": "Alignment"
455
+ "Alignment_type": "Alignment",
456
+ "Print": "Print",
457
+ "Enter_more_character_start_search": "Enter more characters to start search",
458
+ "Create_file_name_sdoc": "Create {{file_name_sdoc}}",
459
+ "Source_document_changed_tip": "Original document has concurrent modifications. Do you like to merge these modifications to the revision?"
456
460
  }
@@ -274,8 +274,8 @@
274
274
  "Delete_reply": "Supprimer la réponse",
275
275
  "Are_you_sure_to_delete_this_comment": "Êtes-vous sûr de vouloir supprimer ce commentaire ?",
276
276
  "Are_you_sure_to_delete_this_reply": "Êtes-vous sûr de vouloir supprimer cette réponse ?",
277
- "Enter_comment_Enter_for_new_line_shift_enter_to_send": "Saisir un commentaire",
278
- "Enter_reply_Enter_for_new_line_Shift_Enter_to_send": "Saisir une réponse",
277
+ "Enter_comment_Enter_for_new_line_shift_enter_to_send": "Enter comment, Enter for new line, Shift + Enter to send",
278
+ "Enter_reply_Enter_for_new_line_Shift_Enter_to_send": "Enter reply, Enter for new line, Shift + Enter to send",
279
279
  "Reopen_discussion": "L'ajout d'une réponse rouvrira la discussion.",
280
280
  "Confirm": "Confirmer",
281
281
  "View_changes": "Afficher les modifications",
@@ -452,5 +452,9 @@
452
452
  "Move_column_count": "Moving {{count}} column(s)",
453
453
  "Move_row_count": "Moving {{count}} row(s)",
454
454
  "Mark_all_as_read": "Mark all as read",
455
- "Alignment_type": "Alignment"
455
+ "Alignment_type": "Alignment",
456
+ "Print": "Imprimer",
457
+ "Enter_more_character_start_search": "Enter more characters to start search",
458
+ "Create_file_name_sdoc": "Create {{file_name_sdoc}}",
459
+ "Source_document_changed_tip": "Original document has concurrent modifications. Do you like to merge these modifications to the revision?"
456
460
  }
@@ -274,8 +274,8 @@
274
274
  "Delete_reply": "Delete reply",
275
275
  "Are_you_sure_to_delete_this_comment": "Are you sure to delete this comment?",
276
276
  "Are_you_sure_to_delete_this_reply": "Are you sure to delete this reply?",
277
- "Enter_comment_Enter_for_new_line_shift_enter_to_send": "Enter a comment",
278
- "Enter_reply_Enter_for_new_line_Shift_Enter_to_send": "Enter a reply",
277
+ "Enter_comment_Enter_for_new_line_shift_enter_to_send": "Enter comment, Enter for new line, Shift + Enter to send",
278
+ "Enter_reply_Enter_for_new_line_Shift_Enter_to_send": "Enter reply, Enter for new line, Shift + Enter to send",
279
279
  "Reopen_discussion": "Adding a reply will reopen this discussion",
280
280
  "Confirm": "Confirm",
281
281
  "View_changes": "View changes",
@@ -452,5 +452,9 @@
452
452
  "Move_column_count": "Moving {{count}} column(s)",
453
453
  "Move_row_count": "Moving {{count}} row(s)",
454
454
  "Mark_all_as_read": "Mark all as read",
455
- "Alignment_type": "Alignment"
455
+ "Alignment_type": "Alignment",
456
+ "Print": "Print",
457
+ "Enter_more_character_start_search": "Enter more characters to start search",
458
+ "Create_file_name_sdoc": "Create {{file_name_sdoc}}",
459
+ "Source_document_changed_tip": "Original document has concurrent modifications. Do you like to merge these modifications to the revision?"
456
460
  }
@@ -274,8 +274,8 @@
274
274
  "Delete_reply": "Удалить ответ",
275
275
  "Are_you_sure_to_delete_this_comment": "Вы уверены, что удалите этот комментарий?",
276
276
  "Are_you_sure_to_delete_this_reply": "Вы уверены, что удалите этот ответ?",
277
- "Enter_comment_Enter_for_new_line_shift_enter_to_send": "Введите комментарий",
278
- "Enter_reply_Enter_for_new_line_Shift_Enter_to_send": "Введите ответ",
277
+ "Enter_comment_Enter_for_new_line_shift_enter_to_send": "Введите комментарий, Enter для новой строки, Shift + Enter для отправки",
278
+ "Enter_reply_Enter_for_new_line_Shift_Enter_to_send": "Введите ответ, Enter для новой строки, Shift + Enter для отправки.",
279
279
  "Reopen_discussion": "Добавление ответа приведёт к возобновлению обсуждения.",
280
280
  "Confirm": "Подтвердить",
281
281
  "View_changes": "Просмотр изменений",
@@ -400,7 +400,7 @@
400
400
  "Delete_failed": "Не удалось удалить",
401
401
  "Insert_caption": "Вставить подпись",
402
402
  "No_collaborators_available": "Нет доступных соавторов",
403
- "Search_collaborator": "Search collaborator",
403
+ "Search_collaborator": "Поиск соавтора",
404
404
  "Doc_comments": "Комментарии к документу",
405
405
  "Tag_not_found": "Тег не найден",
406
406
  "Create_a_new_tag": "Создать новый тег",
@@ -452,5 +452,9 @@
452
452
  "Move_column_count": "Перемещение {{count}} столбцов",
453
453
  "Move_row_count": "Перемещение {{count}} строк",
454
454
  "Mark_all_as_read": "Отметить все как прочитанное",
455
- "Alignment_type": "Alignment"
455
+ "Alignment_type": "Выравнивание",
456
+ "Print": "Печать",
457
+ "Enter_more_character_start_search": "Введите больше символов, чтобы начать поиск",
458
+ "Create_file_name_sdoc": "Создать {{file_name_sdoc}}",
459
+ "Source_document_changed_tip": "Original document has concurrent modifications. Do you like to merge these modifications to the revision?"
456
460
  }
@@ -455,5 +455,6 @@
455
455
  "Alignment_type": "对齐方式",
456
456
  "Print": "打印",
457
457
  "Enter_more_character_start_search": "输入更多字符开始搜索",
458
- "Create_file_name_sdoc": "新建 {{file_name_sdoc}}"
458
+ "Create_file_name_sdoc": "新建 {{file_name_sdoc}}",
459
+ "Source_document_changed_tip": "源文档有并发的改动。你需要合并这些改动到修订稿吗?"
459
460
  }
@@ -1,32 +0,0 @@
1
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
- import React, { useCallback, useEffect, useState } from 'react';
3
- import { MenuItem } from '../../../../commons';
4
- import { MENUS_CONFIG_MAP, COMBINE_CELL } from '../../../../constants';
5
- import { isCombineCellsDisabled, combineCells } from '../../helpers';
6
- const CombineCells = _ref => {
7
- let {
8
- isRichEditor,
9
- className,
10
- editor,
11
- readonly
12
- } = _ref;
13
- const [disabled, setDisabled] = useState(false);
14
- useEffect(() => {
15
- const disabled = isCombineCellsDisabled(editor, readonly);
16
- setDisabled(disabled);
17
- }, [editor, editor.tableSelectedRange, readonly]);
18
- const _combineCells = useCallback(() => {
19
- if (readonly) return;
20
- combineCells(editor);
21
- }, [editor, readonly]);
22
- const menuConfig = MENUS_CONFIG_MAP[COMBINE_CELL];
23
- const props = _objectSpread(_objectSpread({
24
- isRichEditor,
25
- disabled: disabled,
26
- isActive: false
27
- }, menuConfig), {}, {
28
- onMouseDown: _combineCells
29
- });
30
- return /*#__PURE__*/React.createElement(MenuItem, props);
31
- };
32
- export default CombineCells;
@@ -1,30 +0,0 @@
1
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
- import React, { useCallback } from 'react';
3
- import classnames from 'classnames';
4
- import { MenuItem } from '../../../../commons';
5
- import { MENUS_CONFIG_MAP, REMOVE_TABLE } from '../../../../constants';
6
- import { removeTableElement } from '../../helpers';
7
- import { TABLE_ELEMENT } from '../../constants';
8
- const RemoveTable = _ref => {
9
- let {
10
- isRichEditor,
11
- className,
12
- editor,
13
- readonly
14
- } = _ref;
15
- const removeTable = useCallback(() => {
16
- if (readonly) return;
17
- removeTableElement(editor, TABLE_ELEMENT.TABLE);
18
- }, [editor, readonly]);
19
- const menuConfig = MENUS_CONFIG_MAP[REMOVE_TABLE];
20
- const props = _objectSpread(_objectSpread({
21
- isRichEditor,
22
- className: classnames(className, 'sdoc-remove-table menu-group-item'),
23
- disabled: readonly,
24
- isActive: false
25
- }, menuConfig), {}, {
26
- onMouseDown: removeTable
27
- });
28
- return /*#__PURE__*/React.createElement(MenuItem, props);
29
- };
30
- export default RemoveTable;
@@ -1,38 +0,0 @@
1
- import React, { useCallback, useRef } from 'react';
2
- import { useTranslation } from 'react-i18next';
3
- import CommonMenu from './common-menu';
4
- import { insertTableElement, removeTableElement } from '../../helpers';
5
- import { TABLE_ELEMENT } from '../../constants';
6
- const TableColumnMenu = _ref => {
7
- let {
8
- editor,
9
- readonly
10
- } = _ref;
11
- const tableColumnRef = useRef(null);
12
- const {
13
- t
14
- } = useTranslation();
15
- const insertColumn = useCallback(type => {
16
- if (readonly) return;
17
- insertTableElement(editor, type);
18
- tableColumnRef.current && tableColumnRef.current.hidePopover();
19
- }, [editor, readonly]);
20
- const removeColumn = useCallback(type => {
21
- if (readonly) return;
22
- removeTableElement(editor, type);
23
- tableColumnRef.current && tableColumnRef.current.hidePopover();
24
- }, [editor, readonly]);
25
- return /*#__PURE__*/React.createElement(CommonMenu, {
26
- id: "table-column",
27
- iconClass: "sdocfont sdoc-column",
28
- ref: tableColumnRef,
29
- disabled: readonly
30
- }, /*#__PURE__*/React.createElement("div", {
31
- className: "sdoc-dropdown-menu-item",
32
- onClick: () => insertColumn(TABLE_ELEMENT.COLUMN)
33
- }, t('Insert_column')), /*#__PURE__*/React.createElement("div", {
34
- className: "sdoc-dropdown-menu-item",
35
- onClick: () => removeColumn(TABLE_ELEMENT.COLUMN)
36
- }, t('Remove_column')));
37
- };
38
- export default TableColumnMenu;
@@ -1,38 +0,0 @@
1
- import React, { useCallback, useRef } from 'react';
2
- import { useTranslation } from 'react-i18next';
3
- import CommonMenu from './common-menu';
4
- import { insertTableElement, removeTableElement } from '../../helpers';
5
- import { TABLE_ELEMENT } from '../../constants';
6
- const TableRowMenu = _ref => {
7
- let {
8
- editor,
9
- readonly
10
- } = _ref;
11
- const tableRowRef = useRef(null);
12
- const {
13
- t
14
- } = useTranslation();
15
- const insertRow = useCallback(type => {
16
- if (readonly) return;
17
- insertTableElement(editor, type);
18
- tableRowRef.current && tableRowRef.current.hidePopover();
19
- }, [editor, readonly]);
20
- const removeRow = useCallback(type => {
21
- if (readonly) return;
22
- removeTableElement(editor, type);
23
- tableRowRef.current && tableRowRef.current.hidePopover();
24
- }, [editor, readonly]);
25
- return /*#__PURE__*/React.createElement(CommonMenu, {
26
- id: "table-row",
27
- iconClass: "sdocfont sdoc-row",
28
- ref: tableRowRef,
29
- disabled: readonly
30
- }, /*#__PURE__*/React.createElement("div", {
31
- className: "sdoc-dropdown-menu-item",
32
- onClick: () => insertRow(TABLE_ELEMENT.ROW)
33
- }, t('Insert_row')), /*#__PURE__*/React.createElement("div", {
34
- className: "sdoc-dropdown-menu-item",
35
- onClick: () => removeRow(TABLE_ELEMENT.ROW)
36
- }, t('Remove_row')));
37
- };
38
- export default TableRowMenu;