|
|
|
@ -223,11 +223,31 @@ function ReaderHighlight:saveHighlight()
|
|
|
|
|
local hl_item = {}
|
|
|
|
|
hl_item["text"] = self.selected_text.text
|
|
|
|
|
hl_item["boxes"] = self.selected_text.boxes
|
|
|
|
|
hl_item["datetime"] = os.date("%Y-%m-%d %H:%M:%S"),
|
|
|
|
|
table.insert(self.view.highlight.saved[page], hl_item)
|
|
|
|
|
if self.selected_text.text ~= "" then
|
|
|
|
|
self:exportToClippings(page, hl_item)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--DEBUG("saved hightlights", self.view.highlight.saved[page])
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function ReaderHighlight:exportToClippings(page, item)
|
|
|
|
|
DEBUG("export highlight to My Clippings")
|
|
|
|
|
local clippings = io.open("/mnt/us/documents/My Clippings.txt", "a+")
|
|
|
|
|
if clippings then
|
|
|
|
|
local current_locale = os.setlocale()
|
|
|
|
|
os.setlocale("C")
|
|
|
|
|
clippings:write(self.document.file:gsub("(.*/)(.*)", "%2").."\n")
|
|
|
|
|
clippings:write("- Koreader Highlight Page "..page.." ")
|
|
|
|
|
clippings:write("| Added on "..os.date("%A, %b %d, %Y %I:%M:%S %p\n\n"))
|
|
|
|
|
clippings:write(item["text"].."\n")
|
|
|
|
|
clippings:write("==========\n")
|
|
|
|
|
clippings:close()
|
|
|
|
|
os.setlocale(current_locale)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function ReaderHighlight:addNote()
|
|
|
|
|
DEBUG("add Note")
|
|
|
|
|
UIManager:close(self.highlight_dialog)
|
|
|
|
|