diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 4bb8991..6a91dd0 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -103,10 +103,6 @@ jobs: shell: bash -l {0} run: | npm install --legacy-peer-deps && npm run build - mkdir pages - cp build/index.html pages/ - cp build/main.js pages/ - cp build/*css pages/ - name: Deploy Build uses: peaceiris/actions-gh-pages@v4 @@ -116,4 +112,4 @@ jobs: # if: github.ref == 'refs/heads/main' with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./pages + publish_dir: ./build diff --git a/dist/index.d.ts b/dist/index.d.ts index cb0ff5c..5c85822 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -1 +1 @@ -export {}; +export function renderThreeDEditor(materialConfig: any, newDomElement: any): void; diff --git a/dist/index.js b/dist/index.js index c4b3774..5d7dddc 100644 --- a/dist/index.js +++ b/dist/index.js @@ -5,11 +5,12 @@ import { Made } from "@mat3ra/made"; import React from "react"; import ReactDOM from "react-dom"; import { ThreeDEditor } from "./components/ThreeDEditor"; -const domElement = document.getElementById("root"); -const material = new Made.Material(Made.defaultMaterialConfig); // eslint-disable-next-line react/no-render-return-value -window.threeDEditor = ReactDOM.render(_jsx(ThreeDEditor, { editable: true, material: material }), domElement); -window.renderThreeDEditor = (materialConfig, newDomElement) => { - const currentMaterial = new Made.Material(materialConfig); - ReactDOM.render(_jsx(ThreeDEditor, { editable: true, material: currentMaterial }), newDomElement); +const renderThreeDEditor = (materialConfig, newDomElement) => { + const config = materialConfig || Made.defaultMaterialConfig; + const domElement = newDomElement || document.getElementById("root"); + const currentMaterial = new Made.Material(config); + ReactDOM.render(_jsx(ThreeDEditor, { editable: true, material: currentMaterial }), domElement); }; +window.renderThreeDEditor = renderThreeDEditor; +export { renderThreeDEditor }; diff --git a/index.html b/index.html index 5235409..5d0419d 100644 --- a/index.html +++ b/index.html @@ -1,15 +1,16 @@
- +