Added possibility to paste an image from the clipboard
This commit is contained in:
parent
838ca3d38e
commit
24aea957b3
|
@ -132,7 +132,7 @@
|
|||
"Cloned: '%s'": "Geklont: '%s'",
|
||||
"The cloned file '%s' was attached to this paste.": "Die geklonte Datei '%s' wurde angehängt.",
|
||||
"Attach a file": "Datei anhängen",
|
||||
"or drag & drop file": "oder per Drag & Drop einfügen",
|
||||
"alternatively drag & drop a file or paste an image from the clipboard": "Alternativ Drag & Drop einer Datei oder einfügen eines Bildes aus der Zwischenablage",
|
||||
"File too large, to display a preview. Please download the attachment.": "Datei zu groß, um als Vorschau angezeigt zu werden. Bitte Anhang herunterladen.",
|
||||
"Remove attachment": "Anhang entfernen",
|
||||
"Your browser does not support uploading encrypted files. Please use a newer browser.":
|
||||
|
|
|
@ -2298,6 +2298,23 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
|
|||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Attaches the clipboard attachment handler to the page.
|
||||
* @returns {undefined}
|
||||
*/
|
||||
me.addClipboardEventHandler = function () {
|
||||
document.addEventListener("paste",
|
||||
function (event) {
|
||||
var items = (event.clipboardData || event.originalEvent.clipboardData).items;
|
||||
for (var i in items) {
|
||||
var item = items[i];
|
||||
if (item.kind === 'file') {
|
||||
me.readFileData(item.getAsFile());
|
||||
}
|
||||
}
|
||||
}, false);
|
||||
};
|
||||
|
||||
/**
|
||||
* initiate
|
||||
*
|
||||
|
@ -2315,6 +2332,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
|
|||
|
||||
me.$fileInput = $('#file');
|
||||
me.addDragDropHandler();
|
||||
me.addClipboardEventHandler();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ if ($MARKDOWN):
|
|||
<?php
|
||||
endif;
|
||||
?>
|
||||
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-pOe2H/Z6no88ilmHnSzSPrN5jYaj4B0VrxeVKHZ728CwUxNKwI8xIAUH+B/UPnKXgT33IV2EHbBIXYJERQxinA==" crossorigin="anonymous"></script>
|
||||
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-wrGlxXZ5UYLGd+2CJB2I4xXJXoG632WaqM+glL2g669ta/mDwPgDhB+mhoXGdD7PWLpZ9JIgcjovMou/wrPtRg==" crossorigin="anonymous"></script>
|
||||
<!--[if lt IE 10]>
|
||||
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
||||
<![endif]-->
|
||||
|
@ -283,7 +283,7 @@ if ($FILEUPLOAD):
|
|||
<div>
|
||||
<input type="file" id="file" name="file"/>
|
||||
</div>
|
||||
<div id="dragAndDropFileName" class="dragAndDropFile"><?php echo I18n::_('or drag & drop file'); ?></div>
|
||||
<div id="dragAndDropFileName" class="dragAndDropFile"><?php echo I18n::_('alternatively drag & drop a file or paste an image from the clipboard'); ?></div>
|
||||
</li>
|
||||
<li id="customattachment" class="hidden"></li>
|
||||
<li>
|
||||
|
|
|
@ -47,7 +47,7 @@ if ($MARKDOWN):
|
|||
<?php
|
||||
endif;
|
||||
?>
|
||||
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-pOe2H/Z6no88ilmHnSzSPrN5jYaj4B0VrxeVKHZ728CwUxNKwI8xIAUH+B/UPnKXgT33IV2EHbBIXYJERQxinA==" crossorigin="anonymous"></script>
|
||||
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-wrGlxXZ5UYLGd+2CJB2I4xXJXoG632WaqM+glL2g669ta/mDwPgDhB+mhoXGdD7PWLpZ9JIgcjovMou/wrPtRg==" crossorigin="anonymous"></script>
|
||||
<!--[if lt IE 10]>
|
||||
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
||||
<![endif]-->
|
||||
|
@ -203,7 +203,7 @@ if ($FILEUPLOAD):
|
|||
<div id="attach" class="hidden">
|
||||
<span id="clonedfile" class="hidden"><?php echo I18n::_('Cloned file attached.'); ?></span>
|
||||
<span id="filewrap"><?php echo I18n::_('Attach a file'); ?>: <input type="file" id="file" name="file" /></span>
|
||||
<span id="dragAndDropFileName" class="dragAndDropFile"><?php echo I18n::_('or drag & drop file'); ?></span>
|
||||
<span id="dragAndDropFileName" class="dragAndDropFile"><?php echo I18n::_('alternatively drag & drop a file or paste an image from the clipboard'); ?></span>
|
||||
<button id="fileremovebutton"><?php echo I18n::_('Remove attachment'); ?></button>
|
||||
</div>
|
||||
<?php
|
||||
|
|
Loading…
Reference in New Issue