From f0fa0cffac47af857c0376db1b2a62751cdce3e6 Mon Sep 17 00:00:00 2001 From: Tony Jin Date: Wed, 26 Jul 2017 16:26:50 -0700 Subject: [PATCH 01/19] Chore: Update patch release script (#251) --- build/release.sh | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/build/release.sh b/build/release.sh index fb2ba95b8..aa1a63e11 100755 --- a/build/release.sh +++ b/build/release.sh @@ -14,7 +14,7 @@ patch_release=false reset_to_master() { - # Update to latest code on Github master + # Update to latest code on GitHub master git checkout master || return 1 # Wipe tags @@ -110,16 +110,29 @@ push_to_github() { echo "Master version is now at" $VERSION echo "----------------------------------------------------------------------" - # Push to Github including tags - if git push github-upstream master --tags --no-verify; then - echo "----------------------------------------------------------------------" - echo "Pushed version" $VERSION "to git successfully" - echo "----------------------------------------------------------------------" + # Push release to GitHub + if $patch_release; then + if git push github-upstream v$VERSION --no-verify; then + echo "----------------------------------------------------------------------" + echo "Pushed version" $VERSION "to git successfully" + echo "----------------------------------------------------------------------" + else + echo "----------------------------------------------------------------------" + echo "Error while pushing version" $VERSION "to git" + echo "----------------------------------------------------------------------" + return 1 + fi else - echo "----------------------------------------------------------------------" - echo "Error while pushing version" $VERSION "to git" - echo "----------------------------------------------------------------------" - return 1 + if git push github-upstream master --tags --no-verify; then + echo "----------------------------------------------------------------------" + echo "Pushed version" $VERSION "to git successfully" + echo "----------------------------------------------------------------------" + else + echo "----------------------------------------------------------------------" + echo "Error while pushing version" $VERSION "to git" + echo "----------------------------------------------------------------------" + return 1 + fi fi } @@ -156,7 +169,7 @@ push_new_release() { # Update readme update_readme || return 1 - # Push to Github + # Push to GitHub push_to_github || return 1 } From 35994b6a4336b51cb532d8d94e489366a4188d46 Mon Sep 17 00:00:00 2001 From: Tony Jin Date: Wed, 26 Jul 2017 17:25:48 -0700 Subject: [PATCH 02/19] Chore: Switch to git-based changelog generator (#252) --- CHANGELOG.md | 745 ++++++++++++++++++++++------------------------- build/release.sh | 2 +- package.json | 1 + yarn.lock | 214 +++++++++++++- 4 files changed, 558 insertions(+), 404 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 095647283..61a74d9bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,408 +1,365 @@ -# Change Log - -## [v1.2.0](https://github.com/box/box-content-preview/tree/v1.2.0) (2017-07-25) -[Full Changelog](https://github.com/box/box-content-preview/compare/v1.1.1...v1.2.0) - -**Merged pull requests:** - -- Fix: Update box3d to fix camera reload bug [\#245](https://github.com/box/box-content-preview/pull/245) ([MiiBond](https://github.com/MiiBond)) -- New: added support for compressed \(DDS\) textures to 3D preview [\#244](https://github.com/box/box-content-preview/pull/244) ([ikerr](https://github.com/ikerr)) -- Update Translations [\#240](https://github.com/box/box-content-preview/pull/240) ([boxmoji](https://github.com/boxmoji)) -- Fix: Allow legacy annotations to render in PDF.js [\#238](https://github.com/box/box-content-preview/pull/238) ([jeremypress](https://github.com/jeremypress)) -- Fix: Give preview some min width and height [\#237](https://github.com/box/box-content-preview/pull/237) ([priyajeet](https://github.com/priyajeet)) -- Docs: Adding section of using Preview as a component [\#236](https://github.com/box/box-content-preview/pull/236) ([priyajeet](https://github.com/priyajeet)) -- Fix: Increase controls timeout and fix controls behavior for mobile VR [\#235](https://github.com/box/box-content-preview/pull/235) ([jeremypress](https://github.com/jeremypress)) -- Fix: Ensuring annotation scale is set on files with 0 annotations [\#234](https://github.com/box/box-content-preview/pull/234) ([pramodsum](https://github.com/pramodsum)) -- Feature: DrawingAnnotations starting code [\#224](https://github.com/box/box-content-preview/pull/224) ([MinhHNguyen](https://github.com/MinhHNguyen)) - -## [v1.1.1](https://github.com/box/box-content-preview/tree/v1.1.1) (2017-07-20) -[Full Changelog](https://github.com/box/box-content-preview/compare/v1.1.0...v1.1.1) - -**Merged pull requests:** - -- Fix: Don't swallow 'touchstart' event to prevent iOS inertia scrolling [\#233](https://github.com/box/box-content-preview/pull/233) ([jeremypress](https://github.com/jeremypress)) -- Fix: Prevent MP3 from hiding [\#230](https://github.com/box/box-content-preview/pull/230) ([jeremypress](https://github.com/jeremypress)) + +# 1.2.0 (2017-07-25) -## [v1.1.0](https://github.com/box/box-content-preview/tree/v1.1.0) (2017-07-18) -[Full Changelog](https://github.com/box/box-content-preview/compare/v1.0.0...v1.1.0) - -**Merged pull requests:** - -- Docs: Add issue reporting template [\#228](https://github.com/box/box-content-preview/pull/228) ([tonyjin](https://github.com/tonyjin)) -- Fix: Prevent double tap zoom in control bar [\#227](https://github.com/box/box-content-preview/pull/227) ([jeremypress](https://github.com/jeremypress)) -- New: Add ts and flv formats to MediaLoader.js [\#226](https://github.com/box/box-content-preview/pull/226) ([bhh1988](https://github.com/bhh1988)) -- Fix: Limit iOS font fix to 10.3.1 [\#225](https://github.com/box/box-content-preview/pull/225) ([tonyjin](https://github.com/tonyjin)) -- Chore: Full pass of prettier formatting [\#223](https://github.com/box/box-content-preview/pull/223) ([tonyjin](https://github.com/tonyjin)) -- Fix settings pullup for model3D files on mobile [\#222](https://github.com/box/box-content-preview/pull/222) ([jeremypress](https://github.com/jeremypress)) -- Chore: Fix webpack errors and upgrade some packages [\#221](https://github.com/box/box-content-preview/pull/221) ([tonyjin](https://github.com/tonyjin)) -- Update: Render Vera-protected HTML files [\#220](https://github.com/box/box-content-preview/pull/220) ([tonyjin](https://github.com/tonyjin)) -- Chore: Update Travis config [\#219](https://github.com/box/box-content-preview/pull/219) ([tonyjin](https://github.com/tonyjin)) -- Fix: Restore crawler for buffering video [\#218](https://github.com/box/box-content-preview/pull/218) ([jeremypress](https://github.com/jeremypress)) -- Fix: Media controls and usability fixes for mobile [\#217](https://github.com/box/box-content-preview/pull/217) ([jeremypress](https://github.com/jeremypress)) -- Chore: Cleaning up annotation strings/classes [\#215](https://github.com/box/box-content-preview/pull/215) ([pramodsum](https://github.com/pramodsum)) -- Chore: Update .travis.yml to build PRs and merges to master [\#214](https://github.com/box/box-content-preview/pull/214) ([tonyjin](https://github.com/tonyjin)) -- Docs: Update project status badge [\#212](https://github.com/box/box-content-preview/pull/212) ([tonyjin](https://github.com/tonyjin)) - -## [v1.0.0](https://github.com/box/box-content-preview/tree/v1.0.0) (2017-07-12) -[Full Changelog](https://github.com/box/box-content-preview/compare/v0.131.2...v1.0.0) - -## [v0.131.2](https://github.com/box/box-content-preview/tree/v0.131.2) (2017-07-11) -[Full Changelog](https://github.com/box/box-content-preview/compare/v0.131.1...v0.131.2) - -**Merged pull requests:** - -- Fix: Search preview container for mobile annotations dialog [\#209](https://github.com/box/box-content-preview/pull/209) ([pramodsum](https://github.com/pramodsum)) -- Fix: Ensure that annotation scale is never being set to auto [\#208](https://github.com/box/box-content-preview/pull/208) ([pramodsum](https://github.com/pramodsum)) - -## [v0.131.1](https://github.com/box/box-content-preview/tree/v0.131.1) (2017-07-11) -[Full Changelog](https://github.com/box/box-content-preview/compare/v0.131.0...v0.131.1) - -**Merged pull requests:** - -- Fix: Properly scope typography CSS [\#207](https://github.com/box/box-content-preview/pull/207) ([tonyjin](https://github.com/tonyjin)) -- Chore: Cleaning up annotations code comments [\#206](https://github.com/box/box-content-preview/pull/206) ([pramodsum](https://github.com/pramodsum)) - -## [v0.131.0](https://github.com/box/box-content-preview/tree/v0.131.0) (2017-07-07) -[Full Changelog](https://github.com/box/box-content-preview/compare/v0.130.0...v0.131.0) - -**Merged pull requests:** - -- Cleanup for 1.0 for 3D [\#205](https://github.com/box/box-content-preview/pull/205) ([JustinHoldstock](https://github.com/JustinHoldstock)) -- Chore: Preview UI as instance [\#204](https://github.com/box/box-content-preview/pull/204) ([tonyjin](https://github.com/tonyjin)) -- Chore: Update README to include token scope information [\#203](https://github.com/box/box-content-preview/pull/203) ([jeremypress](https://github.com/jeremypress)) -- Chore: Preview Cleanup [\#202](https://github.com/box/box-content-preview/pull/202) ([jeremypress](https://github.com/jeremypress)) -- Fix/notification message timeout [\#201](https://github.com/box/box-content-preview/pull/201) ([MinhHNguyen](https://github.com/MinhHNguyen)) -- Chore: Page num input uses numeric keyboard on mobile devices [\#200](https://github.com/box/box-content-preview/pull/200) ([jeremypress](https://github.com/jeremypress)) -- Chore: Fix ESLint warnings \(JSDoc cleanup\) [\#199](https://github.com/box/box-content-preview/pull/199) ([tonyjin](https://github.com/tonyjin)) -- Update: pdf.js 1.8.514 [\#197](https://github.com/box/box-content-preview/pull/197) ([tonyjin](https://github.com/tonyjin)) -- Fix: Ensures highlight buttons are hidden on mobile devices [\#196](https://github.com/box/box-content-preview/pull/196) ([pramodsum](https://github.com/pramodsum)) -- Docs: Update contributing.md [\#195](https://github.com/box/box-content-preview/pull/195) ([tonyjin](https://github.com/tonyjin)) -- Chore: Remove padding for CSV files [\#194](https://github.com/box/box-content-preview/pull/194) ([jeremypress](https://github.com/jeremypress)) -- Chore: Update to new 'Elements' branding [\#193](https://github.com/box/box-content-preview/pull/193) ([tonyjin](https://github.com/tonyjin)) -- Fix: Allow panning on mobile while zooming into ppt files [\#192](https://github.com/box/box-content-preview/pull/192) ([jeremypress](https://github.com/jeremypress)) -- Fix: Tree shaking bug workaround for csv bundle [\#191](https://github.com/box/box-content-preview/pull/191) ([priyajeet](https://github.com/priyajeet)) -- Chore: Removing unused 'active' & 'active-hover' states for annotations [\#189](https://github.com/box/box-content-preview/pull/189) ([pramodsum](https://github.com/pramodsum)) -- Chore: Scrubber/Media fixes for mobile [\#185](https://github.com/box/box-content-preview/pull/185) ([jeremypress](https://github.com/jeremypress)) +* Release: 1.2.0 ([11b1802](https://github.com/box/box-content-preview/commit/11b1802)) +* Fix: Allow legacy annotations to render in PDF.js (#238) ([ed3b5cb](https://github.com/box/box-content-preview/commit/ed3b5cb)) +* Fix: Ensuring annotation scale is set on files without any annotations (#234) ([aa93d09](https://github.com/box/box-content-preview/commit/aa93d09)) +* Fix: Give preview some min width and height (#237) ([20f6056](https://github.com/box/box-content-preview/commit/20f6056)) +* Fix: Increase controls timeout and fix controls behavior for mobile VR (#235) ([1df8b55](https://github.com/box/box-content-preview/commit/1df8b55)), closes [#235](https://github.com/box/box-content-preview/issues/235) +* Fix: Update box3d to fix camera reload bug (#245) ([1e1495f](https://github.com/box/box-content-preview/commit/1e1495f)), closes [#245](https://github.com/box/box-content-preview/issues/245) +* Chore: Update translations (#240) ([cf1a799](https://github.com/box/box-content-preview/commit/cf1a799)) +* New: added support for compressed (DDS) textures to 3D preview (#244) ([4b5e203](https://github.com/box/box-content-preview/commit/4b5e203)) +* Feature: DrawingAnnotations starting code (#224) ([3960927](https://github.com/box/box-content-preview/commit/3960927)) +* Docs: Adding section of using Preview as a component (#236) ([3c3eb06](https://github.com/box/box-content-preview/commit/3c3eb06)) -## [v0.130.0](https://github.com/box/box-content-preview/tree/v0.130.0) (2017-06-28) -[Full Changelog](https://github.com/box/box-content-preview/compare/v0.129.2...v0.130.0) - -**Merged pull requests:** - -- Fix: Fix hiding on Android Chrome [\#190](https://github.com/box/box-content-preview/pull/190) ([jeremypress](https://github.com/jeremypress)) -- Chore: Add Webpack bundle visualizer [\#188](https://github.com/box/box-content-preview/pull/188) ([tonyjin](https://github.com/tonyjin)) -- Fix: Fix focus for new page number input [\#187](https://github.com/box/box-content-preview/pull/187) ([jeremypress](https://github.com/jeremypress)) -- Fix: Fixes issues with adding annotations on tablets [\#186](https://github.com/box/box-content-preview/pull/186) ([pramodsum](https://github.com/pramodsum)) -- Create highlight dialog [\#184](https://github.com/box/box-content-preview/pull/184) ([JustinHoldstock](https://github.com/JustinHoldstock)) -- Fix: Buttons fail to display when adding a comment to plain highlight [\#183](https://github.com/box/box-content-preview/pull/183) ([pramodsum](https://github.com/pramodsum)) -- Update: Remove 0.25x playback on media files [\#182](https://github.com/box/box-content-preview/pull/182) ([MinhHNguyen](https://github.com/MinhHNguyen)) -- Update: Readme with new badges [\#180](https://github.com/box/box-content-preview/pull/180) ([priyajeet](https://github.com/priyajeet)) -- Chore: Make page number input more visible [\#179](https://github.com/box/box-content-preview/pull/179) ([jeremypress](https://github.com/jeremypress)) -- Fix: Sets the pdf scale after page render rather than on resize [\#178](https://github.com/box/box-content-preview/pull/178) ([pramodsum](https://github.com/pramodsum)) -- New: Allowing users to add new mobile point annotations [\#177](https://github.com/box/box-content-preview/pull/177) ([pramodsum](https://github.com/pramodsum)) -- Chore: Refactor controls for mobile [\#174](https://github.com/box/box-content-preview/pull/174) ([jeremypress](https://github.com/jeremypress)) - -## [v0.129.2](https://github.com/box/box-content-preview/tree/v0.129.2) (2017-06-20) -[Full Changelog](https://github.com/box/box-content-preview/compare/v0.129.1...v0.129.2) - -**Merged pull requests:** - -- Chore: Update ESLint rules and VSCode settings [\#176](https://github.com/box/box-content-preview/pull/176) ([tonyjin](https://github.com/tonyjin)) -- Chore: Tweak fade-in timing of file loading animation [\#175](https://github.com/box/box-content-preview/pull/175) ([jeremypress](https://github.com/jeremypress)) -- Fix: Fix shared links previewed in other subdomains [\#173](https://github.com/box/box-content-preview/pull/173) ([jeremypress](https://github.com/jeremypress)) - -## [v0.129.1](https://github.com/box/box-content-preview/tree/v0.129.1) (2017-06-16) -[Full Changelog](https://github.com/box/box-content-preview/compare/v0.129.0...v0.129.1) - -**Merged pull requests:** - -- Fix: Box3D bug prevented loading video texture from video tag [\#172](https://github.com/box/box-content-preview/pull/172) ([MiiBond](https://github.com/MiiBond)) - -## [v0.129.0](https://github.com/box/box-content-preview/tree/v0.129.0) (2017-06-14) -[Full Changelog](https://github.com/box/box-content-preview/compare/v0.128.0...v0.129.0) - -**Merged pull requests:** - -- Revert "Chore: Refactoring Controls for mobile" [\#171](https://github.com/box/box-content-preview/pull/171) ([jeremypress](https://github.com/jeremypress)) -- New: File specific loading icons [\#170](https://github.com/box/box-content-preview/pull/170) ([jeremypress](https://github.com/jeremypress)) -- Fix: Fix removeEventListener in MediaBaseViewer [\#169](https://github.com/box/box-content-preview/pull/169) ([bhh1988](https://github.com/bhh1988)) -- Fix: Catch loss of WebGL context in Box3D and reload preview [\#168](https://github.com/box/box-content-preview/pull/168) ([MiiBond](https://github.com/MiiBond)) -- Update Translations [\#167](https://github.com/box/box-content-preview/pull/167) ([boxmoji](https://github.com/boxmoji)) -- Chore: Refactoring Controls for mobile [\#159](https://github.com/box/box-content-preview/pull/159) ([jeremypress](https://github.com/jeremypress)) - -## [v0.128.0](https://github.com/box/box-content-preview/tree/v0.128.0) (2017-06-06) -[Full Changelog](https://github.com/box/box-content-preview/compare/v0.127.0...v0.128.0) - -**Merged pull requests:** - -- Update: Change Preview loading message [\#166](https://github.com/box/box-content-preview/pull/166) ([tonyjin](https://github.com/tonyjin)) -- Update: Add support for 'ly' Lilypond musical annotation files [\#165](https://github.com/box/box-content-preview/pull/165) ([tonyjin](https://github.com/tonyjin)) -- Upgrade: Upgrade Shaka-player to fix infinite 401 issue [\#164](https://github.com/box/box-content-preview/pull/164) ([bhh1988](https://github.com/bhh1988)) -- Update: Displaying file type unsupported error [\#163](https://github.com/box/box-content-preview/pull/163) ([jeremypress](https://github.com/jeremypress)) -- Chore: refactored and renamed getPageElAndPageNumber [\#162](https://github.com/box/box-content-preview/pull/162) ([JustinHoldstock](https://github.com/JustinHoldstock)) -- Animate annotation dialog [\#161](https://github.com/box/box-content-preview/pull/161) ([JustinHoldstock](https://github.com/JustinHoldstock)) -- Update Translations [\#160](https://github.com/box/box-content-preview/pull/160) ([boxmoji](https://github.com/boxmoji)) -- Docs: Use ISO date format for LICENSE [\#158](https://github.com/box/box-content-preview/pull/158) ([tonyjin](https://github.com/tonyjin)) -- Chore: Optimizations for highlightMousemoveEvent [\#121](https://github.com/box/box-content-preview/pull/121) ([JustinHoldstock](https://github.com/JustinHoldstock)) - -## [v0.127.0](https://github.com/box/box-content-preview/tree/v0.127.0) (2017-05-30) -[Full Changelog](https://github.com/box/box-content-preview/compare/v0.126.1...v0.127.0) - -**Merged pull requests:** - -- Chore: Re-enabling controls for mobile viewers [\#157](https://github.com/box/box-content-preview/pull/157) ([pramodsum](https://github.com/pramodsum)) -- Fix: Image scaling/rotation is broken when an image has annotations [\#156](https://github.com/box/box-content-preview/pull/156) ([JustinHoldstock](https://github.com/JustinHoldstock)) -- Chore: Use whatwg-fetch instead of isomorphic-fetch [\#155](https://github.com/box/box-content-preview/pull/155) ([tonyjin](https://github.com/tonyjin)) -- Update Translations [\#154](https://github.com/box/box-content-preview/pull/154) ([boxmoji](https://github.com/boxmoji)) -- Fix: Error content jumps on error if download button is absent [\#152](https://github.com/box/box-content-preview/pull/152) ([jeremypress](https://github.com/jeremypress)) -- Fix: Ensure point annotation mode button is hidden on rotated images [\#151](https://github.com/box/box-content-preview/pull/151) ([pramodsum](https://github.com/pramodsum)) -- Fix: Disables annotations after 'load' event on shared links [\#150](https://github.com/box/box-content-preview/pull/150) ([pramodsum](https://github.com/pramodsum)) -- New: Initial mobile optimization of annotation dialogs [\#146](https://github.com/box/box-content-preview/pull/146) ([pramodsum](https://github.com/pramodsum)) -- Fix: Support disabling DASH player in DASH-compatible browser [\#140](https://github.com/box/box-content-preview/pull/140) ([tonyjin](https://github.com/tonyjin)) - -## [v0.126.1](https://github.com/box/box-content-preview/tree/v0.126.1) (2017-05-26) -[Full Changelog](https://github.com/box/box-content-preview/compare/v0.126.0...v0.126.1) - -**Merged pull requests:** - -- Fix: Fixing vanity urls for excel online on IE11 [\#153](https://github.com/box/box-content-preview/pull/153) ([jeremypress](https://github.com/jeremypress)) -- Update: Make media viewer settings menu larger so scrollbars don't show [\#149](https://github.com/box/box-content-preview/pull/149) ([bhh1988](https://github.com/bhh1988)) -- Fix: Reinforcing release script [\#148](https://github.com/box/box-content-preview/pull/148) ([jeremypress](https://github.com/jeremypress)) -- Chore: Fix changelog [\#144](https://github.com/box/box-content-preview/pull/144) ([tonyjin](https://github.com/tonyjin)) -- Chore: Format everything with prettier [\#143](https://github.com/box/box-content-preview/pull/143) ([tonyjin](https://github.com/tonyjin)) -- 692 add toggle for box3d grid [\#138](https://github.com/box/box-content-preview/pull/138) ([MiiBond](https://github.com/MiiBond)) - -## [v0.126.0](https://github.com/box/box-content-preview/tree/v0.126.0) (2017-05-24) -[Full Changelog](https://github.com/box/box-content-preview/compare/v0.125.0...v0.126.0) - -**Merged pull requests:** - -- Update Translations [\#142](https://github.com/box/box-content-preview/pull/142) ([boxmoji](https://github.com/boxmoji)) - -## [v0.125.0](https://github.com/box/box-content-preview/tree/v0.125.0) (2017-05-24) -[Full Changelog](https://github.com/box/box-content-preview/compare/v0.124.0...v0.125.0) - -**Merged pull requests:** - -- Build: Update build script to tag release commits [\#141](https://github.com/box/box-content-preview/pull/141) ([tonyjin](https://github.com/tonyjin)) -- Chore: Update prettier line width to 80 [\#139](https://github.com/box/box-content-preview/pull/139) ([tonyjin](https://github.com/tonyjin)) -- Update: Show rate limit specific error message when a 429 occurs [\#137](https://github.com/box/box-content-preview/pull/137) ([jeremypress](https://github.com/jeremypress)) -- Update: Update Box3D with new material default [\#136](https://github.com/box/box-content-preview/pull/136) ([MiiBond](https://github.com/MiiBond)) -- Chore: Update license formatting [\#135](https://github.com/box/box-content-preview/pull/135) ([tonyjin](https://github.com/tonyjin)) -- Settings properties [\#134](https://github.com/box/box-content-preview/pull/134) ([bhh1988](https://github.com/bhh1988)) -- Chore: Add prettier code formatter [\#133](https://github.com/box/box-content-preview/pull/133) ([tonyjin](https://github.com/tonyjin)) -- Update Translations [\#132](https://github.com/box/box-content-preview/pull/132) ([boxmoji](https://github.com/boxmoji)) -- Fix: Seek time doesn't match filmstrip timecode [\#131](https://github.com/box/box-content-preview/pull/131) ([bhh1988](https://github.com/bhh1988)) -- Update: Adding more languages for subtitles [\#130](https://github.com/box/box-content-preview/pull/130) ([bhh1988](https://github.com/bhh1988)) -- Update: Improve subtitle selection algorithm [\#129](https://github.com/box/box-content-preview/pull/129) ([bhh1988](https://github.com/bhh1988)) -- Update: Some UI changes for video player [\#128](https://github.com/box/box-content-preview/pull/128) ([bhh1988](https://github.com/bhh1988)) -- Chore: Deleting old third-party packages [\#127](https://github.com/box/box-content-preview/pull/127) ([tonyjin](https://github.com/tonyjin)) -- Fix: fix excel setup when enabling the Office viewer via options [\#126](https://github.com/box/box-content-preview/pull/126) ([jeremypress](https://github.com/jeremypress)) -- Update Contributing.md [\#125](https://github.com/box/box-content-preview/pull/125) ([varunmaker](https://github.com/varunmaker)) -- Docs: Update license to Box Software License Agreement [\#124](https://github.com/box/box-content-preview/pull/124) ([tonyjin](https://github.com/tonyjin)) -- Update Translations [\#123](https://github.com/box/box-content-preview/pull/123) ([boxmoji](https://github.com/boxmoji)) - -## [v0.124.0](https://github.com/box/box-content-preview/tree/v0.124.0) (2017-05-17) -[Full Changelog](https://github.com/box/box-content-preview/compare/v0.123.0...v0.124.0) - -## [v0.123.0](https://github.com/box/box-content-preview/tree/v0.123.0) (2017-05-17) -[Full Changelog](https://github.com/box/box-content-preview/compare/v0.122.0...v0.123.0) - -**Merged pull requests:** - -- Language codes [\#122](https://github.com/box/box-content-preview/pull/122) ([bhh1988](https://github.com/bhh1988)) -- Chore: Remove unnecessary mobile check [\#120](https://github.com/box/box-content-preview/pull/120) ([tonyjin](https://github.com/tonyjin)) -- Docs: Remove unneeded file types from image360 docs [\#119](https://github.com/box/box-content-preview/pull/119) ([MiiBond](https://github.com/MiiBond)) -- Fix: Older versions of webkit iOS incorrectly cache range requests [\#118](https://github.com/box/box-content-preview/pull/118) ([tonyjin](https://github.com/tonyjin)) -- Subtitles [\#117](https://github.com/box/box-content-preview/pull/117) ([bhh1988](https://github.com/bhh1988)) -- Fix: Set media viewers' settings menu dimensions with javascript [\#116](https://github.com/box/box-content-preview/pull/116) ([bhh1988](https://github.com/bhh1988)) -- Chore: Document viewer tweaks [\#114](https://github.com/box/box-content-preview/pull/114) ([tonyjin](https://github.com/tonyjin)) -- Update Translations [\#113](https://github.com/box/box-content-preview/pull/113) ([boxmoji](https://github.com/boxmoji)) -- Chore: Moving common annotation methods into Base classes [\#111](https://github.com/box/box-content-preview/pull/111) ([pramodsum](https://github.com/pramodsum)) -- Upgrade: Upgrade Shaka-player to 2.1.1 [\#110](https://github.com/box/box-content-preview/pull/110) ([bhh1988](https://github.com/bhh1988)) -- Multi image annotator [\#109](https://github.com/box/box-content-preview/pull/109) ([JustinHoldstock](https://github.com/JustinHoldstock)) -- Fix: Issue when 'load' event is fired before BoxAnnotations is loaded [\#108](https://github.com/box/box-content-preview/pull/108) ([pramodsum](https://github.com/pramodsum)) -- Chore: Bundling annotations.css separately from preview.css [\#106](https://github.com/box/box-content-preview/pull/106) ([pramodsum](https://github.com/pramodsum)) -- Fix: Don't rely on preview's script tag being present after execution [\#105](https://github.com/box/box-content-preview/pull/105) ([priyajeet](https://github.com/priyajeet)) -- New: platform excel online fork [\#101](https://github.com/box/box-content-preview/pull/101) ([jeremypress](https://github.com/jeremypress)) - -## [v0.122.0](https://github.com/box/box-content-preview/tree/v0.122.0) (2017-05-09) -[Full Changelog](https://github.com/box/box-content-preview/compare/v0.121.1...v0.122.0) - -**Merged pull requests:** - -- Update Translations [\#107](https://github.com/box/box-content-preview/pull/107) ([boxmoji](https://github.com/boxmoji)) -- Chore: Remove font-smoothing and update progress bar color [\#104](https://github.com/box/box-content-preview/pull/104) ([tonyjin](https://github.com/tonyjin)) -- Cleaning up DocBaseViewer [\#103](https://github.com/box/box-content-preview/pull/103) ([jeremypress](https://github.com/jeremypress)) -- Chore: Allow console logging to show in tests [\#100](https://github.com/box/box-content-preview/pull/100) ([bhh1988](https://github.com/bhh1988)) -- Update: Re-enable font loading API support check [\#99](https://github.com/box/box-content-preview/pull/99) ([tonyjin](https://github.com/tonyjin)) -- Fix: Make all svgs not focusable [\#98](https://github.com/box/box-content-preview/pull/98) ([bhh1988](https://github.com/bhh1988)) -- Update: Make media player web-accessible according WCAG2.0 spec [\#97](https://github.com/box/box-content-preview/pull/97) ([bhh1988](https://github.com/bhh1988)) -- Fix: Add Annotations bundling changes back [\#95](https://github.com/box/box-content-preview/pull/95) ([pramodsum](https://github.com/pramodsum)) -- Chore: Remove unused 'parent' field from Box File object [\#91](https://github.com/box/box-content-preview/pull/91) ([tonyjin](https://github.com/tonyjin)) - -## [v0.121.1](https://github.com/box/box-content-preview/tree/v0.121.1) (2017-04-29) -[Full Changelog](https://github.com/box/box-content-preview/compare/v0.121.0...v0.121.1) - -**Merged pull requests:** - -- Revert annotations bundling [\#94](https://github.com/box/box-content-preview/pull/94) ([tonyjin](https://github.com/tonyjin)) - -## [v0.121.0](https://github.com/box/box-content-preview/tree/v0.121.0) (2017-04-25) -[Full Changelog](https://github.com/box/box-content-preview/compare/v0.120.1...v0.121.0) - -**Merged pull requests:** - -- Chore: Add console logging to better debug hanging preview [\#93](https://github.com/box/box-content-preview/pull/93) ([tonyjin](https://github.com/tonyjin)) -- Fix: Don't load preload if the rep has an error [\#92](https://github.com/box/box-content-preview/pull/92) ([tonyjin](https://github.com/tonyjin)) -- Fix: Ensuring annotations are loaded when viewer has permissions [\#90](https://github.com/box/box-content-preview/pull/90) ([pramodsum](https://github.com/pramodsum)) -- Update: Document viewer optimizations [\#89](https://github.com/box/box-content-preview/pull/89) ([tonyjin](https://github.com/tonyjin)) -- Chore: Do not load annotations on shared links [\#88](https://github.com/box/box-content-preview/pull/88) ([pramodsum](https://github.com/pramodsum)) -- Chore: User agent refactor and Browser tests [\#87](https://github.com/box/box-content-preview/pull/87) ([JustinHoldstock](https://github.com/JustinHoldstock)) -- Upgrade: Shaka Player 2.0.8 [\#85](https://github.com/box/box-content-preview/pull/85) ([tonyjin](https://github.com/tonyjin)) -- Chore: Removed underscored variables and getters from all annotation files [\#83](https://github.com/box/box-content-preview/pull/83) ([pramodsum](https://github.com/pramodsum)) -- Chore: Bundling Annotators separately in annotations.js [\#75](https://github.com/box/box-content-preview/pull/75) ([pramodsum](https://github.com/pramodsum)) - -## [v0.120.1](https://github.com/box/box-content-preview/tree/v0.120.1) (2017-04-19) -[Full Changelog](https://github.com/box/box-content-preview/compare/v0.120.0...v0.120.1) - -**Merged pull requests:** - -- Update: Tweak pdf.js range requests for improved performance [\#84](https://github.com/box/box-content-preview/pull/84) ([tonyjin](https://github.com/tonyjin)) - -## [v0.120.0](https://github.com/box/box-content-preview/tree/v0.120.0) (2017-04-18) -[Full Changelog](https://github.com/box/box-content-preview/compare/v0.119.1...v0.120.0) - -**Merged pull requests:** - -- Fix: Prevent WebGL error when prefetching Preview.js [\#82](https://github.com/box/box-content-preview/pull/82) ([jeremypress](https://github.com/jeremypress)) -- Chore: Mock super.setup\(\) in all Viewer unit tests [\#81](https://github.com/box/box-content-preview/pull/81) ([pramodsum](https://github.com/pramodsum)) -- Update: Add client information to performance logging [\#80](https://github.com/box/box-content-preview/pull/80) ([tonyjin](https://github.com/tonyjin)) -- Update: Changing analytics client name to 'box-content-preview' [\#79](https://github.com/box/box-content-preview/pull/79) ([tonyjin](https://github.com/tonyjin)) -- Chore: Rename test-html files and update fixture loading [\#78](https://github.com/box/box-content-preview/pull/78) ([JustinHoldstock](https://github.com/JustinHoldstock)) -- Chore: Triggering point annotation mode by emitting a message [\#77](https://github.com/box/box-content-preview/pull/77) ([pramodsum](https://github.com/pramodsum)) -- Chore: Updating annotations icons to the new Box blue [\#76](https://github.com/box/box-content-preview/pull/76) ([pramodsum](https://github.com/pramodsum)) -- Fix: Only bind custom listeners when annotation threads exist [\#74](https://github.com/box/box-content-preview/pull/74) ([pramodsum](https://github.com/pramodsum)) -- Fix: Handle text representation error [\#72](https://github.com/box/box-content-preview/pull/72) ([tonyjin](https://github.com/tonyjin)) -- Update: Add disableTextLayer option for doc and text viewers [\#71](https://github.com/box/box-content-preview/pull/71) ([tonyjin](https://github.com/tonyjin)) -- Update Translations [\#70](https://github.com/box/box-content-preview/pull/70) ([boxmoji](https://github.com/boxmoji)) -- Update: Disabling font loading API for pdf.js to prevent glitches [\#68](https://github.com/box/box-content-preview/pull/68) ([tonyjin](https://github.com/tonyjin)) - -## [v0.119.1](https://github.com/box/box-content-preview/tree/v0.119.1) (2017-04-12) -[Full Changelog](https://github.com/box/box-content-preview/compare/v0.119.0...v0.119.1) - -**Merged pull requests:** - -- Fix: adding patch to options check in release script [\#69](https://github.com/box/box-content-preview/pull/69) ([jeremypress](https://github.com/jeremypress)) -- Fix: updating metadata from repStatus [\#60](https://github.com/box/box-content-preview/pull/60) ([jeremypress](https://github.com/jeremypress)) - -## [v0.119.0](https://github.com/box/box-content-preview/tree/v0.119.0) (2017-04-11) -[Full Changelog](https://github.com/box/box-content-preview/compare/v0.118.0...v0.119.0) - -**Merged pull requests:** - -- Disable font faces on safari 10\_3 [\#67](https://github.com/box/box-content-preview/pull/67) ([JustinHoldstock](https://github.com/JustinHoldstock)) -- Update: Decrease mobile web max pdf.js canvas size to 3MP [\#66](https://github.com/box/box-content-preview/pull/66) ([tonyjin](https://github.com/tonyjin)) -- Chore: Removing unneeded compatibility.js from pdf.js [\#65](https://github.com/box/box-content-preview/pull/65) ([tonyjin](https://github.com/tonyjin)) -- Update: Increase default doc chunk size to 384KB [\#64](https://github.com/box/box-content-preview/pull/64) ([tonyjin](https://github.com/tonyjin)) -- Update: Upgrade pdf.js to v1.8.175 [\#63](https://github.com/box/box-content-preview/pull/63) ([tonyjin](https://github.com/tonyjin)) -- Fix: Hiding download button in all cases if browser cannot download [\#61](https://github.com/box/box-content-preview/pull/61) ([jeremypress](https://github.com/jeremypress)) -- Chore: Update changelog generator to ignore old pull requests [\#59](https://github.com/box/box-content-preview/pull/59) ([tonyjin](https://github.com/tonyjin)) - -## [v0.118.0](https://github.com/box/box-content-preview/tree/v0.118.0) (2017-04-06) -[Full Changelog](https://github.com/box/box-content-preview/compare/v0.117.0...v0.118.0) - -**Merged pull requests:** - -- Update: New Box-branding for Oculus Touch models [\#58](https://github.com/box/box-content-preview/pull/58) ([MiiBond](https://github.com/MiiBond)) -- Chore: Updating README describing .conventional-changelog-lintrc [\#57](https://github.com/box/box-content-preview/pull/57) ([tonyjin](https://github.com/tonyjin)) - -# Historical Change Log - -## [v0.117.0](https://github.com/box/box-content-preview/tree/v0.117.0) (2017-04-06) -[Full Changelog](https://github.com/box/box-content-preview/compare/v0.116.0...v0.117.0) - -**Merged pull requests:** -- Chore: Fixing changelog generator again [\#56](https://github.com/box/box-content-preview/pull/56) ([tonyjin](https://github.com/tonyjin)) -## [v0.116.0](https://github.com/box/box-content-preview/tree/v0.116.0) (2017-04-06) -[Full Changelog](https://github.com/box/box-content-preview/compare/v0.115.0...v0.116.0) + +## 1.1.1 (2017-07-20) -**Merged pull requests:** - -- Chore: Updating changelog generator [\#55](https://github.com/box/box-content-preview/pull/55) ([tonyjin](https://github.com/tonyjin)) -- Fix: 3D Error messages [\#54](https://github.com/box/box-content-preview/pull/54) ([jeremypress](https://github.com/jeremypress)) -- Chore: Removing rotateLeft method from DocBaseViewer [\#52](https://github.com/box/box-content-preview/pull/52) ([pramodsum](https://github.com/pramodsum)) -- Chore: Switching changelog generation to conventional-changelog [\#51](https://github.com/box/box-content-preview/pull/51) ([jeremypress](https://github.com/jeremypress)) -- Update Translations [\#50](https://github.com/box/box-content-preview/pull/50) ([boxmoji](https://github.com/boxmoji)) -- Fix: COXP-3500 Reset camera issue in Box3D [\#47](https://github.com/box/box-content-preview/pull/47) ([MiiBond](https://github.com/MiiBond)) -- Fix: Don't display find bar when the text-layer/downloads are disabled [\#41](https://github.com/box/box-content-preview/pull/41) ([pramodsum](https://github.com/pramodsum)) -- Chore: Rename viewers [\#29](https://github.com/box/box-content-preview/pull/29) ([JustinHoldstock](https://github.com/JustinHoldstock)) +* Release: 1.1.1 ([9487634](https://github.com/box/box-content-preview/commit/9487634)) +* Fix: Don't swallow touch start event to prevent iOS inertia scrolling (#233) ([d628c14](https://github.com/box/box-content-preview/commit/d628c14)) +* Fix: Prevent MP3 from hiding (#230) ([2a236fe](https://github.com/box/box-content-preview/commit/2a236fe)) -## [v0.115.0](https://github.com/box/box-content-preview/tree/v0.115.0) (2017-04-05) -[Full Changelog](https://github.com/box/box-content-preview/compare/v0.114.0...v0.115.0) -**Merged pull requests:** -- Chore: Add support for build/rsync.json for local development [\#49](https://github.com/box/box-content-preview/pull/49) ([tonyjin](https://github.com/tonyjin)) -- Update: Don't time out during conversion [\#46](https://github.com/box/box-content-preview/pull/46) ([tonyjin](https://github.com/tonyjin)) -- Chore: Minify third party CSS with cssnano [\#45](https://github.com/box/box-content-preview/pull/45) ([tonyjin](https://github.com/tonyjin)) -- Chore: Upgrading PDF.js to 1.7.401 [\#44](https://github.com/box/box-content-preview/pull/44) ([jeremypress](https://github.com/jeremypress)) -- Build: Updating upgrade\_pdfjs script [\#43](https://github.com/box/box-content-preview/pull/43) ([jeremypress](https://github.com/jeremypress)) -- Update Translations [\#40](https://github.com/box/box-content-preview/pull/40) ([boxmoji](https://github.com/boxmoji)) -- Chore: Fixing link in README [\#38](https://github.com/box/box-content-preview/pull/38) ([pramodsum](https://github.com/pramodsum)) -- Build: Adding commit linting [\#37](https://github.com/box/box-content-preview/pull/37) ([jeremypress](https://github.com/jeremypress)) -- Fix: replacing .keynote extension with .key [\#36](https://github.com/box/box-content-preview/pull/36) ([jeremypress](https://github.com/jeremypress)) -- Chore: isMobile refactor [\#35](https://github.com/box/box-content-preview/pull/35) ([jeremypress](https://github.com/jeremypress)) -- Chore: Adding browser canDownload check [\#34](https://github.com/box/box-content-preview/pull/34) ([jeremypress](https://github.com/jeremypress)) -- Chore: Refactor filmstripShowHandler for testability [\#33](https://github.com/box/box-content-preview/pull/33) ([bhh1988](https://github.com/bhh1988)) -- Chore: Continuing to fix release script [\#32](https://github.com/box/box-content-preview/pull/32) ([tonyjin](https://github.com/tonyjin)) -- Fix: Validating annotation thread params [\#17](https://github.com/box/box-content-preview/pull/17) ([pramodsum](https://github.com/pramodsum)) -- Update: Updating box ui colors [\#14](https://github.com/box/box-content-preview/pull/14) ([priyajeet](https://github.com/priyajeet)) + +# 1.1.0 (2017-07-18) -## [v0.114.0](https://github.com/box/box-content-preview/tree/v0.114.0) (2017-03-29) -[Full Changelog](https://github.com/box/box-content-preview/compare/v0.113.0...v0.114.0) +* Release: 1.1.0 ([a8e1216](https://github.com/box/box-content-preview/commit/a8e1216)) +* Docs: Add issue reporting template (#228) ([135e717](https://github.com/box/box-content-preview/commit/135e717)) +* Docs: More README updates ([00821c4](https://github.com/box/box-content-preview/commit/00821c4)) +* Docs: Update document viewer event name ([eae3c74](https://github.com/box/box-content-preview/commit/eae3c74)) +* Docs: Update project status badge (#212) ([f50be16](https://github.com/box/box-content-preview/commit/f50be16)) +* Docs: Update shield for UI Elements ([271cbbb](https://github.com/box/box-content-preview/commit/271cbbb)) +* Docs: Update support section in README ([94c17d4](https://github.com/box/box-content-preview/commit/94c17d4)) +* Fix: Limit iOS font fix to 10.3.1 (#225) ([b17054a](https://github.com/box/box-content-preview/commit/b17054a)), closes [#225](https://github.com/box/box-content-preview/issues/225) +* Fix: Media controls and usability fixes for mobile (#217) ([38ecce7](https://github.com/box/box-content-preview/commit/38ecce7)), closes [#217](https://github.com/box/box-content-preview/issues/217) +* Fix: Prevent double tap zoom in control bar (#227) ([14996a0](https://github.com/box/box-content-preview/commit/14996a0)) +* Fix: Restore crawler for buffering video (#218) ([800692d](https://github.com/box/box-content-preview/commit/800692d)) +* New: Add ts and flv formats to MediaLoader.js (#226) ([be35a75](https://github.com/box/box-content-preview/commit/be35a75)) +* Update: Render Vera-protected HTML files (#220) ([78423ac](https://github.com/box/box-content-preview/commit/78423ac)) +* Chore: Cleaning up annotation strings/classes (#215) ([0cfcaf7](https://github.com/box/box-content-preview/commit/0cfcaf7)) +* Chore: Fix webpack errors and upgrade some packages (#221) ([c309da1](https://github.com/box/box-content-preview/commit/c309da1)), closes [#221](https://github.com/box/box-content-preview/issues/221) +* Chore: Full pass of prettier formatting (#223) ([814aa75](https://github.com/box/box-content-preview/commit/814aa75)) +* Chore: Update .travis.yml to only build master (#214) ([f10b14c](https://github.com/box/box-content-preview/commit/f10b14c)) +* Chore: Update Travis config (#219) ([a6fe4b6](https://github.com/box/box-content-preview/commit/a6fe4b6)) +* Fix settings pullup for model3D files on mobile (#222) ([f285ba8](https://github.com/box/box-content-preview/commit/f285ba8)), closes [#222](https://github.com/box/box-content-preview/issues/222) -**Merged pull requests:** -- Chore: Update release script [\#31](https://github.com/box/box-content-preview/pull/31) ([tonyjin](https://github.com/tonyjin)) -## [v0.113.0](https://github.com/box/box-content-preview/tree/v0.113.0) (2017-03-28) -[Full Changelog](https://github.com/box/box-content-preview/compare/v0.112.0...v0.113.0) - -**Merged pull requests:** - -- Chore: Separate tagging from build [\#30](https://github.com/box/box-content-preview/pull/30) ([tonyjin](https://github.com/tonyjin)) -- Fix: Bug fixes for expiring embed Preview [\#28](https://github.com/box/box-content-preview/pull/28) ([tonyjin](https://github.com/tonyjin)) -- New: adding error messages for iWork files [\#27](https://github.com/box/box-content-preview/pull/27) ([jeremypress](https://github.com/jeremypress)) -- Fix: Don't show error download btn if option is not set [\#25](https://github.com/box/box-content-preview/pull/25) ([tonyjin](https://github.com/tonyjin)) -- Chore: Preview.js cleanup and slight refactor [\#24](https://github.com/box/box-content-preview/pull/24) ([tonyjin](https://github.com/tonyjin)) -- Filmstrip interval should be determined from rep metadata field [\#23](https://github.com/box/box-content-preview/pull/23) ([bhh1988](https://github.com/bhh1988)) -- Breaking: Support {+asset\_path} to follow RFC6570 [\#22](https://github.com/box/box-content-preview/pull/22) ([tonyjin](https://github.com/tonyjin)) -- Fix: Guard against unsupported lose\_context extension on IE11 and Edge [\#21](https://github.com/box/box-content-preview/pull/21) ([MiiBond](https://github.com/MiiBond)) -- New: centering image prints [\#18](https://github.com/box/box-content-preview/pull/18) ([jeremypress](https://github.com/jeremypress)) -- Chore: Remove dist folder from repo [\#16](https://github.com/box/box-content-preview/pull/16) ([tonyjin](https://github.com/tonyjin)) -- Chore: Separately version third-party assets [\#15](https://github.com/box/box-content-preview/pull/15) ([tonyjin](https://github.com/tonyjin)) -- New: Enable activation/deactivation of VR when headset put on/off [\#13](https://github.com/box/box-content-preview/pull/13) ([MiiBond](https://github.com/MiiBond)) -- New: Preload for presentation viewer [\#12](https://github.com/box/box-content-preview/pull/12) ([tonyjin](https://github.com/tonyjin)) -- Release: 0.112.0 [\#11](https://github.com/box/box-content-preview/pull/11) ([tonyjin](https://github.com/tonyjin)) -- Update: Added Box branding to Vive controllers. [\#10](https://github.com/box/box-content-preview/pull/10) ([MiiBond](https://github.com/MiiBond)) -- Breaking: Switching to Preview class instead of Preview singleton [\#7](https://github.com/box/box-content-preview/pull/7) ([priyajeet](https://github.com/priyajeet)) + +# 1.0.0 (2017-07-12) + +* Release: 1.0.0 ([b599cd2](https://github.com/box/box-content-preview/commit/b599cd2)) + + + + +## 0.131.2 (2017-07-11) + +* Release: 0.131.2 ([1021c8e](https://github.com/box/box-content-preview/commit/1021c8e)) +* Fix: Ensure that annotation scale is never being set to auto (#208) ([9899f94](https://github.com/box/box-content-preview/commit/9899f94)) +* Fix: Search preview container for mobile annotations dialog (#209) ([56e026a](https://github.com/box/box-content-preview/commit/56e026a)) + + + + +## 0.131.1 (2017-07-11) + +* Release: 0.131.1 ([6eeb432](https://github.com/box/box-content-preview/commit/6eeb432)) +* Fix: Properly scope typography CSS (#207) ([816ed15](https://github.com/box/box-content-preview/commit/816ed15)) +* Chore: Cleaning up annotations code comments (#206) ([9e042c1](https://github.com/box/box-content-preview/commit/9e042c1)) + + + + +# 0.131.0 (2017-07-07) + +* Release: 0.131.0 ([5b8539f](https://github.com/box/box-content-preview/commit/5b8539f)) +* Chore: Fix ESLint warnings (JSDoc cleanup) (#199) ([d4303aa](https://github.com/box/box-content-preview/commit/d4303aa)), closes [#199](https://github.com/box/box-content-preview/issues/199) +* Chore: Page num input uses numeric keyboard on mobile devices (#200) ([6acf8fa](https://github.com/box/box-content-preview/commit/6acf8fa)) +* Chore: Preview Cleanup (#202) ([18e5969](https://github.com/box/box-content-preview/commit/18e5969)) +* Chore: Preview UI as instance (#204) ([5d06fb3](https://github.com/box/box-content-preview/commit/5d06fb3)) +* Chore: Remove padding for CSV files (#194) ([762896e](https://github.com/box/box-content-preview/commit/762896e)) +* Chore: Removing unused 'active' & 'active-hover' states for annotations (#189) ([3c46e05](https://github.com/box/box-content-preview/commit/3c46e05)) +* Chore: Scrubber/Media fixes for mobile (#185) ([884799c](https://github.com/box/box-content-preview/commit/884799c)), closes [#185](https://github.com/box/box-content-preview/issues/185) +* Chore: Update README to include token scope information (#203) ([a26d600](https://github.com/box/box-content-preview/commit/a26d600)) +* Chore: Update to new 'Elements' branding (#193) ([4995798](https://github.com/box/box-content-preview/commit/4995798)) +* Cleanup for 1.0 for 3D (#205) ([78c11f2](https://github.com/box/box-content-preview/commit/78c11f2)) +* Fix/notification message timeout (#201) ([5d42af4](https://github.com/box/box-content-preview/commit/5d42af4)) +* Fix: Allow panning on mobile while zooming into ppt files (#192) ([68091e3](https://github.com/box/box-content-preview/commit/68091e3)) +* Fix: Ensures highlight buttons are hidden on mobile devices (#196) ([ef8db6e](https://github.com/box/box-content-preview/commit/ef8db6e)) +* Fix: Tree shaking bug workaround for csv bundle (#191) ([edd11e4](https://github.com/box/box-content-preview/commit/edd11e4)) +* Update: pdf.js 1.8.514 (#197) ([bf10569](https://github.com/box/box-content-preview/commit/bf10569)) +* Docs: Update contributing.md (#195) ([08eb9e9](https://github.com/box/box-content-preview/commit/08eb9e9)) + + + + +# 0.130.0 (2017-06-28) + +* Release: 0.130.0 ([53527c0](https://github.com/box/box-content-preview/commit/53527c0)) +* Fix: Buttons fail to display when adding a comment to plain highlight (#183) ([a344153](https://github.com/box/box-content-preview/commit/a344153)) +* Fix: Fix focus for new page number input (#187) ([5f82f15](https://github.com/box/box-content-preview/commit/5f82f15)), closes [#187](https://github.com/box/box-content-preview/issues/187) +* Fix: Fix hiding on Android Chrome (#190) ([897abcd](https://github.com/box/box-content-preview/commit/897abcd)), closes [#190](https://github.com/box/box-content-preview/issues/190) +* Fix: Fixes issues with adding annotations on tablets (#186) ([e6e6c3b](https://github.com/box/box-content-preview/commit/e6e6c3b)), closes [#186](https://github.com/box/box-content-preview/issues/186) +* Fix: Sets the pdf scale after page render rather than on resize (#178) ([8457621](https://github.com/box/box-content-preview/commit/8457621)) +* Create highlight dialog (#184) ([59c0bbb](https://github.com/box/box-content-preview/commit/59c0bbb)) +* Chore: Add Webpack bundle visualizer (#188) ([8fa744e](https://github.com/box/box-content-preview/commit/8fa744e)) +* Chore: Make page number input more visible (#179) ([3b585d8](https://github.com/box/box-content-preview/commit/3b585d8)) +* Chore: Refactor controls for mobile (#174) ([066a3d4](https://github.com/box/box-content-preview/commit/066a3d4)) +* New: Allowing users to add new mobile point annotations (#177) ([56bbbf9](https://github.com/box/box-content-preview/commit/56bbbf9)) +* Update: Readme with new badges (#180) ([fc51f75](https://github.com/box/box-content-preview/commit/fc51f75)) +* Update: Remove 0.25x playback on media files (#182) ([896c755](https://github.com/box/box-content-preview/commit/896c755)) + + + + +## 0.129.2 (2017-06-20) + +* Release: 0.129.2 ([ef39c99](https://github.com/box/box-content-preview/commit/ef39c99)) +* Fix: Fix shared links previewed in other subdomains (#173) ([ab04be5](https://github.com/box/box-content-preview/commit/ab04be5)), closes [#173](https://github.com/box/box-content-preview/issues/173) +* Chore: Tweak fade-in timing of file loading animation (#175) ([1e9cebe](https://github.com/box/box-content-preview/commit/1e9cebe)) +* Chore: Update ESLint rules and VSCode settings (#176) ([28ec823](https://github.com/box/box-content-preview/commit/28ec823)) +* Docs: Update README editor plugins ([b0be367](https://github.com/box/box-content-preview/commit/b0be367)) + + + + +## 0.129.1 (2017-06-16) + +* Release: 0.129.1 ([d6f5878](https://github.com/box/box-content-preview/commit/d6f5878)) +* Fix: Box3D bug prevented loading video texture from video tag ([55d3ca2](https://github.com/box/box-content-preview/commit/55d3ca2)) + + + + +# 0.129.0 (2017-06-14) + +* Release: 0.129.0 ([d38e6df](https://github.com/box/box-content-preview/commit/d38e6df)) +* Mojito: Update translations (#167) ([4210077](https://github.com/box/box-content-preview/commit/4210077)) +* New: File specific loading icons (#170) ([16af34d](https://github.com/box/box-content-preview/commit/16af34d)) +* Fix: Catch loss of WebGL context in Box3D and reload preview ([0de993e](https://github.com/box/box-content-preview/commit/0de993e)) +* Fix: Fix removeEventListener in MediaBaseViewer (#169) ([5760a12](https://github.com/box/box-content-preview/commit/5760a12)), closes [#169](https://github.com/box/box-content-preview/issues/169) +* Chore: Refactoring Controls for mobile (#159) ([98ad9cc](https://github.com/box/box-content-preview/commit/98ad9cc)) + + + + +# 0.128.0 (2017-06-06) + +* Release: 0.128.0 ([a0fc5ae](https://github.com/box/box-content-preview/commit/a0fc5ae)) +* Upgrade: Upgrade Shaka-player to fix infinite 401 issue (#164) ([5646a79](https://github.com/box/box-content-preview/commit/5646a79)), closes [#164](https://github.com/box/box-content-preview/issues/164) +* Update: Add support for 'ly' Lilypond musical annotation files (#165) ([4212692](https://github.com/box/box-content-preview/commit/4212692)) +* Update: Change Preview loading message (#166) ([a8457f0](https://github.com/box/box-content-preview/commit/a8457f0)) +* Update: Displaying file type unsupported error (#163) ([59765e8](https://github.com/box/box-content-preview/commit/59765e8)) +* Chore: Optimizations for highlightMousemoveEvent (#121) ([4d31542](https://github.com/box/box-content-preview/commit/4d31542)) +* Chore: refactored and renamed getPageElAndPageNumber (#162) ([00dedab](https://github.com/box/box-content-preview/commit/00dedab)) +* Animate annotation dialog (#161) ([b7217c6](https://github.com/box/box-content-preview/commit/b7217c6)) +* Mojito: Update translations (#160) ([fbb3989](https://github.com/box/box-content-preview/commit/fbb3989)) +* Docs: Use ISO date format for LICENSE (#158) ([e856302](https://github.com/box/box-content-preview/commit/e856302)) + + + + +# 0.127.0 (2017-05-30) + +* Release: 0.127.0 ([07d036f](https://github.com/box/box-content-preview/commit/07d036f)) +* Fix: Disables annotations after 'load' event on shared links (#150) ([77cf5bb](https://github.com/box/box-content-preview/commit/77cf5bb)) +* Fix: Ensure point annotation mode button is hidden on rotated images (#151) ([e322c6a](https://github.com/box/box-content-preview/commit/e322c6a)) +* Fix: Error content jumps on error if download button is absent (#152) ([2cd6fed](https://github.com/box/box-content-preview/commit/2cd6fed)) +* Fix: Image scaling/rotation is broken when an image has annotations (#156) ([c91e9f9](https://github.com/box/box-content-preview/commit/c91e9f9)) +* Fix: Support disabling DASH viewer in DASH-supported environment (#140) ([b292666](https://github.com/box/box-content-preview/commit/b292666)) +* Chore: Re-enabling controls for mobile viewers (#157) ([a9e1c52](https://github.com/box/box-content-preview/commit/a9e1c52)) +* Chore: Use whatwg-fetch instead of isomorphic-fetch (#155) ([5a8f4f2](https://github.com/box/box-content-preview/commit/5a8f4f2)) +* Mojito: Update translations (#154) ([2e512ed](https://github.com/box/box-content-preview/commit/2e512ed)) +* New: Initial mobile optimization of annotation dialogs (#146) ([d693991](https://github.com/box/box-content-preview/commit/d693991)) + + + + +## 0.126.1 (2017-05-26) + +* Release: 0.126.1 ([e269605](https://github.com/box/box-content-preview/commit/e269605)) +* Fix: Fixing vanity urls for excel online on IE11 (#153) ([ff6ae22](https://github.com/box/box-content-preview/commit/ff6ae22)) +* Fix: Reinforcing release script (#148) ([c7137a0](https://github.com/box/box-content-preview/commit/c7137a0)) +* Update: Make media viewer settings menu larger so scrollbars don't show (#149) ([7da7efc](https://github.com/box/box-content-preview/commit/7da7efc)) +* Chore: Fix changelog (#144) ([be0d2b0](https://github.com/box/box-content-preview/commit/be0d2b0)), closes [#144](https://github.com/box/box-content-preview/issues/144) +* Chore: Format all source code with prettier (#143) ([d2a6835](https://github.com/box/box-content-preview/commit/d2a6835)) +* Add toggle and metadata for box3d grid ([d139a15](https://github.com/box/box-content-preview/commit/d139a15)) + + + + +# 0.126.0 (2017-05-24) + +* Release: 0.126.0 ([22cd9b1](https://github.com/box/box-content-preview/commit/22cd9b1)) +* Chore: Update translations (#142) ([b084505](https://github.com/box/box-content-preview/commit/b084505)) + + + + +# 0.125.0 (2017-05-24) + +* Release: 0.125.0 ([b77af71](https://github.com/box/box-content-preview/commit/b77af71)) +* Build: Update build script to tag release commits (#141) ([15c0034](https://github.com/box/box-content-preview/commit/15c0034)) +* Chore: Add prettier code formatter (#133) ([c3cb7b6](https://github.com/box/box-content-preview/commit/c3cb7b6)) +* Chore: Deleting old third-party packages (#127) ([d45bb83](https://github.com/box/box-content-preview/commit/d45bb83)) +* Chore: Settings.js - Declare class properties at class-level (#134) ([2cacedd](https://github.com/box/box-content-preview/commit/2cacedd)) +* Chore: Update license formatting (#135) ([61b8bbd](https://github.com/box/box-content-preview/commit/61b8bbd)) +* Chore: Update prettier line width to 80 (#139) ([e7fb14b](https://github.com/box/box-content-preview/commit/e7fb14b)) +* Chore: Update translations (#132) ([f5fc6a5](https://github.com/box/box-content-preview/commit/f5fc6a5)) +* Update: Adding more languages for subtitles (#130) ([b55988c](https://github.com/box/box-content-preview/commit/b55988c)) +* Update: Improve subtitle selection algorithm (#129) ([561cb73](https://github.com/box/box-content-preview/commit/561cb73)) +* Update: Show rate limit specific error message when a 429 occurs (#137) ([67b589c](https://github.com/box/box-content-preview/commit/67b589c)) +* Update: Some UI changes for video player (#128) ([81802c1](https://github.com/box/box-content-preview/commit/81802c1)) +* Update: Update Box3D with new material default (#136) ([97fe7a1](https://github.com/box/box-content-preview/commit/97fe7a1)) +* Fix: fix excel setup when enabling the Office viewer via options (#126) ([e8145f5](https://github.com/box/box-content-preview/commit/e8145f5)), closes [#126](https://github.com/box/box-content-preview/issues/126) +* Fix: Seek time doesn't match filmstrip timecode (#131) ([fb1fdd0](https://github.com/box/box-content-preview/commit/fb1fdd0)) +* Docs: Update changelog ([0a19275](https://github.com/box/box-content-preview/commit/0a19275)) +* Docs: Update Contributing.md (#125) ([d717883](https://github.com/box/box-content-preview/commit/d717883)) +* Docs: Update license to Box Software License Agreement (#124) ([b8c6080](https://github.com/box/box-content-preview/commit/b8c6080)) +* Docs: Update README to point to new CodePen demo ([5e20db3](https://github.com/box/box-content-preview/commit/5e20db3)) +* Mojito: Update translations (#123) ([86c8475](https://github.com/box/box-content-preview/commit/86c8475)) + + + + +# 0.124.0 (2017-05-17) + +* 0.124.0 ([e7fd504](https://github.com/box/box-content-preview/commit/e7fd504)) + + + + +# 0.123.0 (2017-05-17) + +* 0.123.0 ([cdd3799](https://github.com/box/box-content-preview/commit/cdd3799)) +* Update: Adding iso639 code translations (#122) ([b4de2a6](https://github.com/box/box-content-preview/commit/b4de2a6)) +* New: Multi image annotations post bundling refactor ([93a5ba2](https://github.com/box/box-content-preview/commit/93a5ba2)) +* New: platform excel online fork (#101) ([a247b9d](https://github.com/box/box-content-preview/commit/a247b9d)) +* New: Support closed-captions/subtitles (#117) ([4c56532](https://github.com/box/box-content-preview/commit/4c56532)) +* Chore: Bundling annotations.css separately from preview.css (#106) ([699ed56](https://github.com/box/box-content-preview/commit/699ed56)) +* Chore: Document viewer tweaks (#114) ([5d0f884](https://github.com/box/box-content-preview/commit/5d0f884)) +* Chore: Moving common annotation methods into Base classes (#111) ([27a908a](https://github.com/box/box-content-preview/commit/27a908a)) +* Chore: Remove unnecessary mobile check (#120) ([7268548](https://github.com/box/box-content-preview/commit/7268548)) +* Chore: Tweak readme on self-hosted vs Box-hosted ([104d03e](https://github.com/box/box-content-preview/commit/104d03e)) +* Chore: Update readme section on Promise polyfills ([7c90078](https://github.com/box/box-content-preview/commit/7c90078)) +* Fix: Dont rely on preview's script tag being present after execution (#105) ([3ae639a](https://github.com/box/box-content-preview/commit/3ae639a)) +* Fix: Issue when 'load' event is fired before BoxAnnotations is loaded (#108) ([b4c8d32](https://github.com/box/box-content-preview/commit/b4c8d32)) +* Fix: Older versions of webkit iOS incorrectly cache range requests (#118) ([0424e16](https://github.com/box/box-content-preview/commit/0424e16)) +* Fix: Set media viewers' settings menu dimensions with javascript (#116) ([3c36f0a](https://github.com/box/box-content-preview/commit/3c36f0a)) +* Docs: Remove unneeded file types from image360 docs (#119) ([0b7d8de](https://github.com/box/box-content-preview/commit/0b7d8de)) +* Mojito: Update translations (#113) ([7c12442](https://github.com/box/box-content-preview/commit/7c12442)) +* Upgrade: Upgrade Shaka-player to 2.1.1 (#110) ([4387245](https://github.com/box/box-content-preview/commit/4387245)) + + + + +# 0.122.0 (2017-05-09) + +* 0.122.0 ([c735f38](https://github.com/box/box-content-preview/commit/c735f38)) +* Mojito: Update translations (#107) ([197945d](https://github.com/box/box-content-preview/commit/197945d)) +* Chore: Allow console logging to show in tests (#100) ([b0e15b1](https://github.com/box/box-content-preview/commit/b0e15b1)) +* Chore: cleaning up DocBaseViewer (#103) ([9d444b3](https://github.com/box/box-content-preview/commit/9d444b3)) +* Chore: Remove font-smoothing and update progress bar color (#104) ([2581b88](https://github.com/box/box-content-preview/commit/2581b88)) +* Chore: Remove unused 'parent' field from Box File object (#91) ([1f9a94b](https://github.com/box/box-content-preview/commit/1f9a94b)) +* Update: Make media player web-accessible according to WCAG2.0 spec (#97) ([687dba4](https://github.com/box/box-content-preview/commit/687dba4)) +* Update: Re-enable font loading API support check (#99) ([eca9e6d](https://github.com/box/box-content-preview/commit/eca9e6d)) +* Fix: Add Annotations bundling changes back (#95) ([bbc6ea3](https://github.com/box/box-content-preview/commit/bbc6ea3)) +* Fix: Make all svgs not focusable (#98) ([edcf0e1](https://github.com/box/box-content-preview/commit/edcf0e1)) + + + + +## 0.121.1 (2017-04-29) + +* 0.121.1 ([948fbf8](https://github.com/box/box-content-preview/commit/948fbf8)) +* Revert annotations bundling (#94) ([176ad13](https://github.com/box/box-content-preview/commit/176ad13)) + + + + +# 0.121.0 (2017-04-25) + +* 0.121.0 ([3e1e045](https://github.com/box/box-content-preview/commit/3e1e045)) +* Chore: Add console logging to better debug hanging preview (#93) ([3e6299b](https://github.com/box/box-content-preview/commit/3e6299b)) +* Chore: Bundling Annotators separately in annotations.js (#75) ([efa8b2a](https://github.com/box/box-content-preview/commit/efa8b2a)) +* Chore: Do not load annotations on shared links (#88) ([8b959cd](https://github.com/box/box-content-preview/commit/8b959cd)) +* Chore: Removed underscored variables and getters from all annotation files (#83) ([ac838d2](https://github.com/box/box-content-preview/commit/ac838d2)) +* Chore: User agent refactor and Browser tests (#87) ([059f6ac](https://github.com/box/box-content-preview/commit/059f6ac)) +* Fix: Don't load preload if the rep has an error (#92) ([ab5c65a](https://github.com/box/box-content-preview/commit/ab5c65a)) +* Fix: Ensuring annotations are loaded when viewer has permissions (#90) ([b90cdde](https://github.com/box/box-content-preview/commit/b90cdde)) +* Update: Document viewer optimizations (#89) ([41560d6](https://github.com/box/box-content-preview/commit/41560d6)) +* Upgrade: Shaka Player 2.0.8 (#85) ([461070d](https://github.com/box/box-content-preview/commit/461070d)) + + + + +## 0.120.1 (2017-04-19) + +* 0.120.1 ([35be0a5](https://github.com/box/box-content-preview/commit/35be0a5)) +* Update: Tweak pdf.js range requests for improved performance (#84) ([0e7f358](https://github.com/box/box-content-preview/commit/0e7f358)) + + + + +# 0.120.0 (2017-04-18) + +* 0.120.0 ([85337bc](https://github.com/box/box-content-preview/commit/85337bc)) +* Fix: Handle text representation error (#72) ([81fc4e4](https://github.com/box/box-content-preview/commit/81fc4e4)) +* Fix: Only bind custom listeners when annotation threads exist (#74) ([1e2e9f7](https://github.com/box/box-content-preview/commit/1e2e9f7)) +* Fix: Prevent webGL error when prefetching Preview.js (#82) ([e0a420a](https://github.com/box/box-content-preview/commit/e0a420a)) +* Update: Add client information to performance logging (#80) ([f7bea68](https://github.com/box/box-content-preview/commit/f7bea68)) +* Update: Add disableTextLayer option for doc and text viewers (#71) ([a36f735](https://github.com/box/box-content-preview/commit/a36f735)) +* Update: Changing analytics client name to 'box-content-preview' (#79) ([983dda9](https://github.com/box/box-content-preview/commit/983dda9)) +* Update: Disabling font loading API for pdf.js to prevent glitches (#68) ([5b5807b](https://github.com/box/box-content-preview/commit/5b5807b)) +* Chore: Mock super.setup() in all Viewer unit tests (#81) ([fec384c](https://github.com/box/box-content-preview/commit/fec384c)) +* Chore: Rename test-html files and update fixture loading (#78) ([8285e39](https://github.com/box/box-content-preview/commit/8285e39)) +* Chore: Triggering point annotation mode by emitting a message (#77) ([cc3e283](https://github.com/box/box-content-preview/commit/cc3e283)) +* Chore: Updating annotations icons to the new Box blue (#76) ([979e129](https://github.com/box/box-content-preview/commit/979e129)) +* Mojito: Update translations (#70) ([5daa11e](https://github.com/box/box-content-preview/commit/5daa11e)) + + + + +## 0.119.1 (2017-04-12) + +* 0.119.1 ([bc9b581](https://github.com/box/box-content-preview/commit/bc9b581)) +* Fix: adding patch to options check in release script (#69) ([86c3fef](https://github.com/box/box-content-preview/commit/86c3fef)) +* Fix: updating metadata from repStatus (#60) ([51143b0](https://github.com/box/box-content-preview/commit/51143b0)) + + + + +# 0.119.0 (2017-04-11) + +* 0.119.0 ([762fad8](https://github.com/box/box-content-preview/commit/762fad8)) +* Fix: Hiding download button in all cases if browser cannot download (#61) ([3a5bb41](https://github.com/box/box-content-preview/commit/3a5bb41)) +* Fix: Temporary disableFontFaces on IOS 10.3 ([67de2d7](https://github.com/box/box-content-preview/commit/67de2d7)) +* Update: Decrease mobile web max pdf.js canvas size to 3MP (#66) ([88304c9](https://github.com/box/box-content-preview/commit/88304c9)) +* Update: Increase default doc chunk size to 384KB (#64) ([ebbaccd](https://github.com/box/box-content-preview/commit/ebbaccd)) +* Update: Upgrade pdf.js to v1.8.175 (#63) ([14ac6f9](https://github.com/box/box-content-preview/commit/14ac6f9)) +* Chore: Removing unneeded compatibility.js from pdf.js (#65) ([82d582e](https://github.com/box/box-content-preview/commit/82d582e)) +* Chore: Update changelog generator to ignore old pull requests (#59) ([7ad5088](https://github.com/box/box-content-preview/commit/7ad5088)) + + + + +# 0.118.0 (2017-04-06) + +* 0.118.0 ([930c432](https://github.com/box/box-content-preview/commit/930c432)) +* Chore: Moving existing CHANGELOG.md to HISTORY.md ([126f78d](https://github.com/box/box-content-preview/commit/126f78d)) +* Chore: Updating README describing .conventional-changelog-lintrc (#57) ([897b858](https://github.com/box/box-content-preview/commit/897b858)) +* Update: New Box-branding for Oculus Touch models (#58) ([59880de](https://github.com/box/box-content-preview/commit/59880de)) + + + + +# 0.117.0 (2017-04-06) + +* New: Initial push to GitHub ([448c477](https://github.com/box/box-content-preview/commit/448c477)) + -## [v0.112.0](https://github.com/box/box-content-preview/tree/v0.112.0) (2017-03-22) -[Full Changelog](https://github.com/box/box-content-preview/compare/v0.111.0...v0.112.0) -**Merged pull requests:** - -- Build: Add release script [\#9](https://github.com/box/box-content-preview/pull/9) ([tonyjin](https://github.com/tonyjin)) -- Fix uncaught exceptions box3d [\#8](https://github.com/box/box-content-preview/pull/8) ([JustinHoldstock](https://github.com/JustinHoldstock)) -- 397 animation controls dont appear [\#6](https://github.com/box/box-content-preview/pull/6) ([MiiBond](https://github.com/MiiBond)) -- Update: Adjust default camera distance for model3d viewer [\#5](https://github.com/box/box-content-preview/pull/5) ([MiiBond](https://github.com/MiiBond)) -- 360 update oculus touch materials [\#4](https://github.com/box/box-content-preview/pull/4) ([MiiBond](https://github.com/MiiBond)) -- Update README license to match LICENSE file [\#3](https://github.com/box/box-content-preview/pull/3) ([tonyjin](https://github.com/tonyjin)) -- Move documentation into viewer folders [\#2](https://github.com/box/box-content-preview/pull/2) ([tonyjin](https://github.com/tonyjin)) -- Setting up Travis [\#1](https://github.com/box/box-content-preview/pull/1) ([tonyjin](https://github.com/tonyjin)) - - -\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file diff --git a/build/release.sh b/build/release.sh index aa1a63e11..7825818b6 100755 --- a/build/release.sh +++ b/build/release.sh @@ -71,7 +71,7 @@ update_changelog() { echo "Updating CHANGELOG.md" echo "----------------------------------------------------------------------" - if github_changelog_generator box/box-content-preview --future-release v$VERSION --exclude-labels legacy-ignore; then + if ./node_modules/.bin/conventional-changelog -i CHANGELOG.md --same-file then echo "----------------------------------------------------------------------" echo "Updated CHANGELOG successfully" echo "----------------------------------------------------------------------" diff --git a/package.json b/package.json index ff2249e6b..97a452dc7 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "chai": "^3.5.0", "chai-as-promised": "5.3.0", "chai-dom": "^1.5.0", + "conventional-changelog-cli": "^1.3.2", "conventional-changelog-lint": "^1.1.7", "css-loader": "^0.27.3", "cssnano-cli": "^1.0.5", diff --git a/yarn.lock b/yarn.lock index 91aee520d..8ae157b21 100644 --- a/yarn.lock +++ b/yarn.lock @@ -51,6 +51,10 @@ acorn@^5.0.0, acorn@^5.0.1, acorn@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.1.1.tgz#53fe161111f912ab999ee887a90a0bc52822fd75" +add-stream@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/add-stream/-/add-stream-1.0.0.tgz#6a7990437ca736d5e1288db92bd3266d5f5cb2aa" + after@0.8.2: version "0.8.2" resolved "https://registry.yarnpkg.com/after/-/after-0.8.2.tgz#fedb394f9f0e02aa9768e702bda23b505fae7e1f" @@ -1466,6 +1470,92 @@ conventional-changelog-angular@1.3.0: github-url-from-git "^1.4.0" q "^1.4.1" +conventional-changelog-angular@^1.3.4: + version "1.4.0" + resolved "https://registry.yarnpkg.com/conventional-changelog-angular/-/conventional-changelog-angular-1.4.0.tgz#118b9f7d41a3d99500bfb6bea1f3525e055e8b9b" + dependencies: + compare-func "^1.3.1" + github-url-from-git "^1.4.0" + q "^1.4.1" + read-pkg-up "^2.0.0" + +conventional-changelog-atom@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/conventional-changelog-atom/-/conventional-changelog-atom-0.1.1.tgz#d40a9b297961b53c745e5d1718fd1a3379f6a92f" + dependencies: + q "^1.4.1" + +conventional-changelog-cli@^1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/conventional-changelog-cli/-/conventional-changelog-cli-1.3.2.tgz#33abf2b5720a9b094df38e81741ccb502e1a4125" + dependencies: + add-stream "^1.0.0" + conventional-changelog "^1.1.4" + lodash "^4.1.0" + meow "^3.7.0" + tempfile "^1.1.1" + +conventional-changelog-codemirror@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/conventional-changelog-codemirror/-/conventional-changelog-codemirror-0.1.0.tgz#7577a591dbf9b538e7a150a7ee62f65a2872b334" + dependencies: + q "^1.4.1" + +conventional-changelog-core@^1.9.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/conventional-changelog-core/-/conventional-changelog-core-1.9.0.tgz#de5dfbc091847656508d4a389e35c9a1bc49e7f4" + dependencies: + conventional-changelog-writer "^1.1.0" + conventional-commits-parser "^1.0.0" + dateformat "^1.0.12" + get-pkg-repo "^1.0.0" + git-raw-commits "^1.2.0" + git-remote-origin-url "^2.0.0" + git-semver-tags "^1.2.0" + lodash "^4.0.0" + normalize-package-data "^2.3.5" + q "^1.4.1" + read-pkg "^1.1.0" + read-pkg-up "^1.0.1" + through2 "^2.0.0" + +conventional-changelog-ember@^0.2.6: + version "0.2.6" + resolved "https://registry.yarnpkg.com/conventional-changelog-ember/-/conventional-changelog-ember-0.2.6.tgz#8b7355419f5127493c4c562473ab2fc792f1c2b6" + dependencies: + q "^1.4.1" + +conventional-changelog-eslint@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/conventional-changelog-eslint/-/conventional-changelog-eslint-0.1.0.tgz#a52411e999e0501ce500b856b0a643d0330907e2" + dependencies: + q "^1.4.1" + +conventional-changelog-express@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/conventional-changelog-express/-/conventional-changelog-express-0.1.0.tgz#55c6c841c811962036c037bdbd964a54ae310fce" + dependencies: + q "^1.4.1" + +conventional-changelog-jquery@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/conventional-changelog-jquery/-/conventional-changelog-jquery-0.1.0.tgz#0208397162e3846986e71273b6c79c5b5f80f510" + dependencies: + q "^1.4.1" + +conventional-changelog-jscs@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/conventional-changelog-jscs/-/conventional-changelog-jscs-0.1.0.tgz#0479eb443cc7d72c58bf0bcf0ef1d444a92f0e5c" + dependencies: + q "^1.4.1" + +conventional-changelog-jshint@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/conventional-changelog-jshint/-/conventional-changelog-jshint-0.1.0.tgz#00cab8e9a3317487abd94c4d84671342918d2a07" + dependencies: + compare-func "^1.3.1" + q "^1.4.1" + conventional-changelog-lint-config-angular@0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/conventional-changelog-lint-config-angular/-/conventional-changelog-lint-config-angular-0.4.1.tgz#0f1d090883636ca45f08304ce72ee0b2c60d9ffa" @@ -1490,7 +1580,44 @@ conventional-changelog-lint@^1.1.7: pos "0.4.2" rc "1.1.7" -conventional-commits-parser@1.3.0: +conventional-changelog-writer@^1.1.0: + version "1.4.1" + resolved "https://registry.yarnpkg.com/conventional-changelog-writer/-/conventional-changelog-writer-1.4.1.tgz#3f4cb4d003ebb56989d30d345893b52a43639c8e" + dependencies: + compare-func "^1.3.1" + conventional-commits-filter "^1.0.0" + dateformat "^1.0.11" + handlebars "^4.0.2" + json-stringify-safe "^5.0.1" + lodash "^4.0.0" + meow "^3.3.0" + semver "^5.0.1" + split "^1.0.0" + through2 "^2.0.0" + +conventional-changelog@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/conventional-changelog/-/conventional-changelog-1.1.4.tgz#108bc750c2a317e200e2f9b413caaa1f8c7efa3b" + dependencies: + conventional-changelog-angular "^1.3.4" + conventional-changelog-atom "^0.1.0" + conventional-changelog-codemirror "^0.1.0" + conventional-changelog-core "^1.9.0" + conventional-changelog-ember "^0.2.6" + conventional-changelog-eslint "^0.1.0" + conventional-changelog-express "^0.1.0" + conventional-changelog-jquery "^0.1.0" + conventional-changelog-jscs "^0.1.0" + conventional-changelog-jshint "^0.1.0" + +conventional-commits-filter@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/conventional-commits-filter/-/conventional-commits-filter-1.0.0.tgz#6fc2a659372bc3f2339cf9ffff7e1b0344b93039" + dependencies: + is-subset "^0.1.1" + modify-values "^1.0.0" + +conventional-commits-parser@1.3.0, conventional-commits-parser@^1.0.0: version "1.3.0" resolved "https://registry.yarnpkg.com/conventional-commits-parser/-/conventional-commits-parser-1.3.0.tgz#e327b53194e1a7ad5dc63479ee9099a52b024865" dependencies: @@ -1772,7 +1899,7 @@ date-now@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b" -dateformat@^1.0.6: +dateformat@^1.0.11, dateformat@^1.0.12, dateformat@^1.0.6: version "1.0.12" resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-1.0.12.tgz#9f124b67594c937ff706932e4a642cca8dbbfee9" dependencies: @@ -2780,6 +2907,16 @@ get-caller-file@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.2.tgz#f702e63127e7e231c160a80c1554acb70d5047e5" +get-pkg-repo@^1.0.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/get-pkg-repo/-/get-pkg-repo-1.4.0.tgz#c73b489c06d80cc5536c2c853f9e05232056972d" + dependencies: + hosted-git-info "^2.1.4" + meow "^3.3.0" + normalize-package-data "^2.3.0" + parse-github-repo-url "^1.3.0" + through2 "^2.0.0" + get-stdin@5.0.1, get-stdin@^5.0.0, get-stdin@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-5.0.1.tgz#122e161591e21ff4c52530305693f20e6393a398" @@ -2808,6 +2945,30 @@ git-raw-commits@1.1.2: split2 "^2.0.0" through2 "^2.0.0" +git-raw-commits@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/git-raw-commits/-/git-raw-commits-1.2.0.tgz#0f3a8bfd99ae0f2d8b9224d58892975e9a52d03c" + dependencies: + dargs "^4.0.1" + lodash.template "^4.0.2" + meow "^3.3.0" + split2 "^2.0.0" + through2 "^2.0.0" + +git-remote-origin-url@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/git-remote-origin-url/-/git-remote-origin-url-2.0.0.tgz#5282659dae2107145a11126112ad3216ec5fa65f" + dependencies: + gitconfiglocal "^1.0.0" + pify "^2.3.0" + +git-semver-tags@^1.2.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/git-semver-tags/-/git-semver-tags-1.2.1.tgz#6ccd2a52e735b736748dc762444fcd9588e27490" + dependencies: + meow "^3.3.0" + semver "^5.0.1" + git-toplevel@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/git-toplevel/-/git-toplevel-1.1.1.tgz#d3879c6ca6120c8cb180c52842094c0cc9eadaca" @@ -2815,6 +2976,12 @@ git-toplevel@1.1.1: es6-promise "^3.0.2" jq-trim "^0.1.1" +gitconfiglocal@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/gitconfiglocal/-/gitconfiglocal-1.0.0.tgz#41d045f3851a5ea88f03f24ca1c6178114464b9b" + dependencies: + ini "^1.3.2" + github-url-from-git@^1.4.0: version "1.5.0" resolved "https://registry.yarnpkg.com/github-url-from-git/-/github-url-from-git-1.5.0.tgz#f985fedcc0a9aa579dc88d7aff068d55cc6251a0" @@ -2934,7 +3101,7 @@ gzip-size@^3.0.0: dependencies: duplexer "^0.1.1" -handlebars@^4.0.1: +handlebars@^4.0.1, handlebars@^4.0.2: version "4.0.10" resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.10.tgz#3d30c718b09a3d96f23ea4cc1f403c4d3ba9ff4f" dependencies: @@ -3156,7 +3323,7 @@ inherits@2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1" -ini@~1.3.0: +ini@^1.3.2, ini@~1.3.0: version "1.3.4" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.4.tgz#0537cb79daf59b59a1a517dff706c86ec039162e" @@ -3386,6 +3553,10 @@ is-stream@^1.0.1, is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" +is-subset@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-subset/-/is-subset-0.1.1.tgz#8a59117d932de1de00f245fcdd39ce43f1e939a6" + is-supported-regexp-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-supported-regexp-flag/-/is-supported-regexp-flag-1.0.0.tgz#8b520c85fae7a253382d4b02652e045576e13bb8" @@ -3548,7 +3719,7 @@ json-stable-stringify@^1.0.0, json-stable-stringify@^1.0.1: dependencies: jsonify "~0.0.0" -json-stringify-safe@~5.0.1: +json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" @@ -4285,6 +4456,10 @@ mock-local-storage@^1.0.2: dependencies: core-js "^0.8.3" +modify-values@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.0.tgz#e2b6cdeb9ce19f99317a53722f3dbf5df5eaaab2" + mojito-rb-gen@^0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/mojito-rb-gen/-/mojito-rb-gen-0.0.1.tgz#27750b8059ea500fcef4f67621a3a169606df80d" @@ -4479,7 +4654,7 @@ nopt@^4.0.1: abbrev "1" osenv "^0.1.4" -normalize-package-data@^2.3.2, normalize-package-data@^2.3.4: +normalize-package-data@^2.3.0, normalize-package-data@^2.3.2, normalize-package-data@^2.3.4, normalize-package-data@^2.3.5: version "2.4.0" resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.4.0.tgz#12f95a307d58352075a04907b84ac8be98ac012f" dependencies: @@ -4711,6 +4886,10 @@ parse-asn1@^5.0.0: evp_bytestokey "^1.0.0" pbkdf2 "^3.0.3" +parse-github-repo-url@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/parse-github-repo-url/-/parse-github-repo-url-1.4.0.tgz#286c53e2c9962e0641649ee3ac9508fca4dd959c" + parse-glob@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/parse-glob/-/parse-glob-3.0.4.tgz#b2c376cfb11f35513badd173ef0bb6e3a388391c" @@ -5453,7 +5632,7 @@ read-pkg-up@^2.0.0: find-up "^2.0.0" read-pkg "^2.0.0" -read-pkg@^1.0.0: +read-pkg@^1.0.0, read-pkg@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-1.1.0.tgz#f5ffaa5ecd29cb31c0474bca7d756b6bb29e3f28" dependencies: @@ -5816,7 +5995,7 @@ scss-tokenizer@^0.2.3: js-base64 "^2.1.8" source-map "^0.4.2" -"semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@~5.3.0: +"semver@2 || 3 || 4 || 5", semver@^5.0.1, semver@^5.3.0, semver@~5.3.0: version "5.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" @@ -6051,6 +6230,12 @@ split2@^2.0.0: dependencies: through2 "^2.0.2" +split@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/split/-/split-1.0.0.tgz#c4395ce683abcd254bc28fe1dabb6e5c27dcffae" + dependencies: + through "2" + sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" @@ -6374,6 +6559,13 @@ tar@^2.0.0, tar@^2.2.1: fstream "^1.0.2" inherits "2" +tempfile@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/tempfile/-/tempfile-1.1.1.tgz#5bcc4eaecc4ab2c707d8bc11d99ccc9a2cb287f2" + dependencies: + os-tmpdir "^1.0.0" + uuid "^2.0.1" + test-exclude@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-4.1.1.tgz#4d84964b0966b0087ecc334a2ce002d3d9341e26" @@ -6422,7 +6614,7 @@ through2@^2.0.0, through2@^2.0.2: readable-stream "^2.1.5" xtend "~4.0.1" -"through@>=2.2.7 <3", through@^2.3.6, through@~2.3.4: +through@2, "through@>=2.2.7 <3", through@^2.3.6, through@~2.3.4: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" @@ -6616,6 +6808,10 @@ utils-merge@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.0.tgz#0294fb922bb9375153541c4f7096231f287c8af8" +uuid@^2.0.1: + version "2.0.3" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a" + uuid@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" From 01cdf3c47975429c23d231241a208dd1ffc4fe79 Mon Sep 17 00:00:00 2001 From: Tony Jin Date: Wed, 26 Jul 2017 17:30:12 -0700 Subject: [PATCH 03/19] Fix: Typo in release script --- build/release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/release.sh b/build/release.sh index 7825818b6..376282981 100755 --- a/build/release.sh +++ b/build/release.sh @@ -71,7 +71,7 @@ update_changelog() { echo "Updating CHANGELOG.md" echo "----------------------------------------------------------------------" - if ./node_modules/.bin/conventional-changelog -i CHANGELOG.md --same-file then + if ./node_modules/.bin/conventional-changelog -i CHANGELOG.md --same-file; then echo "----------------------------------------------------------------------" echo "Updated CHANGELOG successfully" echo "----------------------------------------------------------------------" From 0ba78044e38f6b78615337670f1db6b17ace1fc9 Mon Sep 17 00:00:00 2001 From: Jeremy Press Date: Thu, 27 Jul 2017 09:58:13 -0700 Subject: [PATCH 04/19] Fix: Hide filmstrip when controls hide (#239) --- src/lib/viewers/media/MediaControls.js | 1 + src/lib/viewers/media/__tests__/MediaControls-test.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/viewers/media/MediaControls.js b/src/lib/viewers/media/MediaControls.js index 4eb52f3cc..72cda7dcf 100644 --- a/src/lib/viewers/media/MediaControls.js +++ b/src/lib/viewers/media/MediaControls.js @@ -611,6 +611,7 @@ class MediaControls extends EventEmitter { if (this.wrapperEl && this.wrapperEl.parentNode) { this.wrapperEl.parentNode.classList.remove(SHOW_CONTROLS_CLASS); + this.filmstripHideHandler(); } } diff --git a/src/lib/viewers/media/__tests__/MediaControls-test.js b/src/lib/viewers/media/__tests__/MediaControls-test.js index 1c1b07124..47ed034d7 100644 --- a/src/lib/viewers/media/__tests__/MediaControls-test.js +++ b/src/lib/viewers/media/__tests__/MediaControls-test.js @@ -625,6 +625,7 @@ describe('lib/viewers/media/MediaControls', () => { describe('hide()', () => { beforeEach(() => { stubs.isSettingsVisible = sandbox.stub(mediaControls, 'isSettingsVisible'); + stubs.filmstripHideHandler = sandbox.stub(mediaControls, 'filmstripHideHandler'); stubs.show = sandbox.stub(mediaControls, 'show'); }); @@ -643,13 +644,14 @@ describe('lib/viewers/media/MediaControls', () => { expect(stubs.show).to.be.called; }); - it('should remove the show controls class if the wrapper element and parent exist', () => { + it('should remove the show controls class and hide the filmstrip if the wrapper element and parent exist', () => { mediaControls.preventHiding = false; stubs.isSettingsVisible.returns(false); mediaControls.hide(); expect(stubs.show).to.not.be.called; expect(mediaControls.wrapperEl.parentNode.classList.contains('bp-media-controls-is-visible')).to.be.false; + expect(stubs.filmstripHideHandler).to.be.called; }); }); From 1ee02fee2545d8d0c813abe3fd12a9e1ac0ab7a5 Mon Sep 17 00:00:00 2001 From: Jeremy Press Date: Thu, 27 Jul 2017 13:17:47 -0700 Subject: [PATCH 05/19] Fix: Fix media query so 3D settings pullup is never truncated (#253) --- src/lib/viewers/box3d/Box3DControls.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/viewers/box3d/Box3DControls.scss b/src/lib/viewers/box3d/Box3DControls.scss index 3895fcb6f..15f0e033f 100644 --- a/src/lib/viewers/box3d/Box3DControls.scss +++ b/src/lib/viewers/box3d/Box3DControls.scss @@ -1,4 +1,4 @@ -$compact-width: 375px; +$compact-width: 510px; $compact-height: 550px; @media (max-width: $compact-width) { From 6080055a6df660c9d7ffeca03dc33373bdbcced1 Mon Sep 17 00:00:00 2001 From: Sumedha Pramod Date: Thu, 27 Jul 2017 14:04:29 -0700 Subject: [PATCH 06/19] Chore: Default single page images to page 1 for annotations (#249) --- .../__tests__/annotatorUtil-test.js | 2 +- src/lib/annotations/annotatorUtil.js | 2 +- src/lib/annotations/doc/DocAnnotator.js | 6 +--- .../doc/__tests__/DocAnnotator-test.js | 33 ++++--------------- src/lib/annotations/image/ImageAnnotator.js | 12 ++++--- src/lib/annotations/image/ImagePointDialog.js | 5 +-- .../image/__tests__/ImagePointDialog-test.js | 20 ++++++----- .../__tests__/ImagePointThread-test.html | 2 +- .../image/__tests__/ImagePointThread-test.js | 33 ++++++++++--------- 9 files changed, 47 insertions(+), 68 deletions(-) diff --git a/src/lib/annotations/__tests__/annotatorUtil-test.js b/src/lib/annotations/__tests__/annotatorUtil-test.js index 86776dfcc..b32369fb7 100644 --- a/src/lib/annotations/__tests__/annotatorUtil-test.js +++ b/src/lib/annotations/__tests__/annotatorUtil-test.js @@ -85,7 +85,7 @@ describe('lib/annotations/annotatorUtil', () => { const barEl = document.querySelector('.bar'); const result = getPageInfo(barEl); assert.equal(result.pageEl, null, 'Page element should be null'); - assert.equal(result.page, -1, 'Page number should be -1'); + assert.equal(result.page, 1, 'Page number should be 1'); }); }); diff --git a/src/lib/annotations/annotatorUtil.js b/src/lib/annotations/annotatorUtil.js index 5070db25a..1ba94184a 100644 --- a/src/lib/annotations/annotatorUtil.js +++ b/src/lib/annotations/annotatorUtil.js @@ -41,7 +41,7 @@ export function findClosestElWithClass(element, className) { */ export function getPageInfo(element) { const pageEl = findClosestElWithClass(element, 'page') || null; - let page = -1; + let page = 1; if (pageEl) { page = parseInt(pageEl.getAttribute('data-page-number'), 10); diff --git a/src/lib/annotations/doc/DocAnnotator.js b/src/lib/annotations/doc/DocAnnotator.js index 48b1af506..3dd11cfc4 100644 --- a/src/lib/annotations/doc/DocAnnotator.js +++ b/src/lib/annotations/doc/DocAnnotator.js @@ -223,11 +223,7 @@ class DocAnnotator extends Annotator { } // Get correct page - let { pageEl, page } = annotatorUtil.getPageInfo(event.target); - if (page === -1) { - // The ( .. ) around assignment is required syntax - ({ pageEl, page } = annotatorUtil.getPageInfo(window.getSelection().anchorNode)); - } + const { pageEl, page } = annotatorUtil.getPageInfo(event.target); // Use highlight module to calculate quad points const { highlightEls } = docAnnotatorUtil.getHighlightAndHighlightEls(this.highlighter, pageEl); diff --git a/src/lib/annotations/doc/__tests__/DocAnnotator-test.js b/src/lib/annotations/doc/__tests__/DocAnnotator-test.js index bab1feca7..a0b68e8f6 100644 --- a/src/lib/annotations/doc/__tests__/DocAnnotator-test.js +++ b/src/lib/annotations/doc/__tests__/DocAnnotator-test.js @@ -138,19 +138,10 @@ describe('lib/annotations/doc/DocAnnotator', () => { it('should infer page from selection if it cannot be inferred from event', () => { annotator.highlighter.highlights = [{}, {}]; - stubs.getPageInfo.onFirstCall().returns({ pageEl: null, page: -1 }); - stubs.getPageInfo.onSecondCall().returns({ - pageEl: { - getBoundingClientRect: sandbox.stub().returns({ - width: 100, - height: 100 - }) - }, - page: 2 - }); + stubs.getPageInfo.returns({ pageEl: null, page: -1 }); annotator.getLocationFromEvent({}, TYPES.highlight); - expect(stubs.getPageInfo).to.be.called.twice; + expect(stubs.getPageInfo).to.be.called; }); it('should not return a valid highlight location if no highlights exist', () => { @@ -178,27 +169,15 @@ describe('lib/annotations/doc/DocAnnotator', () => { }); it('should not return a location if there is no selection present', () => { - annotator.highlighter.highlights = []; - const location = annotator.getLocationFromEvent({}, TYPES.highlight_comment); - expect(location).to.be.null; + expect(annotator.getLocationFromEvent({}, TYPES.highlight_comment)).to.be.null; }); it('should infer page from selection if it cannot be inferred from event', () => { - annotator.highlighter.highlights = [{}]; - const getPageStub = stubs.getPageInfo; - getPageStub.onFirstCall().returns({ pageEl: null, page: -1 }); - getPageStub.onSecondCall().returns({ - pageEl: { - getBoundingClientRect: sandbox.stub().returns({ - width: 100, - height: 100 - }) - }, - page: 2 - }); + annotator.highlighter.highlights = [{}, {}]; + stubs.getPageInfo.returns({ pageEl: null, page: -1 }); annotator.getLocationFromEvent({}, TYPES.highlight_comment); - expect(stubs.getSel).to.have.been.called; + expect(stubs.getPageInfo).to.be.called; }); it('should not return a valid highlight location if no highlights exist', () => { diff --git a/src/lib/annotations/image/ImageAnnotator.js b/src/lib/annotations/image/ImageAnnotator.js index 644948ce3..2668b454c 100644 --- a/src/lib/annotations/image/ImageAnnotator.js +++ b/src/lib/annotations/image/ImageAnnotator.js @@ -46,9 +46,6 @@ class ImageAnnotator extends Annotator { // If no image page was selected, ignore, as all images have a page number. const { page } = annotatorUtil.getPageInfo(imageEl); - if (!page) { - return location; - } // Location based only on image position const imageDimensions = imageEl.getBoundingClientRect(); @@ -89,6 +86,13 @@ class ImageAnnotator extends Annotator { */ createAnnotationThread(annotations, location, type) { let thread; + + // Corrects any image annotation page number to 1 instead of -1 + const fixedLocation = location; + if (fixedLocation.page < 0) { + fixedLocation.page = 1; + } + const threadParams = { annotatedElement: this.annotatedElement, annotations, @@ -97,7 +101,7 @@ class ImageAnnotator extends Annotator { fileVersionId: this.fileVersionId, isMobile: this.isMobile, locale: this.locale, - location, + location: fixedLocation, type }; diff --git a/src/lib/annotations/image/ImagePointDialog.js b/src/lib/annotations/image/ImagePointDialog.js index 282fdb8c0..ad97bc98d 100644 --- a/src/lib/annotations/image/ImagePointDialog.js +++ b/src/lib/annotations/image/ImagePointDialog.js @@ -3,7 +3,6 @@ import AnnotationDialog from '../AnnotationDialog'; import * as annotatorUtil from '../annotatorUtil'; import * as imageAnnotatorUtil from './imageAnnotatorUtil'; -const IMAGE_NODE_NAME = 'img'; const PAGE_PADDING_TOP = 15; const POINT_ANNOTATION_ICON_HEIGHT = 31; const POINT_ANNOTATION_ICON_DOT_HEIGHT = 8; @@ -33,9 +32,7 @@ class ImagePointDialog extends AnnotationDialog { const dialogWidth = dialogDimensions.width; // Get image tag inside viewer, based on page number. All images are page 1 by default. - const imageEl = - this.annotatedElement.querySelector(`[data-page-number="${this.location.page || 1}"]`) || - this.annotatedElement.querySelector(IMAGE_NODE_NAME); + const imageEl = this.annotatedElement.querySelector(`[data-page-number="${this.location.page}"]`); // Center middle of dialog with point - this coordinate is with respect to the page let dialogLeftX = browserX - dialogWidth / 2; diff --git a/src/lib/annotations/image/__tests__/ImagePointDialog-test.js b/src/lib/annotations/image/__tests__/ImagePointDialog-test.js index 2fc1cb124..e2d06ebbb 100644 --- a/src/lib/annotations/image/__tests__/ImagePointDialog-test.js +++ b/src/lib/annotations/image/__tests__/ImagePointDialog-test.js @@ -3,7 +3,7 @@ import ImagePointDialog from '../ImagePointDialog'; import * as annotatorUtil from '../../annotatorUtil'; import * as imageAnnotatorUtil from '../imageAnnotatorUtil'; -let pointDialog; +let dialog; const sandbox = sinon.sandbox.create(); describe('lib/annotations/image/ImagePointDialog', () => { @@ -14,21 +14,23 @@ describe('lib/annotations/image/ImagePointDialog', () => { beforeEach(() => { fixture.load('annotations/image/__tests__/ImagePointDialog-test.html'); - pointDialog = new ImagePointDialog({ + dialog = new ImagePointDialog({ annotatedElement: document.querySelector('.annotated-element'), - location: {}, + location: { + page: 1 + }, annotations: [], canAnnotate: true }); - pointDialog.setup([]); - pointDialog.element.style.width = '282px'; + dialog.setup([]); + dialog.element.style.width = '282px'; }); afterEach(() => { sandbox.verifyAndRestore(); - if (typeof pointDialog.destroy === 'function') { - pointDialog.destroy(); - pointDialog = null; + if (typeof dialog.destroy === 'function') { + dialog.destroy(); + dialog = null; } }); @@ -38,7 +40,7 @@ describe('lib/annotations/image/ImagePointDialog', () => { sandbox.stub(annotatorUtil, 'repositionCaret'); sandbox.stub(annotatorUtil, 'showElement'); - pointDialog.position(); + dialog.position(); expect(imageAnnotatorUtil.getBrowserCoordinatesFromLocation).to.have.been.called; expect(annotatorUtil.repositionCaret).to.have.been.called; diff --git a/src/lib/annotations/image/__tests__/ImagePointThread-test.html b/src/lib/annotations/image/__tests__/ImagePointThread-test.html index e3f72d217..26005b1ee 100644 --- a/src/lib/annotations/image/__tests__/ImagePointThread-test.html +++ b/src/lib/annotations/image/__tests__/ImagePointThread-test.html @@ -1,4 +1,4 @@ -
+
diff --git a/src/lib/annotations/image/__tests__/ImagePointThread-test.js b/src/lib/annotations/image/__tests__/ImagePointThread-test.js index 37f03d6e4..c227d467b 100644 --- a/src/lib/annotations/image/__tests__/ImagePointThread-test.js +++ b/src/lib/annotations/image/__tests__/ImagePointThread-test.js @@ -5,7 +5,7 @@ import * as annotatorUtil from '../../annotatorUtil'; import { STATES } from '../../annotationConstants'; import * as imageAnnotatorUtil from '../imageAnnotatorUtil'; -let pointThread; +let thread; const sandbox = sinon.sandbox.create(); describe('lib/annotations/image/ImagePointThread', () => { @@ -16,7 +16,7 @@ describe('lib/annotations/image/ImagePointThread', () => { beforeEach(() => { fixture.load('annotations/image/__tests__/ImagePointThread-test.html'); - pointThread = new ImagePointThread({ + thread = new ImagePointThread({ annotatedElement: document.querySelector('.annotated-element'), annotations: [], annotationService: {}, @@ -35,43 +35,44 @@ describe('lib/annotations/image/ImagePointThread', () => { it('should position and show the thread', () => { sandbox.stub(imageAnnotatorUtil, 'getBrowserCoordinatesFromLocation').returns([1, 2]); sandbox.stub(annotatorUtil, 'showElement'); + sandbox.stub(thread, 'showDialog'); - pointThread.show(); + thread.show(); expect(imageAnnotatorUtil.getBrowserCoordinatesFromLocation).to.have.been.calledWith( - pointThread.location, - pointThread.annotatedElement + thread.location, + thread.annotatedElement ); - expect(annotatorUtil.showElement).to.have.been.calledWith(pointThread.element); + expect(annotatorUtil.showElement).to.have.been.calledWith(thread.element); }); it('should show the dialog if the state is pending', () => { sandbox.stub(imageAnnotatorUtil, 'getBrowserCoordinatesFromLocation').returns([1, 2]); sandbox.stub(annotatorUtil, 'showElement'); - sandbox.stub(pointThread, 'showDialog'); + sandbox.stub(thread, 'showDialog'); - pointThread.state = STATES.pending; - pointThread.show(); + thread.state = STATES.pending; + thread.show(); - expect(pointThread.showDialog).to.have.been.called; + expect(thread.showDialog).to.have.been.called; }); it('should not show the dialog if the state is not pending', () => { sandbox.stub(imageAnnotatorUtil, 'getBrowserCoordinatesFromLocation').returns([1, 2]); sandbox.stub(annotatorUtil, 'showElement'); - sandbox.stub(pointThread, 'showDialog'); + sandbox.stub(thread, 'showDialog'); - pointThread.state = STATES.inactive; - pointThread.show(); + thread.state = STATES.inactive; + thread.show(); - expect(pointThread.showDialog).to.not.have.been.called; + expect(thread.showDialog).to.not.have.been.called; }); }); describe('createDialog', () => { it('should initialize an appropriate dialog', () => { - pointThread.createDialog(); - expect(pointThread.dialog instanceof ImagePointDialog).to.be.true; + thread.createDialog(); + expect(thread.dialog instanceof ImagePointDialog).to.be.true; }); }); }); From af861cfc33c6c4648a2cd31598c22a9dcf06819e Mon Sep 17 00:00:00 2001 From: Sumedha Pramod Date: Thu, 27 Jul 2017 14:12:59 -0700 Subject: [PATCH 07/19] Fix: Don't trigger highlight dialogs while mouse is over another dialog (#242) --- src/lib/annotations/AnnotationDialog.js | 41 ++++++++----------- src/lib/annotations/annotationConstants.js | 10 +++++ src/lib/annotations/doc/DocAnnotator.js | 6 +++ src/lib/annotations/doc/DocHighlightDialog.js | 10 ++--- .../doc/__tests__/docAnnotatorUtil-test.js | 19 ++++++++- src/lib/annotations/doc/docAnnotatorUtil.js | 41 ++++++++++++++++++- 6 files changed, 93 insertions(+), 34 deletions(-) diff --git a/src/lib/annotations/AnnotationDialog.js b/src/lib/annotations/AnnotationDialog.js index e4b689325..8e1adf5b7 100644 --- a/src/lib/annotations/AnnotationDialog.js +++ b/src/lib/annotations/AnnotationDialog.js @@ -17,15 +17,6 @@ const CLASS_ANIMATE_DIALOG = 'bp-animate-show-dialog'; const CLASS_DELETE_CONFIRMATION = 'delete-confirmation'; const CLASS_BUTTON_DELETE_CONFIRM = 'confirm-delete-btn'; -const DATA_TYPE_POST = 'post-annotation-btn'; -const DATA_TYPE_CANCEL = 'cancel-annotation-btn'; -const DATA_TYPE_REPLY_TEXTAREA = 'reply-textarea'; -const DATA_TYPE_CANCEL_REPLY = 'cancel-reply-btn'; -const DATA_TYPE_POST_REPLY = 'post-reply-btn'; -const DATA_TYPE_DELETE = 'delete-btn'; -const DATA_TYPE_CANCEL_DELETE = 'cancel-delete-btn'; -const DATA_TYPE_CONFIRM_DELETE = 'confirm-delete-btn'; - @autobind class AnnotationDialog extends EventEmitter { //-------------------------------------------------------------------------- @@ -409,11 +400,11 @@ class AnnotationDialog extends EventEmitter { switch (dataType) { // Clicking 'Post' button to create an annotation - case DATA_TYPE_POST: + case constants.DATA_TYPE_POST: this.postAnnotation(); break; // Clicking 'Cancel' button to cancel the annotation - case DATA_TYPE_CANCEL: + case constants.DATA_TYPE_CANCEL: if (this.isMobile) { // Hide mobile dialog without destroying the thread this.hideMobileDialog(); @@ -425,27 +416,27 @@ class AnnotationDialog extends EventEmitter { this.deactivateReply(true); break; // Clicking inside reply text area - case DATA_TYPE_REPLY_TEXTAREA: + case constants.DATA_TYPE_REPLY_TEXTAREA: this.activateReply(); break; // Canceling a reply - case DATA_TYPE_CANCEL_REPLY: + case constants.DATA_TYPE_CANCEL_REPLY: this.deactivateReply(true); break; // Clicking 'Post' button to create a reply annotation - case DATA_TYPE_POST_REPLY: + case constants.DATA_TYPE_POST_REPLY: this.postReply(); break; // Clicking trash icon to initiate deletion - case DATA_TYPE_DELETE: + case constants.DATA_TYPE_DELETE: this.showDeleteConfirmation(annotationID); break; // Clicking 'Cancel' button to cancel deletion - case DATA_TYPE_CANCEL_DELETE: + case constants.DATA_TYPE_CANCEL_DELETE: this.hideDeleteConfirmation(annotationID); break; // Clicking 'Delete' button to confirm deletion - case DATA_TYPE_CONFIRM_DELETE: { + case constants.DATA_TYPE_CONFIRM_DELETE: { this.deleteAnnotation(annotationID); break; } @@ -500,7 +491,7 @@ class AnnotationDialog extends EventEmitter {
${text}
@@ -508,10 +499,10 @@ class AnnotationDialog extends EventEmitter { ${__('annotation_delete_confirmation_message')}
- -
@@ -666,10 +657,10 @@ class AnnotationDialog extends EventEmitter {
- -
@@ -680,12 +671,12 @@ class AnnotationDialog extends EventEmitter { + )}" data-type="${constants.DATA_TYPE_REPLY_TEXTAREA}">
- -
diff --git a/src/lib/annotations/annotationConstants.js b/src/lib/annotations/annotationConstants.js index fc79ed8ef..0785b6065 100644 --- a/src/lib/annotations/annotationConstants.js +++ b/src/lib/annotations/annotationConstants.js @@ -25,6 +25,16 @@ export const CLASS_ANNOTATION_BUTTON_DRAW_ENTER = 'bp-btn-annotate-draw-enter'; export const DATA_TYPE_ANNOTATION_DIALOG = 'annotation-dialog'; export const DATA_TYPE_ANNOTATION_INDICATOR = 'annotation-indicator'; +export const DATA_TYPE_HIGHLIGHT = 'highlight-btn'; +export const DATA_TYPE_ADD_HIGHLIGHT_COMMENT = 'add-highlight-comment-btn'; +export const DATA_TYPE_POST = 'post-annotation-btn'; +export const DATA_TYPE_CANCEL = 'cancel-annotation-btn'; +export const DATA_TYPE_REPLY_TEXTAREA = 'reply-textarea'; +export const DATA_TYPE_CANCEL_REPLY = 'cancel-reply-btn'; +export const DATA_TYPE_POST_REPLY = 'post-reply-btn'; +export const DATA_TYPE_DELETE = 'delete-btn'; +export const DATA_TYPE_CANCEL_DELETE = 'cancel-delete-btn'; +export const DATA_TYPE_CONFIRM_DELETE = 'confirm-delete-btn'; export const SECTION_CREATE = '[data-section="create"]'; export const SECTION_SHOW = '[data-section="show"]'; diff --git a/src/lib/annotations/doc/DocAnnotator.js b/src/lib/annotations/doc/DocAnnotator.js index 3dd11cfc4..70421b4ea 100644 --- a/src/lib/annotations/doc/DocAnnotator.js +++ b/src/lib/annotations/doc/DocAnnotator.js @@ -576,7 +576,13 @@ class DocAnnotator extends Annotator { return; } + // Determine if mouse is over any highlight dialog currently + // and ignore hover events of any highlights below const event = this.mouseMoveEvent; + if (docAnnotatorUtil.isDialogDataType(event.target)) { + return; + } + this.mouseMoveEvent = null; this.throttleTimer = performance.now(); // Only filter through highlight threads on the current page diff --git a/src/lib/annotations/doc/DocHighlightDialog.js b/src/lib/annotations/doc/DocHighlightDialog.js index 1adc60cf4..ebba86e7d 100644 --- a/src/lib/annotations/doc/DocHighlightDialog.js +++ b/src/lib/annotations/doc/DocHighlightDialog.js @@ -11,8 +11,6 @@ const CLASS_HIGHLIGHT_DIALOG = 'bp-highlight-dialog'; const CLASS_ANNOTATION_HIGHLIGHT_DIALOG = 'bp-annotation-highlight-dialog'; const CLASS_TEXT_HIGHLIGHTED = 'bp-is-text-highlighted'; const CLASS_HIGHLIGHT_LABEL = 'bp-annotation-highlight-label'; -const DATA_TYPE_HIGHLIGHT = 'highlight-btn'; -const DATA_TYPE_ADD_HIGHLIGHT_COMMENT = 'add-highlight-comment-btn'; const HIGHLIGHT_DIALOG_HEIGHT = 38; const PAGE_PADDING_BOTTOM = 15; @@ -330,11 +328,11 @@ class DocHighlightDialog extends AnnotationDialog { switch (dataType) { // Clicking 'Highlight' button to create or remove a highlight - case DATA_TYPE_HIGHLIGHT: + case constants.DATA_TYPE_HIGHLIGHT: this.drawAnnotation(); break; // Clicking 'Highlight' button to create a highlight - case DATA_TYPE_ADD_HIGHLIGHT_COMMENT: + case constants.DATA_TYPE_ADD_HIGHLIGHT_COMMENT: this.emit('annotationdraw'); this.toggleHighlightCommentsReply(false); this.toggleHighlightDialogs(); @@ -481,12 +479,12 @@ class DocHighlightDialog extends AnnotationDialog { diff --git a/src/lib/annotations/doc/__tests__/docAnnotatorUtil-test.js b/src/lib/annotations/doc/__tests__/docAnnotatorUtil-test.js index 1498382bd..52616342f 100644 --- a/src/lib/annotations/doc/__tests__/docAnnotatorUtil-test.js +++ b/src/lib/annotations/doc/__tests__/docAnnotatorUtil-test.js @@ -11,13 +11,16 @@ import { getBrowserCoordinatesFromLocation, getLowerRightCornerOfLastQuadPoint, getContext, - getPageEl + getPageEl, + isDialogDataType } from '../docAnnotatorUtil'; import { SELECTOR_ANNOTATION_DIALOG, SELECTOR_ANNOTATION_CONTAINER, - CLASS_ANNOTATION_DIALOG + CLASS_ANNOTATION_DIALOG, + DATA_TYPE_ANNOTATION_DIALOG } from '../../annotationConstants'; +import * as annotatorUtil from '../../annotatorUtil'; const sandbox = sinon.sandbox.create(); @@ -239,4 +242,16 @@ describe('lib/annotations/doc/docAnnotatorUtil', () => { assert.equal(pageEl, truePageEl); }); }); + + describe('isDialogDataType()', () => { + it('should return true if the mouse event occured in a highlight dialog', () => { + sandbox.stub(annotatorUtil, 'findClosestDataType').returns(DATA_TYPE_ANNOTATION_DIALOG); + expect(isDialogDataType({})).to.be.true; + }); + + it('should return false if the mouse event occured outside a highlight dialog', () => { + sandbox.stub(annotatorUtil, 'findClosestDataType').returns('something'); + expect(isDialogDataType({})).to.be.false; + }); + }); }); diff --git a/src/lib/annotations/doc/docAnnotatorUtil.js b/src/lib/annotations/doc/docAnnotatorUtil.js index 6307c2a05..b0234fc6a 100644 --- a/src/lib/annotations/doc/docAnnotatorUtil.js +++ b/src/lib/annotations/doc/docAnnotatorUtil.js @@ -4,7 +4,19 @@ import { CLASS_ANNOTATION_HIGHLIGHT_DIALOG, SELECTOR_ANNOTATION_CONTAINER, PAGE_PADDING_TOP, - PAGE_PADDING_BOTTOM + PAGE_PADDING_BOTTOM, + DATA_TYPE_ANNOTATION_DIALOG, + DATA_TYPE_ANNOTATION_INDICATOR, + DATA_TYPE_HIGHLIGHT, + DATA_TYPE_ADD_HIGHLIGHT_COMMENT, + DATA_TYPE_POST, + DATA_TYPE_CANCEL, + DATA_TYPE_REPLY_TEXTAREA, + DATA_TYPE_CANCEL_REPLY, + DATA_TYPE_POST_REPLY, + DATA_TYPE_DELETE, + DATA_TYPE_CANCEL_DELETE, + DATA_TYPE_CONFIRM_DELETE } from '../annotationConstants'; const PREVIEW_PRESENTATION_CLASS = 'bp-doc-presentation'; @@ -14,6 +26,21 @@ const PDF_UNIT_TO_CSS_PIXEL = 4 / 3; const CSS_PIXEL_TO_PDF_UNIT = 3 / 4; const HIGHLIGHT_DIALOG_HEIGHT = 48; +const DIALOG_DATATYPES = [ + DATA_TYPE_ANNOTATION_DIALOG, + DATA_TYPE_ANNOTATION_INDICATOR, + DATA_TYPE_HIGHLIGHT, + DATA_TYPE_ADD_HIGHLIGHT_COMMENT, + DATA_TYPE_POST, + DATA_TYPE_CANCEL, + DATA_TYPE_REPLY_TEXTAREA, + DATA_TYPE_CANCEL_REPLY, + DATA_TYPE_POST_REPLY, + DATA_TYPE_DELETE, + DATA_TYPE_CANCEL_DELETE, + DATA_TYPE_CONFIRM_DELETE +]; + /** * Checks whether this annotator is on a presentation (PPT) or not. * @@ -359,3 +386,15 @@ export function getContext(pageEl, annotationLayerClass, paddingTop, paddingBott export function getPageEl(annotatedEl, pageNum) { return annotatedEl.querySelector(`[data-page-number="${pageNum}"]`); } + +/** + * Checks whether the mouse event occured in a highlight dialog + * + * @private + * @param {HTMLElement} eventTarget mouse event target element + * @return {boolean} Whether mouse event occured in a highlight dialog + */ +export function isDialogDataType(eventTarget) { + const dataType = annotatorUtil.findClosestDataType(eventTarget); + return DIALOG_DATATYPES.indexOf(dataType) !== -1; +} From a2d2985161b92b56544c39820726e67a25636dd1 Mon Sep 17 00:00:00 2001 From: Tony Jin Date: Thu, 27 Jul 2017 18:11:53 -0700 Subject: [PATCH 08/19] Chore: Add github release notes in release script (#255) --- build/release.sh | 6 ++++++ package.json | 1 + src/lib/file.js | 2 +- yarn.lock | 34 ++++++++++++++++++++++++++++++---- 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/build/release.sh b/build/release.sh index 376282981..08dfeba4a 100755 --- a/build/release.sh +++ b/build/release.sh @@ -171,6 +171,12 @@ push_new_release() { # Push to GitHub push_to_github || return 1 + + # Push GitHub release + echo "----------------------------------------------------------------------" + echo "Pushing new GitHub release" + echo "----------------------------------------------------------------------" + ./node_modules/.bin/conventional-github-releaser || return 1 } diff --git a/package.json b/package.json index 97a452dc7..4b05a0941 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "chai-dom": "^1.5.0", "conventional-changelog-cli": "^1.3.2", "conventional-changelog-lint": "^1.1.7", + "conventional-github-releaser": "^1.1.12", "css-loader": "^0.27.3", "cssnano-cli": "^1.0.5", "deepmerge": "^1.5.0", diff --git a/src/lib/file.js b/src/lib/file.js index c8b941ad5..0b9e6bab3 100644 --- a/src/lib/file.js +++ b/src/lib/file.js @@ -99,7 +99,7 @@ export function checkFileValid(file) { } /** - * If the file doens't already have an original representation, creates an + * If the file doesn't already have an original representation, creates an * original representation url from the authenticated download url and adds * it to the file representations * diff --git a/yarn.lock b/yarn.lock index 8ae157b21..758f36035 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1595,7 +1595,7 @@ conventional-changelog-writer@^1.1.0: split "^1.0.0" through2 "^2.0.0" -conventional-changelog@^1.1.4: +conventional-changelog@^1.1.0, conventional-changelog@^1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/conventional-changelog/-/conventional-changelog-1.1.4.tgz#108bc750c2a317e200e2f9b413caaa1f8c7efa3b" dependencies: @@ -1629,6 +1629,22 @@ conventional-commits-parser@1.3.0, conventional-commits-parser@^1.0.0: through2 "^2.0.0" trim-off-newlines "^1.0.0" +conventional-github-releaser@^1.1.12: + version "1.1.12" + resolved "https://registry.yarnpkg.com/conventional-github-releaser/-/conventional-github-releaser-1.1.12.tgz#064db4b5508bacd572ba303be3f37786e4e6465e" + dependencies: + conventional-changelog "^1.1.0" + dateformat "^1.0.11" + git-semver-tags "^1.0.0" + github "^0.2.4" + lodash.merge "^4.0.2" + meow "^3.3.0" + object-assign "^4.0.1" + q "^1.4.1" + semver "^5.0.1" + semver-regex "^1.0.0" + through2 "^2.0.0" + convert-source-map@^1.1.0: version "1.5.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.0.tgz#9acd70851c6d5dfdd93d9282e5edf94a03ff46b5" @@ -2962,7 +2978,7 @@ git-remote-origin-url@^2.0.0: gitconfiglocal "^1.0.0" pify "^2.3.0" -git-semver-tags@^1.2.0: +git-semver-tags@^1.0.0, git-semver-tags@^1.2.0: version "1.2.1" resolved "https://registry.yarnpkg.com/git-semver-tags/-/git-semver-tags-1.2.1.tgz#6ccd2a52e735b736748dc762444fcd9588e27490" dependencies: @@ -2986,6 +3002,12 @@ github-url-from-git@^1.4.0: version "1.5.0" resolved "https://registry.yarnpkg.com/github-url-from-git/-/github-url-from-git-1.5.0.tgz#f985fedcc0a9aa579dc88d7aff068d55cc6251a0" +github@^0.2.4: + version "0.2.4" + resolved "https://registry.yarnpkg.com/github/-/github-0.2.4.tgz#24fa7f0e13fa11b946af91134c51982a91ce538b" + dependencies: + mime "^1.2.11" + glob-base@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" @@ -4164,7 +4186,7 @@ lodash.memoize@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" -lodash.merge@^4.6.0: +lodash.merge@^4.0.2, lodash.merge@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.0.tgz#69884ba144ac33fe699737a6086deffadd0f89c5" @@ -4389,7 +4411,7 @@ mime@1.3.4: version "1.3.4" resolved "https://registry.yarnpkg.com/mime/-/mime-1.3.4.tgz#115f9e3b6b3daf2959983cb38f149a2d40eb5d53" -mime@^1.3.4: +mime@^1.2.11, mime@^1.3.4: version "1.3.6" resolved "https://registry.yarnpkg.com/mime/-/mime-1.3.6.tgz#591d84d3653a6b0b4a3b9df8de5aa8108e72e5e0" @@ -5995,6 +6017,10 @@ scss-tokenizer@^0.2.3: js-base64 "^2.1.8" source-map "^0.4.2" +semver-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/semver-regex/-/semver-regex-1.0.0.tgz#92a4969065f9c70c694753d55248fc68f8f652c9" + "semver@2 || 3 || 4 || 5", semver@^5.0.1, semver@^5.3.0, semver@~5.3.0: version "5.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" From fde58d7a8619139f0d55dd37548cd9390f11dcf6 Mon Sep 17 00:00:00 2001 From: Tony Jin Date: Thu, 27 Jul 2017 18:42:48 -0700 Subject: [PATCH 09/19] Release: 1.3.0 --- CHANGELOG.md | 18 ++++++++++++++++++ README.md | 12 ++++++------ package.json | 2 +- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61a74d9bf..2e0da6d0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,21 @@ + +# 1.3.0 (2017-07-28) + +* Chore: Add github release notes in release script (#255) ([a2d2985](https://github.com/box/box-content-preview/commit/a2d2985)) +* Chore: Default single page images to page 1 for annotations (#249) ([6080055](https://github.com/box/box-content-preview/commit/6080055)) +* Chore: Modify patch release script (#250) ([afc51d3](https://github.com/box/box-content-preview/commit/afc51d3)) +* Chore: Renaming AnnotationThread.thread to AnnotationThread.threadNumber (#241) ([66b1d7c](https://github.com/box/box-content-preview/commit/66b1d7c)) +* Chore: Switch to git-based changelog generator (#252) ([35994b6](https://github.com/box/box-content-preview/commit/35994b6)) +* Chore: Update patch release script (#251) ([f0fa0cf](https://github.com/box/box-content-preview/commit/f0fa0cf)) +* Fix: Add clickHandlers back for all enabled annotation modes (#248) ([b3dd251](https://github.com/box/box-content-preview/commit/b3dd251)) +* Fix: Don't trigger highlight dialogs while mouse is over another dialog (#242) ([af861cf](https://github.com/box/box-content-preview/commit/af861cf)) +* Fix: Fix media query so 3D settings pullup is never truncated (#253) ([1ee02fe](https://github.com/box/box-content-preview/commit/1ee02fe)), closes [#253](https://github.com/box/box-content-preview/issues/253) +* Fix: Fix release script ([499c06b](https://github.com/box/box-content-preview/commit/499c06b)) +* Fix: Hide filmstrip when controls hide (#239) ([0ba7804](https://github.com/box/box-content-preview/commit/0ba7804)) +* Fix: Typo in release script ([01cdf3c](https://github.com/box/box-content-preview/commit/01cdf3c)) + + + # 1.2.0 (2017-07-25) diff --git a/README.md b/README.md index 27cb7813e..afc6b16e4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ [![Project Status](https://img.shields.io/badge/status-active-brightgreen.svg?style=flat-square)](http://opensource.box.com/badges/) [![Styled With Prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) [![build status](https://img.shields.io/travis/box/box-content-preview/master.svg?style=flat-square)](https://travis-ci.org/box/box-content-preview) -[![version](https://img.shields.io/badge/version-v1.2.0-blue.svg?style=flat-square)](https://github.com/box/box-content-preview) +[![version](https://img.shields.io/badge/version-v1.3.0-blue.svg?style=flat-square)](https://github.com/box/box-content-preview) [![npm version](https://img.shields.io/npm/v/box-ui-elements.svg?style=flat-square)](https://www.npmjs.com/package/box-ui-elements) [Box Content Preview](https://docs.box.com/docs/box-content-preview) @@ -19,11 +19,11 @@ If you are using Internet Explorer 11, which doesn't natively support promises, Current Version --------------- -* Version: v1.2.0 +* Version: v1.3.0 * Locale: en-US -https://cdn01.boxcdn.net/platform/preview/1.2.0/en-US/preview.js -https://cdn01.boxcdn.net/platform/preview/1.2.0/en-US/preview.css +https://cdn01.boxcdn.net/platform/preview/1.3.0/en-US/preview.js +https://cdn01.boxcdn.net/platform/preview/1.3.0/en-US/preview.css Supported Locales ----------------- @@ -53,8 +53,8 @@ You can self-host the Box Content Preview UI Element or reference the versions a - - + +
diff --git a/package.json b/package.json index 4b05a0941..8f1d6a57b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "box-content-preview", - "version": "1.2.0", + "version": "1.3.0", "description": "Box Content Preview UI Element", "author": "Box (https://www.box.com/)", "license": "SEE LICENSE IN LICENSE", From d115c1cbf9ebd8727926919208fe70e7f5df5df5 Mon Sep 17 00:00:00 2001 From: Tony Jin Date: Thu, 27 Jul 2017 18:44:44 -0700 Subject: [PATCH 10/19] Fix: Tweak release script Remove || return 1 after pushing Github release since valid output can trigger the error case --- build/release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/release.sh b/build/release.sh index 08dfeba4a..d691c2db4 100755 --- a/build/release.sh +++ b/build/release.sh @@ -176,7 +176,7 @@ push_new_release() { echo "----------------------------------------------------------------------" echo "Pushing new GitHub release" echo "----------------------------------------------------------------------" - ./node_modules/.bin/conventional-github-releaser || return 1 + ./node_modules/.bin/conventional-github-releaser } From fc25534e32eeff22c7c0be7a6505c64564adbec4 Mon Sep 17 00:00:00 2001 From: MinhHNguyen Date: Fri, 28 Jul 2017 16:43:31 -0700 Subject: [PATCH 11/19] Fix: Load annotator with the correct initial scale (#256) * Fix: annotator is now loaded with the correct initial scale * Fix: update annotator tests for constructor change * Update: remove chaining call * Update: initial scale can be passed in as a parameter in init --- src/lib/annotations/Annotator.js | 6 ++++-- src/lib/annotations/__tests__/Annotator-test.js | 6 ++++-- src/lib/annotations/doc/DocAnnotator.js | 4 ++-- src/lib/viewers/BaseViewer.js | 7 +++++-- src/lib/viewers/__tests__/BaseViewer-test.js | 6 ++++-- src/lib/viewers/doc/DocBaseViewer.js | 3 ++- src/lib/viewers/doc/__tests__/DocBaseViewer-test.js | 3 ++- 7 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/lib/annotations/Annotator.js b/src/lib/annotations/Annotator.js index 060ee901f..e8e8973d0 100644 --- a/src/lib/annotations/Annotator.js +++ b/src/lib/annotations/Annotator.js @@ -86,9 +86,10 @@ class Annotator extends EventEmitter { /** * Initializes annotator. * + * @param {number} [initialScale] - The initial scale factor to render the annotations * @return {void} */ - init() { + init(initialScale = 1) { this.annotatedElement = this.getAnnotatedEl(this.container); this.notification = new Notification(this.annotatedElement); @@ -106,7 +107,8 @@ class Annotator extends EventEmitter { this.setupMobileDialog(); } - this.setScale(1); + const scale = initialScale; + this.setScale(scale); this.setupAnnotations(); this.showAnnotations(); } diff --git a/src/lib/annotations/__tests__/Annotator-test.js b/src/lib/annotations/__tests__/Annotator-test.js index fe8d45c92..4d6ece2af 100644 --- a/src/lib/annotations/__tests__/Annotator-test.js +++ b/src/lib/annotations/__tests__/Annotator-test.js @@ -96,6 +96,7 @@ describe('lib/annotations/Annotator', () => { beforeEach(() => { const annotatedEl = document.querySelector('.annotated-element'); sandbox.stub(annotator, 'getAnnotatedEl').returns(annotatedEl); + annotator.annotatedElement = annotatedEl; stubs.scale = sandbox.stub(annotator, 'setScale'); stubs.setup = sandbox.stub(annotator, 'setupAnnotations'); @@ -105,8 +106,8 @@ describe('lib/annotations/Annotator', () => { }); it('should set scale and setup annotations', () => { - annotator.init(); - expect(stubs.scale).to.be.called; + annotator.init(5); + expect(stubs.scale).to.be.calledWith(5); expect(stubs.setup).to.be.called; expect(stubs.show).to.be.called; expect(annotator.annotationService).to.not.be.null; @@ -161,6 +162,7 @@ describe('lib/annotations/Annotator', () => { describe('once annotator is initialized', () => { beforeEach(() => { const annotatedEl = document.querySelector('.annotated-element'); + annotator.annotatedElement = annotatedEl; sandbox.stub(annotator, 'getAnnotatedEl').returns(annotatedEl); sandbox.stub(annotator, 'setupAnnotations'); sandbox.stub(annotator, 'showAnnotations'); diff --git a/src/lib/annotations/doc/DocAnnotator.js b/src/lib/annotations/doc/DocAnnotator.js index 70421b4ea..88d8e6f06 100644 --- a/src/lib/annotations/doc/DocAnnotator.js +++ b/src/lib/annotations/doc/DocAnnotator.js @@ -296,7 +296,7 @@ class DocAnnotator extends Annotator { } else if (type === TYPES.point) { thread = new DocPointThread(threadParams); } else { - throw new Error(`DocAnnotator: Unknown Annotation Type: ${type}`); + throw new Error(`Unhandled document annotation type: ${type}`); } this.addThreadToMap(thread); @@ -576,7 +576,7 @@ class DocAnnotator extends Annotator { return; } - // Determine if mouse is over any highlight dialog currently + // Determine if mouse is over any highlight dialog // and ignore hover events of any highlights below const event = this.mouseMoveEvent; if (docAnnotatorUtil.isDialogDataType(event.target)) { diff --git a/src/lib/viewers/BaseViewer.js b/src/lib/viewers/BaseViewer.js index 25d0041d4..7b4955688 100644 --- a/src/lib/viewers/BaseViewer.js +++ b/src/lib/viewers/BaseViewer.js @@ -344,7 +344,9 @@ class BaseViewer extends EventEmitter { // Add a resize handler for the window document.defaultView.addEventListener('resize', this.debouncedResizeHandler); - this.addListener('load', () => { + this.addListener('load', (event) => { + ({ scale: this.scale = 1 } = event); + if (this.annotationsPromise) { this.annotationsPromise.then(this.loadAnnotator); } @@ -653,7 +655,8 @@ class BaseViewer extends EventEmitter { locale: location.locale, previewUI: this.previewUI }); - this.annotator.init(); + + this.annotator.init(this.scale); // Disables controls during point annotation mode this.annotator.addListener('annotationmodeenter', this.disableViewerControls); diff --git a/src/lib/viewers/__tests__/BaseViewer-test.js b/src/lib/viewers/__tests__/BaseViewer-test.js index cf5e54a47..1b131bb02 100644 --- a/src/lib/viewers/__tests__/BaseViewer-test.js +++ b/src/lib/viewers/__tests__/BaseViewer-test.js @@ -744,9 +744,11 @@ describe('lib/viewers/BaseViewer', () => { } }; base.addListener = sandbox.stub(); + base.scale = 1.5; base.annotator = { init: sandbox.stub(), - addListener: sandbox.stub() + addListener: sandbox.stub(), + setScale: sandbox.stub() }; base.annotatorConf = { CONSTRUCTOR: sandbox.stub().returns(base.annotator) @@ -754,7 +756,7 @@ describe('lib/viewers/BaseViewer', () => { base.initAnnotations(); }); it('should initialize the annotator', () => { - expect(base.annotator.init).to.be.called; + expect(base.annotator.init).to.be.calledWith(1.5); expect(base.annotator.addListener).to.be.calledWith('annotationmodeenter', sinon.match.func); expect(base.annotator.addListener).to.be.calledWith('annotationmodeexit', sinon.match.func); expect(base.annotator.addListener).to.be.calledWith('annotationsfetched', sinon.match.func); diff --git a/src/lib/viewers/doc/DocBaseViewer.js b/src/lib/viewers/doc/DocBaseViewer.js index 495f0bc96..b4dc9e77d 100644 --- a/src/lib/viewers/doc/DocBaseViewer.js +++ b/src/lib/viewers/doc/DocBaseViewer.js @@ -998,7 +998,8 @@ class DocBaseViewer extends BaseViewer { this.loaded = true; this.emit('load', { numPages: this.pdfViewer.pagesCount, - endProgress: false // Indicate that viewer will end progress later + endProgress: false, // Indicate that viewer will end progress later + scale: this.pdfViewer.currentScale }); } } diff --git a/src/lib/viewers/doc/__tests__/DocBaseViewer-test.js b/src/lib/viewers/doc/__tests__/DocBaseViewer-test.js index a0d52ce55..75398f203 100644 --- a/src/lib/viewers/doc/__tests__/DocBaseViewer-test.js +++ b/src/lib/viewers/doc/__tests__/DocBaseViewer-test.js @@ -1436,7 +1436,8 @@ describe('src/lib/viewers/doc/DocBaseViewer', () => { docBase.pagesinitHandler(); expect(stubs.emit).to.be.calledWith('load', { endProgress: false, - numPages: 5 + numPages: 5, + scale: sinon.match.any }); expect(docBase.loaded).to.be.truthy; }); From b7cde84684f55db116304b2cfac705121e9148c8 Mon Sep 17 00:00:00 2001 From: Sumedha Pramod Date: Fri, 28 Jul 2017 17:02:57 -0700 Subject: [PATCH 12/19] Chore: Removing initAnnotations() from DocBaseViewer (#259) --- src/lib/viewers/doc/DocBaseViewer.js | 16 ++++---------- .../doc/__tests__/DocBaseViewer-test.js | 21 ++----------------- 2 files changed, 6 insertions(+), 31 deletions(-) diff --git a/src/lib/viewers/doc/DocBaseViewer.js b/src/lib/viewers/doc/DocBaseViewer.js index b4dc9e77d..816b69373 100644 --- a/src/lib/viewers/doc/DocBaseViewer.js +++ b/src/lib/viewers/doc/DocBaseViewer.js @@ -651,18 +651,7 @@ class DocBaseViewer extends BaseViewer { } /** - * Initializes annotations. - * - * @protected - * @return {void} - */ - initAnnotations() { - super.initAnnotations(); - this.setupPageIds(); - } - - /** - * Add page IDs to each page since annotations explicitly needs IDs per page (rangy). + * Add page IDs to each page * * @private * @return {void} @@ -1001,6 +990,9 @@ class DocBaseViewer extends BaseViewer { endProgress: false, // Indicate that viewer will end progress later scale: this.pdfViewer.currentScale }); + + // Add page IDs to each page after page structure is available + this.setupPageIds(); } } diff --git a/src/lib/viewers/doc/__tests__/DocBaseViewer-test.js b/src/lib/viewers/doc/__tests__/DocBaseViewer-test.js index 75398f203..2a84f3100 100644 --- a/src/lib/viewers/doc/__tests__/DocBaseViewer-test.js +++ b/src/lib/viewers/doc/__tests__/DocBaseViewer-test.js @@ -1083,25 +1083,6 @@ describe('src/lib/viewers/doc/DocBaseViewer', () => { }); }); - describe('initAnnotations()', () => { - const initFunc = BaseViewer.prototype.initAnnotations; - - afterEach(() => { - Object.defineProperty(BaseViewer.prototype, 'initAnnotations', { value: initFunc }); - }); - - it('should set up page IDs and initialize the annotator', () => { - docBase.pdfViewer = { - currentScale: 1 - }; - sandbox.stub(docBase, 'setupPageIds'); - Object.defineProperty(BaseViewer.prototype, 'initAnnotations', { value: sandbox.mock() }); - - docBase.initAnnotations(); - expect(docBase.setupPageIds).to.be.called; - }); - }); - describe('setupPageIds()', () => { it('should add page IDs', () => { const pageEl = document.createElement('div'); @@ -1412,6 +1393,7 @@ describe('src/lib/viewers/doc/DocBaseViewer', () => { stubs.setPage = sandbox.stub(docBase, 'setPage'); stubs.getCachedPage = sandbox.stub(docBase, 'getCachedPage'); stubs.emit = sandbox.stub(docBase, 'emit'); + stubs.setupPages = sandbox.stub(docBase, 'setupPageIds'); }); it('should load UI, check the pagination buttons, set the page, and make document scrollable', () => { @@ -1424,6 +1406,7 @@ describe('src/lib/viewers/doc/DocBaseViewer', () => { expect(stubs.checkPaginationButtons).to.be.called; expect(stubs.setPage).to.be.called; expect(docBase.docEl).to.have.class('bp-is-scrollable'); + expect(stubs.setupPages).to.be.called; }); it('should broadcast that the preview is loaded if it hasn\'t already', () => { From 41b1af0aeeebfd56fac8af8e074aa3284d8b8b89 Mon Sep 17 00:00:00 2001 From: MinhHNguyen Date: Fri, 28 Jul 2017 22:43:50 -0700 Subject: [PATCH 13/19] Fix: Emit scale does not always pass events (#261) * Fix: fancy destructure no bueno * Update: async unit tests * Update: pr feedback --- src/lib/viewers/BaseViewer.js | 4 ++- src/lib/viewers/__tests__/BaseViewer-test.js | 34 ++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/lib/viewers/BaseViewer.js b/src/lib/viewers/BaseViewer.js index 7b4955688..bb64723f5 100644 --- a/src/lib/viewers/BaseViewer.js +++ b/src/lib/viewers/BaseViewer.js @@ -345,7 +345,9 @@ class BaseViewer extends EventEmitter { document.defaultView.addEventListener('resize', this.debouncedResizeHandler); this.addListener('load', (event) => { - ({ scale: this.scale = 1 } = event); + if (event && event.scale) { + this.scale = event.scale; + } if (this.annotationsPromise) { this.annotationsPromise.then(this.loadAnnotator); diff --git a/src/lib/viewers/__tests__/BaseViewer-test.js b/src/lib/viewers/__tests__/BaseViewer-test.js index 1b131bb02..39ce8cc41 100644 --- a/src/lib/viewers/__tests__/BaseViewer-test.js +++ b/src/lib/viewers/__tests__/BaseViewer-test.js @@ -278,6 +278,40 @@ describe('lib/viewers/BaseViewer', () => { expect(document.defaultView.addEventListener).to.be.calledWith('resize', base.debouncedResizeHandler); expect(base.addListener).to.be.calledWith('load', sinon.match.func); }); + + it('should load the annotator when load is emitted with scale', (done) => { + sandbox.stub(fullscreen, 'addListener'); + sandbox.stub(document.defaultView, 'addEventListener'); + sandbox.stub(base, 'loadAnnotator'); + base.annotationsPromise = { + then: (arg) => { + expect(base.scale).to.equal(1.5); + expect(arg).to.equal(base.loadAnnotator); + done(); + } + }; + + base.addCommonListeners(); + expect(base.scale).to.equal(1); + base.emit('load', { + scale: 1.5 + }); + }); + + it('should load the annotator when load is emitted without an event', (done) => { + sandbox.stub(fullscreen, 'addListener'); + sandbox.stub(document.defaultView, 'addEventListener'); + sandbox.stub(base, 'loadAnnotator'); + base.annotationsPromise = { + then: (arg) => { + expect(arg).to.equal(base.loadAnnotator); + done(); + } + }; + + base.addCommonListeners(); + base.emit('load'); + }); }); describe('toggleFullscreen()', () => { From b8c776d452adba6bb389f06959d8a677653e8d55 Mon Sep 17 00:00:00 2001 From: Jeremy Press Date: Mon, 31 Jul 2017 09:50:21 -0700 Subject: [PATCH 14/19] New: Add pseudo fullscreen to mobile Safari (#246) * New: Add pseudo fullscreen to mobile Safari --- src/lib/Controls.scss | 1 + src/lib/_common.scss | 11 +++++++ src/lib/constants.js | 1 + src/lib/viewers/BaseViewer.js | 28 +++++++++++------- src/lib/viewers/__tests__/BaseViewer-test.js | 30 ++++++++++++++++++++ src/lib/viewers/doc/DocBaseViewer.js | 2 +- 6 files changed, 62 insertions(+), 11 deletions(-) diff --git a/src/lib/Controls.scss b/src/lib/Controls.scss index c95334896..2ea3831c0 100644 --- a/src/lib/Controls.scss +++ b/src/lib/Controls.scss @@ -41,6 +41,7 @@ opacity: .7; outline: 0; padding: 0; + // disables non-standard gestures such as double-tap to zoom touch-action: manipulation; user-select: none; width: 48px; diff --git a/src/lib/_common.scss b/src/lib/_common.scss index 33946fe53..462eda12c 100644 --- a/src/lib/_common.scss +++ b/src/lib/_common.scss @@ -25,6 +25,8 @@ $header-height: 48px; overflow: hidden; padding: 0; position: relative; + // disables non-standard gestures such as double-tap to zoom + touch-action: manipulation; width: 100%; a { @@ -131,6 +133,15 @@ $header-height: 48px; right: 0; top: 0; + // Pseudo fullscreen for iOS Safari which doesn't support the fullscreen API + &.bp-fullscreen-unsupported { + bottom: 0; + left: 0; + position: fixed; + right: 0; + top: 0; + } + &.bp-dark { background-color: $black; } diff --git a/src/lib/constants.js b/src/lib/constants.js index 3e234eac2..77b16d700 100644 --- a/src/lib/constants.js +++ b/src/lib/constants.js @@ -29,6 +29,7 @@ export const CLASS_BOX_PREVIEW_TOGGLE_OVERLAY = 'bp-toggle-overlay'; export const CLASS_BOX_PREVIEW_THEME_DARK = 'bp-theme-dark'; export const CLASS_ELEM_KEYBOARD_FOCUS = 'bp-has-keyboard-focus'; export const CLASS_FULLSCREEN = 'bp-is-fullscreen'; +export const CLASS_FULLSCREEN_UNSUPPORTED = 'bp-fullscreen-unsupported'; export const CLASS_INVISIBLE = 'bp-is-invisible'; export const CLASS_IS_VISIBLE = 'bp-is-visible'; export const CLASS_IS_SCROLLABLE = 'bp-is-scrollable'; diff --git a/src/lib/viewers/BaseViewer.js b/src/lib/viewers/BaseViewer.js index bb64723f5..b29692946 100644 --- a/src/lib/viewers/BaseViewer.js +++ b/src/lib/viewers/BaseViewer.js @@ -17,6 +17,7 @@ import Browser from '../Browser'; import { PERMISSION_ANNOTATE, CLASS_FULLSCREEN, + CLASS_FULLSCREEN_UNSUPPORTED, CLASS_HIDDEN, CLASS_BOX_PREVIEW_MOBILE, SELECTOR_BOX_PREVIEW, @@ -329,17 +330,9 @@ class BaseViewer extends EventEmitter { */ addCommonListeners() { // Attach common full screen event listeners - /* istanbul ignore next */ - fullscreen.addListener('enter', () => { - this.containerEl.classList.add(CLASS_FULLSCREEN); - this.resize(); - }); + fullscreen.addListener('enter', this.onFullscreenToggled); - /* istanbul ignore next */ - fullscreen.addListener('exit', () => { - this.containerEl.classList.remove(CLASS_FULLSCREEN); - this.resize(); - }); + fullscreen.addListener('exit', this.onFullscreenToggled); // Add a resize handler for the window document.defaultView.addEventListener('resize', this.debouncedResizeHandler); @@ -357,6 +350,7 @@ class BaseViewer extends EventEmitter { /** * Enters or exits fullscreen + * * @protected * @return {void} */ @@ -364,6 +358,20 @@ class BaseViewer extends EventEmitter { fullscreen.toggle(this.containerEl); } + /** + * Applies appropriate styles and resizes the document depending on fullscreen state + * + * @return {void} + */ + onFullscreenToggled() { + this.containerEl.classList.toggle(CLASS_FULLSCREEN); + if (!fullscreen.isSupported()) { + this.containerEl.classList.toggle(CLASS_FULLSCREEN_UNSUPPORTED); + } + + this.resize(); + } + /** * Resizing logic * diff --git a/src/lib/viewers/__tests__/BaseViewer-test.js b/src/lib/viewers/__tests__/BaseViewer-test.js index 39ce8cc41..a3f132fa9 100644 --- a/src/lib/viewers/__tests__/BaseViewer-test.js +++ b/src/lib/viewers/__tests__/BaseViewer-test.js @@ -322,6 +322,36 @@ describe('lib/viewers/BaseViewer', () => { }); }); + describe('onFullscreenToggled()', () => { + beforeEach(() => { + base.containerEl = document.createElement('div'); + sandbox.stub(fullscreen, 'isSupported').returns(false); + sandbox.stub(base, 'resize'); + + }); + + it('should toggle the fullscreen class', () => { + base.onFullscreenToggled(); + expect(base.containerEl.classList.contains(constants.CLASS_FULLSCREEN)).to.be.true; + + base.onFullscreenToggled(); + expect(base.containerEl.classList.contains(constants.CLASS_FULLSCREEN)).to.be.false; + }); + + it('should toggle the unsupported class if the browser does not support the fullscreen API', () => { + base.onFullscreenToggled(); + expect(base.containerEl.classList.contains(constants.CLASS_FULLSCREEN_UNSUPPORTED)).to.be.true; + + base.onFullscreenToggled(); + expect(base.containerEl.classList.contains(constants.CLASS_FULLSCREEN_UNSUPPORTED)).to.be.false; + }); + + it('should resize the viewer', () => { + base.onFullscreenToggled(); + expect(base.resize).to.be.called; + }); + }); + describe('resize()', () => { it('should broadcast resize event', () => { sandbox.stub(base, 'emit'); diff --git a/src/lib/viewers/doc/DocBaseViewer.js b/src/lib/viewers/doc/DocBaseViewer.js index 816b69373..28e4dcbcf 100644 --- a/src/lib/viewers/doc/DocBaseViewer.js +++ b/src/lib/viewers/doc/DocBaseViewer.js @@ -361,7 +361,7 @@ class DocBaseViewer extends BaseViewer { const previousPageButtonEl = this.containerEl.querySelector('.bp-previous-page'); const nextPageButtonEl = this.containerEl.querySelector('.bp-next-page'); - // Safari disables keyboard input in fullscreen + // Safari disables keyboard input in fullscreen before Safari 10.1 const isSafariFullscreen = Browser.getName() === 'Safari' && fullscreen.isFullscreen(this.containerEl); // Disable page number selector if there is only one page or less From 4de12596b57e87a369b92a739bbf61c0d6ff906a Mon Sep 17 00:00:00 2001 From: Jeremy Press Date: Mon, 31 Jul 2017 10:59:28 -0700 Subject: [PATCH 15/19] New: add annotation-noicon to allow native PDF annotations to be shown (#258) --- src/lib/viewers/doc/DocBaseViewer.js | 1 + src/third-party/doc/0.130.0/images/annotation-noicon.svg | 1 + 2 files changed, 2 insertions(+) create mode 100644 src/third-party/doc/0.130.0/images/annotation-noicon.svg diff --git a/src/lib/viewers/doc/DocBaseViewer.js b/src/lib/viewers/doc/DocBaseViewer.js index 28e4dcbcf..70cc1a89d 100644 --- a/src/lib/viewers/doc/DocBaseViewer.js +++ b/src/lib/viewers/doc/DocBaseViewer.js @@ -585,6 +585,7 @@ class DocBaseViewer extends BaseViewer { const { size, extension, watermark_info: watermarkInfo } = file; const assetUrlCreator = createAssetUrlCreator(location); PDFJS.workerSrc = assetUrlCreator(`third-party/doc/${DOC_STATIC_ASSETS_VERSION}/pdf.worker.min.js`); + PDFJS.imageResourcesPath = assetUrlCreator(`third-party/doc/${DOC_STATIC_ASSETS_VERSION}/images/`); PDFJS.cMapUrl = `${location.staticBaseURI}third-party/doc/${DOC_STATIC_ASSETS_VERSION}/cmaps/`; PDFJS.cMapPacked = true; diff --git a/src/third-party/doc/0.130.0/images/annotation-noicon.svg b/src/third-party/doc/0.130.0/images/annotation-noicon.svg new file mode 100644 index 000000000..2a30986be --- /dev/null +++ b/src/third-party/doc/0.130.0/images/annotation-noicon.svg @@ -0,0 +1 @@ + From 9ab6db4c1f5a33d5455126b1472654f529333d0c Mon Sep 17 00:00:00 2001 From: Sumedha Pramod Date: Mon, 31 Jul 2017 15:22:21 -0700 Subject: [PATCH 16/19] Fix: Don't trigger highlight if a new highlight is being created (#265) --- src/lib/annotations/doc/DocAnnotator.js | 11 ++++++++++- .../annotations/doc/__tests__/DocAnnotator-test.js | 14 ++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/lib/annotations/doc/DocAnnotator.js b/src/lib/annotations/doc/DocAnnotator.js index 88d8e6f06..c8f10ab51 100644 --- a/src/lib/annotations/doc/DocAnnotator.js +++ b/src/lib/annotations/doc/DocAnnotator.js @@ -328,6 +328,7 @@ class DocAnnotator extends Annotator { return null; } this.createHighlightDialog.hide(); + this.isCreatingHighlight = false; const location = this.getLocationFromEvent(this.lastHighlightEvent, TYPES.highlight); if (!location) { @@ -576,6 +577,12 @@ class DocAnnotator extends Annotator { return; } + // Determine if user is in the middle of creating a highlight + // annotation and ignore hover events of any highlights below + if (this.isCreatingHighlight) { + return; + } + // Determine if mouse is over any highlight dialog // and ignore hover events of any highlights below const event = this.mouseMoveEvent; @@ -669,6 +676,8 @@ class DocAnnotator extends Annotator { this.highlighter.removeAllHighlights(); } this.createHighlightDialog.hide(); + this.isCreatingHighlight = false; + // Creating highlights is disabled on mobile for now since the // event we would listen to, selectionchange, fires continuously and // is unreliable. If the mouse moved or we double clicked text, @@ -678,7 +687,6 @@ class DocAnnotator extends Annotator { } else { this.highlightClickHandler(event); } - this.isCreatingHighlight = false; } /** @@ -724,6 +732,7 @@ class DocAnnotator extends Annotator { if (!this.isMobile) { this.createHighlightDialog.setPosition(right - pageLeft, bottom - pageTop); } + this.isCreatingHighlight = true; this.lastHighlightEvent = event; } diff --git a/src/lib/annotations/doc/__tests__/DocAnnotator-test.js b/src/lib/annotations/doc/__tests__/DocAnnotator-test.js index a0b68e8f6..d3633e807 100644 --- a/src/lib/annotations/doc/__tests__/DocAnnotator-test.js +++ b/src/lib/annotations/doc/__tests__/DocAnnotator-test.js @@ -694,18 +694,32 @@ describe('lib/annotations/doc/DocAnnotator', () => { stubs.getPageInfo = stubs.getPageInfo.returns({ pageEl: {}, page: 1 }); stubs.getThreads = sandbox.stub(annotator, 'getHighlightThreadsOnPage'); stubs.clock = sinon.useFakeTimers(); + stubs.isDialog = sandbox.stub(docAnnotatorUtil, 'isDialogDataType'); let timer = 0; window.performance = window.performance || { now: () => {} }; sandbox.stub(window.performance, 'now', () => { return (timer += 500); }); + + annotator.isCreatingHighlight = false; }); afterEach(() => { stubs.clock.restore(); }); + it('should not do anything if user is creating a highlight', () => { + stubs.threadMock.expects('onMousemove').returns(false).never(); + stubs.delayMock.expects('onMousemove').returns(true).never(); + stubs.getThreads.returns([stubs.thread, stubs.delayThread]); + annotator.isCreatingHighlight = true; + + annotator.mouseMoveEvent = { clientX: 3, clientY: 3 }; + annotator.onHighlightCheck(); + expect(stubs.isDialog).to.not.be.called; + }); + it('should not add any delayThreads if there are no threads on the current page', () => { stubs.threadMock.expects('onMousemove').returns(false).never(); stubs.delayMock.expects('onMousemove').returns(true).never(); From 249e9f1ce166408f74e79b8b1f3493f77275a4a0 Mon Sep 17 00:00:00 2001 From: Sumedha Pramod Date: Mon, 31 Jul 2017 16:15:47 -0700 Subject: [PATCH 17/19] Chore: Duplicating any util.js methods used into annotatorUtil.js (#260) --- src/lib/annotations/AnnotationDialog.js | 3 +- src/lib/annotations/AnnotationService.js | 2 +- .../__tests__/annotatorUtil-test.js | 154 +++++++++++++++++- src/lib/annotations/annotatorUtil.js | 141 ++++++++++++++++ src/lib/annotations/doc/DocHighlightDialog.js | 7 +- .../doc/__tests__/DocHighlightDialog-test.js | 2 +- 6 files changed, 300 insertions(+), 9 deletions(-) diff --git a/src/lib/annotations/AnnotationDialog.js b/src/lib/annotations/AnnotationDialog.js index 8e1adf5b7..27b22868e 100644 --- a/src/lib/annotations/AnnotationDialog.js +++ b/src/lib/annotations/AnnotationDialog.js @@ -3,7 +3,6 @@ import EventEmitter from 'events'; import * as annotatorUtil from './annotatorUtil'; import * as constants from './annotationConstants'; import { CLASS_ACTIVE, CLASS_HIDDEN } from '../constants'; -import { decodeKeydown } from '../util'; import { ICON_CLOSE, ICON_DELETE } from '../icons/icons'; const CLASS_ANNOTATION_PLAIN_HIGHLIGHT = 'bp-plain-highlight'; @@ -329,7 +328,7 @@ class AnnotationDialog extends EventEmitter { keydownHandler(event) { event.stopPropagation(); - const key = decodeKeydown(event); + const key = annotatorUtil.decodeKeydown(event); if (key === 'Escape') { this.hide(); } else { diff --git a/src/lib/annotations/AnnotationService.js b/src/lib/annotations/AnnotationService.js index a537b1dbc..ce3ceef66 100644 --- a/src/lib/annotations/AnnotationService.js +++ b/src/lib/annotations/AnnotationService.js @@ -2,7 +2,7 @@ import 'whatwg-fetch'; import EventEmitter from 'events'; import autobind from 'autobind-decorator'; import Annotation from './Annotation'; -import { getHeaders } from '../util'; +import { getHeaders } from './annotatorUtil'; const ANONYMOUS_USER = { id: '0', diff --git a/src/lib/annotations/__tests__/annotatorUtil-test.js b/src/lib/annotations/__tests__/annotatorUtil-test.js index b32369fb7..a20385f0b 100644 --- a/src/lib/annotations/__tests__/annotatorUtil-test.js +++ b/src/lib/annotations/__tests__/annotatorUtil-test.js @@ -18,7 +18,10 @@ import { repositionCaret, isPending, validateThreadParams, - eventToLocationHandler + eventToLocationHandler, + decodeKeydown, + getHeaders, + replacePlaceholders } from '../annotatorUtil'; import { STATES, @@ -400,4 +403,153 @@ describe('lib/annotations/annotatorUtil', () => { expect(annotator.isChanged).to.be.true; }); }); + + describe('decodeKeydown()', () => { + it('should return empty when no key', () => { + assert.equal( + decodeKeydown({ + key: '' + }), + '' + ); + }); + it('should return empty when modifier and key are same', () => { + assert.equal( + decodeKeydown({ + key: 'Control', + ctrlKey: true + }), + '' + ); + }); + it('should return correct with ctrl modifier', () => { + assert.equal( + decodeKeydown({ + key: '1', + ctrlKey: true + }), + 'Control+1' + ); + }); + it('should return correct with shift modifier', () => { + assert.equal( + decodeKeydown({ + key: '1', + shiftKey: true + }), + 'Shift+1' + ); + }); + it('should return correct with meta modifier', () => { + assert.equal( + decodeKeydown({ + key: '1', + metaKey: true + }), + 'Meta+1' + ); + }); + it('should return space key', () => { + assert.equal( + decodeKeydown({ + key: ' ' + }), + 'Space' + ); + }); + it('should return right arrow key', () => { + assert.equal( + decodeKeydown({ + key: 'Right' + }), + 'ArrowRight' + ); + }); + it('should return left arrow key', () => { + assert.equal( + decodeKeydown({ + key: 'Left' + }), + 'ArrowLeft' + ); + }); + it('should return up arrow key', () => { + assert.equal( + decodeKeydown({ + key: 'Up' + }), + 'ArrowUp' + ); + }); + it('should return down arrow key', () => { + assert.equal( + decodeKeydown({ + key: 'Down' + }), + 'ArrowDown' + ); + }); + it('should return esc key', () => { + assert.equal( + decodeKeydown({ + key: 'U+001B' + }), + 'Escape' + ); + }); + it('should decode correct UTF8 key', () => { + assert.equal( + decodeKeydown({ + key: 'U+0041' + }), + 'A' + ); + }); + }); + + /* eslint-disable no-undef */ + describe('getHeaders()', () => { + it('should return correct headers', () => { + const sharedLink = 'https://sharename'; + const fooHeader = 'bar'; + const token = 'someToken'; + const headers = getHeaders({ foo: fooHeader }, token, sharedLink); + expect(headers.foo).to.equal(fooHeader); + expect(headers.Authorization).to.equal(`Bearer ${token}`); + expect(headers.BoxApi).to.equal(`shared_link=${sharedLink}`); + expect(headers['X-Box-Client-Name']).to.equal(__NAME__); + expect(headers['X-Box-Client-Version']).to.equal(__VERSION__); + }); + + it('should return correct headers with password', () => { + const headers = getHeaders({ foo: 'bar' }, 'token', 'https://sharename', 'password'); + assert.equal(headers.foo, 'bar'); + assert.equal(headers.Authorization, 'Bearer token'); + assert.equal(headers.BoxApi, 'shared_link=https://sharename&shared_link_password=password'); + assert.equal(headers['X-Box-Client-Name'], __NAME__); + assert.equal(headers['X-Box-Client-Version'], __VERSION__); + }); + }); + + describe('replacePlaceholders()', () => { + it('should replace only the placeholder with the custom value in the given string', () => { + expect(replacePlaceholders('{1} highlighted', ['Bob'])).to.equal('Bob highlighted'); + }); + + it('should replace all placeholders with the custom value in the given string', () => { + expect(replacePlaceholders('{1} highlighted {2}', ['Bob', 'Suzy'])).to.equal('Bob highlighted Suzy'); + }); + + it('should replace only placeholders that have custom value in the given string', () => { + expect(replacePlaceholders('{1} highlighted {2}', ['Bob'])).to.equal('Bob highlighted {2}'); + }); + + it('should respect the order of placeholders when given an arbitrary order', () => { + expect(replacePlaceholders('{2} highlighted {1}', ['Bob', 'Suzy'])).to.equal('Suzy highlighted Bob'); + }); + + it('should replace with the same value if the placeholder is repeated', () => { + expect(replacePlaceholders('{2} highlighted {2}', ['Bob', 'Suzy'])).to.equal('Suzy highlighted Suzy'); + }); + }); }); diff --git a/src/lib/annotations/annotatorUtil.js b/src/lib/annotations/annotatorUtil.js index 1ba94184a..ce4ad0f33 100644 --- a/src/lib/annotations/annotatorUtil.js +++ b/src/lib/annotations/annotatorUtil.js @@ -1,6 +1,14 @@ +import 'whatwg-fetch'; import { CLASS_ACTIVE, CLASS_HIDDEN, CLASS_INVISIBLE } from '../constants'; import { TYPES, SELECTOR_ANNOTATION_CARET, PENDING_STATES } from './annotationConstants'; +const HEADER_CLIENT_NAME = 'X-Box-Client-Name'; +const HEADER_CLIENT_VERSION = 'X-Box-Client-Version'; +/* eslint-disable no-undef */ +const CLIENT_NAME = __NAME__; +const CLIENT_VERSION = __VERSION__; +/* eslint-enable no-undef */ + const AVATAR_COLOR_COUNT = 9; // 9 colors defined in Box React UI avatar code const THREAD_PARAMS = [ 'annotatedElement', @@ -379,3 +387,136 @@ export function eventToLocationHandler(locationFunction, callback) { } }; } + +//------------------------------------------------------------------------------ +// General Util Methods +//------------------------------------------------------------------------------ + +/** + * Function to decode key down events into keys + * + * @param {Event} event - Keydown event + * @return {string} Decoded keydown key + */ +export function decodeKeydown(event) { + let modifier = ''; + + // KeyboardEvent.key is the new spec supported in Chrome, Firefox and IE. + // KeyboardEvent.keyIdentifier is the old spec supported in Safari. + // Priority is given to the new spec. + let key = event.key || event.keyIdentifier || ''; + + // Get the modifiers on their own + if (event.ctrlKey) { + modifier = 'Control'; + } else if (event.shiftKey) { + modifier = 'Shift'; + } else if (event.metaKey) { + modifier = 'Meta'; + } + + // The key and keyIdentifier specs also include modifiers. + // Since we are manually getting the modifiers above we do + // not want to trap them again here. + if (key === modifier) { + key = ''; + } + + // keyIdentifier spec returns UTF8 char codes + // Need to convert them back to ascii. + if (key.indexOf('U+') === 0) { + if (key === 'U+001B') { + key = 'Escape'; + } else { + key = String.fromCharCode(key.replace('U+', '0x')); + } + } + + // If nothing was pressed just return + if (!key) { + return ''; + } + + // Special casing for space bar + if (key === ' ') { + key = 'Space'; + } + + // Edge bug which outputs "Esc" instead of "Escape" + // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/5290772/ + if (key === 'Esc') { + key = 'Escape'; + } + + // keyIdentifier spec does not prefix the word Arrow. + // Newer key spec does it automatically. + if (key === 'Right' || key === 'Left' || key === 'Down' || key === 'Up') { + key = `Arrow${key}`; + } + + if (modifier) { + modifier += '+'; + } + + return modifier + key; +} + +/** + * Builds a list of required XHR headers. + * + * @param {Object} [headers] - Optional headers + * @param {string} [token] - Optional auth token + * @param {string} [sharedLink] - Optional shared link + * @param {string} [password] - Optional shared link password + * @return {Object} Headers + */ +export function getHeaders(headers = {}, token = '', sharedLink = '', password = '') { + /* eslint-disable no-param-reassign */ + if (token) { + headers.Authorization = `Bearer ${token}`; + } + if (sharedLink) { + headers.BoxApi = `shared_link=${sharedLink}`; + + if (password) { + headers.BoxApi = `${headers.BoxApi}&shared_link_password=${password}`; + } + } + + // Following headers are for API analytics + if (CLIENT_NAME) { + headers[HEADER_CLIENT_NAME] = CLIENT_NAME; + } + + if (CLIENT_VERSION) { + headers[HEADER_CLIENT_VERSION] = CLIENT_VERSION; + } + + /* eslint-enable no-param-reassign */ + return headers; +} + +/** + * Replaces variable place holders specified between {} in the string with + * specified custom value. Localizes strings that include variables. + * + * @param {string} string - String to be interpolated + * @param {string[]} placeholderValues - Custom values to replace into string + * @return {string} Properly translated string with replaced custom variable + */ +export function replacePlaceholders(string, placeholderValues) { + const regex = /\{\d+\}/g; + + if (!string || !string.length) { + return string; + } + + return string.replace(regex, (match) => { + // extracting the index that is supposed to replace the matched placeholder + const placeholderIndex = parseInt(match.replace(/^\D+/g, ''), 10) - 1; + + /* eslint-disable no-plusplus */ + return placeholderValues[placeholderIndex] ? placeholderValues[placeholderIndex] : match; + /* eslint-enable no-plusplus */ + }); +} diff --git a/src/lib/annotations/doc/DocHighlightDialog.js b/src/lib/annotations/doc/DocHighlightDialog.js index ebba86e7d..584d122a1 100644 --- a/src/lib/annotations/doc/DocHighlightDialog.js +++ b/src/lib/annotations/doc/DocHighlightDialog.js @@ -3,7 +3,6 @@ import AnnotationDialog from '../AnnotationDialog'; import * as annotatorUtil from '../annotatorUtil'; import * as docAnnotatorUtil from './docAnnotatorUtil'; import { CLASS_HIDDEN, CLASS_ACTIVE } from '../../constants'; -import { replacePlaceholders, decodeKeydown } from '../../util'; import { ICON_HIGHLIGHT, ICON_HIGHLIGHT_COMMENT } from '../../icons/icons'; import * as constants from '../annotationConstants'; @@ -36,7 +35,7 @@ class DocHighlightDialog extends AnnotationDialog { // Will be displayed as '{name} highlighted' if (annotation.text === '' && annotation.user.id !== '0') { const highlightLabelEl = this.highlightDialogEl.querySelector(`.${CLASS_HIGHLIGHT_LABEL}`); - highlightLabelEl.textContent = replacePlaceholders(__('annotation_who_highlighted'), [ + highlightLabelEl.textContent = annotatorUtil.replacePlaceholders(__('annotation_who_highlighted'), [ annotation.user.name ]); annotatorUtil.showElement(highlightLabelEl); @@ -242,7 +241,7 @@ class DocHighlightDialog extends AnnotationDialog { // be 'Some User' if (annotatorUtil.isPlainHighlight(annotations) && annotations[0].user.id !== '0') { const highlightLabelEl = this.highlightDialogEl.querySelector(`.${CLASS_HIGHLIGHT_LABEL}`); - highlightLabelEl.textContent = replacePlaceholders(__('annotation_who_highlighted'), [ + highlightLabelEl.textContent = annotatorUtil.replacePlaceholders(__('annotation_who_highlighted'), [ annotations[0].user.name ]); annotatorUtil.showElement(highlightLabelEl); @@ -309,7 +308,7 @@ class DocHighlightDialog extends AnnotationDialog { */ keydownHandler(event) { event.stopPropagation(); - if (decodeKeydown(event) === 'Enter') { + if (annotatorUtil.decodeKeydown(event) === 'Enter') { this.mousedownHandler(event); } super.keydownHandler(event); diff --git a/src/lib/annotations/doc/__tests__/DocHighlightDialog-test.js b/src/lib/annotations/doc/__tests__/DocHighlightDialog-test.js index c0c99b036..23faf3cd6 100644 --- a/src/lib/annotations/doc/__tests__/DocHighlightDialog-test.js +++ b/src/lib/annotations/doc/__tests__/DocHighlightDialog-test.js @@ -5,7 +5,7 @@ import AnnotationDialog from '../../AnnotationDialog'; import * as annotatorUtil from '../../annotatorUtil'; import * as docAnnotatorUtil from '../docAnnotatorUtil'; import { CLASS_HIDDEN, CLASS_ACTIVE } from '../../../constants'; -import * as util from '../../../util'; +import * as util from '../../annotatorUtil'; import * as constants from '../../annotationConstants'; let dialog; From 2ee12a37cfc9e73803efcf8dfd6c2388e6e133ab Mon Sep 17 00:00:00 2001 From: boxmoji Date: Tue, 1 Aug 2017 08:55:37 -0700 Subject: [PATCH 18/19] Mojito: Update translations (#266) --- src/i18n/en-AU.properties | 40 +++++++++++++++++++-------------------- src/i18n/en-GB.properties | 40 +++++++++++++++++++-------------------- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/i18n/en-AU.properties b/src/i18n/en-AU.properties index 549e83a61..770e65812 100644 --- a/src/i18n/en-AU.properties +++ b/src/i18n/en-AU.properties @@ -5,9 +5,9 @@ zoom_in=Zoom in # Button tooltip for zooming out of a preview zoom_out=Zoom out # Button tooltip for entering a full screen preview -enter_fullscreen=Enter fullscreen +enter_fullscreen=Enter full screen # Button tooltip for exiting a full screen preview -exit_fullscreen=Exit fullscreen +exit_fullscreen=Exit full screen # Button tooltip for going to the previous page in a preview previous_page=Previous page # Input tooltip for navigating to a specific page in a preview @@ -29,31 +29,31 @@ previous_file=Previous file # Accessible text for right navigation arrow that navigates user to next file in collection next_file=Next file # Text shown while preview is loading -loading_preview=Loading Preview... +loading_preview=Loading preview... # Text for download button shown while preview is loading -download_file=Download File +download_file=Download file # Text shown when a text file has been truncated due to size limits. text_truncated=This file has been truncated due to size limits. Please download to view the whole file. # Error messages # Default preview error message -error_default=We're sorry, the preview didn't load. This file type may not be supported. +error_default=Sorry! The preview hasn't loaded. This file type may not be supported. # No permissions preview error message -error_permissions=We're sorry, you don't have permission to preview this file. +error_permissions=Sorry! You don't have permission to preview this file. # Preview refresh error message suggesting refreshing the page as a possible fix -error_refresh=We're sorry, the preview didn't load. Please refresh the page. +error_refresh=Sorry! The preview hasn't loaded. Please refresh the page. # Preview rate limit error suggesting waiting a few minutes to avoid rate limit -error_rate_limit=We're sorry, the preview didn't load because your request was rate limited. Please wait a few minutes and try again. +error_rate_limit=Sorry! The preview hasn't loaded because your request has been rate limited. Please wait a few minutes and try again. # Preview re-upload error message suggesting re-uploading the file or contacting support as a possible fix -error_reupload=We're sorry, the preview didn't load. Please re-upload the file or contact Box support. +error_reupload=Sorry! The preview hasn't loaded. Please re-upload the file or contact Box support. # Preview error message shown when the user's browser doesn't support previews of this file type -error_browser_unsupported=We're sorry, your browser doesn't support preview for {1}. +error_browser_unsupported=Sorry! Your browser doesn't support preview for {1}. # Preview error message shown when the file has invalid formatting (most likely a 3D file) -error_file_type_unsupported=We're sorry, this file format is not supported. +error_file_type_unsupported=Sorry! This file format is not supported. # Preview error message shown when an iWork file is previewed -error_iwork=We're sorry, iWork files are not currently supported. +error_iwork=Sorry! iWork files are not currently supported. # Preview error message shown when document loading fails (most likely due to password or watermark) -error_document=We're sorry, the preview didn't load. This document may be protected. +error_document=Sorry! The preview hasn't loaded. This document may be protected. # Media Preview # Label for changing speed in media player @@ -65,9 +65,9 @@ media_quality=Quality # Label for automatic quality in media player media_quality_auto=Auto # Label for volume slider in media player -media_volume_slider=Volume Slider +media_volume_slider=Volume slider # Label for time slider in media player -media_time_slider=Media Slider +media_time_slider=Media slider # Label for Volume button in media player media_mute=Mute # Label for Volume button in media player @@ -79,7 +79,7 @@ media_pause=Pause # Label for Settings button in media player media_settings=Settings # Label for subtitles/closed-captions in media player -media_subtitles_cc=Subtitles/Closed Captions +media_subtitles_cc=Subtitles/closed captions # Used in ARIA label for volume volume=Volume # Used in ARIA label for timescrubber progress @@ -118,7 +118,7 @@ annotation_delete_confirmation_message=Delete this annotation? # Alternate text for profile picture annotation_profile_alt=Avatar # Username for anonymous user -annotation_anonymous_user_name=Some User +annotation_anonymous_user_name=Some user # Message that annotation is in the process of being posted annotation_posting_message=Posting... # Accessibilty message for button that toggles point annotation mode @@ -132,11 +132,11 @@ annotation_highlight_comment=Add comment to highlighted text # Text for which user made the highlight annotation annotation_who_highlighted={1} highlighted # Text for when annotations fail to load -annotations_load_error=We're sorry, annotations failed to load for this file. +annotations_load_error=Sorry! Annotations failed to load for this file. # Text for when the annotation can't be created -annotations_create_error=We're sorry, the annotation could not be created. +annotations_create_error=Sorry! The annotation could not be created. # Text for when the annotation can't be deleted -annotations_delete_error=We're sorry, the annotation could not be deleted. +annotations_delete_error=Sorry! The annotation could not be deleted. # Text for when the authorization token is invalid annotations_authorization_error=Your session has expired. Please refresh the page. diff --git a/src/i18n/en-GB.properties b/src/i18n/en-GB.properties index 549e83a61..770e65812 100644 --- a/src/i18n/en-GB.properties +++ b/src/i18n/en-GB.properties @@ -5,9 +5,9 @@ zoom_in=Zoom in # Button tooltip for zooming out of a preview zoom_out=Zoom out # Button tooltip for entering a full screen preview -enter_fullscreen=Enter fullscreen +enter_fullscreen=Enter full screen # Button tooltip for exiting a full screen preview -exit_fullscreen=Exit fullscreen +exit_fullscreen=Exit full screen # Button tooltip for going to the previous page in a preview previous_page=Previous page # Input tooltip for navigating to a specific page in a preview @@ -29,31 +29,31 @@ previous_file=Previous file # Accessible text for right navigation arrow that navigates user to next file in collection next_file=Next file # Text shown while preview is loading -loading_preview=Loading Preview... +loading_preview=Loading preview... # Text for download button shown while preview is loading -download_file=Download File +download_file=Download file # Text shown when a text file has been truncated due to size limits. text_truncated=This file has been truncated due to size limits. Please download to view the whole file. # Error messages # Default preview error message -error_default=We're sorry, the preview didn't load. This file type may not be supported. +error_default=Sorry! The preview hasn't loaded. This file type may not be supported. # No permissions preview error message -error_permissions=We're sorry, you don't have permission to preview this file. +error_permissions=Sorry! You don't have permission to preview this file. # Preview refresh error message suggesting refreshing the page as a possible fix -error_refresh=We're sorry, the preview didn't load. Please refresh the page. +error_refresh=Sorry! The preview hasn't loaded. Please refresh the page. # Preview rate limit error suggesting waiting a few minutes to avoid rate limit -error_rate_limit=We're sorry, the preview didn't load because your request was rate limited. Please wait a few minutes and try again. +error_rate_limit=Sorry! The preview hasn't loaded because your request has been rate limited. Please wait a few minutes and try again. # Preview re-upload error message suggesting re-uploading the file or contacting support as a possible fix -error_reupload=We're sorry, the preview didn't load. Please re-upload the file or contact Box support. +error_reupload=Sorry! The preview hasn't loaded. Please re-upload the file or contact Box support. # Preview error message shown when the user's browser doesn't support previews of this file type -error_browser_unsupported=We're sorry, your browser doesn't support preview for {1}. +error_browser_unsupported=Sorry! Your browser doesn't support preview for {1}. # Preview error message shown when the file has invalid formatting (most likely a 3D file) -error_file_type_unsupported=We're sorry, this file format is not supported. +error_file_type_unsupported=Sorry! This file format is not supported. # Preview error message shown when an iWork file is previewed -error_iwork=We're sorry, iWork files are not currently supported. +error_iwork=Sorry! iWork files are not currently supported. # Preview error message shown when document loading fails (most likely due to password or watermark) -error_document=We're sorry, the preview didn't load. This document may be protected. +error_document=Sorry! The preview hasn't loaded. This document may be protected. # Media Preview # Label for changing speed in media player @@ -65,9 +65,9 @@ media_quality=Quality # Label for automatic quality in media player media_quality_auto=Auto # Label for volume slider in media player -media_volume_slider=Volume Slider +media_volume_slider=Volume slider # Label for time slider in media player -media_time_slider=Media Slider +media_time_slider=Media slider # Label for Volume button in media player media_mute=Mute # Label for Volume button in media player @@ -79,7 +79,7 @@ media_pause=Pause # Label for Settings button in media player media_settings=Settings # Label for subtitles/closed-captions in media player -media_subtitles_cc=Subtitles/Closed Captions +media_subtitles_cc=Subtitles/closed captions # Used in ARIA label for volume volume=Volume # Used in ARIA label for timescrubber progress @@ -118,7 +118,7 @@ annotation_delete_confirmation_message=Delete this annotation? # Alternate text for profile picture annotation_profile_alt=Avatar # Username for anonymous user -annotation_anonymous_user_name=Some User +annotation_anonymous_user_name=Some user # Message that annotation is in the process of being posted annotation_posting_message=Posting... # Accessibilty message for button that toggles point annotation mode @@ -132,11 +132,11 @@ annotation_highlight_comment=Add comment to highlighted text # Text for which user made the highlight annotation annotation_who_highlighted={1} highlighted # Text for when annotations fail to load -annotations_load_error=We're sorry, annotations failed to load for this file. +annotations_load_error=Sorry! Annotations failed to load for this file. # Text for when the annotation can't be created -annotations_create_error=We're sorry, the annotation could not be created. +annotations_create_error=Sorry! The annotation could not be created. # Text for when the annotation can't be deleted -annotations_delete_error=We're sorry, the annotation could not be deleted. +annotations_delete_error=Sorry! The annotation could not be deleted. # Text for when the authorization token is invalid annotations_authorization_error=Your session has expired. Please refresh the page. From 6b361ed13df0f41ebcbc8565244ea5cbff303427 Mon Sep 17 00:00:00 2001 From: MinhHNguyen Date: Tue, 1 Aug 2017 09:35:50 -0700 Subject: [PATCH 19/19] Fix: thread save incorrectly rejects when no dialogue exists (#247) * Fix: thread save incorrectly rejects when no dialogue exists * Update: tests for updating local annotations on annotationthreads * Update: annotation save tests and variable name updates --- src/lib/annotations/AnnotationThread.js | 57 ++++++++++++------- .../__tests__/AnnotationThread-test.js | 46 +++++++++++++++ 2 files changed, 83 insertions(+), 20 deletions(-) diff --git a/src/lib/annotations/AnnotationThread.js b/src/lib/annotations/AnnotationThread.js index 4a1e0d04c..45c2947ea 100644 --- a/src/lib/annotations/AnnotationThread.js +++ b/src/lib/annotations/AnnotationThread.js @@ -146,29 +146,10 @@ class AnnotationThread extends EventEmitter { // Changing state from pending this.state = STATES.hover; - // Save annotation on server this.annotationService .create(annotationData) - .then((savedAnnotation) => { - // If no temporary annotation is found, save to thread normally - const tempIdx = this.annotations.indexOf(tempAnnotation); - if (tempIdx === -1) { - this.saveAnnotationToThread(savedAnnotation); - } - - // Add thread number to associated dialog and thread - this.threadNumber = this.threadNumber || savedAnnotation.threadNumber; - this.dialog.element.dataset.threadNumber = this.threadNumber; - - // Otherwise, replace temporary annotation with annotation saved to server - this.annotations[tempIdx] = savedAnnotation; - - if (this.dialog) { - this.dialog.addAnnotation(savedAnnotation); - this.dialog.removeAnnotation(tempAnnotationID); - } - }) + .then((savedAnnotation) => this.updateTemporaryAnnotation(tempAnnotation, savedAnnotation)) .catch(() => { // Remove temporary annotation this.deleteAnnotation(tempAnnotationID, /* useServer */ false); @@ -396,6 +377,42 @@ class AnnotationThread extends EventEmitter { // Private //-------------------------------------------------------------------------- + /** + * Update a temporary annotation with the annotation saved on the backend. Set the threadNumber if it has not + * yet been set. Propogate the threadnumber to an attached dialog if applicable. + * + * @private + * @param {Annotation} tempAnnotation - The locally stored placeholder for the server validated annotation + * @param {Annotation} savedAnnotation - The annotation determined by the backend to be used as the source of truth + * @return {void} + */ + updateTemporaryAnnotation(tempAnnotation, savedAnnotation) { + const tempIdx = this.annotations.indexOf(tempAnnotation); + if (tempIdx === -1) { + // If no temporary annotation is found, save to thread normally + this.saveAnnotationToThread(savedAnnotation); + } else { + // Otherwise, replace temporary annotation with annotation saved to server + this.annotations[tempIdx] = savedAnnotation; + } + + // Set threadNumber if the savedAnnotation is the first annotation of the thread + if (!this.threadNumber && savedAnnotation && savedAnnotation.threadNumber) { + this.threadNumber = savedAnnotation.threadNumber; + } + + if (this.dialog) { + // Add thread number to associated dialog and thread + if (this.dialog.element && this.dialog.element.dataset) { + this.dialog.element.dataset.threadNumber = this.threadNumber; + } + + // Remove temporary annotation and replace it with the saved annotation + this.dialog.addAnnotation(savedAnnotation); + this.dialog.removeAnnotation(tempAnnotation.annotationID); + } + } + /** * Creates the HTML for the annotation indicator. * diff --git a/src/lib/annotations/__tests__/AnnotationThread-test.js b/src/lib/annotations/__tests__/AnnotationThread-test.js index 2235e33ee..d9fa3ba30 100644 --- a/src/lib/annotations/__tests__/AnnotationThread-test.js +++ b/src/lib/annotations/__tests__/AnnotationThread-test.js @@ -174,6 +174,52 @@ describe('lib/annotations/AnnotationThread', () => { }); }); + describe('updateTemporaryAnnotation()', () => { + let annotationService; + + beforeEach(() => { + annotationService = { + create: () => {} + }; + + thread = new AnnotationThread({ + annotatedElement: document.querySelector('.annotated-element'), + annotations: [], + annotationService, + fileVersionId: '1', + location: {}, + threadID: '2', + threadNumber: '1', + type: 'point' + }); + + stubs.create = sandbox.stub(annotationService, 'create'); + stubs.saveAnnotationToThread = sandbox.stub(thread, 'saveAnnotationToThread'); + }); + + it('should save annotation to thread if it does not exist in annotations array', () => { + const serverAnnotation = 'real annotation'; + const tempAnnotation = serverAnnotation; + + thread.updateTemporaryAnnotation(tempAnnotation, serverAnnotation); + + expect(stubs.saveAnnotationToThread).to.be.called; + }); + + it('should overwrite a local annotation to the thread if it does exist as an associated annotation', () => { + const serverAnnotation = 'real annotation'; + const tempAnnotation = 'placeholder annotation'; + const isServerAnnotation = (annotation => (annotation === serverAnnotation)); + + thread.annotations.push(tempAnnotation) + expect(thread.annotations.find(isServerAnnotation)).to.be.undefined; + thread.updateTemporaryAnnotation(tempAnnotation, serverAnnotation); + expect(stubs.saveAnnotationToThread).to.not.be.called; + expect(thread.annotations.find(isServerAnnotation)).to.not.be.undefined; + }); + + }) + describe('deleteAnnotation()', () => { let annotationService;