@seafile/sdoc-editor 2.0.37-alpg-0.1.4 → 2.0.37-alpg-0.1.5

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.
@@ -17,7 +17,7 @@ Object.defineProperty(exports, "PLUGIN_DISPLAY_TYPE", {
17
17
  return _plugin.PLUGIN_DISPLAY_TYPE;
18
18
  }
19
19
  });
20
- exports.Z_INDEX = exports.WIKI_OUTLINE = exports.WIKI_EDITOR = exports.SDOC_STORAGE = exports.REVISION_DIFF_VALUE = exports.REVISION_DIFF_KEY = exports.REBASE_TYPES = exports.REBASE_TYPE = exports.REBASE_ORIGIN = exports.REBASE_MARK_KEY = exports.REBASE_MARKS = void 0;
20
+ exports.Z_INDEX = exports.WIKI_OUTLINE = exports.WIKI_EDITOR_EDIT_AREA_WIDTH = exports.WIKI_EDITOR = exports.SDOC_STORAGE = exports.REVISION_DIFF_VALUE = exports.REVISION_DIFF_KEY = exports.REBASE_TYPES = exports.REBASE_TYPE = exports.REBASE_ORIGIN = exports.REBASE_MARK_KEY = exports.REBASE_MARKS = void 0;
21
21
  var Z_INDEX = _interopRequireWildcard(require("./z-index"));
22
22
  exports.Z_INDEX = Z_INDEX;
23
23
  var _plugin = require("./plugin");
@@ -55,6 +55,7 @@ const REVISION_DIFF_KEY = exports.REVISION_DIFF_KEY = 'diff';
55
55
  const REVISION_DIFF_VALUE = exports.REVISION_DIFF_VALUE = '1';
56
56
  const PAGE_EDIT_AREA_WIDTH = exports.PAGE_EDIT_AREA_WIDTH = 672; // 672 = 794 - 2[borderLeft + borderRight] - 120[paddingLeft + paddingRight]
57
57
  const COMMENT_EDITOR_EDIT_AREA_WIDTH = exports.COMMENT_EDITOR_EDIT_AREA_WIDTH = 364;
58
+ const WIKI_EDITOR_EDIT_AREA_WIDTH = exports.WIKI_EDITOR_EDIT_AREA_WIDTH = 714;
58
59
  const COMMENT_EDITOR = exports.COMMENT_EDITOR = 'comment_editor';
59
60
  const WIKI_EDITOR = exports.WIKI_EDITOR = 'wiki_editor';
60
61
  const DOCUMENT_PLUGIN_EDITOR = exports.DOCUMENT_PLUGIN_EDITOR = 'document_plugin_editor';
@@ -47,7 +47,7 @@ const WikiEditor = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
47
47
  cursors
48
48
  } = document;
49
49
  newEditor.cursors = cursors || {};
50
- newEditor.width = _constants.PAGE_EDIT_AREA_WIDTH; // default width
50
+ newEditor.width = _constants.WIKI_EDITOR_EDIT_AREA_WIDTH; // default width
51
51
  return newEditor;
52
52
 
53
53
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -208,7 +208,6 @@ const Table = _ref => {
208
208
  }, /*#__PURE__*/_react.default.createElement(_hooks.SettingSelectRangeContext.Provider, {
209
209
  value: isSettingSelectRange
210
210
  }, /*#__PURE__*/_react.default.createElement(_tableRoot.default, {
211
- editor: editor,
212
211
  columns: columns,
213
212
  attributes: attributes
214
213
  }, isSelected && /*#__PURE__*/_react.default.createElement(_tableHeader.default, {
@@ -263,7 +262,6 @@ function renderTable(props) {
263
262
  const rowHeightList = element.children.map((item, index) => (0, _helpers.getRowHeight)(item, index));
264
263
  style.gridAutoRows = rowHeightList.map(item => `minmax(${item}px, auto)`).join(' ');
265
264
  return /*#__PURE__*/_react.default.createElement(_tableRoot.default, {
266
- editor: editor,
267
265
  columns: columns,
268
266
  attributes: attributes
269
267
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -11,8 +11,6 @@ var _classnames = _interopRequireDefault(require("classnames"));
11
11
  var _slateReact = require("@seafile/slate-react");
12
12
  var _hooks = require("./hooks");
13
13
  var _menu = require("../menu");
14
- /* eslint-disable react-hooks/exhaustive-deps */
15
-
16
14
  const TableRoot = _ref => {
17
15
  let {
18
16
  attributes,
@@ -23,7 +21,7 @@ const TableRoot = _ref => {
23
21
  const readonly = (0, _slateReact.useReadOnly)();
24
22
  const tableScrollWrapper = (0, _react.useRef)(null);
25
23
  const [scrollLeft, setScrollLeft] = (0, _react.useState)(0);
26
- const [editorWidth, setEditorWidth] = (0, _react.useState)(editor.width);
24
+ // const [editorWidth, setEditorWidth] = useState(editor.width);
27
25
  const allWidth = columns.reduce((pre, cur) => pre + cur.width, 0);
28
26
  const onScroll = (0, _react.useCallback)(event => {
29
27
  setScrollLeft(event.target.scrollLeft);
@@ -34,12 +32,13 @@ const TableRoot = _ref => {
34
32
  onContextMenu
35
33
  } = (0, _hooks.useContextMenu)(tableScrollWrapper);
36
34
  console.log(2, editor, editor.width, columns, allWidth);
37
- (0, _react.useLayoutEffect)(() => {
38
- if (readonly) {
39
- setEditorWidth(editor.width);
40
- }
41
- }, [editor.width, readonly]);
42
- console.log(6, editorWidth);
35
+
36
+ // useLayoutEffect(() => {
37
+ // if (readonly) {
38
+ // setEditorWidth(editor.width);
39
+ // }
40
+ // }, [editor.width, readonly]);
41
+ // console.log(6, editorWidth);
43
42
  return /*#__PURE__*/_react.default.createElement(_hooks.TableRootContext.Provider, {
44
43
  value: tableScrollWrapper.current
45
44
  }, /*#__PURE__*/_react.default.createElement(_hooks.TableRootScrollLeftContext.Provider, {
@@ -50,7 +49,7 @@ const TableRoot = _ref => {
50
49
  }),
51
50
  style: {
52
51
  ...attributes.style,
53
- maxWidth: editorWidth ? editorWidth : '100%'
52
+ maxWidth: editor.width ? editor.width : '100%'
54
53
  }
55
54
  }), /*#__PURE__*/_react.default.createElement("div", {
56
55
  className: (0, _classnames.default)('sdoc-table-scroll-wrapper', {
@@ -42,8 +42,7 @@ const SdocWikiEditor = _ref => {
42
42
  cursors
43
43
  } = document;
44
44
  newEditor.cursors = cursors || {};
45
- newEditor.width = 714; // default width
46
- console.log(2, newEditor);
45
+ newEditor.width = _constants.WIKI_EDITOR_EDIT_AREA_WIDTH; // default width
47
46
  newEditor.editorType = _constants.WIKI_EDITOR;
48
47
  return newEditor;
49
48
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "2.0.37-alpg-0.1.4",
3
+ "version": "2.0.37-alpg-0.1.5",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",