@seafile/sdoc-editor 1.0.198-test3.1 → 1.0.198-test4.0

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.
@@ -27,7 +27,6 @@ const InsertElementDialog = _ref => {
27
27
  let {
28
28
  editor
29
29
  } = _ref;
30
- console.log(3, editor.selection);
31
30
  const [dialogType, setDialogType] = (0, _react.useState)('');
32
31
  const [element, setElement] = (0, _react.useState)('');
33
32
  const [insertPosition, setInsertPosition] = (0, _react.useState)(_constants2.INSERT_POSITION.CURRENT);
@@ -98,7 +97,6 @@ const InsertElementDialog = _ref => {
98
97
  // link shortcut wrapping link
99
98
  handleSubmit
100
99
  } = _ref2;
101
- console.log(5, type, element, insertSdocFileLinkCallback, insertWhiteboard);
102
100
  setInsertPosition(insertPosition);
103
101
  setSlateNode(slateNode);
104
102
  setElement(element);
@@ -24,7 +24,6 @@ const SelectSdocFileDialog = _ref => {
24
24
  insertLinkCallback,
25
25
  insertWhiteboardFile
26
26
  } = _ref;
27
- console.log(3, editor.selection);
28
27
  const {
29
28
  t
30
29
  } = (0, _reactI18next.useTranslation)('sdoc-editor');
@@ -65,7 +64,6 @@ const SelectSdocFileDialog = _ref => {
65
64
  insertSdocFileLinkCallback && insertSdocFileLinkCallback(editor, fileInfo.name, fileInfo.file_uuid);
66
65
  break;
67
66
  case _constants.ELEMENT_TYPE.WHITEBOARD:
68
- console.log(33, insertWhiteboardFile, insertWhiteboard);
69
67
  insertWhiteboard && insertWhiteboard(editor, fileInfo.name, fileInfo.path);
70
68
  break;
71
69
  default:
@@ -80,19 +78,16 @@ const SelectSdocFileDialog = _ref => {
80
78
  let fileInfo = {
81
79
  ...currentSelectedFile
82
80
  };
83
- console.log(22, fileInfo, file_uuid, currentSelectedFile);
84
81
 
85
82
  // Insert whiteboard file in sdoc
86
83
  if (dialogType === _constants.ELEMENT_TYPE.WHITEBOARD) {
87
84
  insertFile(fileInfo);
88
85
  closeDialog();
89
- console.log(7);
90
86
  return;
91
87
  }
92
88
 
93
89
  // File has no id
94
90
  if (!file_uuid || file_uuid === '') {
95
- console.log('no operation');
96
91
  _context.default.getSdocLocalFileId(currentSelectedFile.path).then(res => {
97
92
  if (res.status === 200) {
98
93
  fileInfo = {
@@ -46,7 +46,6 @@ const LocalFiles = _ref => {
46
46
  }, []);
47
47
  const getTreeData = (0, _react.useCallback)((p, indexId, treeData) => {
48
48
  return _context.default.getSdocLocalFiles(p, fileType).then(res => {
49
- console.log(9, res);
50
49
  res.data.forEach(item => {
51
50
  item.indexId = _slugid.default.nice();
52
51
  });
@@ -57,7 +57,6 @@ const getType = editor => {
57
57
  };
58
58
  exports.getType = getType;
59
59
  const insertSdocFileLink = (editor, text, uuid) => {
60
- console.log(10, editor.selection);
61
60
  if (isMenuDisabled(editor)) return;
62
61
  // Selection folded or not
63
62
  const {
@@ -62,17 +62,11 @@ const generateWhiteboardNode = function (repoID) {
62
62
  exports.generateWhiteboardNode = generateWhiteboardNode;
63
63
  const insertWhiteboard = (editor, filename, filePath) => {
64
64
  var _editor$selection;
65
- console.log(8, editor.selection);
66
65
  if (isInsertWhiteboardMenuDisabled(editor)) return;
66
+ if (editor.selection == null) return;
67
67
  const {
68
68
  repoID
69
69
  } = window.app.pageOptions;
70
- const {
71
- selection
72
- } = editor;
73
- if (selection == null) return;
74
- // const isCollapsed = Range.isCollapsed(selection);
75
-
76
70
  const whiteboardNode = generateWhiteboardNode(repoID, filename, filePath);
77
71
  let path = (_editor$selection = editor.selection) === null || _editor$selection === void 0 ? void 0 : _editor$selection.anchor.path;
78
72
  const position = 'after';
@@ -82,7 +76,6 @@ const insertWhiteboard = (editor, filename, filePath) => {
82
76
  });
83
77
  const nextPath = _slate.Path.next([path[0] + 1]);
84
78
  if (!(0, _core.getNode)(editor, nextPath)) {
85
- console.log(5);
86
79
  _slate.Transforms.insertNodes(editor, (0, _core.generateDefaultParagraph)(), {
87
80
  at: nextPath
88
81
  });
@@ -92,14 +85,12 @@ const insertWhiteboard = (editor, filename, filePath) => {
92
85
  anchor: endOfFirstNode,
93
86
  focus: endOfFirstNode
94
87
  };
95
- console.log(range);
96
88
  (0, _core.focusEditor)(editor, range);
97
89
  return;
98
90
  }
99
91
  };
100
92
  exports.insertWhiteboard = insertWhiteboard;
101
93
  const onCreateWhiteboardFile = editor => {
102
- // e.stopPropagation();
103
94
  const eventBus = _eventBus.default.getInstance();
104
95
  const external_props = {
105
96
  insertWhiteboard,
@@ -3,6 +3,7 @@
3
3
  width: 670px;
4
4
  height: 300px;
5
5
  border: 1px solid #ccc;
6
+ margin: 5px 0;
6
7
  }
7
8
 
8
9
  .sdoc-whiteboard-container.isSelected {
@@ -21,16 +22,11 @@
21
22
  z-index: 2;
22
23
  }
23
24
 
24
- .sdoc-whiteboard-wrapper {
25
- pointer-events: none !important;
26
- }
27
-
28
25
  .sdoc-whiteboard-wrapper * {
29
26
  pointer-events: none !important;
30
27
  }
31
28
 
32
29
  .sdoc-whiteboard-wrapper .tldraw-editor-container {
33
30
  position: absolute !important;
34
- pointer-events: none !important;
35
31
  }
36
32
 
@@ -29,11 +29,8 @@ const withWhiteboard = editor => {
29
29
  return isVoid(elem);
30
30
  };
31
31
  newEditor.onHotKeyDown = event => {
32
- console.log(77);
33
32
  const [whiteboardNode, path] = (0, _core.getSelectedNodeEntryByType)(editor, _constants.WHITEBOARD) || [];
34
- console.log(whiteboardNode, path);
35
33
  if (path) {
36
- console.log(55, event);
37
34
  // Insert empty paragraph node after whiteboard when clicking 'enter' on selected whiteboard
38
35
  if ((0, _isHotkey.default)('enter', event)) {
39
36
  event.preventDefault();
@@ -23,7 +23,6 @@ const Whiteboard = _ref => {
23
23
  title
24
24
  } = element;
25
25
  const whiteboardRef = (0, _react.useRef)();
26
- console.log(33, repoID, filePath);
27
26
  const isSelected = (0, _slateReact.useSelected)();
28
27
  const containerId = `whiteboard-${title}`;
29
28
  // Set default whiteboard readonly as true
@@ -35,7 +34,6 @@ const Whiteboard = _ref => {
35
34
  window.open(url, '_blank');
36
35
  return;
37
36
  };
38
- console.log(6, isSelected);
39
37
  (0, _react.useEffect)(() => {
40
38
  const eventBus = _eventBus.default.getInstance();
41
39
  eventBus.dispatch(_constants.EXTERNAL_EVENT.TLDRAW_EDITOR, {
@@ -66,7 +66,6 @@ const InsertToolbar = _ref => {
66
66
  readonly,
67
67
  toggle
68
68
  };
69
- console.log(9, props.editor.selection);
70
69
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("button", {
71
70
  type: "button",
72
71
  className: validClassName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "1.0.198-test3.1",
3
+ "version": "1.0.198-test4.0",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",