[UX] Add "Follow Link" in hold/highlight dialog (#3190)

* This way you can disable "tap to follow links" on single tap yet still follow links.
* Change menu as well as per @poire-z's suggestion.
This commit is contained in:
Frans de Jonge
2017-09-09 18:30:00 +02:00
committed by GitHub
parent 71553a5190
commit f439ca0e8d
4 changed files with 128 additions and 68 deletions

View File

@@ -194,9 +194,9 @@ If you'd like to change the order in which dictionaries are queried (and their r
}
end
function ReaderDictionary:onLookupWord(word, box, highlight)
function ReaderDictionary:onLookupWord(word, box, highlight, link)
self.highlight = highlight
self:stardictLookup(word, box)
self:stardictLookup(word, box, link)
return true
end
@@ -317,7 +317,7 @@ function ReaderDictionary:dismissLookupInfo()
self.lookup_progress_msg = nil
end
function ReaderDictionary:stardictLookup(word, box)
function ReaderDictionary:stardictLookup(word, box, link)
logger.dbg("lookup word:", word, box)
-- escape quotes and other funny characters in word
word = self:cleanSelection(word)
@@ -402,10 +402,10 @@ function ReaderDictionary:stardictLookup(word, box)
}
}
end
self:showDict(word, tidyMarkup(final_results), box)
self:showDict(word, tidyMarkup(final_results), box, link)
end
function ReaderDictionary:showDict(word, results, box)
function ReaderDictionary:showDict(word, results, box, link)
self:dismissLookupInfo()
if results and results[1] then
logger.dbg("showing quick lookup window", word, results)
@@ -416,6 +416,8 @@ function ReaderDictionary:showDict(word, results, box)
dialog = self.dialog,
-- original lookup word
word = word,
-- selected link, if any
selected_link = link,
results = results,
dictionary = self.default_dictionary,
width = Screen:getWidth() - Screen:scaleBySize(80),