pasteboard.setAllowedTypes()

类型 函数
返回值
版本 2024.3703 版
关键字 setAllowedTypes、Pasteboard
另请参阅 Pasteboard

概述

设置粘贴时应用会接受的文件类型。例如,如果你只想让应用粘贴字符串,则只将 "string" 包含在 allowedTypes 表中。

语法

pasteboard.setAllowedTypes( allowedTypes ) 
pasteboard.setAllowedTypes( nil )
allowedTypes (可选)

表格包含以逗号分隔的数据类型列表,应用会接受这些数据类型以执行粘贴操作。有效选项包括 "image""string""url"。你也可以传递 nil 以禁用所有粘贴操作。

示例

local pasteboard = require( "plugin.pasteboard" )

-- Set the data types this application allows for a paste action
pasteboard.setAllowedTypes( { "string", "url", "image" } )