54. paste

Parameter syntax:

'into'|'toOrInto' | ('to'|'before'|'after' [ implicit_selection ]?) 
([ S string ]? | [ '[systemSelection]' ]?)
into

Pastes the content of system clipboard into element containing caret, at caret position.

toOrInto

Pastes the content of system clipboard replacing text selection or selected nodes.

OR if there is no explicit selection, pastes the content of system clipboard into element containing caret, at caret position.

to

Pastes the content of system clipboard replacing text selection or selected nodes.

before or after

Pastes the content of system clipboard before of after selected nodes.

The system clipboard may contain one or several nodes or just plain text. The content of system clipboard, is parsed as XML if it begins with "<?xml" otherwise it is considered to be plain text.

If several nodes are to be pasted, they must be wrapped in a {http://www.xmlmind.com/xmleditor/namespace/clipboard}clipboard element. See last example below.

If string is specified in the command parameter, this string is used instead of the content of system clipboard.

If the [systemSelection] option is used, the content of system selection is used instead of the content of system clipboard.

Examples:

paste toOrInto
paste toOrInto[systemSelection]
paste before[implicitElement]
paste before[implicitElement][systemSelection]
paste after <?xml version='1.0'?><p>A paragraph.</p>

# Whitespace and newlines have been added to improve readability.
# In reality, they are not allowed here.

paste into <?xml version="1.0"?>
  <ns:clipboard xmlns:ns="http://www.xmlmind.com/xmleditor/namespace/clipboard">
  A text line containing <b>bold</b> and <i>italic</i> text.
  </ns:clipboard>