Add selection argument to jsfile

It was only given to `jscommand`.
This commit is contained in:
twio142 2022-06-02 03:47:36 +02:00 committed by GitHub
parent 637676d3ab
commit d5b28c550a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);
});
}