Commit f25b83b3 authored by 罗超's avatar 罗超

Merge branch 'master' of http://gitlab.oytour.com/viitto/madara

parents 665ae7bc 9ef4771b
...@@ -475,9 +475,6 @@ export default { ...@@ -475,9 +475,6 @@ export default {
} }
}, },
mounted() { mounted() {
this.MsgBus.$on('change-historic', function (){
console.log("asdasd 哈哈哈哈")
})
this.audio_base=this.$electron.remote.getGlobal("AUDIO_PATH")+'audio/' this.audio_base=this.$electron.remote.getGlobal("AUDIO_PATH")+'audio/'
if (window.localStorage.top) { if (window.localStorage.top) {
this.TOPSESSION = JSON.parse(window.localStorage.top); this.TOPSESSION = JSON.parse(window.localStorage.top);
......
...@@ -244,6 +244,8 @@ export default { ...@@ -244,6 +244,8 @@ export default {
offMsgBusListener(){ offMsgBusListener(){
this.MsgBus.$off("send-at-name"); this.MsgBus.$off("send-at-name");
this.MsgBus.$off("new-screen-hot"); this.MsgBus.$off("new-screen-hot");
this.$electron.ipcRenderer.removeAllListeners(['new-send-file'])
let _this = this;
}, },
toolPaste: function (e) { toolPaste: function (e) {
let clipboardData = 1; let clipboardData = 1;
...@@ -278,7 +280,6 @@ export default { ...@@ -278,7 +280,6 @@ export default {
innerHTML: sessionText innerHTML: sessionText
}) })
} }
this.MsgBus.$emit('change-historic')
window.localStorage.historicList = JSON.stringify(historicList) window.localStorage.historicList = JSON.stringify(historicList)
}, },
updateClipboard() { updateClipboard() {
...@@ -291,47 +292,55 @@ export default { ...@@ -291,47 +292,55 @@ export default {
}; };
a.readAsDataURL(blob); a.readAsDataURL(blob);
}, },
NextClip(event){
console.log(123)
let that = this;
var clipboardData = event.clipboardData;
var items, item, types;
if (clipboardData) {
items = clipboardData.items;
if (!items || items.length == 0) {
that.$electron.ipcRenderer.send("read-clip");
return false;
} else {
// 保存在剪贴板中的数据类型
types = clipboardData.types || [];
for (var i = 0; i < types.length; i++) {
if (types[i] === "Files") {
item = items[i];
break;
}
}
if (
item &&
item.kind === "file" &&
item.type.match(/^image\//i)
) {
// 读取该图片
var file = item.getAsFile(),
reader = new FileReader(),
name = "";
if (item.type.match(/^image\//i))
name = `截图_${Date.parse(new Date())}.png`;
reader.onload = function(e) {
that.createImage(e.target.result)
};
reader.readAsDataURL(file);
}
}
}
},
initClip() { initClip() {
let that = this; let that = this;
document document
.querySelector("#msgEditorBox") .querySelector("#msgEditorBox")
.addEventListener("paste", function(event) { .removeEventListener("paste", that.NextClip, true);
var clipboardData = event.clipboardData; setTimeout(()=>{
var items, item, types; document
if (clipboardData) { .querySelector("#msgEditorBox")
items = clipboardData.items; .addEventListener("paste", that.NextClip);
if (!items || items.length == 0) { }, 20)
that.$electron.ipcRenderer.send("read-clip");
return false;
} else {
// 保存在剪贴板中的数据类型
types = clipboardData.types || [];
for (var i = 0; i < types.length; i++) {
if (types[i] === "Files") {
item = items[i];
break;
}
}
if (
item &&
item.kind === "file" &&
item.type.match(/^image\//i)
) {
// 读取该图片
var file = item.getAsFile(),
reader = new FileReader(),
name = "";
if (item.type.match(/^image\//i))
name = `截图_${Date.parse(new Date())}.png`;
reader.onload = function(e) {
that.createImage(e.target.result)
};
reader.readAsDataURL(file);
}
}
}
});
}, },
createImage(dataurl){ createImage(dataurl){
var strLen = dataurl.length; var strLen = dataurl.length;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment