add context menu options for logview

This commit is contained in:
takase1121 2021-08-22 19:33:28 +08:00 committed by Francesco
parent 7c3daa0f39
commit 2fec3052ce
1 changed files with 18 additions and 0 deletions

View File

@ -42,6 +42,24 @@ keymap.add {
["menu"] = "context:show"
}
local function copy_log()
local item = core.active_view.hovered_item
if item then
system.set_clipboard(core.get_log(item))
end
end
local function open_as_doc()
local doc = core.open_doc("logs.txt")
core.root_view:open_doc(doc)
doc:insert(1, 1, core.get_log())
end
menu:register("core.logview", {
{ text = "Copy entry", command = copy_log },
{ text = "Open as file", command = open_as_doc }
})
if require("plugins.scale") then
menu:register("core.docview", {
{ text = "Font +", command = "scale:increase" },