Skip to content

Commit

Permalink
reset code editor space while changing workspaces. forbid designer sh…
Browse files Browse the repository at this point in the history
…ortcuts while editing code
  • Loading branch information
alexandrustefan committed Nov 13, 2021
1 parent 1c90ec5 commit 7cbb821
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 10 deletions.
6 changes: 6 additions & 0 deletions Platform/UI/Canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ function newCanvas() {
UI.projects.foundations.spaces.sideSpace.finalize()
UI.projects.foundations.spaces.chartingSpace.finalize()
UI.projects.foundations.spaces.floatingSpace.finalize()
UI.projects.foundations.spaces.codeEditorSpace.finalize()
thisObject.shorcutNumbers = undefined

if (browserCanvas.removeEventListener) {
Expand Down Expand Up @@ -385,6 +386,11 @@ function newCanvas() {
if (UI.projects.education !== undefined && UI.projects.education.spaces.docsSpace.isVisible === true) {
return
}
/* When the Code Editor is Visible, we do not process key down events of the Designer Space. */
if (UI.projects.foundations.spaces.codeEditorSpace.isVisible === true) {
return
}

thisObject.mouse.event = event
thisObject.mouse.action = 'key down'

Expand Down
2 changes: 1 addition & 1 deletion Platform/WebServer/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
<div id="governance-reports-space-div" class="governance-page" style="position:fixed; top:100000px; left:100000px">
<div id="governance-content-div"></div>
</div>
<div id="code-editor-space-div" class="governance-page" style="position:fixed; top:100000px; left:100000px">
<div id="code-editor-space-div" class="docs-page" style="position:fixed; top:100000px; left:100000px">
<div id="code-editor-content-div" class="code-editor-content-div">
</div>
</div>
Expand Down
27 changes: 20 additions & 7 deletions Projects/Foundations/UI/Spaces/CodeEditor-Space/CodeEditorSpace.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ function newFoundationsCodeEditorSpace() {
sidePanelTab: undefined,
container: undefined,
editorPage: undefined,
isVisible: undefined,
reset: reset,
openSpaceArea: openSpaceArea,
physics: physics,
draw: draw,
Expand All @@ -23,15 +25,24 @@ function newFoundationsCodeEditorSpace() {
return thisObject

function finalize() {
thisObject.sidePanelTab = undefined
if (isInitialized === false) { return }

thisObject.container.finalize()
thisObject.container = undefined


canvas.eventHandler.stopListening(browserResizedEventSubscriptionId)
thisObject.sidePanelTab.container.eventHandler.stopListening(openingEventSubscriptionId)
thisObject.sidePanelTab.container.eventHandler.stopListening(closingEventSubscriptionId)
UI.projects.foundations.spaces.sideSpace.deleteSidePanelTab('Foundations', 'javascript-code', 'Code', 'right')

thisObject.editorPage.finalize()
thisObject.editorPage = undefined

isInitialized = false
}

function initialize() {

thisObject.container = newContainer()
thisObject.container.name = MODULE_NAME
thisObject.container.initialize()
Expand All @@ -43,10 +54,7 @@ function newFoundationsCodeEditorSpace() {
resize()

thisObject.editorPage = newFoundationsCodeEditorEditorPage()
thisObject.footer = newGovernanceReportsFooter() // Reuse simple footer

thisObject.editorPage.initialize()
thisObject.footer.initialize()

thisObject.sidePanelTab = UI.projects.foundations.spaces.sideSpace.createSidePanelTab(thisObject.container, 'Foundations', 'javascript-code', 'Code', 'right')

Expand All @@ -66,6 +74,11 @@ function newFoundationsCodeEditorSpace() {
thisObject.editorPage.render(originatingNode, codeEditorType)
}

function reset() {
finalize()
initialize()
}

function physics() {
if (isInitialized === false) {
return
Expand All @@ -92,11 +105,11 @@ function newFoundationsCodeEditorSpace() {
}

function onOpening() {

thisObject.isVisible = true
}

function onClosing() {

thisObject.isVisible = false
}

function draw() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ function newFoundationsCodeEditorEditorPage() {
/**
* The autocomplete models will be based on:
* 1. Existing code in the data mines -> we will create models for each code node (it's like opening multiple files in vscode)
* 2. Formulas from data mines by creating an object representation of all formulas see implementation below than passing it to the monaco registerCompletionItemProvider
* 2. Formulas from data mines by creating an object representation of all formulas see implementation below then passing it to the monaco registerCompletionItemProvider
* 2. Trading engine loaded into the workspace - we create an obj. representation using getProtocolNode and we are using monaco registerCompletionItemProvider
*
*/
Expand Down
3 changes: 2 additions & 1 deletion Projects/Foundations/UI/Spaces/Design-Space/Workspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ function newWorkspace() {

UI.projects.education.spaces.docsSpace.sidePanelTab.close()
UI.projects.foundations.spaces.workspaceSpace.sidePanelTab.close()
UI.projects.foundations.spaces.codeEditorSpace.sidePanelTab.close()
UI.projects.foundations.spaces.floatingSpace.inMapMode = true
workingAtTask = 2
break
Expand Down Expand Up @@ -446,7 +447,7 @@ function newWorkspace() {

UI.projects.governance.spaces.reportsSpace.reset()
UI.projects.governance.spaces.userProfileSpace.reset()

UI.projects.foundations.spaces.codeEditorSpace.reset()
await UI.projects.education.spaces.docsSpace.reset()
await UI.projects.education.spaces.tutorialSpace.reset()

Expand Down

0 comments on commit 7cbb821

Please sign in to comment.