generated from adobe/aem-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export default async function decorate(block) { | ||
try { | ||
// get the content | ||
const fragment = await getFragmentFromFile('/fragments/spline.html'); | ||
Check failure on line 4 in blocks/spline-viewer/spline-viewer.js GitHub Actions / build
|
||
block.innerHTML = ''; | ||
const fragmentHtml = parser.parseFromString(fragment, 'text/html'); | ||
Check failure on line 6 in blocks/spline-viewer/spline-viewer.js GitHub Actions / build
|
||
[...fragmentHtml.body.children].forEach((item) => { | ||
block.append(item); | ||
}); | ||
} catch (e) { | ||
block.textContent = ''; | ||
// eslint-disable-next-line no-console | ||
console.warn(`cannot load snippet at ${e}`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<script type="module" src="https://unpkg.com/@splinetool/[email protected]/build/spline-viewer.js"></script> | ||
<spline-viewer url="https://prod.spline.design/UBAIdqMtOkuDExkL/scene.splinecode"></spline-viewer> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* global WebImporter */ | ||
const splineViewer = (main, document) => { | ||
const splineViewerEl = main.querySelector('div#spline-viewer'); | ||
if (splineViewerEl) { | ||
const block = [['Spline Viewer'], ['']]; | ||
const table = WebImporter.DOMUtils.createTable(block, document); | ||
splineViewerEl.replaceWith(table); | ||
} | ||
}; | ||
export default splineViewer; |