diff --git a/src/commands.ts b/src/commands.ts index c7af206..c83e223 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -221,7 +221,10 @@ const cmd_export_wxmp = (plugin:NoteSyncPlugin) => ({ hotkeys: [{ modifiers: ['Alt', 'Shift'], key: 'P' }], callback: async () => { if(!plugin.easyapi.cfile){return} - let ctx = await plugin.app.vault.read(plugin.easyapi.cfile); + let ctx = plugin.easyapi.ceditor.getSelection(); + if(!ctx){ + ctx = await plugin.app.vault.read(plugin.easyapi.cfile); + } let html = plugin.wxmp.marked.marked(ctx); let rhtml = await plugin.wxmp.html_to_wxmp(html); plugin.wxmp.copy_as_html(rhtml);