File tree 2 files changed +25
-22
lines changed
tools/importer/transformers
2 files changed +25
-22
lines changed Original file line number Diff line number Diff line change
1
+ import { getFragmentFromFile } from '../../scripts/scripts.js' ;
2
+
1
3
export default async function decorate ( block ) {
2
- try {
3
- // get the content
4
- const fragment = await getFragmentFromFile ( '/fragments/spline.html' ) ;
5
- block . innerHTML = '' ;
6
- const fragmentHtml = parser . parseFromString ( fragment , 'text/html' ) ;
7
- [ ...fragmentHtml . body . children ] . forEach ( ( item ) => {
8
- block . append ( item ) ;
9
- } ) ;
10
- } catch ( e ) {
11
- block . textContent = '' ;
12
- // eslint-disable-next-line no-console
13
- console . warn ( `cannot load snippet at ${ e } ` ) ;
14
- }
15
- }
4
+ try {
5
+ // get the content
6
+ const fragment = await getFragmentFromFile ( '/fragments/spline.html' ) ;
7
+ block . innerHTML = '' ;
8
+ const parser = new DOMParser ( ) ;
9
+ const fragmentHtml = parser . parseFromString ( fragment , 'text/html' ) ;
10
+ [ ...fragmentHtml . body . children ] . forEach ( ( item ) => {
11
+ block . append ( item ) ;
12
+ } ) ;
13
+ } catch ( e ) {
14
+ block . textContent = '' ;
15
+ // eslint-disable-next-line no-console
16
+ console . warn ( `cannot load snippet at ${ e } ` ) ;
17
+ }
18
+ }
Original file line number Diff line number Diff line change 1
1
/* global WebImporter */
2
2
const splineViewer = ( main , document ) => {
3
- const splineViewerEl = main . querySelector ( 'div#spline-viewer' ) ;
4
- if ( splineViewerEl ) {
5
- const block = [ [ 'Spline Viewer' ] , [ '' ] ] ;
6
- const table = WebImporter . DOMUtils . createTable ( block , document ) ;
7
- splineViewerEl . replaceWith ( table ) ;
8
- }
9
- } ;
10
- export default splineViewer ;
3
+ const splineViewerEl = main . querySelector ( 'div#spline-viewer' ) ;
4
+ if ( splineViewerEl ) {
5
+ const block = [ [ 'Spline Viewer' ] , [ '' ] ] ;
6
+ const table = WebImporter . DOMUtils . createTable ( block , document ) ;
7
+ splineViewerEl . replaceWith ( table ) ;
8
+ }
9
+ } ;
10
+ export default splineViewer ;
You can’t perform that action at this time.
0 commit comments