Skip to content

Commit

Permalink
Use the built in pdf viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Jan 12, 2023
1 parent f786a69 commit 81bc9d8
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 201 deletions.
146 changes: 0 additions & 146 deletions app/assets/javascripts/modules/pdf_viewer.js

This file was deleted.

3 changes: 1 addition & 2 deletions app/javascript/packs/pdf_viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { CssInjection } from '../../assets/javascripts/modules/css_injection.js'
import { EmbedThis } from '../../assets/javascripts/modules/embed_this.js';
import { PopupPanels } from '../../assets/javascripts/modules/popup_panels.js';
import CommonViewerBehavior from '../../assets/javascripts/modules/common_viewer_behavior.js';
import PDFViewer from '../../assets/javascripts/modules/pdf_viewer.js';
import Fullscreen from '../../assets/javascripts/modules/fullscreen.js';

$(document).ready(function() {
Expand All @@ -13,6 +12,6 @@ $(document).ready(function() {
CommonViewerBehavior.initializeViewer();
PopupPanels.init();
EmbedThis.init();
PDFViewer.init();
// PDFViewer.init();
Fullscreen.init('.sul-embed-pdf');
});
1 change: 0 additions & 1 deletion app/javascript/packs/pdf_worker.js

This file was deleted.

22 changes: 1 addition & 21 deletions app/views/embed/body/_pdf_viewer.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,6 @@
<div class='sul-embed-body sul-embed-pdf'
data-sul-embed-theme="<%= asset_url('pdf.css') %>"
data-sul-icons="<%= asset_url('sul_icons.css') %>">
<button aria-label="Zoom in" class="button zoom-in">+</button>
<button aria-label="Zoom out" class="button zoom-out">-</button>
<button aria-label="Previous page" class="button prev-page">
<i class="sul-i-arrow-left-8"></i>
</button>
<button aria-label="Next page" class="button next-page">
<i class="sul-i-arrow-right-8"></i>
</button>
<div id="pdf-viewer" class="pdf-viewer"
data-worker-url="<%= asset_pack_url('pdf_worker.js') %>"
data-pdf-url="<%= viewer.pdf_files.first %>"
data-location-restricted="<%= viewer.all_documents_location_restricted? %>"
>
<div class="loading-spinner"></div>
<canvas></canvas>
<button
aria-label="Exit full screen"
class="sul-embed-btn sul-i-close sul-close-fullscreen-button"
id="close-full-screen-button">
</button>
</div>
<embed src="<%= viewer.pdf_files.first %>" style="height: 100vh; width: 100%">
<%= javascript_packs_with_chunks_tag('pdf_viewer') %>
</div>
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"mirador-dl-plugin": "^0.13.0",
"mirador-image-tools": "^0.8.0",
"mirador-share-plugin": "^0.11.0",
"pdfjs-dist": "2.3.200",
"prop-types": "^15.7.2",
"react": "^16.8.6",
"react-dom": "^16.8.6",
Expand Down
31 changes: 1 addition & 30 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6520,7 +6520,7 @@ loader-runner@^2.4.0:
resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.4.0.tgz#ed47066bfe534d7e84c4c7b9998c2a75607d9357"
integrity sha512-Jsmr89RcXGIwivFY21FcRrisYZfvLMTWx5kOLc+JTxtpBOG6xML0vzbc6SEQG2FO9/4Fc3wW4LVcB5DmGflaRw==

loader-utils@^1.0.0, loader-utils@^1.1.0, loader-utils@^1.2.3, loader-utils@^1.4.0:
loader-utils@^1.1.0, loader-utils@^1.2.3, loader-utils@^1.4.0:
version "1.4.2"
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.4.2.tgz#29a957f3a63973883eb684f10ffd3d151fec01a3"
integrity sha512-I5d00Pd/jwMD2QCduo657+YM/6L3KZu++pmX9VFncxaxvHcru9jx1lBaFft+r4Mt2jK0Yhp41XlRAihzPxHNCg==
Expand Down Expand Up @@ -7076,11 +7076,6 @@ nice-try@^1.0.4:
resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366"
integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==

node-ensure@^0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/node-ensure/-/node-ensure-0.0.0.tgz#ecae764150de99861ec5c810fd5d096b183932a7"
integrity sha512-DRI60hzo2oKN1ma0ckc6nQWlHU69RH6xN0sjQTjMpChPfTYvKZdcQFfdYK2RWbJcKyUizSIy/l8OTGxMAM1QDw==

node-fetch@^2.6.1, node-fetch@^2.6.7:
version "2.6.7"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad"
Expand Down Expand Up @@ -7621,14 +7616,6 @@ pbkdf2@^3.0.3:
safe-buffer "^5.0.1"
sha.js "^2.4.8"

[email protected]:
version "2.3.200"
resolved "https://registry.yarnpkg.com/pdfjs-dist/-/pdfjs-dist-2.3.200.tgz#2920dc28ae7f2b8313cd6d6223c97ae85ac07eac"
integrity sha512-+8wBjU5h8LPZOIvR9X2uCrp/8xWQG1DRDKMLg5lzGN1qyIAZlYUxA0KQyy12Nw5jN7ozulC6v97PMaDcLgAcFg==
dependencies:
node-ensure "^0.0.0"
worker-loader "^2.0.0"

picocolors@^0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-0.2.1.tgz#570670f793646851d1ba135996962abad587859f"
Expand Down Expand Up @@ -9209,14 +9196,6 @@ scheduler@^0.19.1:
loose-envify "^1.1.0"
object-assign "^4.1.1"

schema-utils@^0.4.0:
version "0.4.7"
resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-0.4.7.tgz#ba74f597d2be2ea880131746ee17d0a093c68187"
integrity sha512-v/iwU6wvwGK8HbU9yi3/nhGzP0yGSuhQMzL6ySiec1FSrZZDkhm4noOSWzrNFo/jEc+SJY6jRTwuwbSXJPDUnQ==
dependencies:
ajv "^6.1.0"
ajv-keywords "^3.1.0"

schema-utils@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-1.0.0.tgz#0b79a93204d7b600d4b2850d1f66c2a34951c770"
Expand Down Expand Up @@ -10829,14 +10808,6 @@ worker-farm@^1.7.0:
dependencies:
errno "~0.1.7"

worker-loader@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/worker-loader/-/worker-loader-2.0.0.tgz#45fda3ef76aca815771a89107399ee4119b430ac"
integrity sha512-tnvNp4K3KQOpfRnD20m8xltE3eWh89Ye+5oj7wXEEHKac1P4oZ6p9oTj8/8ExqoSBnk9nu5Pr4nKfQ1hn2APJw==
dependencies:
loader-utils "^1.0.0"
schema-utils "^0.4.0"

wrap-ansi@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-5.1.0.tgz#1fd1f67235d5b6d0fee781056001bfb694c03b09"
Expand Down

0 comments on commit 81bc9d8

Please sign in to comment.