diff options
author | Mike Greiling <mike@pixelcog.com> | 2018-03-01 02:02:18 -0600 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2018-03-01 11:29:25 -0600 |
commit | 4e86a7378cd96ffebfb1c128c9fcb614ee479ffe (patch) | |
tree | f4b1d8e1584f793da826634ddb7a39569a8ec05a | |
parent | e2c87838157d90062725fd648788c6e1839bc8d8 (diff) | |
download | gitlab-ce-4e86a7378cd96ffebfb1c128c9fcb614ee479ffe.tar.gz |
migrate pdf_viewer to dynamic import
-rw-r--r-- | app/assets/javascripts/blob/pdf_viewer.js | 2 | ||||
-rw-r--r-- | app/assets/javascripts/blob/viewer/index.js | 3 | ||||
-rw-r--r-- | app/views/projects/blob/viewers/_pdf.html.haml | 4 | ||||
-rw-r--r-- | config/webpack.config.js | 2 |
4 files changed, 4 insertions, 7 deletions
diff --git a/app/assets/javascripts/blob/pdf_viewer.js b/app/assets/javascripts/blob/pdf_viewer.js index 91abe9dd699..cabbb396ea7 100644 --- a/app/assets/javascripts/blob/pdf_viewer.js +++ b/app/assets/javascripts/blob/pdf_viewer.js @@ -1,3 +1,3 @@ import renderPDF from './pdf'; -document.addEventListener('DOMContentLoaded', renderPDF); +export default renderPDF; diff --git a/app/assets/javascripts/blob/viewer/index.js b/app/assets/javascripts/blob/viewer/index.js index 0574b5b79aa..b227cf38920 100644 --- a/app/assets/javascripts/blob/viewer/index.js +++ b/app/assets/javascripts/blob/viewer/index.js @@ -35,6 +35,9 @@ export default class BlobViewer { case 'notebook': initViewer(import(/* webpackChunkName: 'notebook_viewer' */ '../notebook_viewer')); break; + case 'pdf': + initViewer(import(/* webpackChunkName: 'pdf_viewer' */ '../pdf_viewer')); + break; default: break; } diff --git a/app/views/projects/blob/viewers/_pdf.html.haml b/app/views/projects/blob/viewers/_pdf.html.haml index fc3f0d922b1..95d837a57dc 100644 --- a/app/views/projects/blob/viewers/_pdf.html.haml +++ b/app/views/projects/blob/viewers/_pdf.html.haml @@ -1,5 +1 @@ -- content_for :page_specific_javascripts do - = webpack_bundle_tag('common_vue') - = webpack_bundle_tag('pdf_viewer') - .file-content#js-pdf-viewer{ data: { endpoint: blob_raw_path } } diff --git a/config/webpack.config.js b/config/webpack.config.js index 20d95ff22a1..1e181363fc1 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -45,7 +45,6 @@ function generateEntries() { const manualEntries = { monitoring: './monitoring/monitoring_bundle.js', mr_notes: './mr_notes/index.js', - pdf_viewer: './blob/pdf_viewer.js', protected_branches: './protected_branches', registry_list: './registry/index.js', sketch_viewer: './blob/sketch_viewer.js', @@ -224,7 +223,6 @@ const config = { chunks: [ 'monitoring', 'mr_notes', - 'pdf_viewer', 'registry_list', 'ide', ], |