Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vlaaad committed Jun 11, 2024
1 parent e3f53f7 commit 0c97507
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions docs/en/manuals/editor-scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ Inside the `run` handler, you can query and change the in-memory editor state. Q
query = {selection = {type = "outline", cardinality = "one"}},
active = function(opts)
local node = opts.selection
return editor.can_set(node, "position") and editor.can_set(node, "rotation") and editor.can_set(node, "scale")
return editor.can_set(node, "position")
and editor.can_set(node, "rotation")
and editor.can_set(node, "scale")
end,
run = function(opts)
local node = opts.selection
Expand Down Expand Up @@ -157,7 +159,7 @@ Inside the `run` handler, you can write to files (using `io` module) and execute
run = function(opts)
local text = editor.get(opts.selection, "text")
local new_text = editor.execute("jq", "-n", "--argjson", "data", text, "$data", {
reload_resources = false, -- don't reload resources since `jq` does not modify files on disk
reload_resources = false, -- don't reload resources since jq does not touch disk
out = "capture" -- return text output instead of nothing
})
editor.transact({ editor.tx.set(opts.selection, "text", new_text) })
Expand Down

0 comments on commit 0c97507

Please sign in to comment.