working paste uploader

This commit is contained in:
mappu 2017-10-08 16:15:15 +13:00
parent 36145c0a2f
commit 2f05753c8e
2 changed files with 10 additions and 3 deletions

View File

@ -122,6 +122,13 @@ var contented = (function ($, currentScriptPath) {
handleUploadFrom($(".contented-file-selector")[0].files);
});
$f.find('.contented-paste-upload').on('click', function(e) {
e.preventDefault();
e.stopPropagation();
var blob = new Blob([$(".contented-if-paste textarea").val()], {type : 'text/plain'});
handleUploadFrom([blob]);
});
$("body").append($f);
var setProgressCaption = function(message) {

View File

@ -75,8 +75,7 @@
.contented textarea {
resize: none;
width:100%;
height:100%;
padding: 0;
height:calc(100% - 1em - 15px);
box-sizing:border-box;
}
.contented-progress-bar {
@ -137,7 +136,8 @@
</div>
<div class="contented-upload-if contented-if-paste">
<textarea name="paste-content"></textarea>
<textarea placeholder="Paste content here"></textarea>
<button class="contented-paste-upload">Upload &raquo;</button>
</div>
<div class="contented-upload-if contented-if-progress">