@@ -18,7 +18,7 @@ interface RectBounds {
18
18
height : number ;
19
19
}
20
20
21
- type RegionId = "mainmenu" | "simulator" | "toolbox" | "workspace " | "editortools" | "tutorial" ;
21
+ type RegionId = "mainmenu" | "simulator" | "toolbox" | "editor " | "editortools" | "tutorial" ;
22
22
23
23
interface Region {
24
24
id : RegionId ;
@@ -112,30 +112,30 @@ const regions: Region[] = [
112
112
}
113
113
} ,
114
114
{
115
- id : "workspace " ,
116
- ariaLabel : lf ( "Workspace " ) ,
115
+ id : "editor " ,
116
+ ariaLabel : lf ( "Editor " ) ,
117
117
shortcutKey : "4" ,
118
118
getBounds ( projectView : IProjectView ) {
119
- let workspaceSelector : string = undefined ;
120
- if ( projectView . isBlocksActive ( ) ) {
121
- workspaceSelector = ".blocklySvg" ;
122
- } else if ( projectView . isPxtJsonEditor ( ) ) {
123
- workspaceSelector = "#pxtJsonEditor" ;
124
- } else if ( projectView . isJavaScriptActive ( ) || projectView . isPythonActive ( ) ) {
125
- workspaceSelector = "#monacoEditorArea" ;
126
- }
127
- const bounds = document . querySelector ( workspaceSelector ) ?. getBoundingClientRect ( ) ;
128
- if ( ! projectView . isPxtJsonEditor ( ) ) {
129
- // Use bounds that don't overlap the toolbox region.
130
- const toolbox = getToolboxBounds ( projectView ) ;
131
- const copied = DOMRect . fromRect ( bounds ) ;
132
- if ( toolbox ) {
133
- copied . x = toolbox . right ;
134
- copied . width = bounds . width - toolbox . width ;
119
+ const editorSelectors = [ "#pxtJsonEditor" , "#githubEditor" , "#blocksArea" , "#serialEditor" , "#assetEditor" , "#monacoEditor" ] ;
120
+ for ( const selector of editorSelectors ) {
121
+ const element = document . querySelector ( selector ) as HTMLElement | null ;
122
+ if ( element . offsetParent !== null ) {
123
+ console . log ( element ) ;
124
+ const bounds = element . getBoundingClientRect ( ) ;
125
+ if ( selector === "#monacoEditor" || selector === "#blocksArea" ) {
126
+ // Use bounds that don't overlap the toolbox region.
127
+ const toolbox = getToolboxBounds ( projectView ) ;
128
+ const copied = DOMRect . fromRect ( bounds ) ;
129
+ if ( toolbox ) {
130
+ copied . x = toolbox . right ;
131
+ copied . width = bounds . width - toolbox . width ;
132
+ }
133
+ return copied ;
134
+ }
135
+ return bounds ;
135
136
}
136
- return copied ;
137
137
}
138
- return bounds ;
138
+ return undefined ;
139
139
} ,
140
140
focus ( projectView : IProjectView ) {
141
141
if ( projectView . isPxtJsonEditor ( ) ) {
@@ -159,7 +159,8 @@ const regions: Region[] = [
159
159
{
160
160
id : "tutorial" ,
161
161
ariaLabel : lf ( "Tutorial" ) ,
162
- shortcutKey : "u" ,
162
+ // This isn't really in sequence but it's not usually present.
163
+ shortcutKey : "0" ,
163
164
getBounds ( ) {
164
165
return document . querySelector ( ".tutorialWrapper" ) ?. getBoundingClientRect ( ) ;
165
166
} ,
@@ -209,7 +210,7 @@ export const NavigateRegionsOverlay = ({ parent }: NavigateRegionsOverlayProps)
209
210
parent . hideNavigateRegions ( ) ;
210
211
}
211
212
212
- if ( ! regionRects . get ( "workspace " ) ) {
213
+ if ( ! regionRects . get ( "editor " ) ) {
213
214
// Something is awry, bail out.
214
215
parent . hideNavigateRegions ( ) ;
215
216
return null ;
0 commit comments