diff --git a/Projects/Foundations/UI/Spaces/CodeEditor-Space/EditorPage.js b/Projects/Foundations/UI/Spaces/CodeEditor-Space/EditorPage.js new file mode 100644 index 000000000..942bc2feb --- /dev/null +++ b/Projects/Foundations/UI/Spaces/CodeEditor-Space/EditorPage.js @@ -0,0 +1,414 @@ +function newFoundationsCodeEditorEditorPage() { + let thisObject = { + originatingNode: undefined, + editorType: undefined, + render: render, + initialize: initialize, + finalize: finalize + } + + let monacoInitialized = false + let monacoEditor = undefined + let codeString = '' + let tradingEngineObj = undefined + let recordFormulasObj = {} + let chartObj = {} + + return thisObject + + + function initialize() { + buildEditorHTML() + buildIntelliSenseModels() + } + + + function finalize() { + monacoInitialized = false + monacoEditor = undefined + codeString = '' + tradingEngineObj = undefined + recordFormulasObj = {} + thisObject.originatingNode = undefined + thisObject.editorType = undefined + + } + + + function render(originatingNode, editorType) { + + thisObject.editorType = editorType + thisObject.originatingNode = originatingNode + createEditingNodePath() + + + /** + * The reason we are doing the monaco initialization here is simply because monaco will set his own width at the moment it's rendered + * Rendering it earlier when the code panel is closed will result in a very narrow width + * Therefore we choose to render it after the panel has his width set correctly + * Probably there is a better way but at the time this has been coded, nothing else seemed to work + **/ + + require(["vs/editor/editor.main"], initMonacoEditor) + + } + + function initMonacoEditor() { + if (monacoEditor === undefined) { + document.getElementById('no-content').remove() + document.getElementById('code-path').insertAdjacentHTML('afterend', `
