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

Commit563874f

Browse files
committed
initialize webview
1 parent9241fef commit563874f

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

‎src/editor/commands/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import*asvscodefrom'vscode'
22
importstartfrom'./start'
3+
importReactPanelfrom'../views/createWebview'
34

45
// import runTest from './runTest'
56
// import loadSolution from './loadSolution'
@@ -8,6 +9,7 @@ import start from './start'
89
constCOMMANDS={
910
// TUTORIAL_SETUP: 'coderoad.tutorial_setup',
1011
START:'coderoad.start',
12+
OPEN_WEBVIEW:'coderoad.open_webview'
1113
// RUN_TEST: 'coderoad.test_run',
1214
// LOAD_SOLUTION: 'coderoad.solution_load',
1315
// QUIT: 'coderoad.quit',
@@ -19,6 +21,10 @@ export default (context: vscode.ExtensionContext): void => {
1921
[COMMANDS.START]:asyncfunctionstartCommand():Promise<void>{
2022
returnstart(context)
2123
},
24+
[COMMANDS.OPEN_WEBVIEW]:()=>{
25+
console.log('webview createOrShow')
26+
ReactPanel.createOrShow(context.extensionPath);
27+
}
2228
// [COMMANDS.RUN_TEST]: runTest,
2329
// [COMMANDS.LOAD_SOLUTION]: loadSolution,
2430
// [COMMANDS.QUIT]: () => quit(context.subscriptions),

‎src/editor/views/createWebview.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ class ReactPanel {
2121
publicstaticasynccreateOrShow(extensionPath:string):Promise<void>{
2222
consthasActiveEditor=vscode.window.activeTextEditor
2323

24-
if(!hasActiveEditor){
25-
thrownewError('Should have an open file on launch')
26-
}
27-
constcolumn=vscode.ViewColumn.Two
24+
//if (!hasActiveEditor) {
25+
// throw new Error('Should have an open file on launch')
26+
//}
27+
constcolumn=vscode.ViewColumn.One
2828

2929
// If we already have a panel, show it.
3030
// Otherwise, create a new panel.

‎src/state/actions/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import{assign}from'xstate'
22
import*asCRfrom'typings'
3-
import*asstoragefrom'../../services/storage'
4-
import*asgitfrom'../../services/git'
3+
import*asvscodefrom'vscode'
54

65
letinitialTutorial:CR.Tutorial|undefined
76
letinitialProgress:CR.Progress={
@@ -46,5 +45,8 @@ export default {
4645
returnposition
4746
}
4847
}),
49-
48+
createWebview(){
49+
console.log('execute coderoad.open_webview')
50+
vscode.commands.executeCommand('coderoad.open_webview')
51+
}
5052
}

‎src/state/machine.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export const machine = Machine<
2525
},
2626
},
2727
NewTutorial:{
28+
onEntry:['createWebview'],
2829
initial:'SelectTutorial',
2930
states:{
3031
SelectTutorial:{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp