类型 函数 版本 Release 2024.3703 关键词 粘贴,剪贴板 另请参见 剪贴板 pasteboard.copy() pasteboard.clear()
粘贴剪贴板上最顶部的项目。
图像复制/粘贴仅受 iOS 支持。
pasteboard.paste( [listener] )
函数. 执行粘贴操作时需要调用的侦听器函数。该函数会传入一个 event 表,该表可能包含以下属性,具体取决于数据粘贴的类型
local pasteboard = require( "plugin.pasteboard" )
-- Callback function for the paste method
local function onPaste( event )
-- Print the type of data on the pasteboard
print( "Type of data:", pasteboard.getType() )
-- Paste an image
if ( event.filename ) then
print( "filename is:", event.filename )
print( "baseDir is:", event.baseDir )
end
-- Paste a string
if ( event.string ) then
print( "string is:", event.string )
end
-- Paste a URL
if ( event.url ) then
print( "URL is:", event.url )
end
end
pasteboard.paste( onPaste )