mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
@@ -281,7 +281,7 @@ function ReaderHighlight:translate(selected_text)
|
||||
end
|
||||
end
|
||||
|
||||
function ReaderHighlight:onHoldRelease(arg, ges)
|
||||
function ReaderHighlight:onHoldRelease()
|
||||
if self.selected_word then
|
||||
self:lookup(self.selected_word)
|
||||
self.selected_word = nil
|
||||
@@ -347,6 +347,16 @@ function ReaderHighlight:onHoldRelease(arg, ges)
|
||||
return true
|
||||
end
|
||||
|
||||
function ReaderHighlight:onHighlight()
|
||||
if self.hold_pos then
|
||||
if not self.selected_text then
|
||||
self.selected_text = self.ui.document:getTextFromPositions(self.hold_pos, self.hold_pos)
|
||||
DEBUG("selected text:", self.selected_text)
|
||||
end
|
||||
self:saveHighlight()
|
||||
end
|
||||
end
|
||||
|
||||
function ReaderHighlight:saveHighlight()
|
||||
DEBUG("save highlight")
|
||||
local page = self.hold_pos.page
|
||||
|
||||
@@ -132,6 +132,12 @@ function DictQuickLookup:update()
|
||||
self:changeToPrevDict()
|
||||
end,
|
||||
},
|
||||
{
|
||||
text = _("Highlight"),
|
||||
callback = function()
|
||||
self.ui:handleEvent(Event:new("Highlight"))
|
||||
end,
|
||||
},
|
||||
{
|
||||
text = ">>",
|
||||
enabled = self:isNextDictAvaiable(),
|
||||
@@ -142,17 +148,24 @@ function DictQuickLookup:update()
|
||||
},
|
||||
{
|
||||
{
|
||||
text = _("Highlight"),
|
||||
text = _("Wikipedia"),
|
||||
enabled = false,
|
||||
callback = function()
|
||||
self.ui:handleEvent(Event:new("Highlight"))
|
||||
self.ui:handleEvent(Event:new("HighlightWiki"))
|
||||
end,
|
||||
},
|
||||
{
|
||||
text = _("Add Note"),
|
||||
enabled = false,
|
||||
callback = function()
|
||||
self.ui:handleEvent(Event:new("AddNote"))
|
||||
self.ui:handleEvent(Event:new("HighlightAddNote"))
|
||||
end,
|
||||
},
|
||||
{
|
||||
text = _("More"),
|
||||
enabled = false,
|
||||
callback = function()
|
||||
self.ui:handleEvent(Event:new("HighlightMore"))
|
||||
end,
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user