mirror of
https://github.com/anyproto/anytype-ts.git
synced 2025-06-07 21:47:02 +09:00
fix deps
This commit is contained in:
parent
43789d7fd3
commit
0e3b0e9d92
5 changed files with 27 additions and 19 deletions
|
@ -75,5 +75,9 @@
|
|||
{
|
||||
"from": "node_modules/util",
|
||||
"to": "node_modules/util"
|
||||
},
|
||||
{
|
||||
"from": "node_modules/mime-types",
|
||||
"to": "node_modules/mime-types"
|
||||
}
|
||||
]
|
||||
|
|
|
@ -636,4 +636,4 @@
|
|||
"pre-commit": "npm run precommit && git add licenses.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
import * as React from 'react';
|
||||
import $ from 'jquery';
|
||||
import raf from 'raf';
|
||||
import { observer } from 'mobx-react';
|
||||
import { Label, Icon } from 'Component';
|
||||
import { I, C, S, U, J, keyboard, translate, Storage, Preview } from 'Lib';
|
||||
|
@ -179,12 +180,17 @@ const BlockChat = observer(class BlockChat extends React.Component<I.BlockCompon
|
|||
|
||||
rebind () {
|
||||
const { isPopup, block } = this.props;
|
||||
const { account } = S.Auth;
|
||||
const win = $(window);
|
||||
const ns = block.id + U.Common.getEventNamespace(isPopup);
|
||||
|
||||
this.unbind();
|
||||
|
||||
win.on(`messageAdd.${ns}`, (e, id: string) => this.scrollToMessage(id));
|
||||
win.on(`messageAdd.${ns}`, (e, message: I.ChatMessage) => {
|
||||
if (message.creator != account.id) {
|
||||
this.scrollToMessage(message.id);
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
loadMessages (clear: boolean, callBack?: () => void) {
|
||||
|
@ -441,27 +447,26 @@ const BlockChat = observer(class BlockChat extends React.Component<I.BlockCompon
|
|||
return;
|
||||
};
|
||||
|
||||
return node.offset().top + node.outerHeight() + J.Size.header;
|
||||
return node.offset().top + node.outerHeight();
|
||||
};
|
||||
|
||||
scrollToMessage (id: string) {
|
||||
const container = U.Common.getScrollContainer(this.props.isPopup);
|
||||
raf(() => {
|
||||
const container = U.Common.getScrollContainer(this.props.isPopup);
|
||||
const top = this.getMessageScrollOffset(id);
|
||||
|
||||
container.scrollTop(this.getMessageScrollOffset(id));
|
||||
container.get(0).scrollTo({ top, behavior: 'smooth' });
|
||||
});
|
||||
};
|
||||
|
||||
scrollToBottom () {
|
||||
const messages = this.getMessages();
|
||||
const length = messages.length;
|
||||
raf(() => {
|
||||
const { isPopup } = this.props;
|
||||
const container = U.Common.getScrollContainer(isPopup);
|
||||
const height = isPopup ? container.get(0).scrollHeight : document.body.scrollHeight;
|
||||
|
||||
if (!length) {
|
||||
return;
|
||||
};
|
||||
|
||||
const id = messages[length - 1].id;
|
||||
const container = U.Common.getScrollContainer(this.props.isPopup);
|
||||
|
||||
container.scrollTop(this.getMessageScrollOffset(id) + 10000);
|
||||
container.get(0).scrollTo({ top: height + 10000, behavior: 'smooth' });
|
||||
});
|
||||
};
|
||||
|
||||
onThread (id: string) {
|
||||
|
|
|
@ -471,7 +471,7 @@ const ChatForm = observer(class ChatForm extends React.Component<Props, State> {
|
|||
return;
|
||||
};
|
||||
|
||||
const { rootId, scrollToMessage } = this.props;
|
||||
const { rootId, scrollToMessage, scrollToBottom } = this.props;
|
||||
const node = $(this.node);
|
||||
const loader = node.find('#form-loader');
|
||||
const list = this.state.files || [];
|
||||
|
@ -505,7 +505,6 @@ const ChatForm = observer(class ChatForm extends React.Component<Props, State> {
|
|||
return;
|
||||
};
|
||||
|
||||
scrollToMessage(this.editingId);
|
||||
clear();
|
||||
});
|
||||
};
|
||||
|
@ -526,7 +525,7 @@ const ChatForm = observer(class ChatForm extends React.Component<Props, State> {
|
|||
};
|
||||
|
||||
Storage.setLastChatMessageId(rootId, message.messageId);
|
||||
scrollToMessage(message.messageId);
|
||||
scrollToBottom();
|
||||
clear();
|
||||
});
|
||||
};
|
||||
|
|
|
@ -952,7 +952,7 @@ class Dispatcher {
|
|||
U.Common.notification(author?.name, message.content.text);
|
||||
};
|
||||
|
||||
$(window).trigger('messageAdd', [ message.id ]);
|
||||
$(window).trigger('messageAdd', [ message ]);
|
||||
break;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue