mirror of
https://github.com/koreader/koreader.git
synced 2025-12-18 12:02:09 +01:00
add base document init method to create new configurable for each document
this should fix configurables pollution when opening multiple documents at the same time, e.g. when clipping page images in Evernote plugin.
This commit is contained in:
@@ -50,18 +50,22 @@ local Document = {
|
||||
|
||||
-- flag to show that the document needs to be unlocked by a password
|
||||
is_locked = false,
|
||||
|
||||
configurable = Configurable,
|
||||
}
|
||||
|
||||
function Document:new(o)
|
||||
local o = o or {}
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
if o._init then o:_init() end
|
||||
if o.init then o:init() end
|
||||
return o
|
||||
end
|
||||
|
||||
-- base document initialization should be called on each document init
|
||||
function Document:_init()
|
||||
self.configurable = Configurable:new()
|
||||
end
|
||||
|
||||
-- override this method to open a document
|
||||
function Document:init()
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user