diff --git a/README.md b/README.md index 5d61b9f..119b904 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,13 @@ +![CadHub banner](https://raw.githubusercontent.com/Irev-Dev/repo-images/main/images/gear%20donutbanner.png) + # [C a d H u b](https://cadhub.xyz) [![Netlify Status](https://api.netlify.com/api/v1/badges/77f37543-e54a-4723-8136-157c0221ec27/deploy-status)](https://app.netlify.com/sites/cadhubxyz/deploys) -CadHub aims to be a community website for javascript based code-cad. Currently trying to integrate [cascadeStudio](https://zalo.github.io/CascadeStudio/), but if successful plan to also integrate [JSCAD](https://openjscad.org/). -OpenScad has proven code-cad a much loved formate for cad-modeling. Joining code-cad to a mature language like javascript that has a package manager (npm) plus a community hub for sharing cad models like CadHub, we're going to build a thriving community. +CadHub aims to be a community website for code-cad. Currently trying to integrate the excellent [cascadeStudio](https://zalo.github.io/CascadeStudio/), but maybe more in future. +OpenScad has proven that code-cad is a much loved format for cad-modeling. We're going to build a thriving community. + +If you want to be involved in anyway, swing by the [discord channel](https://discord.gg/SD7zFRNjGH). diff --git a/web/src/cascade b/web/src/cascade index 93582a3..330374d 160000 --- a/web/src/cascade +++ b/web/src/cascade @@ -1 +1 @@ -Subproject commit 93582a351d17e8c90b40f2aa8523fc0f8b02c36a +Subproject commit 330374d5cdb7fdaba8d1bd674bbafce5ca93db3f diff --git a/web/src/components/IdeCascadeStudio/IdeCascadeStudio.js b/web/src/components/IdeCascadeStudio/IdeCascadeStudio.js index 9a472f7..7f2a03a 100644 --- a/web/src/components/IdeCascadeStudio/IdeCascadeStudio.js +++ b/web/src/components/IdeCascadeStudio/IdeCascadeStudio.js @@ -4,8 +4,6 @@ import CascadeController from 'src/helpers/cascadeController' import IdeToolbar from 'src/components/IdeToolbar' import { useEffect, useState } from 'react' -const domNode = document.createElement('div').setAttribute('id', 'sickId') - const IdeCascadeStudio = ({ part, saveCode, loading, error }) => { const [code, setCode] = useState(part.code) const { currentUser } = useAuth() @@ -15,7 +13,7 @@ const IdeCascadeStudio = ({ part, saveCode, loading, error }) => { // "opening" and "closing" it for the ide part of the app by displaying none or block. Which is why this useEffect // returns a clean up function that hides the div again. const onCodeChange = (code) => setCode(code) - CascadeController.initialise(onCodeChange, part.code, domNode) + CascadeController.initialise(onCodeChange, part.code) const element = document.getElementById('cascade-container') element.setAttribute('style', 'display: block; opacity: 100%; overflow: hidden; height: calc(100vh - 8rem)') // eslint-disable-line return () => { diff --git a/web/src/components/IdePartCell/IdePartCell.js b/web/src/components/IdePartCell/IdePartCell.js index 83a87ef..6bbffcf 100644 --- a/web/src/components/IdePartCell/IdePartCell.js +++ b/web/src/components/IdePartCell/IdePartCell.js @@ -14,6 +14,7 @@ export const QUERY = gql` user { id userName + image } } } diff --git a/web/src/helpers/cascadeController.js b/web/src/helpers/cascadeController.js index b18cb59..b9c9bb9 100644 --- a/web/src/helpers/cascadeController.js +++ b/web/src/helpers/cascadeController.js @@ -8,17 +8,19 @@ class CascadeController { } initialise(onCodeChange, code) { + const onInit = () => { + const editor = getEditor() + editor.setValue(code) + editor.evaluateCode(false) + } // only inits on first call, after that it just updates the editor and revaluates code, maybe should rename? this.incomingOnCodeChang = onCodeChange if (!this._hasInitialised) { - initialize(this.controllerOnCodeChange, code) + initialize(this.controllerOnCodeChange, code, onInit) this._hasInitialised = true return } - const editor = getEditor() - editor.setValue(code) - editor.evaluateCode(false) - return this.domNode + onInit() } }