@seafile/sdoc-editor 1.0.202-test-0.0.2 → 1.0.202-test-0.0.3

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.
@@ -52,7 +52,6 @@ const generateEmptyMultiColumn = (editor, MultiColumnType) => {
52
52
  id: columnWidthKey,
53
53
  type: _constants.ELEMENT_TYPE.COLUMN,
54
54
  width: columnWidth,
55
- initialPageWith: realTimePageWidth(),
56
55
  children: [{
57
56
  id: _slugid.default.nice(),
58
57
  type: _constants.PARAGRAPH,
@@ -53,18 +53,19 @@ const MultiColumn = _ref => {
53
53
  console.log(4, updatedColumns);
54
54
  setColumn(updatedColumns);
55
55
  setPageWidth(realTimeWidth);
56
+ } else {
57
+ const newStyle = {
58
+ ...element.style,
59
+ gridTemplateColumns: columnWidthList.join(' ')
60
+ };
61
+ console.log(100, newStyle);
62
+ setStyle(newStyle);
56
63
  }
57
64
  });
58
65
  resizeObserver.observe(sdocEditorPage);
59
66
  return () => {
60
67
  resizeObserver.disconnect();
61
68
  };
62
- } else {
63
- const newStyle = {
64
- ...element.style,
65
- gridTemplateColumns: columnWidthList.join(' ')
66
- };
67
- setStyle(newStyle);
68
69
  }
69
70
  }, [pageWidth, element.style, element.column, column]);
70
71
 
@@ -30,12 +30,9 @@ const Column = _ref => {
30
30
  const resizeObserver = new ResizeObserver(entries => {
31
31
  const realTimeWidth = entries[0].contentRect.width;
32
32
  if (realTimeWidth !== pageWidth) {
33
+ console.log(55, realTimeWidth, pageWidth);
33
34
  const scaleFactor = realTimeWidth / pageWidth;
34
- const matchingColumn = parentNode.column.find(column => column.key === element.id);
35
- if (matchingColumn) {
36
- console.log(444444, matchingColumn.width, scaleFactor);
37
- setColumnWidth(matchingColumn.width * scaleFactor);
38
- }
35
+ setColumnWidth(preColumnwidth => preColumnwidth * scaleFactor);
39
36
  setPageWidth(realTimeWidth);
40
37
  }
41
38
  });
@@ -43,21 +40,14 @@ const Column = _ref => {
43
40
  return () => {
44
41
  resizeObserver.disconnect();
45
42
  };
46
- } else {
47
- const matchingColumn = parentNode.column.find(column => column.key === element.id);
48
- if (matchingColumn) {
49
- setColumnWidth(matchingColumn.width);
50
- }
51
43
  }
52
44
  }, [editor, element, parentNode.column, pageWidth]);
53
-
54
- // useEffect(() => {
55
- // const matchingColumn = parentNode.column.find(column => column.key === element.id);
56
- // if (matchingColumn) {
57
- // setColumnWidth(matchingColumn.width);
58
- // }
59
- // }, [editor, element, parentNode.column]);
60
-
45
+ (0, _react.useEffect)(() => {
46
+ const matchingColumn = parentNode.column.find(column => column.key === element.id);
47
+ if (matchingColumn) {
48
+ setColumnWidth(matchingColumn.width);
49
+ }
50
+ }, [editor, element, parentNode.column]);
61
51
  return /*#__PURE__*/_react.default.createElement("div", Object.assign({}, attributes, {
62
52
  className: (0, _classnames.default)('column', attributes.className),
63
53
  "data-id": element.id,
@@ -100,6 +100,7 @@ const ResizeHandlers = _ref => {
100
100
  ...column,
101
101
  left: column.width
102
102
  }));
103
+ console.log(3333, newColumn);
103
104
  handleResizeColumn(newColumn);
104
105
  (0, _helper.updateColumnWidth)(editor, element, newColumn);
105
106
  setIsDraggingResizeHandler(false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "1.0.202-test-0.0.2",
3
+ "version": "1.0.202-test-0.0.3",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",