@seafile/comment-editor 0.0.1-alpha.51 → 0.0.1-alpha.53

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.
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = void 0;
9
9
  var _react = _interopRequireWildcard(require("react"));
10
- var _reactI18next = require("react-i18next");
11
10
  var _slate = require("@seafile/slate");
12
11
  var _slateReact = require("@seafile/slate-react");
13
12
  var _classnames = _interopRequireDefault(require("classnames"));
@@ -30,6 +29,8 @@ var _slateToMd = _interopRequireDefault(require("../slate-convert/slate-to-md"))
30
29
  var _eventBus = _interopRequireDefault(require("../utils/event-bus"));
31
30
  var _eventHandler = _interopRequireDefault(require("../utils/event-handler"));
32
31
  require("./comment-editor.css");
32
+ // import { useTranslation } from 'react-i18next';
33
+
33
34
  const getSubmitTip = (type, content) => {
34
35
  if (content) return 'Save';
35
36
  return type === 'comment' ? 'Comment' : 'Reply';
@@ -47,9 +48,7 @@ const CommentEditor = _ref => {
47
48
  closePanel
48
49
  } = _ref;
49
50
  const commentWrapperRef = (0, _react.useRef)();
50
- const {
51
- t
52
- } = (0, _reactI18next.useTranslation)('sdoc-editor');
51
+ // const { t } = useTranslation('sdoc-editor');
53
52
  const {
54
53
  className,
55
54
  userInfo,
@@ -144,30 +143,32 @@ const CommentEditor = _ref => {
144
143
  }, []);
145
144
 
146
145
  // set editor children
147
- (0, _react.useEffect)(() => {
148
- let children = (0, _mdToSlate.default)(content);
149
- editor.children = children;
150
- _slate.Transforms.select(editor, _slate.Editor.end(editor, []));
151
- }, [editor, content]);
146
+ // useEffect(() => {
147
+ // let children = mdStringToSlate(content);
148
+ // editor.children = children;
149
+ // Transforms.select(editor, Editor.end(editor, []));
150
+ // }, [editor, content]);
151
+
152
+ // // useMount: focus editor
153
+ // useEffect(() => {
154
+ // const [firstNode] = editor.children;
155
+ // if (firstNode) {
156
+ // const [firstNodeFirstChild] = firstNode.children;
157
+
158
+ // if (firstNodeFirstChild) {
159
+ // const endOfFirstNode = Editor.end(editor, [0, 0]);
160
+ // const range = {
161
+ // anchor: endOfFirstNode,
162
+ // focus: endOfFirstNode,
163
+ // };
164
+ // focusEditor(editor, range);
165
+ // }
166
+ // // Force refresh to fix comment list
167
+ // setSlateValue([...editor.children]);
168
+ // }
169
+ // // eslint-disable-next-line react-hooks/exhaustive-deps
170
+ // }, []);
152
171
 
153
- // useMount: focus editor
154
- (0, _react.useEffect)(() => {
155
- const [firstNode] = editor.children;
156
- if (firstNode) {
157
- const [firstNodeFirstChild] = firstNode.children;
158
- if (firstNodeFirstChild) {
159
- const endOfFirstNode = _slate.Editor.end(editor, [0, 0]);
160
- const range = {
161
- anchor: endOfFirstNode,
162
- focus: endOfFirstNode
163
- };
164
- (0, _core.focusEditor)(editor, range);
165
- }
166
- // Force refresh to fix comment list
167
- setSlateValue([...editor.children]);
168
- }
169
- // eslint-disable-next-line react-hooks/exhaustive-deps
170
- }, []);
171
172
  const handleFocusEditor = e => {
172
173
  if (e.target === commentEditorContainerRef.current) {
173
174
  const focusPoint = _slate.Editor.end(editor, []);
@@ -219,9 +220,51 @@ const CommentEditor = _ref => {
219
220
  eventProxy.onKeyDown(event);
220
221
  }, [eventProxy, editor]);
221
222
  console.log('toolMenus', toolMenus);
222
- return /*#__PURE__*/_react.default.createElement("div", {
223
- className: (0, _classnames.default)('comment-editor-wrapper', className),
224
- ref: commentWrapperRef
225
- }, /*#__PURE__*/_react.default.createElement("div", null, "123"));
223
+ return /*#__PURE__*/_react.default.createElement("div", null, "123")
224
+ // <div className={classNames('comment-editor-wrapper', className)} ref={commentWrapperRef}>
225
+ // {/* {type === 'comment' && !hiddenUserInfo && (
226
+ // <div className="comment-editor-user-info">
227
+ // <div className="comment-editor-user-img">
228
+ // <img src={userInfo.avatar_url} alt="" height="100%" width="100%" />
229
+ // </div>
230
+ // <div className="comment-editor-user-name">{userInfo.name}</div>
231
+ // </div>
232
+ // )}
233
+ // <div className='comment-editor-container'>
234
+ // <div className="comment-editor-content">
235
+ // <div ref={commentEditorContainerRef} className='article comment-editor' onClick={handleFocusEditor} >
236
+ // <ScrollContext.Provider value={{ scrollRef: commentEditorContainerRef }}>
237
+ // <Slate editor={editor} value={slateValue} onChange={setSlateValue}>
238
+ // <Editable
239
+ // id='sdoc-editor'
240
+ // scrollSelectionIntoView={handleScrollIntoView}
241
+ // cursors={cursors}
242
+ // renderElement={(props) => RenderCommentEditorCustomRenderElement({ ...props, commentType: type })}
243
+ // renderLeaf={renderLeaf}
244
+ // onMouseDown={onMouseDown}
245
+ // decorate={decorate}
246
+ // onCut={eventProxy.onCut}
247
+ // onCopy={eventProxy.onCopy}
248
+ // onCompositionStart={eventProxy.onCompositionStart}
249
+ // onCompositionUpdate={eventProxy.onCompositionUpdate}
250
+ // onCompositionEnd={eventProxy.onCompositionEnd}
251
+ // onKeyDown={onKeyDown}
252
+ // onBeforeInput={eventProxy.onBeforeInput}
253
+ // />
254
+ // </Slate>
255
+ // </ScrollContext.Provider>
256
+ // </div>
257
+ // <CommentEditorToolbar
258
+ // editor={editor}
259
+ // toolMenus={toolMenus}
260
+ // onSubmit={onSubmit}
261
+ // submitBtnText={t(submitTip)}
262
+ // onCancel={onCancel}
263
+ // />
264
+ // </div>
265
+ // </div>
266
+ // {toolMenus.includes(IMAGE) && <InsertElementDialog editor={editor} />} */}
267
+ // </div>
268
+ ;
226
269
  };
227
270
  var _default = exports.default = CommentEditor;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/comment-editor",
3
- "version": "0.0.1-alpha.51",
3
+ "version": "0.0.1-alpha.53",
4
4
  "private": false,
5
5
  "description": "This is a comment editor",
6
6
  "main": "dist/index.js",