Display previews as they come in; fix image viewer
This commit is contained in:
parent
c6262a36e6
commit
5792bff49d
@ -124,10 +124,8 @@ export default {
|
|||||||
link: Object,
|
link: Object,
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
if (this.link.shown) {
|
const options = require("../js/options");
|
||||||
const options = require("../js/options");
|
this.$set(this.link, "canDisplay", this.link.type !== "loading" && options.shouldOpenMessagePreview(this.link.type));
|
||||||
this.$set(this.link, "canDisplay", options.shouldOpenMessagePreview(this.link.type));
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onPreviewReady() {
|
onPreviewReady() {
|
||||||
|
@ -60,6 +60,9 @@ export default {
|
|||||||
return "message-" + this.message.type;
|
return "message-" + this.message.type;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
require("../js/renderPreview");
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
isAction() {
|
isAction() {
|
||||||
return typeof MessageTypes["message-" + this.message.type] !== "undefined";
|
return typeof MessageTypes["message-" + this.message.type] !== "undefined";
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const socket = require("../socket");
|
const socket = require("../socket");
|
||||||
|
const {shouldOpenMessagePreview} = require("../options");
|
||||||
const {vueApp, findChannel} = require("../vue");
|
const {vueApp, findChannel} = require("../vue");
|
||||||
|
|
||||||
socket.on("msg:preview", function(data) {
|
socket.on("msg:preview", function(data) {
|
||||||
@ -14,6 +15,8 @@ socket.on("msg:preview", function(data) {
|
|||||||
const previewIndex = message.previews.findIndex((m) => m.link === data.preview.link);
|
const previewIndex = message.previews.findIndex((m) => m.link === data.preview.link);
|
||||||
|
|
||||||
if (previewIndex > -1) {
|
if (previewIndex > -1) {
|
||||||
|
data.preview.canDisplay = shouldOpenMessagePreview(data.preview.type);
|
||||||
|
|
||||||
vueApp.$set(message.previews, previewIndex, data.preview);
|
vueApp.$set(message.previews, previewIndex, data.preview);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user