Clipboard Extended

Represents the clipboard used for copying and pasting in Atom.

An instance of this class is always available as the atom.clipboard global.

Examples

atom.clipboard.write('hello')

console.log(atom.clipboard.read()) // 'hello'

Methods

::write(text, metadata)

Write the given text to the clipboard.

The metadata associated with the text is available by calling ::readWithMetadata.

Argument Description

text

The String to store.

metadata

optional

The additional info to associate with the text.

::read()

Read the text from the clipboard.

Return values

Returns a String.

::writeFindText()

Write the given text to the macOS find pasteboard

::readFindText()

Read the text from the macOS find pasteboard.

Return values

Returns a String.

::readWithMetadata()

Read the text from the clipboard and return both the text and the associated metadata.

Return values

Returns an Object with the following keys:

  • text The String clipboard text.
  • metadata The metadata stored by an earlier call to ::write.