From cac818a878a86ea74626873d553066365d17f147 Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Fri, 11 Oct 2019 08:32:01 -0600 Subject: [PATCH] files: turn off page.js click handler because it prevents preventDefault on file links (sometimes) then use it explicitly where we need it, on the left/right preview buttons test plan: - go to user files (/files) - have multiple image files in a folder - reload the page, then click an image file - it should preview, not download - clicking the left/right arrows at the side of the preview window should go to the previous/next image without reloading the page fixes ADMIN-2923 Change-Id: Ib97d25d51e7c94fb962e5d24d3c763554e7fcdd4 Reviewed-on: https://gerrit.instructure.com/212876 Tested-by: Jenkins Reviewed-by: Clay Diffrient QA-Review: Carl Kibler Product-Review: Jeremy Stanley --- app/jsx/files/FilePreview.js | 1 + app/jsx/files/router.js | 2 +- package.json | 2 +- yarn.lock | 7 ++++--- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/jsx/files/FilePreview.js b/app/jsx/files/FilePreview.js index 704de9ef9ff..cccc9728029 100644 --- a/app/jsx/files/FilePreview.js +++ b/app/jsx/files/FilePreview.js @@ -207,6 +207,7 @@ export default class FilePreview extends React.PureComponent { this.getNavigationParams({id: nextItem.id}) )}`} className="ef-file-preview-container-arrow-link" + onClick={e => page.clickHandler(e.nativeEvent)} >
{linkText} diff --git a/app/jsx/files/router.js b/app/jsx/files/router.js index ab92901aa05..68f962280a7 100644 --- a/app/jsx/files/router.js +++ b/app/jsx/files/router.js @@ -100,7 +100,7 @@ page('/folder/*', getFolderSplat, renderShowFolder) export default { start() { - page.start() + page.start({click: false}) }, getFolderSplat // Export getSplat for testing } diff --git a/package.json b/package.json index f363bf310d9..00b5331f685 100644 --- a/package.json +++ b/package.json @@ -108,7 +108,7 @@ "moment": "^2.10.6", "newless": "^0.3.0", "normalize-scroll-left": "^0.2", - "page": "visionmedia/page.js#1.6.4", + "page": "^1.11", "parse-decimal-number": "1.0.0", "parse-link-header": "^1", "prop-types": "^15", diff --git a/yarn.lock b/yarn.lock index 076fc223a1c..a068687c24b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15189,9 +15189,10 @@ package-hash@^3.0.0: resolved "https://registry.yarnpkg.com/package/-/package-1.0.1.tgz#d25a1f99e2506dcb27d6704b83dca8a312e4edcc" integrity sha1-0lofmeJQbcsn1nBLg9yooxLk7cw= -page@visionmedia/page.js#1.6.4: - version "1.6.4" - resolved "https://codeload.github.com/visionmedia/page.js/tar.gz/d11509f1f0fed0309391d995919c25dce84b8abd" +page@^1.11: + version "1.11.5" + resolved "https://registry.yarnpkg.com/page/-/page-1.11.5.tgz#0cfc8608be337f26f4377f31df0787aef0ca1af7" + integrity sha512-0JXUHc7Y8p1cPJQbhZSwaKO3p+bU3Rgny+OM5gJMKHWHvJKan/fsE5RUzEjRQolv9DzPOSVWfSOHz0lLxK19eA== dependencies: path-to-regexp "~1.2.1"