2015-10-03 01:57:40 +08:00
---
layout: docs
title: Clipboard
2015-10-04 04:39:16 +08:00
edit_url: "https://github.com/nylas/N1/blob/master/src/clipboard.coffee"
2015-10-03 01:57:40 +08:00
---
2015-10-02 03:34:16 +08:00
2015-10-03 01:57:40 +08:00
< h2 > Summary< / h2 >
2015-10-02 03:34:16 +08:00
2015-10-03 01:57:40 +08:00
< div class = "markdown-from-sourecode" >
< p > < p > Represents the clipboard used for copying and pasting in Atom.< / p >
2015-10-02 03:34:16 +08:00
< p > An instance of this class is always available as the < code > atom.clipboard< / code > global.< / p >
< / p >
2015-10-03 01:57:40 +08:00
< / div >
2015-10-02 03:34:16 +08:00
2015-10-03 01:57:40 +08:00
< ul >
< / ul >
2015-10-02 03:34:16 +08:00
2015-10-03 01:57:40 +08:00
< h3 > Instance Methods< / h3 >
2015-10-02 03:34:16 +08:00
2015-10-03 01:57:40 +08:00
< h4 id = write class = "function-name" >
write(< span class = "args" > < span class = "arg" > text< / span > < span class = "arg" > metadata< / span > < / span > ) < a href = "#write" class = "link" > < / a >
< / h4 >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< div class = "function-description markdown-from-sourecode" >
< p > < p > Write the given text to the clipboard.< / p >
< p > The metadata associated with the text is available by calling
< a href = '#readWithMetadata' > readWithMetadata< / a > .< / p >
< / p >
< / div >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< strong > Parameters< / strong >
< table class = "arguments" >
2015-10-02 03:34:16 +08:00
< tr >
2015-10-03 01:57:40 +08:00
< th > Argument< / th >
< th > Description< / th >
2015-10-02 03:34:16 +08:00
< / tr >
< tr >
2015-10-03 01:57:40 +08:00
< td style = "width:15%;" >
< em > text< / em >
< / td >
< td class = "markdown-from-sourecode" >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< p > The < a href = 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string' > String< / a > to store.< / p >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< / td >
2015-10-02 03:34:16 +08:00
< / tr >
2015-10-03 01:57:40 +08:00
< tr >
< td style = "width:15%;" >
< em > metadata< / em >
< / td >
< td class = "markdown-from-sourecode" >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< p > The additional info to associate with the text. < / p >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< / td >
< / tr >
< / table >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< h4 id = read class = "function-name" >
read(< span class = "args" > < / span > ) < a href = "#read" class = "link" > < / a >
< / h4 >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< div class = "function-description markdown-from-sourecode" >
< p > < p > Read the text from the clipboard.< / p >
< / p >
< / div >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< strong > Returns< / strong >
< table class = "arguments" >
< tr >
< th > Return Values< / th >
< / tr >
< tr > < td class = "markdown-from-sourecode" > < p > Returns a < a href = 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string' > String< / a > .< / p >
< / td > < / tr >
< / table >
< h4 id = readWithMetadata class = "function-name" >
readWithMetadata(< span class = "args" > < / span > ) < a href = "#readWithMetadata" class = "link" > < / a >
< / h4 >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< div class = "function-description markdown-from-sourecode" >
< p > < p > Read the text from the clipboard and return both the text and the
associated metadata.< / p >
< / p >
< / div >
2015-10-04 04:39:16 +08:00
2015-10-03 01:57:40 +08:00
< strong > Returns< / strong >
< table class = "arguments" >
< tr >
< th > Return Values< / th >
< / tr >
< tr > < td class = "markdown-from-sourecode" > < p > Returns an < a href = 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/object' > Object< / a > with the following keys:< / p >
< ul >
< li > < code > text< / code > The < a href = 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string' > String< / a > clipboard text.< / li >
< li > < code > metadata< / code > The metadata stored by an earlier call to < a href = '#write' > write< / a > .< / li >
< / ul >
< / td > < / tr >
< / table >