@seafile/sdoc-editor 2.0.37-alpg-0.0.5 → 2.0.37-alpg-0.0.7

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.
@@ -252,12 +252,14 @@ function renderTable(props) {
252
252
  const editor = (0, _slateReact.useSlateStatic)();
253
253
  console.log(0, editor, editor.width);
254
254
  const columns = (0, _helpers.getTableColumns)(editor, element);
255
- console.log(1, editor, columns, element);
255
+ console.log(1, editor, editor.width, element);
256
256
  let style = element.style ? {
257
257
  ...element.style
258
258
  } : {};
259
259
  const columnWidthList = columns.map(item => `${item.width}px`);
260
260
  style.gridTemplateColumns = columnWidthList.join(' ');
261
+ const w2 = editor.width;
262
+ console.log(3, w2);
261
263
  const rowHeightList = element.children.map((item, index) => (0, _helpers.getRowHeight)(item, index));
262
264
  style.gridAutoRows = rowHeightList.map(item => `minmax(${item}px, auto)`).join(' ');
263
265
  return /*#__PURE__*/_react.default.createElement(_tableRoot.default, {
@@ -11,6 +11,8 @@ 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
+
14
16
  const TableRoot = _ref => {
15
17
  let {
16
18
  editor,
@@ -32,6 +34,10 @@ const TableRoot = _ref => {
32
34
  onContextMenu
33
35
  } = (0, _hooks.useContextMenu)(tableScrollWrapper);
34
36
  console.log(2, editor, editor.width, columns, allWidth);
37
+ let editorWidth;
38
+ (0, _react.useEffect)(() => {
39
+ editorWidth = editor.width;
40
+ }, [editor]);
35
41
  return /*#__PURE__*/_react.default.createElement(_hooks.TableRootContext.Provider, {
36
42
  value: tableScrollWrapper.current
37
43
  }, /*#__PURE__*/_react.default.createElement(_hooks.TableRootScrollLeftContext.Provider, {
@@ -42,7 +48,7 @@ const TableRoot = _ref => {
42
48
  }),
43
49
  style: {
44
50
  ...attributes.style,
45
- maxWidth: editor.width ? editor.width : '100%'
51
+ maxWidth: editorWidth ? editorWidth : '100%'
46
52
  }
47
53
  }), /*#__PURE__*/_react.default.createElement("div", {
48
54
  className: (0, _classnames.default)('sdoc-table-scroll-wrapper', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "2.0.37-alpg-0.0.5",
3
+ "version": "2.0.37-alpg-0.0.7",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",