From 00b886c4921ee395f9f9d9a08c33489c8ecd6536 Mon Sep 17 00:00:00 2001 From: Haocen Xu Date: Sun, 25 Aug 2019 12:00:59 -0400 Subject: [PATCH 1/2] Refactor attachment editable logic to avoid undesired assumption --- js/privatebin.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/js/privatebin.js b/js/privatebin.js index 6cde5dc..b141779 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -2145,18 +2145,6 @@ jQuery.PrivateBin = (function($, RawDeflate) { return isPreview; }; - /** - * gets the visibility of the editor - * - * @name Editor.isHidden - * @function - * @return {bool} - */ - me.isHidden = function() - { - return $message.hasClass('hidden'); - }; - /** * reset the Editor view * @@ -2855,7 +2843,7 @@ jQuery.PrivateBin = (function($, RawDeflate) { evt.stopPropagation(); evt.preventDefault(); - if (Editor.isHidden()) { + if (TopNav.isAttachmentReadonly()) { return false; } @@ -2873,7 +2861,7 @@ jQuery.PrivateBin = (function($, RawDeflate) { $(document).draghover().on({ 'draghoverstart': function(e) { - if (Editor.isHidden()) { + if (TopNav.isAttachmentReadonly()) { e.stopPropagation(); e.preventDefault(); return false; @@ -2903,7 +2891,7 @@ jQuery.PrivateBin = (function($, RawDeflate) { */ function addClipboardEventHandler() { $(document).on('paste', function (event) { - if (Editor.isHidden()) { + if (TopNav.isAttachmentReadonly()) { event.stopPropagation(); event.preventDefault(); return false; @@ -3845,6 +3833,18 @@ jQuery.PrivateBin = (function($, RawDeflate) { $formatter.parent().find(`a[data-format="${format}"]`).click(); } + /** + * returns if attachment dropdown is readonly, not editable + * + * @name TopNav.isAttachmentReadonly + * @function + * @return {bool} + */ + me.isAttachmentReadonly = function() + { + return $attach.hasClass('hidden'); + } + /** * init navigation manager * From 5877111ccb9eb2c7618a9db0f125438f41f6d0c1 Mon Sep 17 00:00:00 2001 From: Haocen Xu Date: Sun, 25 Aug 2019 12:03:37 -0400 Subject: [PATCH 2/2] Update SRI --- tpl/bootstrap.php | 2 +- tpl/page.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index 6d2faba..2d07fe2 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -71,7 +71,7 @@ if ($MARKDOWN): endif; ?> - + diff --git a/tpl/page.php b/tpl/page.php index 30ec6e7..eec66ae 100644 --- a/tpl/page.php +++ b/tpl/page.php @@ -49,7 +49,7 @@ if ($MARKDOWN): endif; ?> - +