@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.
- package/dist/basic-sdk/extension/plugins/multi-column/helper.js +0 -1
- package/dist/basic-sdk/extension/plugins/multi-column/render/index.js +7 -6
- package/dist/basic-sdk/extension/plugins/multi-column/render/render-column.js +8 -18
- package/dist/basic-sdk/extension/plugins/multi-column/resize-handlers/index.js +1 -0
- package/package.json +1 -1
|
@@ -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
|
-
|
|
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
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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,
|