From 344b9c389fb5662d2afc905ba362a6d39fc6a6da Mon Sep 17 00:00:00 2001 From: weijiuqiao <59040746+weijiuqiao@users.noreply.github.com> Date: Sun, 18 Feb 2024 15:47:34 +0800 Subject: [PATCH] reverse book_title part --- plugins/vocabbuilder.koplugin/main.lua | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/plugins/vocabbuilder.koplugin/main.lua b/plugins/vocabbuilder.koplugin/main.lua index a37d42e1c..120338f8f 100644 --- a/plugins/vocabbuilder.koplugin/main.lua +++ b/plugins/vocabbuilder.koplugin/main.lua @@ -77,14 +77,7 @@ local function resetButtonOnLookupWindow() text = _("Add to vocabulary builder"), font_bold = false, callback = function() - local book_title = obj.ui.doc_settings and obj.ui.doc_settings:readSetting("doc_props").title or _("Dictionary lookup") - if book_title == "" then -- no or empty metadata title - if obj.ui.document and obj.ui.document.file then - local util = require("util") - local directory, filename = util.splitFilePathName(obj.ui.document.file) -- luacheck: no unused - book_title = util.splitFileNameSuffix(filename) - end - end + local book_title = (obj.ui.doc_props and obj.ui.doc_props.display_title) or _("Dictionary lookup") obj.ui:handleEvent(Event:new("WordLookedUp", obj.word, book_title, true)) -- is_manual: true local button = obj.button_table.button_by_id["vocabulary"] if button then