migrate sketch_viewer to dynamic import
This commit is contained in:
parent
4e86a7378c
commit
9d9d010594
4 changed files with 5 additions and 7 deletions
|
@ -1,8 +1,8 @@
|
|||
/* eslint-disable no-new */
|
||||
import SketchLoader from './sketch';
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
export default () => {
|
||||
const el = document.getElementById('js-sketch-viewer');
|
||||
|
||||
new SketchLoader(el);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -38,6 +38,9 @@ export default class BlobViewer {
|
|||
case 'pdf':
|
||||
initViewer(import(/* webpackChunkName: 'pdf_viewer' */ '../pdf_viewer'));
|
||||
break;
|
||||
case 'sketch':
|
||||
initViewer(import(/* webpackChunkName: 'sketch_viewer' */ '../sketch_viewer'));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
- 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 } }
|
||||
.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');
|
||||
|
|
|
@ -47,7 +47,6 @@ function generateEntries() {
|
|||
mr_notes: './mr_notes/index.js',
|
||||
protected_branches: './protected_branches',
|
||||
registry_list: './registry/index.js',
|
||||
sketch_viewer: './blob/sketch_viewer.js',
|
||||
stl_viewer: './blob/stl_viewer.js',
|
||||
terminal: './terminal/terminal_bundle.js',
|
||||
two_factor_auth: './two_factor_auth.js',
|
||||
|
|
Loading…
Reference in a new issue