Add bookmark key to clipboard.write
This commit is contained in:
parent
358bf1bf69
commit
e802d0e4a0
2 changed files with 9 additions and 2 deletions
|
@ -54,12 +54,16 @@ std::string Read(const std::string& format_string,
|
|||
void Write(const mate::Dictionary& data,
|
||||
mate::Arguments* args) {
|
||||
ui::ScopedClipboardWriter writer(GetClipboardType(args));
|
||||
base::string16 text, html;
|
||||
base::string16 text, html, bookmark;
|
||||
gfx::Image image;
|
||||
|
||||
if (data.Get("text", &text))
|
||||
if (data.Get("text", &text)) {
|
||||
writer.WriteText(text);
|
||||
|
||||
if (data.Get("bookmark", &bookmark))
|
||||
writer.WriteBookmark(bookmark, base::UTF16ToUTF8(text));
|
||||
}
|
||||
|
||||
if (data.Get("rtf", &text)) {
|
||||
std::string rtf = base::UTF16ToUTF8(text);
|
||||
writer.WriteRTF(rtf);
|
||||
|
|
|
@ -58,16 +58,19 @@ describe('clipboard module', function () {
|
|||
var p = path.join(fixtures, 'assets', 'logo.png')
|
||||
var i = nativeImage.createFromPath(p)
|
||||
var markup = process.platform === 'darwin' ? "<meta charset='utf-8'><b>Hi</b>" : process.platform === 'linux' ? '<meta http-equiv="content-type" ' + 'content="text/html; charset=utf-8"><b>Hi</b>' : '<b>Hi</b>'
|
||||
var bookmark = {title: 'a title', url: 'test'}
|
||||
clipboard.write({
|
||||
text: 'test',
|
||||
html: '<b>Hi</b>',
|
||||
rtf: '{\\rtf1\\utf8 text}',
|
||||
bookmark: 'a title',
|
||||
image: p
|
||||
})
|
||||
assert.equal(clipboard.readText(), text)
|
||||
assert.equal(clipboard.readHTML(), markup)
|
||||
assert.equal(clipboard.readRTF(), rtf)
|
||||
assert.equal(clipboard.readImage().toDataURL(), i.toDataURL())
|
||||
assert.deepEqual(clipboard.readBookmark(), bookmark)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue