From dd1fa7777f406df3a761b30d4e04433025ac31ce Mon Sep 17 00:00:00 2001 From: hius07 <62179190+hius07@users.noreply.github.com> Date: Thu, 21 Mar 2024 09:26:19 +0200 Subject: [PATCH] readerbookmark: add annotation AutoText check --- frontend/apps/reader/modules/readerbookmark.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/frontend/apps/reader/modules/readerbookmark.lua b/frontend/apps/reader/modules/readerbookmark.lua index 262a2bf01..58f441fc2 100644 --- a/frontend/apps/reader/modules/readerbookmark.lua +++ b/frontend/apps/reader/modules/readerbookmark.lua @@ -1534,4 +1534,17 @@ function ReaderBookmark:getBookmarkForHighlight(item) return self.bookmarks[self:getBookmarkIndexFullScan(item)] end +function ReaderBookmark:getAnnotationAutoText(annotation, force_auto_text) + if force_auto_text or G_reader_settings:nilOrTrue("bookmarks_items_auto_text") then + local page = self:getBookmarkPageString(annotation.page) + return T(_("Page %1 %2 @ %3"), page, annotation.text, annotation.datetime) + end +end + +--- Check if the note has not been edited manually +function ReaderBookmark:isAnnotationAutoText(annotation) + local note = annotation.note + return (note == nil) or (note == annotation.text) or (note == self:getAnnotationAutoText(annotation, true)) +end + return ReaderBookmark