Last active
March 21, 2025 17:26
-
-
Save dmalinovsky/f9cb7640294108d66b180401e788cc79 to your computer and use it in GitHub Desktop.
Patch for KOReader to open the selected text as an URL in the browser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local Device = require("device") | |
local ReaderHighlight = require("apps/reader/modules/readerhighlight") | |
local util = require("util") | |
local init_orig = ReaderHighlight.init | |
ReaderHighlight.init = function(self) | |
init_orig(self) | |
self:addToHighlightDialog("08_open_url", function(this) | |
return { | |
text = "Open as URL", | |
callback = function() | |
local text = util.cleanupSelectedText(this.selected_text.text) | |
this:onClose() | |
Device:openLink(text) | |
end, | |
} | |
end) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment