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

Commit2d06aac

Browse files
committed
prevent multiple CR windows open
1 parentfab91ab commit2d06aac

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

‎src/editor/ReactWebView.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ class ReactWebView {
9494

9595
privateasyncdispose():Promise<void>{
9696
// Clean up our resources
97+
this.loaded=false
9798
this.panel.dispose()
9899
Promise.all(this.disposables.map((x)=>x.dispose()))
99100
}

‎src/editor/commands/index.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,26 @@ export const createCommands = ({ context, machine, storage, git, position }: Cre
3636
return{
3737
// initialize
3838
[COMMANDS.START]:()=>{
39-
// if (webview) {
40-
// console.log('CodeRoad already loaded')
41-
// return
42-
// }
43-
// set local storage workspace
39+
letwebviewState:'INITIALIZING'|'RESTARTING'
40+
if(!webview){
41+
webviewState='INITIALIZING'
42+
}elseif(webview.loaded){
43+
// already loaded
44+
vscode.window.showInformationMessage('CodeRoad already open')
45+
return
46+
}else{
47+
webviewState='RESTARTING'
48+
}
49+
4450
setStorage(context.workspaceState)
4551

46-
constisInitialized=!!webview
4752
// activate machine
4853
webview=newReactWebView(context.extensionPath)
49-
if(!isInitialized){
54+
if(webviewState==='INITIALIZING'){
5055
machine.activate()
51-
}else{
56+
}elseif(webviewState==='RESTARTING'){
5257
setTimeout(()=>{
53-
//unfortunate hack to make data update on new windows
58+
//timeout hack to make data update on new windows
5459
//@ts-ignore
5560
machine.refresh()
5661
},1000)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp