mirror of
https://github.com/thelounge/thelounge.git
synced 2024-06-08 08:42:17 +02:00
Fix sending msg:preview:toggle to server
This commit is contained in:
parent
2bb8287519
commit
1cd28a5ccf
|
@ -15,7 +15,7 @@ export default {
|
|||
onClick: function() {
|
||||
this.link.shown = !this.link.shown;
|
||||
|
||||
this.$parent.$emit("linkPreviewToggle");
|
||||
this.$parent.$emit("linkPreviewToggle", this.link, this.$parent.message);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
<Message
|
||||
v-else
|
||||
:message="message"
|
||||
@linkPreviewToggle="onLinkPreviewToggle"
|
||||
:key="message.id"/>
|
||||
</template>
|
||||
</div>
|
||||
|
@ -43,6 +44,7 @@
|
|||
<script>
|
||||
const constants = require("../js/constants");
|
||||
const clipboard = require("../js/clipboard");
|
||||
import socket from "../js/socket";
|
||||
import Message from "./Message.vue";
|
||||
import MessageCondensed from "./MessageCondensed.vue";
|
||||
|
||||
|
@ -114,6 +116,17 @@ export default {
|
|||
onCopy() {
|
||||
clipboard(this.$el);
|
||||
},
|
||||
onLinkPreviewToggle(preview, message) {
|
||||
// Tell the server we're toggling so it remembers at page reload
|
||||
// TODO Avoid sending many single events when using `/collapse` or `/expand`
|
||||
// See https://github.com/thelounge/thelounge/issues/1377
|
||||
socket.emit("msg:preview:toggle", {
|
||||
target: this.channel.id,
|
||||
msgId: message.id,
|
||||
link: preview.link,
|
||||
shown: preview.shown,
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -156,11 +156,6 @@ module.exports = function parse(text, message = null, createElement = null) {
|
|||
props: {
|
||||
link: preview,
|
||||
},
|
||||
on: {
|
||||
linkPreviewToggle() {
|
||||
console.log('it got toggled!!!')
|
||||
}
|
||||
}
|
||||
}, fragments)];
|
||||
|
||||
//`<button class="toggle-button toggle-preview" data-url="${escapedLink}" hidden></button>`;
|
||||
|
|
Loading…
Reference in a new issue