mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Implement generic internal clipboard for all devices
Will allow copying selected text from a book to the TextEditor. Will be overriden on devices that implement interactions with the system clipboard.
This commit is contained in:
@@ -24,7 +24,7 @@ local Device = {
|
||||
isTouchDevice = no,
|
||||
hasFrontlight = no,
|
||||
needsTouchScreenProbe = no,
|
||||
hasClipboard = no,
|
||||
hasClipboard = yes, -- generic internal clipboard on all devices
|
||||
hasColorScreen = no,
|
||||
hasBGRFrameBuffer = no,
|
||||
canToggleGSensor = no,
|
||||
|
||||
@@ -75,6 +75,8 @@ local MSC_RAW_GSENSOR_FRONT = 0x1c
|
||||
|
||||
-- luacheck: pop
|
||||
|
||||
local _internal_clipboard_text = nil -- holds the last copied text
|
||||
|
||||
local Input = {
|
||||
-- this depends on keyboard layout and should be overridden:
|
||||
event_map = {},
|
||||
@@ -141,6 +143,17 @@ local Input = {
|
||||
}
|
||||
},
|
||||
gesture_detector = nil,
|
||||
|
||||
-- simple internal clipboard implementation, can be overidden to use system clipboard
|
||||
hasClipboardText = function()
|
||||
return _internal_clipboard_text ~= nil and _internal_clipboard_text ~= ""
|
||||
end,
|
||||
getClipboardText = function()
|
||||
return _internal_clipboard_text
|
||||
end,
|
||||
setClipboardText = function(text)
|
||||
_internal_clipboard_text = text
|
||||
end,
|
||||
}
|
||||
|
||||
function Input:new(o)
|
||||
|
||||
Reference in New Issue
Block a user