Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit89f98d6

Browse files
authored
Merge pull requestcoderoad#39 from ShMcK/fix/editor-windows
Fix/editor windows
2 parentsf17682a +8f91d7f commit89f98d6

File tree

4 files changed

+33
-32
lines changed

4 files changed

+33
-32
lines changed

‎src/actions/setupActions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const setupActions = async (workspaceRoot: vscode.WorkspaceFolder, {commands, co
5858
// await vscode.window.showTextDocument(doc, vscode.ViewColumn.One)
5959
// // there are times when initialization leave the panel behind any files opened
6060
// // ensure the panel is redrawn on the right side first
61-
// // webview.createOrShow(vscode.ViewColumn.Two)
61+
// // webview.createOrShow()
6262
// } catch (error) {
6363
// console.log(`Failed to open file ${filePath}`, error)
6464
// }

‎src/editor/ReactWebView.ts

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ReactWebView {
3535
this.extensionPath=extensionPath
3636

3737
// Create and show a new webview panel
38-
this.panel=this.createWebviewPanel(vscode.ViewColumn.Two)
38+
this.panel=this.createWebviewPanel()
3939

4040
// Set the webview initial html content
4141
this.render()
@@ -46,23 +46,16 @@ class ReactWebView {
4646

4747

4848
// update panel on changes
49-
constupdateWindows=()=>{
50-
vscode.commands.executeCommand('coderoad.open_webview')
51-
}
49+
//const updateWindows = () => {
50+
//vscode.commands.executeCommand('coderoad.open_webview')
51+
//}
5252

53-
// prevents new panels from going on top of coderoad panel
54-
vscode.window.onDidChangeActiveTextEditor((textEditor?:vscode.TextEditor)=>{
55-
// console.log('onDidChangeActiveTextEditor')
56-
// console.log(textEditor)
57-
if(!textEditor||textEditor.viewColumn!==vscode.ViewColumn.Two){
58-
updateWindows()
59-
}
60-
})
61-
// // prevents moving coderoad panel on top of left panel
62-
vscode.window.onDidChangeVisibleTextEditors((textEditor:vscode.TextEditor[])=>{
63-
// console.log('onDidChangeVisibleTextEditors')
64-
updateWindows()
65-
})
53+
// // // prevents moving coderoad panel on top of left panel
54+
// vscode.window.onDidChangeVisibleTextEditors((textEditors: vscode.TextEditor[]) => {
55+
// console.log('onDidChangeVisibleTextEditors')
56+
// console.log(textEditors)
57+
// // updateWindows()
58+
// })
6659

6760
// TODO: prevent window from moving to the left when no windows remain on rights
6861

@@ -81,13 +74,21 @@ class ReactWebView {
8174
this.send=this.channel.send
8275
}
8376

84-
publiccreateOrShow(column:number):void{
77+
publiccreateOrShow():void{
78+
vscode.commands.executeCommand('vscode.setEditorLayout',{
79+
orientation:0,
80+
groups:[{groups:[{}],size:0.6},{groups:[{}],size:0.4}],
81+
})
8582
// If we already have a panel, show it.
8683
// Otherwise, create a new panel.
84+
8785
if(this.panel&&this.panel.webview){
88-
this.panel.reveal(column)
86+
if(!this.loaded){
87+
this.panel.reveal(vscode.ViewColumn.Two)
88+
this.loaded=true
89+
}
8990
}else{
90-
this.panel=this.createWebviewPanel(column)
91+
this.panel=this.createWebviewPanel()
9192
}
9293
}
9394

@@ -98,7 +99,7 @@ class ReactWebView {
9899
Promise.all(this.disposables.map((x)=>x.dispose()))
99100
}
100101

101-
privatecreateWebviewPanel=(column:number):vscode.WebviewPanel=>{
102+
privatecreateWebviewPanel=():vscode.WebviewPanel=>{
102103
constviewType='CodeRoad'
103104
consttitle='CodeRoad'
104105
constconfig={
@@ -109,7 +110,8 @@ class ReactWebView {
109110
// prevents destroying the window when it is in the background
110111
retainContextWhenHidden:true,
111112
}
112-
returnvscode.window.createWebviewPanel(viewType,title,column,config)
113+
this.loaded=true
114+
returnvscode.window.createWebviewPanel(viewType,title,vscode.ViewColumn.Two,config)
113115
}
114116

115117
privaterender=async():Promise<void>=>{

‎src/editor/commands.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,9 @@ export const createCommands = ({extensionPath, workspaceState, workspaceRoot}: C
4747
})
4848
},
4949
// open React webview
50-
[COMMANDS.OPEN_WEBVIEW]:(column:number=vscode.ViewColumn.Two)=>{
50+
[COMMANDS.OPEN_WEBVIEW]:()=>{
5151
// setup 1x1 horizontal layout
52-
53-
// reset layout
54-
vscode.commands.executeCommand('vscode.setEditorLayout',{
55-
orientation:0,
56-
groups:[{groups:[{}],size:0.6},{groups:[{}],size:0.4}],
57-
})
58-
59-
webview.createOrShow(column)
52+
webview.createOrShow()
6053
},
6154
[COMMANDS.SET_CURRENT_STEP]:({stepId}:{stepId:string})=>{
6255
// NOTE: as async, may sometimes be inaccurate

‎src/editor/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ class Editor {
1111
console.log('ACTIVATE!')
1212
this.vscodeExt=vscodeExt
1313

14+
// set out 60/40 layout
15+
vscode.commands.executeCommand('vscode.setEditorLayout',{
16+
orientation:0,
17+
groups:[{groups:[{}],size:0.6},{groups:[{}],size:0.4}],
18+
})
19+
1420
// commands
1521
this.activateCommands()
1622

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp