@@ -27,7 +27,58 @@ module.exports = (config, { env }) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
config.plugins.push(new MonacoWebpackPlugin())
|
config.plugins.push(
|
||||||
|
new MonacoWebpackPlugin({
|
||||||
|
languages: ['typescript'],
|
||||||
|
features: [
|
||||||
|
'accessibilityHelp',
|
||||||
|
'anchorSelect',
|
||||||
|
'bracketMatching',
|
||||||
|
'caretOperations',
|
||||||
|
'clipboard',
|
||||||
|
'codeAction',
|
||||||
|
'codelens',
|
||||||
|
'comment',
|
||||||
|
'contextmenu',
|
||||||
|
'coreCommands',
|
||||||
|
'cursorUndo',
|
||||||
|
'documentSymbols',
|
||||||
|
'find',
|
||||||
|
'folding',
|
||||||
|
'fontZoom',
|
||||||
|
'format',
|
||||||
|
'gotoError',
|
||||||
|
'gotoLine',
|
||||||
|
'gotoSymbol',
|
||||||
|
'hover',
|
||||||
|
'inPlaceReplace',
|
||||||
|
'indentation',
|
||||||
|
'inlineHints',
|
||||||
|
'inspectTokens',
|
||||||
|
'linesOperations',
|
||||||
|
'linkedEditing',
|
||||||
|
'links',
|
||||||
|
'multicursor',
|
||||||
|
'parameterHints',
|
||||||
|
'quickCommand',
|
||||||
|
'quickHelp',
|
||||||
|
'quickOutline',
|
||||||
|
'referenceSearch',
|
||||||
|
'rename',
|
||||||
|
'smartSelect',
|
||||||
|
'snippets',
|
||||||
|
'suggest',
|
||||||
|
'toggleHighContrast',
|
||||||
|
'toggleTabFocusMode',
|
||||||
|
'transpose',
|
||||||
|
'unusualLineTerminators',
|
||||||
|
'viewportSemanticTokens',
|
||||||
|
'wordHighlighter',
|
||||||
|
'wordOperations',
|
||||||
|
'wordPartOperations',
|
||||||
|
],
|
||||||
|
})
|
||||||
|
)
|
||||||
config.module.rules[0].oneOf.push({
|
config.module.rules[0].oneOf.push({
|
||||||
test: /opencascade\.wasm\.wasm$/,
|
test: /opencascade\.wasm\.wasm$/,
|
||||||
type: 'javascript/auto',
|
type: 'javascript/auto',
|
||||||
|
|||||||
Submodule web/src/cascade updated: 12235af072...cd23a8e673
@@ -1,7 +1,7 @@
|
|||||||
import { useContext, useEffect } from 'react'
|
import { useContext, useEffect, Suspense, lazy } from 'react'
|
||||||
import { isBrowser } from '@redwoodjs/prerender/browserUtils'
|
import { isBrowser } from '@redwoodjs/prerender/browserUtils'
|
||||||
import { IdeContext } from 'src/components/IdeToolbarNew'
|
import { IdeContext } from 'src/components/IdeToolbarNew'
|
||||||
import Editor from '@monaco-editor/react'
|
const Editor = lazy(() => import('@monaco-editor/react'))
|
||||||
|
|
||||||
const IdeEditor = () => {
|
const IdeEditor = () => {
|
||||||
const { state, dispatch } = useContext(IdeContext)
|
const { state, dispatch } = useContext(IdeContext)
|
||||||
@@ -39,12 +39,14 @@ const IdeEditor = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="h-full" onKeyDown={handleSaveHotkey}>
|
<div className="h-full" onKeyDown={handleSaveHotkey}>
|
||||||
<Editor
|
<Suspense fallback={<div>. . . loading</div>}>
|
||||||
defaultValue={state.code}
|
<Editor
|
||||||
// TODO #247 cpp seems better than js for the time being
|
defaultValue={state.code}
|
||||||
defaultLanguage="cpp"
|
// TODO #247 cpp seems better than js for the time being
|
||||||
onChange={handleCodeChange}
|
defaultLanguage="cpp"
|
||||||
/>
|
onChange={handleCodeChange}
|
||||||
|
/>
|
||||||
|
</Suspense>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class CascadeController {
|
|||||||
// 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) {
|
||||||
new initialize(this.controllerOnCodeChange, code, onInit)
|
initialize(this.controllerOnCodeChange, code, onInit)
|
||||||
this._hasInitialised = true
|
this._hasInitialised = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -25,23 +25,28 @@ class CascadeController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
capture(environment, width = 512, height = 384) {
|
capture(environment, width = 512, height = 384) {
|
||||||
environment.camera.aspect = width / height;
|
environment.camera.aspect = width / height
|
||||||
environment.camera.updateProjectionMatrix();
|
environment.camera.updateProjectionMatrix()
|
||||||
environment.renderer.setSize(width, height);
|
environment.renderer.setSize(width, height)
|
||||||
environment.renderer.render(environment.scene, environment.camera, null, false);
|
environment.renderer.render(
|
||||||
|
environment.scene,
|
||||||
|
environment.camera,
|
||||||
|
null,
|
||||||
|
false
|
||||||
|
)
|
||||||
let imgBlob = new Promise((resolve, reject) => {
|
let imgBlob = new Promise((resolve, reject) => {
|
||||||
environment.renderer.domElement.toBlob(
|
environment.renderer.domElement.toBlob(
|
||||||
(blob) => {
|
(blob) => {
|
||||||
blob.name = `part_capture-${ Date.now() }`
|
blob.name = `part_capture-${Date.now()}`
|
||||||
resolve(blob)
|
resolve(blob)
|
||||||
},
|
},
|
||||||
'image/jpeg',
|
'image/jpeg',
|
||||||
1
|
1
|
||||||
);
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
// Return to original dimensions
|
// Return to original dimensions
|
||||||
environment.onWindowResize();
|
environment.onWindowResize()
|
||||||
|
|
||||||
return imgBlob
|
return imgBlob
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user