Fix sending msg:preview:toggle to server
This commit is contained in:
parent
2bb8287519
commit
1cd28a5ccf
@ -15,7 +15,7 @@ export default {
|
|||||||
onClick: function() {
|
onClick: function() {
|
||||||
this.link.shown = !this.link.shown;
|
this.link.shown = !this.link.shown;
|
||||||
|
|
||||||
this.$parent.$emit("linkPreviewToggle");
|
this.$parent.$emit("linkPreviewToggle", this.link, this.$parent.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
<Message
|
<Message
|
||||||
v-else
|
v-else
|
||||||
:message="message"
|
:message="message"
|
||||||
|
@linkPreviewToggle="onLinkPreviewToggle"
|
||||||
:key="message.id"/>
|
:key="message.id"/>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
@ -43,6 +44,7 @@
|
|||||||
<script>
|
<script>
|
||||||
const constants = require("../js/constants");
|
const constants = require("../js/constants");
|
||||||
const clipboard = require("../js/clipboard");
|
const clipboard = require("../js/clipboard");
|
||||||
|
import socket from "../js/socket";
|
||||||
import Message from "./Message.vue";
|
import Message from "./Message.vue";
|
||||||
import MessageCondensed from "./MessageCondensed.vue";
|
import MessageCondensed from "./MessageCondensed.vue";
|
||||||
|
|
||||||
@ -114,6 +116,17 @@ export default {
|
|||||||
onCopy() {
|
onCopy() {
|
||||||
clipboard(this.$el);
|
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>
|
</script>
|
||||||
|
@ -156,11 +156,6 @@ module.exports = function parse(text, message = null, createElement = null) {
|
|||||||
props: {
|
props: {
|
||||||
link: preview,
|
link: preview,
|
||||||
},
|
},
|
||||||
on: {
|
|
||||||
linkPreviewToggle() {
|
|
||||||
console.log('it got toggled!!!')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, fragments)];
|
}, fragments)];
|
||||||
|
|
||||||
//`<button class="toggle-button toggle-preview" data-url="${escapedLink}" hidden></button>`;
|
//`<button class="toggle-button toggle-preview" data-url="${escapedLink}" hidden></button>`;
|
||||||
|
Loading…
Reference in New Issue
Block a user