diff --git a/.husky/pre-commit b/.husky/pre-commit index 49fa585e24..7d1e3f139d 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -5,7 +5,7 @@ npx lint-staged --concurrent false # npm run typecheck # Checking for secrets -# gitleaks protect --verbose --redact --staged +gitleaks protect --verbose --redact --staged # Checking dependencies' licenses npx license-checker --production --json --out licenses.json diff --git a/src/ts/component/block/table.tsx b/src/ts/component/block/table.tsx index 085a5cfa10..a9615f3f3b 100644 --- a/src/ts/component/block/table.tsx +++ b/src/ts/component/block/table.tsx @@ -27,6 +27,7 @@ const BlockTable = observer(class BlockTable extends React.Component raf(() => this.resize())); + $(this.node).on('resizeInit resizeMove', e => this.resize()); }; getData () { @@ -1530,35 +1533,41 @@ const BlockTable = observer(class BlockTable extends React.Component width += parseInt(it)); - - obj.css({ width: 'auto' }); - - if (parent.isPage() || parent.isLayoutDiv()) { - const container = U.Common.getPageContainer(isPopup); - - maxWidth = container.width() - PADDING; - wrapperWidth = getWrapperWidth() + J.Size.blockMenu; - - wrap.toggleClass('withScroll', width > maxWidth); - width = Math.max(wrapperWidth, Math.min(maxWidth, width)); - - obj.css({ - width: (width >= wrapperWidth) ? width : 'auto', - marginLeft: (width >= wrapperWidth) ? Math.min(0, (wrapperWidth - width) / 2) : '', - }); - } else { - const parentObj = $(`#block-${parent.id}`); - if (parentObj.length) { - maxWidth = parentObj.width() - J.Size.blockMenu; - }; - - wrap.toggleClass('withScroll', width > maxWidth); + if (this.frameResize) { + raf.cancel(this.frameResize); }; + + this.frameResize = raf(() => { + let width = J.Size.blockMenu + 10; + let maxWidth = 0; + let wrapperWidth = 0; + + String(row.css('grid-template-columns') || '').split(' ').forEach(it => width += parseInt(it)); + + obj.css({ width: 'auto', marginLeft: 0 }); + + if (parent.isPage() || parent.isLayoutDiv()) { + const container = U.Common.getPageContainer(isPopup); + + maxWidth = container.width() - PADDING; + wrapperWidth = getWrapperWidth() + J.Size.blockMenu; + + wrap.toggleClass('withScroll', width > maxWidth); + width = Math.max(wrapperWidth, Math.min(maxWidth, width)); + + obj.css({ + width: (width >= wrapperWidth) ? width : 'auto', + marginLeft: (width >= wrapperWidth) ? Math.min(0, (wrapperWidth - width) / 2) : '', + }); + } else { + const parentObj = $(`#block-${parent.id}`); + if (parentObj.length) { + maxWidth = parentObj.width() - J.Size.blockMenu; + }; + + wrap.toggleClass('withScroll', width > maxWidth); + }; + }); }; }); diff --git a/src/ts/component/editor/page.tsx b/src/ts/component/editor/page.tsx index f3aabfd275..91fda253c2 100644 --- a/src/ts/component/editor/page.tsx +++ b/src/ts/component/editor/page.tsx @@ -2319,7 +2319,6 @@ const EditorPage = observer(class EditorPage extends React.Component