@seafile/sdoc-editor 0.5.57 → 0.5.59

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.
@@ -56,7 +56,7 @@
56
56
  .sdoc-editor-container .article .sdoc-image-wrapper {
57
57
  position: relative;
58
58
  display: inline-block;
59
- padding: 6px 6px 6px 0;
59
+ padding: 6px 1px 6px 1px;
60
60
  margin: 0 0.15em;
61
61
  }
62
62
 
@@ -18,7 +18,7 @@ import { IMAGE, IMAGE_BLOCK, CODE_LINE } from '../extension/constants';
18
18
  import { isPreventResetTableSelectedRange } from '../extension/plugins/table/helpers';
19
19
  const EditableArticle = _ref => {
20
20
  let {
21
- isShowComment,
21
+ showComment,
22
22
  editor,
23
23
  slateValue,
24
24
  updateSlateValue
@@ -211,12 +211,12 @@ const EditableArticle = _ref => {
211
211
  onCopy: eventProxy.onCopy,
212
212
  onCompositionStart: eventProxy.onCompositionStart,
213
213
  id: "sdoc-editor"
214
- })), /*#__PURE__*/React.createElement(SideToolbar, null), isShowComment && /*#__PURE__*/React.createElement(CommentWrapper, {
214
+ })), /*#__PURE__*/React.createElement(SideToolbar, null), showComment && /*#__PURE__*/React.createElement(CommentWrapper, {
215
215
  editor: editor,
216
216
  type: "editor"
217
217
  })));
218
218
  };
219
219
  EditableArticle.defaultProps = {
220
- isShowComment: true
220
+ showComment: true
221
221
  };
222
222
  export default EditableArticle;
@@ -68,7 +68,8 @@ const RevisionEditor = forwardRef((_ref, ref) => {
68
68
  ref: editorRef,
69
69
  editor: editor,
70
70
  isReloading: isReloading,
71
- document: document
71
+ document: document,
72
+ showComment: true
72
73
  });
73
74
  });
74
75
  export default RevisionEditor;
@@ -1,5 +1,5 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
- import React, { useEffect, useState, useImperativeHandle, forwardRef, useMemo, useCallback } from 'react';
2
+ import React, { useEffect, useState, useImperativeHandle, forwardRef, useMemo, useCallback, Fragment } from 'react';
3
3
  import { Editor } from '@seafile/slate';
4
4
  import deepCopy from 'deep-copy';
5
5
  import context from '../../context';
@@ -22,7 +22,8 @@ const SdocEditor = forwardRef((_ref, ref) => {
22
22
  let {
23
23
  editor: propsEditor,
24
24
  document,
25
- isReloading
25
+ isReloading,
26
+ showComment
26
27
  } = _ref;
27
28
  const validEditor = propsEditor || useMemo(() => {
28
29
  const defaultEditor = createDefaultEditor();
@@ -138,7 +139,8 @@ const SdocEditor = forwardRef((_ref, ref) => {
138
139
  showComment: false
139
140
  }, /*#__PURE__*/React.createElement(ReadOnlyArticle, {
140
141
  editor: validEditor,
141
- slateValue: slateValue
142
+ slateValue: slateValue,
143
+ showComment: false
142
144
  }))));
143
145
  }
144
146
  if (isFreezed) {
@@ -157,22 +159,25 @@ const SdocEditor = forwardRef((_ref, ref) => {
157
159
  }, /*#__PURE__*/React.createElement(ReadOnlyArticle, {
158
160
  editor: validEditor,
159
161
  slateValue: slateValue,
160
- isShowComment: true
162
+ showComment: true
161
163
  })))));
162
164
  }
165
+ const isShowComment = typeof showComment === 'boolean' ? showComment : true;
166
+ const Provider = isShowComment ? CollaboratorsProvider : Fragment;
163
167
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(EditorContainer, {
164
168
  editor: validEditor
165
- }, /*#__PURE__*/React.createElement(CollaboratorsProvider, null, /*#__PURE__*/React.createElement(ColorProvider, null, /*#__PURE__*/React.createElement(HeaderToolbar, {
169
+ }, /*#__PURE__*/React.createElement(Provider, null, /*#__PURE__*/React.createElement(ColorProvider, null, /*#__PURE__*/React.createElement(HeaderToolbar, {
166
170
  editor: validEditor
167
171
  }), /*#__PURE__*/React.createElement(EditorContent, {
168
172
  docValue: slateValue,
169
173
  showOutline: true,
170
174
  editor: validEditor,
171
- showComment: true
175
+ showComment: isShowComment
172
176
  }, /*#__PURE__*/React.createElement(EditableArticle, {
173
177
  editor: validEditor,
174
178
  slateValue: slateValue,
175
- updateSlateValue: onValueChange
179
+ updateSlateValue: onValueChange,
180
+ showComment: isShowComment
176
181
  }))))), /*#__PURE__*/React.createElement(InsertElementDialog, {
177
182
  editor: validEditor
178
183
  }));
@@ -38,7 +38,7 @@ export const FILE_TYPE = {
38
38
  [FILE_LINK]: 'file',
39
39
  [SDOC_LINK]: 'sdoc'
40
40
  };
41
- export const SUPPORTED_SIDE_OPERATION_TYPE = [PARAGRAPH, SUBTITLE, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, CHECK_LIST_ITEM, CODE_BLOCK, TABLE, BLOCKQUOTE, CALL_OUT];
41
+ export const SUPPORTED_SIDE_OPERATION_TYPE = [PARAGRAPH, SUBTITLE, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, CHECK_LIST_ITEM, CODE_BLOCK, TABLE, BLOCKQUOTE, CALL_OUT, IMAGE_BLOCK];
42
42
  export const MOUSE_ENTER_EVENT_DISABLED_MAP = {
43
43
  [PARAGRAPH]: [CALL_OUT],
44
44
  [TITLE]: [CALL_OUT],
@@ -56,5 +56,5 @@ export const MOUSE_ENTER_EVENT_DISABLED_MAP = {
56
56
  [HEADER6]: [CALL_OUT],
57
57
  [CALL_OUT]: [CALL_OUT]
58
58
  };
59
- export const ROOT_ELEMENT_TYPES = [PARAGRAPH, TITLE, SUBTITLE, CHECK_LIST_ITEM, ORDERED_LIST, UNORDERED_LIST, BLOCKQUOTE, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, CALL_OUT, TABLE, CODE_BLOCK];
59
+ export const ROOT_ELEMENT_TYPES = [PARAGRAPH, TITLE, SUBTITLE, CHECK_LIST_ITEM, ORDERED_LIST, UNORDERED_LIST, BLOCKQUOTE, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, CALL_OUT, TABLE, CODE_BLOCK, IMAGE_BLOCK];
60
60
  export { ELEMENT_TYPE, BLOCKQUOTE, TITLE, SUBTITLE, HEADER, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, PARAGRAPH, ORDERED_LIST, UNORDERED_LIST, LIST_ITEM, CHECK_LIST_ITEM, CODE_BLOCK, CODE_LINE, TABLE, TABLE_CELL, TABLE_ROW, LINK, SDOC_LINK, FILE_LINK, IMAGE, IMAGE_BLOCK, TOP_LEVEL_TYPES, INLINE_LEVEL_TYPES, CALL_OUT, MENTION, MENTION_TEMP, FILE_LINK_INSET_INPUT_TEMP };
@@ -9,7 +9,7 @@ const ReadOnlyArticle = _ref => {
9
9
  let {
10
10
  editor,
11
11
  slateValue,
12
- isShowComment
12
+ showComment
13
13
  } = _ref;
14
14
  const decorate = usePipDecorate(editor);
15
15
  return /*#__PURE__*/React.createElement(Slate, {
@@ -24,12 +24,12 @@ const ReadOnlyArticle = _ref => {
24
24
  renderElement: renderElement,
25
25
  renderLeaf: renderLeaf,
26
26
  decorate: decorate
27
- })), isShowComment && /*#__PURE__*/React.createElement(CommentWrapper, {
27
+ })), showComment && /*#__PURE__*/React.createElement(CommentWrapper, {
28
28
  editor: editor,
29
29
  type: "editor"
30
30
  })));
31
31
  };
32
32
  ReadOnlyArticle.defaultProps = {
33
- isShowComment: false
33
+ showComment: false
34
34
  };
35
35
  export default ReadOnlyArticle;
@@ -35,6 +35,7 @@ const SDocViewer = _ref => {
35
35
  };
36
36
  SDocViewer.defaultProps = {
37
37
  showToolbar: false,
38
- showOutline: false
38
+ showOutline: false,
39
+ showComment: false
39
40
  };
40
41
  export default SDocViewer;
@@ -32,7 +32,7 @@ const SDocMdViewer = _ref => {
32
32
  }, /*#__PURE__*/React.createElement(ReadOnlyArticle, {
33
33
  editor: validEditor,
34
34
  slateValue: slateValue,
35
- isShowComment: false
35
+ showComment: false
36
36
  }), showOutline && /*#__PURE__*/React.createElement("div", {
37
37
  className: "sdoc-wiki-outline-container"
38
38
  }, /*#__PURE__*/React.createElement(Outline, {
@@ -16,7 +16,8 @@ const DocInfo = _ref => {
16
16
  isStarred,
17
17
  isDraft,
18
18
  isEditMode,
19
- isPublished = false
19
+ isPublished = false,
20
+ showFileTags = true
20
21
  } = _ref;
21
22
  const isSdocRevision = context.getSetting('isSdocRevision');
22
23
  const docName = context.getSetting('docName');
@@ -61,7 +62,7 @@ const DocInfo = _ref => {
61
62
  alt: t('Document_frozen'),
62
63
  title: t('Document_frozen'),
63
64
  width: "16px"
64
- })), /*#__PURE__*/React.createElement(FileTagQuickView, null), /*#__PURE__*/React.createElement(TipMessage, {
65
+ })), showFileTags && /*#__PURE__*/React.createElement(FileTagQuickView, null), /*#__PURE__*/React.createElement(TipMessage, {
65
66
  isEditMode: isEditMode
66
67
  }));
67
68
  if (!isSdocRevision) {
@@ -15,6 +15,9 @@ const SimpleEditor = _ref => {
15
15
  let {
16
16
  isStarred,
17
17
  isDraft,
18
+ showComment,
19
+ showDocOperations = true,
20
+ showFileTags = true,
18
21
  t
19
22
  } = _ref;
20
23
  context.initApi();
@@ -99,7 +102,8 @@ const SimpleEditor = _ref => {
99
102
  return /*#__PURE__*/React.createElement(SDocEditor, {
100
103
  ref: editorRef,
101
104
  isReloading: isReloading,
102
- document: document
105
+ document: document,
106
+ showComment: showComment
103
107
  });
104
108
  }
105
109
  if (isPublished) {
@@ -117,7 +121,7 @@ const SimpleEditor = _ref => {
117
121
  revisionContent: revisionContent,
118
122
  didMountCallback: setDiffChanges
119
123
  });
120
- }, [isSdocRevision, editorRef, isReloading, document, isPublished, isShowChanges, revisionContent, setDiffChanges]);
124
+ }, [isSdocRevision, isPublished, isShowChanges, isReloading, document, revisionContent, setDiffChanges, showComment]);
121
125
  if (isFirstLoading) {
122
126
  return /*#__PURE__*/React.createElement(Loading, null);
123
127
  }
@@ -131,9 +135,10 @@ const SimpleEditor = _ref => {
131
135
  return /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement(Layout, null, /*#__PURE__*/React.createElement(Header, null, /*#__PURE__*/React.createElement(DocInfo, {
132
136
  isStarred: isStarred,
133
137
  isDraft: isDraft,
138
+ showFileTags: showFileTags,
134
139
  isPublished: isPublished,
135
140
  isEditMode: isPublished ? false : !isShowChanges
136
- }), /*#__PURE__*/React.createElement(DocOperations, {
141
+ }), showDocOperations && /*#__PURE__*/React.createElement(DocOperations, {
137
142
  isShowChanges: isShowChanges,
138
143
  isPublished: isPublished,
139
144
  changes: changes,
@@ -81,7 +81,8 @@ class SimpleViewer extends React.Component {
81
81
  })))), /*#__PURE__*/React.createElement(Content, null, /*#__PURE__*/React.createElement(SDocViewer, {
82
82
  document: document,
83
83
  showToolbar: false,
84
- showOutline: false
84
+ showOutline: false,
85
+ showComment: false
85
86
  }))));
86
87
  }
87
88
  return /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement(Layout, null, /*#__PURE__*/React.createElement(Header, null, /*#__PURE__*/React.createElement("div", {
@@ -100,7 +101,8 @@ class SimpleViewer extends React.Component {
100
101
  })))), /*#__PURE__*/React.createElement(Content, null, /*#__PURE__*/React.createElement(SDocViewer, {
101
102
  document: document,
102
103
  showToolbar: true,
103
- showOutline: true
104
+ showOutline: true,
105
+ showComment: false
104
106
  }))));
105
107
  }
106
108
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.5.57",
3
+ "version": "0.5.59",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",
@@ -97,7 +97,7 @@
97
97
  "css-minimizer-webpack-plugin": "5.0.1",
98
98
  "dotenv": "6.2.0",
99
99
  "dotenv-expand": "5.1.0",
100
- "ejs": "3.1.8",
100
+ "ejs": "3.1.10",
101
101
  "eslint": "6.8.0",
102
102
  "eslint-config-react-app": "^5.0.2",
103
103
  "eslint-loader": "4.0.2",