Commit 9d9d0105 authored by Mike Greiling's avatar Mike Greiling

migrate sketch_viewer to dynamic import

parent 4e86a737
/* eslint-disable no-new */ /* eslint-disable no-new */
import SketchLoader from './sketch'; import SketchLoader from './sketch';
document.addEventListener('DOMContentLoaded', () => { export default () => {
const el = document.getElementById('js-sketch-viewer'); const el = document.getElementById('js-sketch-viewer');
new SketchLoader(el); new SketchLoader(el);
}); };
...@@ -38,6 +38,9 @@ export default class BlobViewer { ...@@ -38,6 +38,9 @@ export default class BlobViewer {
case 'pdf': case 'pdf':
initViewer(import(/* webpackChunkName: 'pdf_viewer' */ '../pdf_viewer')); initViewer(import(/* webpackChunkName: 'pdf_viewer' */ '../pdf_viewer'));
break; break;
case 'sketch':
initViewer(import(/* webpackChunkName: 'sketch_viewer' */ '../sketch_viewer'));
break;
default: default:
break; break;
} }
......
- content_for :page_specific_javascripts do
= webpack_bundle_tag('common_vue')
= webpack_bundle_tag('sketch_viewer')
.file-content#js-sketch-viewer{ data: { endpoint: blob_raw_path } } .file-content#js-sketch-viewer{ data: { endpoint: blob_raw_path } }
.js-loading-icon.text-center.prepend-top-default.append-bottom-default.js-loading-icon{ 'aria-label' => 'Loading Sketch preview' } .js-loading-icon.text-center.prepend-top-default.append-bottom-default.js-loading-icon{ 'aria-label' => 'Loading Sketch preview' }
= icon('spinner spin 2x', 'aria-hidden' => 'true'); = icon('spinner spin 2x', 'aria-hidden' => 'true');
...@@ -47,7 +47,6 @@ function generateEntries() { ...@@ -47,7 +47,6 @@ function generateEntries() {
mr_notes: './mr_notes/index.js', mr_notes: './mr_notes/index.js',
protected_branches: './protected_branches', protected_branches: './protected_branches',
registry_list: './registry/index.js', registry_list: './registry/index.js',
sketch_viewer: './blob/sketch_viewer.js',
stl_viewer: './blob/stl_viewer.js', stl_viewer: './blob/stl_viewer.js',
terminal: './terminal/terminal_bundle.js', terminal: './terminal/terminal_bundle.js',
two_factor_auth: './two_factor_auth.js', two_factor_auth: './two_factor_auth.js',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment