From c0b07e540183bd85c7d6cc9e7335823ad374cd37 Mon Sep 17 00:00:00 2001 From: Felix Hamann Date: Tue, 28 May 2019 20:56:00 +0200 Subject: [PATCH 1/2] fix navigate-away-prompt js utility in chrome --- static/js/utils/form.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/static/js/utils/form.js b/static/js/utils/form.js index c545caa93..fadcbb7a4 100644 --- a/static/js/utils/form.js +++ b/static/js/utils/form.js @@ -322,7 +322,9 @@ // cancel the unload event. This is the standard to force the prompt to appear. event.preventDefault(); - // for all non standard compliant browsers we return a truthy value to activate the prompt. + // chrome apparently does not comply to standards. We need to set the events' returnValue as well. + event.returnValue = true; + // for all other non standard compliant browsers we return a truthy value to activate the prompt. return true; } From c2ab196b92440758d3092a4256e40cc5e86aed18 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 28 May 2019 22:30:38 +0200 Subject: [PATCH 2/2] Fix handling of suggested UploadSpecificFiles --- src/Handler/Utils/Form.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Handler/Utils/Form.hs b/src/Handler/Utils/Form.hs index 12fdc847c..0b661e87e 100644 --- a/src/Handler/Utils/Form.hs +++ b/src/Handler/Utils/Form.hs @@ -420,8 +420,8 @@ uploadModeForm prev = multiActionA actions (fslI MsgSheetUploadMode) (classifyUp let iStart = maybe 0 (succ . fst) $ Map.lookupMax oldRess in pure $ Map.singleton iStart fileRes return (addRes', formWidget') - miCell _ initFile initFile' nudge csrf = - sFileForm nudge (Just $ fromMaybe initFile initFile') csrf + miCell _ initFile _ nudge csrf = + sFileForm nudge (Just initFile) csrf miDelete = miDeleteList miAllowAdd _ _ _ = True miAddEmpty _ _ _ = Set.empty