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 <cdiffrient@instructure.com>
QA-Review: Carl Kibler <ckibler@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
This commit is contained in:
Jeremy Stanley 2019-10-11 08:32:01 -06:00
parent 4f89ef6bd8
commit cac818a878
4 changed files with 7 additions and 5 deletions

View File

@ -207,6 +207,7 @@ export default class FilePreview extends React.PureComponent {
this.getNavigationParams({id: nextItem.id}) this.getNavigationParams({id: nextItem.id})
)}`} )}`}
className="ef-file-preview-container-arrow-link" className="ef-file-preview-container-arrow-link"
onClick={e => page.clickHandler(e.nativeEvent)}
> >
<div className="ef-file-preview-arrow-link"> <div className="ef-file-preview-arrow-link">
<span className="screenreader-only">{linkText}</span> <span className="screenreader-only">{linkText}</span>

View File

@ -100,7 +100,7 @@ page('/folder/*', getFolderSplat, renderShowFolder)
export default { export default {
start() { start() {
page.start() page.start({click: false})
}, },
getFolderSplat // Export getSplat for testing getFolderSplat // Export getSplat for testing
} }

View File

@ -108,7 +108,7 @@
"moment": "^2.10.6", "moment": "^2.10.6",
"newless": "^0.3.0", "newless": "^0.3.0",
"normalize-scroll-left": "^0.2", "normalize-scroll-left": "^0.2",
"page": "visionmedia/page.js#1.6.4", "page": "^1.11",
"parse-decimal-number": "1.0.0", "parse-decimal-number": "1.0.0",
"parse-link-header": "^1", "parse-link-header": "^1",
"prop-types": "^15", "prop-types": "^15",

View File

@ -15189,9 +15189,10 @@ package-hash@^3.0.0:
resolved "https://registry.yarnpkg.com/package/-/package-1.0.1.tgz#d25a1f99e2506dcb27d6704b83dca8a312e4edcc" resolved "https://registry.yarnpkg.com/package/-/package-1.0.1.tgz#d25a1f99e2506dcb27d6704b83dca8a312e4edcc"
integrity sha1-0lofmeJQbcsn1nBLg9yooxLk7cw= integrity sha1-0lofmeJQbcsn1nBLg9yooxLk7cw=
page@visionmedia/page.js#1.6.4: page@^1.11:
version "1.6.4" version "1.11.5"
resolved "https://codeload.github.com/visionmedia/page.js/tar.gz/d11509f1f0fed0309391d995919c25dce84b8abd" resolved "https://registry.yarnpkg.com/page/-/page-1.11.5.tgz#0cfc8608be337f26f4377f31df0787aef0ca1af7"
integrity sha512-0JXUHc7Y8p1cPJQbhZSwaKO3p+bU3Rgny+OM5gJMKHWHvJKan/fsE5RUzEjRQolv9DzPOSVWfSOHz0lLxK19eA==
dependencies: dependencies:
path-to-regexp "~1.2.1" path-to-regexp "~1.2.1"