From 612ee997076507be7e0b398013f1fdd28658984c Mon Sep 17 00:00:00 2001 From: chrox Date: Mon, 15 Jun 2015 18:11:42 +0800 Subject: [PATCH] dictionary lookup now supports phrase This should fix #1537. --- frontend/apps/reader/modules/readerhighlight.lua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/frontend/apps/reader/modules/readerhighlight.lua b/frontend/apps/reader/modules/readerhighlight.lua index 91e9e1950..2d8f33ad3 100644 --- a/frontend/apps/reader/modules/readerhighlight.lua +++ b/frontend/apps/reader/modules/readerhighlight.lua @@ -359,10 +359,9 @@ function ReaderHighlight:onHoldRelease() end, }, { - text = _("More"), - enabled = false, + text = _("Dictionary"), callback = function() - self:moreAction() + self:onHighlightDictLookup() self:onClose() end, }, @@ -487,6 +486,15 @@ function ReaderHighlight:onHighlightSearch() end end +function ReaderHighlight:onHighlightDictLookup() + DEBUG("dictionary lookup highlight") + self:highlightFromHoldPos() + if self.selected_text then + local text = require("util").stripePunctuations(self.selected_text.text) + self.ui:handleEvent(Event:new("LookupWord", text)) + end +end + function ReaderHighlight:shareHighlight() DEBUG("share highlight") end