hot patch
This commit is contained in:
Submodule web/src/cascade updated: 93582a351d...330374d5cd
@@ -4,8 +4,6 @@ import CascadeController from 'src/helpers/cascadeController'
|
|||||||
import IdeToolbar from 'src/components/IdeToolbar'
|
import IdeToolbar from 'src/components/IdeToolbar'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
|
|
||||||
const domNode = document.createElement('div').setAttribute('id', 'sickId')
|
|
||||||
|
|
||||||
const IdeCascadeStudio = ({ part, saveCode, loading, error }) => {
|
const IdeCascadeStudio = ({ part, saveCode, loading, error }) => {
|
||||||
const [code, setCode] = useState(part.code)
|
const [code, setCode] = useState(part.code)
|
||||||
const { currentUser } = useAuth()
|
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
|
// "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.
|
// returns a clean up function that hides the div again.
|
||||||
const onCodeChange = (code) => setCode(code)
|
const onCodeChange = (code) => setCode(code)
|
||||||
CascadeController.initialise(onCodeChange, part.code, domNode)
|
CascadeController.initialise(onCodeChange, part.code)
|
||||||
const element = document.getElementById('cascade-container')
|
const element = document.getElementById('cascade-container')
|
||||||
element.setAttribute('style', 'display: block; opacity: 100%; overflow: hidden; height: calc(100vh - 8rem)') // eslint-disable-line
|
element.setAttribute('style', 'display: block; opacity: 100%; overflow: hidden; height: calc(100vh - 8rem)') // eslint-disable-line
|
||||||
return () => {
|
return () => {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ export const QUERY = gql`
|
|||||||
user {
|
user {
|
||||||
id
|
id
|
||||||
userName
|
userName
|
||||||
|
image
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,17 +8,19 @@ class CascadeController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
initialise(onCodeChange, code) {
|
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?
|
// only inits on first call, after that it just updates the editor and revaluates code, maybe should rename?
|
||||||
this.incomingOnCodeChang = onCodeChange
|
this.incomingOnCodeChang = onCodeChange
|
||||||
if (!this._hasInitialised) {
|
if (!this._hasInitialised) {
|
||||||
initialize(this.controllerOnCodeChange, code)
|
initialize(this.controllerOnCodeChange, code, onInit)
|
||||||
this._hasInitialised = true
|
this._hasInitialised = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const editor = getEditor()
|
onInit()
|
||||||
editor.setValue(code)
|
|
||||||
editor.evaluateCode(false)
|
|
||||||
return this.domNode
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user