const clipboard = require('electron').clipboard;
clipboard.writeText('Example String');
clipboard.writeText('Example String', 'selection');
console.log(clipboard.readText('selection'));
方法
clipboard.readText([type])
clipboard.writeText(text[, type])
text
Stringtype
String (可选)
clipboard.readHtml([type])
clipboard.writeHtml(markup[, type])
markup
Stringtype
String (可选)
clipboard.readImage([type])
clipboard.writeImage(image[, type])
clipboard.readRtf([type])
clipboard.writeRtf(text[, type])
text
Stringtype
String (可选)
clipboard.clear([type])
clipboard.has(data[, type])
Experimental
data
Stringtype
String (可选)
console.log(clipboard.has('<p>selection</p>'));
clipboard.read(data[, type])
Experimental
data
Stringtype
String (可选)
clipboard.write(data[, type])
data
Objecttype
String (可选)
clipboard.write({text: 'test', html: "<b>test</b>"});
请发表评论