1
0
Fork 0
mirror of https://github.com/anyproto/anytype-ts.git synced 2025-06-08 05:57:02 +09:00

JS-4759, JS-4760: fix

This commit is contained in:
Andrew Simachev 2024-06-19 10:19:05 +02:00
parent 48a1f7d58f
commit 4a43c5c0b7
No known key found for this signature in database
GPG key ID: 49A163D0D14E6FD8

View file

@ -184,6 +184,10 @@ const WidgetIndex = observer(class WidgetIndex extends React.Component<Props> {
};
switch (layout) {
case I.WidgetLayout.Link: {
cn.push('widgetLink');
break;
};
case I.WidgetLayout.Space: {
cn.push('widgetSpace');
@ -486,14 +490,14 @@ const WidgetIndex = observer(class WidgetIndex extends React.Component<Props> {
initToggle () {
const { block, isPreview } = this.props;
const node = $(this.node);
const wrapper = node.find('#wrapper');
const innerWrap = node.find('#innerWrap');
const icon = node.find('.icon.collapse');
const isClosed = Storage.checkToggle('widget', block.id);
if (!isPreview) {
isClosed ? node.addClass('isClosed') : node.removeClass('isClosed');
isClosed ? icon.addClass('isClosed') : node.removeClass('isClosed');
isClosed ? wrapper.hide() : wrapper.show();
isClosed ? innerWrap.hide() : innerWrap.show();
};
};
@ -509,17 +513,19 @@ const WidgetIndex = observer(class WidgetIndex extends React.Component<Props> {
const { block } = this.props;
const node = $(this.node);
const icon = node.find('.icon.collapse');
const innerWrap = node.find('#innerWrap');
const innerWrap = node.find('#innerWrap').show();
const wrapper = node.find('#wrapper').css({ height: 'auto' });
const height = wrapper.outerHeight();
const minHeight = this.getMinHeight();
node.addClass('isClosed');
icon.removeClass('isClosed');
wrapper.css({ height: minHeight }).show();
innerWrap.css({ opacity: 1 });
wrapper.css({ height: minHeight });
raf(() => { wrapper.css({ height }); });
raf(() => {
wrapper.css({ height });
innerWrap.css({ opacity: 1 });
});
window.clearTimeout(this.timeout);
this.timeout = window.setTimeout(() => {
@ -554,7 +560,8 @@ const WidgetIndex = observer(class WidgetIndex extends React.Component<Props> {
const isClosed = Storage.checkToggle('widget', block.id);
if (isClosed) {
wrapper.css({ height: '' }).hide();
wrapper.css({ height: '' });
innerWrap.hide();
};
}, 450);
};