Pasting images basically works.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3802 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
fefb0f92bc
commit
d3875cf738
@ -1 +1 @@
|
||||
{"type":"tildefriends-app","files":{"app.js":"&OOcUHSIAA6CR2dYSv2BwOMBZ1hjFg+PJZPABhZMe1Gc=.sha256","index.html":"&H2L4kR9xDS6oS7EDpesDCDB3JXDjcLTBg9XoR2mZaZw=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256","tf-user.js":"&DdJwZYEo7AqFyutYMvEjykoVXxdHVog0UXye6Sbo0TU=.sha256","tf-message.js":"&3dPiSNYjoJE3zn1oTT1SBhbvkW9MHr7ZUDxUJiBI1Ss=.sha256","tf.js":"&RAwMitnSkY+F3lDbyXAvWYT1QOX0lUsNZC+JE7KW4JM=.sha256","commonmark.min.js":"&EP0OeR9zyLwZannz+0ga4s9AGES2RLvvIIQYHqqV6+k=.sha256","vue.js":"&g1wvA+yHl1sVC+eufTsg9If7ZeVyMTBU+h0tks7ZNzE=.sha256","vue-material-theme-default-dark.css":"&RP2nr+2CR18BpHHw5ST9a5GJUCOG9n0G2kuGkcQioWE=.sha256","vue-material.min.css":"&kGbUM2QgFSyHZRzqQb0b+0S3EVIlZ0AXpdiAVjIhou8=.sha256","roboto.css":"&jJv43Om673mQO5JK0jj7714s5E+5Yrf82H6LcDx7wUs=.sha256","material-icons.css":"&a28PdcVvgq/DxyIvJAx/e+ZOEtOuHnr3kjLWKyzH11M=.sha256","tf-shared.js":"&+qPP3g4CAUlkt8K4iBCZ+F5Fy6N7fu6MggvSVss2juE=.sha256"}}
|
||||
{"type":"tildefriends-app","files":{"app.js":"&OOcUHSIAA6CR2dYSv2BwOMBZ1hjFg+PJZPABhZMe1Gc=.sha256","index.html":"&vAy6mHSTMNDHo2P9CuRbsi0FMRtbOXXOP/2JbfGiZMU=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256","tf-user.js":"&DdJwZYEo7AqFyutYMvEjykoVXxdHVog0UXye6Sbo0TU=.sha256","tf-message.js":"&3dPiSNYjoJE3zn1oTT1SBhbvkW9MHr7ZUDxUJiBI1Ss=.sha256","tf.js":"&/yKh5E/PLaK/M3tivdldiEDnpeYQYyuLHWjjdM/QpxE=.sha256","commonmark.min.js":"&EP0OeR9zyLwZannz+0ga4s9AGES2RLvvIIQYHqqV6+k=.sha256","vue.js":"&g1wvA+yHl1sVC+eufTsg9If7ZeVyMTBU+h0tks7ZNzE=.sha256","vue-material-theme-default-dark.css":"&RP2nr+2CR18BpHHw5ST9a5GJUCOG9n0G2kuGkcQioWE=.sha256","vue-material.min.css":"&kGbUM2QgFSyHZRzqQb0b+0S3EVIlZ0AXpdiAVjIhou8=.sha256","roboto.css":"&jJv43Om673mQO5JK0jj7714s5E+5Yrf82H6LcDx7wUs=.sha256","material-icons.css":"&a28PdcVvgq/DxyIvJAx/e+ZOEtOuHnr3kjLWKyzH11M=.sha256","tf-shared.js":"&+qPP3g4CAUlkt8K4iBCZ+F5Fy6N7fu6MggvSVss2juE=.sha256"}}
|
@ -65,10 +65,15 @@
|
||||
<div class="md-layout">
|
||||
<md-field class="md-layout-item">
|
||||
<label>Post a message</label>
|
||||
<md-textarea id="post_text" v-model="post_text"></md-textarea>
|
||||
<md-textarea id="post_text" v-model="post_text" v-on:paste="paste"></md-textarea>
|
||||
</md-field>
|
||||
<md-card class="md-layout-item" v-if="post_text && post_text.length">
|
||||
<md-card-content v-html="markdown(post_text)"></md-card-content>
|
||||
<md-card-content>
|
||||
<md-card-media v-for="link in Object.keys(mentions)" v-bind:key="link">
|
||||
<img v-if="(mentions[link].type || '').startsWith('image/')" :src="'/' + link + '/view'">
|
||||
</md-card-media>
|
||||
</md-card-content>
|
||||
</md-card>
|
||||
</div>
|
||||
</md-card-content>
|
||||
|
@ -243,7 +243,6 @@ window.addEventListener('load', function() {
|
||||
input.onchange = function(event) {
|
||||
var file = event.target.files[0];
|
||||
file.arrayBuffer().then(function(buffer) {
|
||||
console.log(buffer);
|
||||
window.parent.postMessage({action: 'storeBlob',
|
||||
blob: {
|
||||
name: file.name,
|
||||
@ -257,6 +256,26 @@ window.addEventListener('load', function() {
|
||||
};
|
||||
input.click();
|
||||
},
|
||||
paste(event) {
|
||||
var items = (event.clipboardData || event.originalEvent.clipboardData).items;
|
||||
for (let item of items) {
|
||||
var file = item.getAsFile();
|
||||
if (file) {
|
||||
file.arrayBuffer().then(function(buffer) {
|
||||
window.parent.postMessage({
|
||||
action: 'storeBlob',
|
||||
blob: {
|
||||
name: file.name,
|
||||
type: file.type,
|
||||
buffer: buffer,
|
||||
},
|
||||
}, '*');
|
||||
});
|
||||
event.preventDefault();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
window.parent.postMessage('ready', '*');
|
||||
|
Loading…
Reference in New Issue
Block a user