mirror of
https://github.com/esm7/obsidian-vimrc-support.git
synced 2026-07-22 05:00:25 +00:00
Fixed jscommand and jsfile broken
This commit is contained in:
parent
08b0c5461a
commit
bcc1e56935
4 changed files with 7 additions and 3 deletions
|
|
@ -257,6 +257,10 @@ See [here](JsSnippets.md) for the full example, and please contribute your own!
|
|||
|
||||
## Changelog
|
||||
|
||||
### 0.7.1
|
||||
|
||||
Fixed `jscommand` and `jsfile` broken in the latest Obsidian update.
|
||||
|
||||
### 0.7.0
|
||||
|
||||
**IMPORTANT: this version drops support for the legacy (CM5) Obsidian editor.**
|
||||
|
|
|
|||
2
main.ts
2
main.ts
|
|
@ -521,7 +521,7 @@ export default class VimrcPlugin extends Plugin {
|
|||
if (jsCode[0] != '{' || jsCode[jsCode.length - 1] != '}')
|
||||
throw new Error("Expected an argument which is JS code surrounded by curly brackets: {...}");
|
||||
let currentSelections = this.currentSelection;
|
||||
var chosenSelection = currentSelections[0];
|
||||
var chosenSelection = currentSelections && currentSelections.length > 0 ? currentSelections[0] : null;
|
||||
const command = Function('editor', 'view', 'selection', jsCode);
|
||||
const view = this.getActiveView();
|
||||
command(view.editor, view, chosenSelection);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "obsidian-vimrc-support",
|
||||
"name": "Vimrc Support",
|
||||
"version": "0.7.0",
|
||||
"version": "0.7.1",
|
||||
"description": "Auto-load a startup file with Obsidian Vim commands.",
|
||||
"minAppVersion": "0.15.3",
|
||||
"author": "esm",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "obsidian-vimrc-support",
|
||||
"version": "0.7.0",
|
||||
"version": "0.7.1",
|
||||
"description": "Auto-load a startup file with Obsidian Vim commands.",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
|
|
|||
Loading…
Reference in a new issue