Vocabulary builder: make a word's book title changeable (#9776)

Adds the ability to re-assign which book a word belongs to
and change the name of an existing book. It can be used as
a way to regroup words and hide/show them by book.
This commit is contained in:
weijiuqiao
2022-11-13 04:22:58 +08:00
committed by GitHub
parent 5082289aad
commit 77e0ac57de
3 changed files with 255 additions and 52 deletions

View File

@@ -84,7 +84,7 @@ function SortItemWidget:init()
TextWidget:new{
text = self.item.text,
max_width = text_max_width,
face = self.face,
face = self.item.face or self.face,
},
},
},
@@ -98,7 +98,11 @@ function SortItemWidget:onTap(_, ges)
self.item:callback()
end
elseif self.show_parent.sort_disabled then
return true
if self.item.callback then
self.item:callback()
else
return true
end
elseif self.show_parent.marked == self.index then
self.show_parent.marked = 0
else
@@ -109,7 +113,9 @@ function SortItemWidget:onTap(_, ges)
end
function SortItemWidget:onHold()
if self.item.callback then
if self.item.hold_callback then
self.item:hold_callback(function() self.show_parent:_populateItems() end)
elseif self.item.callback then
self.item:callback()
self.show_parent:_populateItems()
end