aboutsummaryrefslogtreecommitdiff
path: root/plugins/plugin_manager/plugin_view.lua
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2023-10-10 11:45:21 -0400
committerAdam Harrison <adamdharrison@gmail.com>2023-10-10 11:45:21 -0400
commit51f89bcc8a6f3f0f3f36788f5559f2d3e38788f1 (patch)
treebfe96ebf6d93e1b4b57542a9173b92c1350b2912 /plugins/plugin_manager/plugin_view.lua
parent3d4390468181af1e329ba93c9776c906f63b8478 (diff)
downloadlite-xl-plugin-manager-51f89bcc8a6f3f0f3f36788f5559f2d3e38788f1.tar.gz
lite-xl-plugin-manager-51f89bcc8a6f3f0f3f36788f5559f2d3e38788f1.zip
Added in an unstub and VIEW readme function.
Diffstat (limited to 'plugins/plugin_manager/plugin_view.lua')
-rw-r--r--plugins/plugin_manager/plugin_view.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/plugins/plugin_manager/plugin_view.lua b/plugins/plugin_manager/plugin_view.lua
index d223be6..31e3550 100644
--- a/plugins/plugin_manager/plugin_view.lua
+++ b/plugins/plugin_manager/plugin_view.lua
@@ -219,6 +219,14 @@ function PluginView:uninstall(plugin)
end
+function PluginView:unstub(plugin)
+ self.loading = true
+ self.plugin_manager:unstub(plugin, { progress = self.progress_callback }):done(function()
+ self.loading = false
+ self.selected_plugin, plugin_view.selected_plugin_idx = nil, nil
+ end)
+end
+
function PluginView:reinstall(plugin)
self.loading = true
self.plugin_manager:reinstall(plugin, { progress = self.progress_callback }):done(function()
@@ -330,6 +338,20 @@ end, {
end
end
if not opened then core.error("Can't find source for plugin.") end
+ end,
+ ["plugin-manager:view-readme-hovered"] = function()
+ local directory = plugin_view.hovered_plugin.type == "library" and "libraries" or "plugins"
+ local opened = false
+ plugin_view.hovered_plugin:unstub(plugin_view.hovered_plugin):done(function(plugin)
+ for i, path in ipairs({ plugin_view.hovered_plugin.path .. PATHSEP .. "README.md" }) do
+ local stat = system.get_file_info(path)
+ if stat and stat.type == "file" then
+ core.root_view:open_doc(core.open_doc(path))
+ opened = true
+ end
+ end
+ if not opened then core.error("Can't find README for plugin.") end
+ end)
end
})
@@ -354,6 +376,7 @@ PluginView.menu:register(nil, {
{ text = "Install", command = "plugin-manager:install-hovered" },
{ text = "Uninstall", command = "plugin-manager:uninstall-hovered" },
{ text = "View Source", command = "plugin-manager:view-source-hovered" },
+ { text = "View README", command = "plugin-manager:view-readme-hovered" },
ContextMenu.DIVIDER,
{ text = "Refresh Listing", command = "plugin-manager:refresh-all" },
{ text = "Upgrade All", command = "plugin-manager:upgrade-all" },