From 4e9101d7fda53dc2904c2178038af9e8dc4ebc56 Mon Sep 17 00:00:00 2001 From: Sean Upton Date: Wed, 14 Jun 2017 14:12:22 -0600 Subject: [PATCH 1/2] formunloadalert pattern incorrectly used Function.prototype.apply where call (single argument) was intended in modal close scenario; this lead to exception, now fixed. --- CHANGES.rst | 5 +++++ mockup/patterns/formunloadalert/pattern.js | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 26ed1ab38..64dad3503 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -50,6 +50,11 @@ New features: Bug fixes: +- formunloadalert: Fixed incorrect use of Function.prototype.apply, + when call() was seemingly intended; fixes case where modal close leads to + exception. Fixes `issue 776 `_. + [seanupton] + - In the insert link/image modal, pass use the correct related items widget options from the ``linkModal`` attribute. [thet] diff --git a/mockup/patterns/formunloadalert/pattern.js b/mockup/patterns/formunloadalert/pattern.js index 1988efaa2..f79d3992e 100644 --- a/mockup/patterns/formunloadalert/pattern.js +++ b/mockup/patterns/formunloadalert/pattern.js @@ -65,7 +65,7 @@ define([ $modal.data('patternPloneModal').on('hide', function(e) { var modal = $modal.data('patternPloneModal'); if (modal) { - modal._suppressHide = self._handleUnload.apply(self, e); + modal._suppressHide = self._handleUnload.call(self, e); } }); } else { From d28449d58d39e9b7d95af82b54aa2b13a575002b Mon Sep 17 00:00:00 2001 From: Sean Upton Date: Wed, 14 Jun 2017 16:05:49 -0600 Subject: [PATCH 2/2] Fix #777, modal duplicate window.confirm on close of modal form --- CHANGES.rst | 4 ++++ mockup/patterns/modal/pattern.js | 1 + 2 files changed, 5 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 64dad3503..9cb139aec 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -50,6 +50,10 @@ New features: Bug fixes: +- modal: Fixed duplicate window.confirm on form unload. + Fixes `issue 777 `_. + [seanupton] + - formunloadalert: Fixed incorrect use of Function.prototype.apply, when call() was seemingly intended; fixes case where modal close leads to exception. Fixes `issue 776 `_. diff --git a/mockup/patterns/modal/pattern.js b/mockup/patterns/modal/pattern.js index 21673a4fc..c3dbadea1 100644 --- a/mockup/patterns/modal/pattern.js +++ b/mockup/patterns/modal/pattern.js @@ -872,6 +872,7 @@ define([ } self.$wrapper.remove(); if ($('.plone-modal', $('body')).size() < 1) { + self._suppressHide = undefined; self.backdrop.hide(); $('body').removeClass('plone-modal-open'); $(window.parent).off('resize.plone-modal.patterns');