File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616 " onView:mdTreeItems" ,
1717 " onCommand:HackMD.login" ,
1818 " onCommand:HackMD.logout" ,
19- " onCommand:note.newNote "
19+ " onCommand:HackMD.createActiveEditorContentToHackMD "
2020 ],
2121 "license" : " MIT" ,
2222 "homepage" : " https://github.com/hackmdio/vscode-hackmd/blob/master/README.md" ,
9090 "icon" : " src/icon/education.svg"
9191 },
9292 {
93- "command" : " note.newNote " ,
94- "title" : " New note "
93+ "command" : " HackMD.createActiveEditorContentToHackMD " ,
94+ "title" : " HackMD: Create active editor Content to HackMD "
9595 }
9696 ],
9797 "menus" : {
Original file line number Diff line number Diff line change @@ -4,18 +4,13 @@ import { checkLogin } from './../utils';
44const API = new apiClient . default ( ) ;
55
66export async function registerNoteCommands ( context : vscode . ExtensionContext ) {
7- context . subscriptions . push ( vscode . commands . registerCommand ( 'note.newNote ' , async ( ) => {
7+ context . subscriptions . push ( vscode . commands . registerCommand ( 'HackMD.createActiveEditorContentToHackMD ' , async ( ) => {
88 if ( ! ( await checkLogin ( ) ) ) {
99 vscode . window . showInformationMessage ( 'Please login first.' ) ;
1010 return ;
1111 }
12- const mdText = await vscode . window . showInputBox ( {
13- ignoreFocusOut : true ,
14- password : false ,
15- placeHolder : 'MarkDown content' ,
16- prompt : 'Please write down your note text' ,
17- } ) ;
1812
13+ const mdText = vscode . window . activeTextEditor . document . getText ( ) ;
1914 const noteUrl = await API . newNote ( mdText ) ;
2015 const clicked = await vscode . window . showInformationMessage ( 'New note Established!' , ...[ 'Copy URL to clip board' , 'Open in browser' ] ) ;
2116 if ( clicked === 'Copy URL to clip board' ) {
You can’t perform that action at this time.
0 commit comments