From d9adf598d8c1d41efab495d55404f24fa5c7cbe1 Mon Sep 17 00:00:00 2001 From: Erik Michelson Date: Sun, 23 Aug 2020 01:11:31 +0200 Subject: Add dropbox CSP directive if configured and make button clickable The lack of a 'preventDefault' on the click event handler resulted in the dropbox link being unclickable. Furthermore because of a missing CSP rule, the dropbox script couldn't be loaded. The dropbox origin is now added to the CSP script sources if dropbox integration is configured. Signed-off-by: Erik Michelson --- public/js/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'public') diff --git a/public/js/index.js b/public/js/index.js index ad20ffff..02e66490 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -996,7 +996,8 @@ ui.toolbar.export.snippet.click(function () { }) }) // import from dropbox -ui.toolbar.import.dropbox.click(function () { +ui.toolbar.import.dropbox.click(function (event) { + event.preventDefault() var options = { success: function (files) { ui.spinner.show() -- cgit v1.2.3 From f821da6c0934ec1a7ee362b20612d936bd9cebd4 Mon Sep 17 00:00:00 2001 From: Erik Michelson Date: Sun, 23 Aug 2020 01:21:37 +0200 Subject: Add prevent default to export button too Signed-off-by: Erik Michelson --- public/js/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'public') diff --git a/public/js/index.js b/public/js/index.js index 02e66490..3eaba0ee 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -944,7 +944,8 @@ ui.toolbar.download.rawhtml.click(function (e) { // pdf ui.toolbar.download.pdf.attr('download', '').attr('href', noteurl + '/pdf') // export to dropbox -ui.toolbar.export.dropbox.click(function () { +ui.toolbar.export.dropbox.click(function (event) { + event.preventDefault() var filename = renderFilename(ui.area.markdown) + '.md' var options = { files: [ -- cgit v1.2.3