diff --git a/frontend/apps/reader/modules/readerrolling.lua b/frontend/apps/reader/modules/readerrolling.lua index 9f9a0cd48..96aa8e83f 100644 --- a/frontend/apps/reader/modules/readerrolling.lua +++ b/frontend/apps/reader/modules/readerrolling.lua @@ -308,27 +308,31 @@ end function ReaderRolling:onCheckDomStyleCoherence() if self.ui.document and self.ui.document:isBuiltDomStale() then - local has_bookmarks_warn_txt = "" - -- When using an older DOM version, bookmarks may break - if self.using_non_normalized_xpointers and self.ui.bookmark:hasBookmarks() then - has_bookmarks_warn_txt = _("\nNote that this change in styles may render your bookmarks or highlights no more valid.\nIf some of them do not show anymore, you can just revert the change you just made to have them shown again.\n\n") - end - UIManager:show(ConfirmBox:new{ - text = T(_("Styles have changed in such a way that fully reloading the document may be needed for a correct rendering.\n%1Do you want to reload the document?"), has_bookmarks_warn_txt), - ok_callback = function() - -- Allow for ConfirmBox to be closed before showing - -- "Opening file" InfoMessage - UIManager:scheduleIn(0.5, function() - -- And check we haven't quit reader in these 0.5s - if self.ui.document then - self.ui:reloadDocument() - end - end) - end, - }) + local has_bookmarks_warn = self.using_non_normalized_xpointers and self.ui.annotation:hasAnnotations() + self:showReloadConfirmBox(has_bookmarks_warn) end end +function ReaderRolling:showReloadConfirmBox(has_bookmarks_warn) + local has_bookmarks_warn_txt = has_bookmarks_warn + and _("\nNote that this change in styles may render your bookmarks or highlights no more valid.\nIf some of them do not show anymore, you can just revert the change you just made to have them shown again.\n\n") + or "" + UIManager:show(ConfirmBox:new{ + text = T(_("Styles have changed in such a way that fully reloading the document may be needed for a correct rendering.\n%1Do you want to reload the document?"), + has_bookmarks_warn_txt), + ok_callback = function() + -- Allow for ConfirmBox to be closed before showing + -- "Opening file" InfoMessage + UIManager:scheduleIn(0.5, function() + -- And check we haven't quit reader in these 0.5s + if self.ui.document then + self.ui:reloadDocument() + end + end) + end, + }) +end + function ReaderRolling:onSaveSettings() self.ui.doc_settings:delSetting("last_percent") -- deprecated self.ui.doc_settings:saveSetting("last_xpointer", self.xpointer)