function newFoundationsCodeEditorEditorPage() { let thisObject = { originatingNode: undefined, editorType: undefined, render: render, reset:reset, initialize: initialize, finalize: finalize } let monacoInitialized = false let monacoEditor = undefined let codeString = '' let stringObjects = [] let tradingEngineObj = undefined let recordFormulasObj = {} let chartMarketExchangeObj = {} return thisObject function initialize() { buildEditorHTML() buildIntelliSenseModels() } function finalize() { monacoInitialized = false monacoEditor = undefined codeString = '' stringObjects = [] tradingEngineObj = undefined recordFormulasObj = {} chartMarketExchangeObj = {} thisObject.originatingNode = undefined thisObject.editorType = undefined } function reset() { finalize() initialize() } 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', `
