Skip to content

Commit

Permalink
Paste note from clipboard
Browse files Browse the repository at this point in the history
  • Loading branch information
PhosCity authored and arch1t3cht committed Mar 14, 2024
1 parent a6984c9 commit fb3c29f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions macros/arch.NoteBrowser.moon
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export script_name = "Note Browser"
export script_description = "Loads a set of timestamped notes and adds options to mark them or jump between them."
export script_version = "1.3.5"
export script_version = "1.3.6"
export script_namespace = "arch.NoteBrowser"
export script_author = "arch1t3cht"

Expand Down Expand Up @@ -62,21 +62,24 @@ haveDepCtrl, DependencyControl = pcall(require, "l0.DependencyControl")
local config
local fun
local depctrl
local clipboard

if haveDepCtrl
depctrl = DependencyControl({
feed: "https://raw.githubusercontent.com/TypesettingTools/arch1t3cht-Aegisub-Scripts/main/DependencyControl.json",
{
{"l0.Functional", version: "0.6.0", url: "https://github.com/TypesettingTools/Functional",
feed: "https://raw.githubusercontent.com/TypesettingTools/Functional/master/DependencyControl.json"},
"aegisub.clipboard"
}
})
config = depctrl\getConfigHandler(default_config, "config", false)
fun = depctrl\requireModules!
fun, clipboard = depctrl\requireModules!
else
id = () -> nil
config = {c: default_config, load: id, write: id}
fun = require "l0.Functional"
clipboard = require "aegisub.clipboard"


current_notes = {}
Expand Down Expand Up @@ -143,6 +146,13 @@ patch_for_mpvqc = (lines) ->
return patched_lines


fetch_note_from_clipboard = ->
note = clipboard.get!
if note\match "%d+:%d+"
return note
return ""


load_notes = (subs) ->
config\load()
btn, result = aegisub.dialog.display({{
Expand All @@ -164,6 +174,7 @@ load_notes = (subs) ->
},{
class: "textbox",
name: "notes",
text: fetch_note_from_clipboard!,
x: 0, y: 2, width: 2, height: 10,
}})

Expand Down

0 comments on commit fb3c29f

Please sign in to comment.