reverting changes in polish manually
This commit is contained in:
parent
664a9d06f9
commit
fb14847730
6 changed files with 60 additions and 20 deletions
|
|
@ -38,3 +38,6 @@ window.mainApi.on("set-account", (account_) => {
|
|||
|
||||
export default App;
|
||||
export { account };
|
||||
|
||||
// Is called when window is about to close or reload
|
||||
window.onbeforeunload = () => console.log("beforeunload");
|
||||
|
|
@ -9,7 +9,7 @@ const Bubble =
|
|||
}
|
||||
|
||||
Vue.onMounted(() => {
|
||||
document.dispatchEvent(new CustomEvent("scroll"));
|
||||
document.getElementById("messenger").dispatchEvent(new CustomEvent('adjust-scroll'));
|
||||
});
|
||||
|
||||
return { getUrl };
|
||||
|
|
|
|||
|
|
@ -7,11 +7,13 @@ const initScroll = (elementId) => {
|
|||
}
|
||||
|
||||
const isBottom = () => {
|
||||
return el.scrollHeight - el.clientHeight <= el.scrollTop + 1;
|
||||
if (el) {
|
||||
return el.scrollHeight - el.clientHeight <= el.scrollTop + 1;
|
||||
}
|
||||
}
|
||||
|
||||
const adjustScroll = () => {
|
||||
if (isBottom()) {
|
||||
if (el) {
|
||||
el.scrollTo({
|
||||
top: el.scrollHeight - el.clientHeight,
|
||||
behavior: 'smooth'
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import onDrop from "./control/drop.js";
|
||||
import adjustScroll from "./control/scroll.js";
|
||||
import initScroll from "./control/scroll.js";
|
||||
|
||||
import WS from "./ws.js";
|
||||
import Input from "./input.js";
|
||||
|
|
@ -22,24 +22,34 @@ const Messenger = {
|
|||
|
||||
Vue.onMounted(() => {
|
||||
|
||||
window.mainApi.on("update", (update) => {
|
||||
window.mainApi.on("message", (update) => {
|
||||
|
||||
if (update.name)
|
||||
if (update.person)
|
||||
{
|
||||
person.value = update.person;
|
||||
messages.value = update.messages;
|
||||
}
|
||||
else if (update.name)
|
||||
{
|
||||
person.value = update;
|
||||
}
|
||||
else if (message.content)
|
||||
else if (update.content)
|
||||
{
|
||||
messages.value.push(update);
|
||||
}
|
||||
else
|
||||
{
|
||||
messages.value.at(-1).content.push(update);
|
||||
messages.value[messages.value.length - 1].content.push(update);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
window.mainApi.send("message", {route: "window", open: true});
|
||||
initScroll("messenger");
|
||||
window.mainApi.send("messenger");
|
||||
});
|
||||
|
||||
Vue.onUnmounted(() => {
|
||||
messages.value = [];
|
||||
});
|
||||
|
||||
return { person, messages, onDrop };
|
||||
|
|
@ -67,6 +77,3 @@ const Messenger = {
|
|||
}
|
||||
|
||||
export default Messenger;
|
||||
|
||||
// Is called when window is about to close or reload
|
||||
window.onbeforeunload = () => window.mainApi.send("message", {route: "window", open: true});
|
||||
|
|
|
|||
Loading…
Reference in a new issue