11import * as vscode from 'vscode' ;
22import { Store } from '../store' ;
3- import * as apiClient from '@hackmd/api' ;
43import { HackMDTreeViewProvider } from './../tree/index' ;
54import { NoteTreeNode } from './../tree/nodes' ;
65import { MdTextDocumentContentProvider } from './../mdTextDocument' ;
76import { refreshHistoryList } from './../utils' ;
8- const API = new apiClient . default ( ) ;
7+ import { API , apiExportType } from './../api' ;
98
109export async function registerTreeViewCommands ( context : vscode . ExtensionContext , store : Store ) {
1110 const hackMDTreeViewProvider = new HackMDTreeViewProvider ( store ) ;
@@ -14,7 +13,7 @@ export async function registerTreeViewCommands(context: vscode.ExtensionContext,
1413
1514 context . subscriptions . push ( vscode . commands . registerCommand ( 'clickTreeItem' , async ( label , noteId ) => {
1615 if ( label && noteId ) {
17- const content = await API . exportString ( noteId , apiClient . ExportType . MD ) ;
16+ const content = await API . exportString ( noteId , apiExportType . MD ) ;
1817 if ( content ) {
1918 const uri = vscode . Uri . parse ( `hackmd:${ label } .md#${ noteId } ` ) ;
2019 const doc = await vscode . workspace . openTextDocument ( uri ) ;
@@ -26,7 +25,7 @@ export async function registerTreeViewCommands(context: vscode.ExtensionContext,
2625 context . subscriptions . push ( vscode . commands . registerCommand ( 'note.showPreview' , async ( node : NoteTreeNode ) => {
2726 const noteNode = node ;
2827 if ( noteNode . label && noteNode . noteId ) {
29- const content = await API . exportString ( noteNode . noteId , apiClient . ExportType . MD ) ;
28+ const content = await API . exportString ( noteNode . noteId , apiExportType . MD ) ;
3029 if ( content ) {
3130 const uri = vscode . Uri . parse ( `hackmd:${ noteNode . label } .md#${ noteNode . noteId } ` ) ;
3231 vscode . commands . executeCommand ( 'markdown.showPreview' , uri ) ;
@@ -37,7 +36,7 @@ export async function registerTreeViewCommands(context: vscode.ExtensionContext,
3736 context . subscriptions . push ( vscode . commands . registerCommand ( 'note.showPreviewAndEditor' , async ( node : NoteTreeNode ) => {
3837 const noteNode = node ;
3938 if ( noteNode . label && noteNode . noteId ) {
40- const content = await API . exportString ( noteNode . noteId , apiClient . ExportType . MD ) ;
39+ const content = await API . exportString ( noteNode . noteId , apiExportType . MD ) ;
4140 if ( content ) {
4241 const uri = vscode . Uri . parse ( `hackmd:${ noteNode . label } .md#${ noteNode . noteId } ` ) ;
4342 const doc = await vscode . workspace . openTextDocument ( uri ) ;
0 commit comments