mirror of
https://github.com/esm7/obsidian-vimrc-support.git
synced 2026-07-22 05:00:25 +00:00
Merge pull request #103 from twio142/patch-1
Add `selection` argument to `jsfile`
This commit is contained in:
commit
1df6432804
1 changed files with 4 additions and 2 deletions
6
main.ts
6
main.ts
|
|
@ -562,9 +562,11 @@ export default class VimrcPlugin extends Plugin {
|
|||
} catch (e) {
|
||||
throw new Error(`Cannot read file ${params.args[0]} from vault root: ${e.message}`);
|
||||
}
|
||||
const command = Function('editor', 'view', content + extraCode);
|
||||
let currentSelections = this.currentSelection;
|
||||
var chosenSelection = currentSelections[0];
|
||||
const command = Function('editor', 'view', 'selection', content + extraCode);
|
||||
const view = this.getActiveView();
|
||||
command(view.editor, view);
|
||||
command(view.editor, view, chosenSelection);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue