Reset attachment when clicking new paste
This commit is contained in:
parent
fc1be18cbe
commit
5ece4d2632
|
@ -18,14 +18,14 @@ jQuery.fn.draghover = function() {
|
||||||
return this.each(function() {
|
return this.each(function() {
|
||||||
let collection = $(),
|
let collection = $(),
|
||||||
self = $(this);
|
self = $(this);
|
||||||
|
|
||||||
self.on('dragenter', function(e) {
|
self.on('dragenter', function(e) {
|
||||||
if (collection.length === 0) {
|
if (collection.length === 0) {
|
||||||
self.trigger('draghoverstart');
|
self.trigger('draghoverstart');
|
||||||
}
|
}
|
||||||
collection = collection.add(e.target);
|
collection = collection.add(e.target);
|
||||||
});
|
});
|
||||||
|
|
||||||
self.on('dragleave drop', function(e) {
|
self.on('dragleave drop', function(e) {
|
||||||
collection = collection.not(e.target);
|
collection = collection.not(e.target);
|
||||||
if (collection.length === 0) {
|
if (collection.length === 0) {
|
||||||
|
@ -519,7 +519,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* calculate expiration date given initial date and expiration period
|
* calculate expiration date given initial date and expiration period
|
||||||
*
|
*
|
||||||
* @name Helper.calculateExpirationDate
|
* @name Helper.calculateExpirationDate
|
||||||
* @function
|
* @function
|
||||||
* @param {Date} initialDate - may not be empty
|
* @param {Date} initialDate - may not be empty
|
||||||
|
@ -532,7 +532,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
||||||
if (typeof expirationDisplayStringOrSecondsToExpire === 'string') {
|
if (typeof expirationDisplayStringOrSecondsToExpire === 'string') {
|
||||||
secondsToExpiration = me.durationToSeconds(expirationDisplayStringOrSecondsToExpire);
|
secondsToExpiration = me.durationToSeconds(expirationDisplayStringOrSecondsToExpire);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof secondsToExpiration !== 'number') {
|
if (typeof secondsToExpiration !== 'number') {
|
||||||
throw new Error('Cannot calculate expiration date.');
|
throw new Error('Cannot calculate expiration date.');
|
||||||
}
|
}
|
||||||
|
@ -3695,9 +3695,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
||||||
// in any case, remove saved attachment data
|
// in any case, remove saved attachment data
|
||||||
AttachmentViewer.removeAttachmentData();
|
AttachmentViewer.removeAttachmentData();
|
||||||
|
|
||||||
// hide UI for selected files
|
me.clearAttachmentInput();
|
||||||
// our up-to-date jQuery can handle it :)
|
|
||||||
$fileWrap.find('input').val('');
|
|
||||||
AttachmentViewer.clearDragAndDrop();
|
AttachmentViewer.clearDragAndDrop();
|
||||||
|
|
||||||
// pevent '#' from appearing in the URL
|
// pevent '#' from appearing in the URL
|
||||||
|
@ -3722,11 +3720,11 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Template Email body.
|
* Template Email body.
|
||||||
*
|
*
|
||||||
* @name TopNav.templateEmailBody
|
* @name TopNav.templateEmailBody
|
||||||
* @private
|
* @private
|
||||||
* @param {string} expirationDateString
|
* @param {string} expirationDateString
|
||||||
* @param {bool} isBurnafterreading
|
* @param {bool} isBurnafterreading
|
||||||
*/
|
*/
|
||||||
function templateEmailBody(expirationDateString, isBurnafterreading)
|
function templateEmailBody(expirationDateString, isBurnafterreading)
|
||||||
{
|
{
|
||||||
|
@ -3764,10 +3762,10 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trigger Email send.
|
* Trigger Email send.
|
||||||
*
|
*
|
||||||
* @name TopNav.triggerEmailSend
|
* @name TopNav.triggerEmailSend
|
||||||
* @private
|
* @private
|
||||||
* @param {string} emailBody
|
* @param {string} emailBody
|
||||||
*/
|
*/
|
||||||
function triggerEmailSend(emailBody)
|
function triggerEmailSend(emailBody)
|
||||||
{
|
{
|
||||||
|
@ -3980,7 +3978,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* show the "email" button
|
* show the "email" button
|
||||||
*
|
*
|
||||||
* @name TopNav.showEmailbutton
|
* @name TopNav.showEmailbutton
|
||||||
* @function
|
* @function
|
||||||
* @param {int|undefined} optionalRemainingTimeInSeconds
|
* @param {int|undefined} optionalRemainingTimeInSeconds
|
||||||
|
@ -4008,7 +4006,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* hide the "email" button
|
* hide the "email" button
|
||||||
*
|
*
|
||||||
* @name TopNav.hideEmailButton
|
* @name TopNav.hideEmailButton
|
||||||
* @function
|
* @function
|
||||||
*/
|
*/
|
||||||
|
@ -4042,7 +4040,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* only hides the qr code button
|
* only hides the qr code button
|
||||||
*
|
*
|
||||||
* @name TopNav.hideQrCodeButton
|
* @name TopNav.hideQrCodeButton
|
||||||
* @function
|
* @function
|
||||||
*/
|
*/
|
||||||
|
@ -4053,7 +4051,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* hide all irrelevant buttons when viewing burn after reading paste
|
* hide all irrelevant buttons when viewing burn after reading paste
|
||||||
*
|
*
|
||||||
* @name TopNav.hideBurnAfterReadingButtons
|
* @name TopNav.hideBurnAfterReadingButtons
|
||||||
* @function
|
* @function
|
||||||
*/
|
*/
|
||||||
|
@ -4089,7 +4087,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* hides the custom attachment
|
* hides the custom attachment
|
||||||
*
|
*
|
||||||
* @name TopNav.hideCustomAttachment
|
* @name TopNav.hideCustomAttachment
|
||||||
* @function
|
* @function
|
||||||
*/
|
*/
|
||||||
|
@ -4112,6 +4110,19 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the attachment input in the top navigation.
|
||||||
|
*
|
||||||
|
* @name TopNav.clearAttachmentInput
|
||||||
|
* @function
|
||||||
|
*/
|
||||||
|
me.clearAttachmentInput = function()
|
||||||
|
{
|
||||||
|
// hide UI for selected files
|
||||||
|
// our up-to-date jQuery can handle it :)
|
||||||
|
$fileWrap.find('input').val('');
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns the currently set expiration time
|
* returns the currently set expiration time
|
||||||
*
|
*
|
||||||
|
@ -4213,7 +4224,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Highlight file upload
|
* Highlight file upload
|
||||||
*
|
*
|
||||||
* @name TopNav.highlightFileupload
|
* @name TopNav.highlightFileupload
|
||||||
* @function
|
* @function
|
||||||
*/
|
*/
|
||||||
|
@ -4232,7 +4243,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set the format on bootstrap templates in dropdown programmatically
|
* set the format on bootstrap templates in dropdown programmatically
|
||||||
*
|
*
|
||||||
* @name TopNav.setFormat
|
* @name TopNav.setFormat
|
||||||
* @function
|
* @function
|
||||||
*/
|
*/
|
||||||
|
@ -4243,7 +4254,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns if attachment dropdown is readonly, not editable
|
* returns if attachment dropdown is readonly, not editable
|
||||||
*
|
*
|
||||||
* @name TopNav.isAttachmentReadonly
|
* @name TopNav.isAttachmentReadonly
|
||||||
* @function
|
* @function
|
||||||
* @return {bool}
|
* @return {bool}
|
||||||
|
@ -5133,6 +5144,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
||||||
Editor.show();
|
Editor.show();
|
||||||
Editor.focusInput();
|
Editor.focusInput();
|
||||||
AttachmentViewer.removeAttachment();
|
AttachmentViewer.removeAttachment();
|
||||||
|
TopNav.clearAttachmentInput();
|
||||||
|
|
||||||
TopNav.showCreateButtons();
|
TopNav.showCreateButtons();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue