@@ -43,7 +43,8 @@ export async function registerTreeViewCommands(context: vscode.ExtensionContext)
43
43
const content = await API . exportString ( noteId , ExportType . MD ) ;
44
44
if ( ! checkNoteExist ( content ) ) { return ; }
45
45
46
- const fileName = editor . document . fileName . split ( '.' ) [ 0 ] ;
46
+ const lastIndex = editor . document . fileName . lastIndexOf ( '.' ) ;
47
+ const fileName = editor . document . fileName . slice ( 0 , lastIndex + 1 ) ;
47
48
const uri = vscode . Uri . parse ( `hackmd:${ fileName } .md#${ noteId } ` ) ;
48
49
vscode . commands . executeCommand ( 'markdown.showPreview' , uri ) ;
49
50
}
@@ -54,6 +55,7 @@ export async function registerTreeViewCommands(context: vscode.ExtensionContext)
54
55
const content = await API . exportString ( noteNode . noteId , ExportType . MD ) ;
55
56
if ( ! checkNoteExist ( content ) ) { return ; }
56
57
58
+ console . log ( noteNode . label ) ;
57
59
const uri = vscode . Uri . parse ( `hackmd:${ noteNode . label } .md#${ noteNode . noteId } ` ) ;
58
60
const doc = await vscode . workspace . openTextDocument ( uri ) ;
59
61
await vscode . window . showTextDocument ( doc , { preview : false } ) ;
@@ -69,7 +71,8 @@ export async function registerTreeViewCommands(context: vscode.ExtensionContext)
69
71
const content = await API . exportString ( noteId , ExportType . MD ) ;
70
72
if ( ! checkNoteExist ( content ) ) { return ; }
71
73
72
- const fileName = editor . document . fileName . split ( '.' ) [ 0 ] ;
74
+ const lastIndex = editor . document . fileName . lastIndexOf ( '.' ) ;
75
+ const fileName = editor . document . fileName . slice ( 0 , lastIndex + 1 ) ;
73
76
const uri = vscode . Uri . parse ( `hackmd:${ fileName } .md#${ noteId } ` ) ;
74
77
const doc = await vscode . workspace . openTextDocument ( uri ) ;
75
78
await vscode . window . showTextDocument ( doc , { preview : false } ) ;
0 commit comments