mirror of
https://github.com/koreader/koreader.git
synced 2026-12-02 10:12:42 +00:00
[ReaderLink] fix stale cur_highlighted_link causing footnote popup to reopen on Press (#15888)
This commit is contained in:
1 parent
c889c5a1de
commit
b048603171
1 file changed
+9
-6
@@ -1292,7 +1292,7 @@ end
|
||||
function ReaderLink:clearSelectedPageLink(dirty_ui)
|
||||
if self.ui.paging then return end
|
||||
self.cur_selected_page_link_num = nil
|
||||
self.cur_selected_link = nil
|
||||
self.cur_highlighted_link = nil
|
||||
self.document:highlightXPointer()
|
||||
if dirty_ui then
|
||||
UIManager:setDirty(self.dialog, "ui")
|
||||
@@ -1346,7 +1346,7 @@ function ReaderLink:selectRelPageLink(rel)
|
||||
link_y = selected_link.end_y
|
||||
end
|
||||
-- Make it a link as expected by onGotoLink
|
||||
self.cur_selected_link = {
|
||||
self.cur_highlighted_link = {
|
||||
xpointer = selected_link.section or selected_link.uri,
|
||||
marker_xpointer = selected_link.section,
|
||||
from_xpointer = from_xpointer,
|
||||
@@ -1358,19 +1358,22 @@ function ReaderLink:selectRelPageLink(rel)
|
||||
link_y = link_y,
|
||||
}
|
||||
self.document:highlightXPointer() -- clear any previous one
|
||||
self.document:highlightXPointer(self.cur_selected_link.from_xpointer)
|
||||
self.document:highlightXPointer(self.cur_highlighted_link.from_xpointer)
|
||||
UIManager:setDirty(self.dialog, "ui")
|
||||
return true
|
||||
end
|
||||
|
||||
function ReaderLink:onGotoSelectedPageLink()
|
||||
if self.cur_selected_link then
|
||||
return self:onGotoLink(self.cur_selected_link, false, isFootnoteLinkInPopupEnabled())
|
||||
local link = self.cur_highlighted_link
|
||||
if link then
|
||||
-- avoid a further key `Press` incorrectly launching the footnote widget again
|
||||
self.cur_highlighted_link = nil
|
||||
return self:onGotoLink(link, false, isFootnoteLinkInPopupEnabled())
|
||||
end
|
||||
end
|
||||
|
||||
function ReaderLink:onPageUpdate()
|
||||
if self.cur_selected_link then
|
||||
if self.cur_highlighted_link or self.cur_selected_page_link_num then
|
||||
self:clearSelectedPageLink()
|
||||
end
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user