3. Edit menu

Tip

A simplified, contextual, version of the Edit menu is displayed if you right-click in a document view.

Also note that a right-click may be used to select the element clicked upon prior to displaying the popup menu. More precisely:

  • If you right-click outside the existing text or node selection or if there is no selection, this selects (explicitly if really needed to, otherwise implicitly) the element clicked upon.

  • If you right-click inside the existing text or node selection, the selection is not changed.

Undo

Undo last command.

Redo

Redo last undone command.

Repeat

Repeats last repeatable command.

Commands requiring the user to specify an argument (e.g. Replace, Insert Before, Insert, Insert After, Convert, Convert [wrap], Change Processing Instruction Target, etc) are repeatable.

Command History

Displays a dialog box listing last ten repeatable commands from newest to oldest.

Cut

Cuts

  • text selection

  • OR explicitly selected node or node range

  • OR implicitly selected element

to system clipboard.

Tip

It is possible to cut and paste nodes between two instances of XXE (of course if the DTD or schema allows it).

Copy

Copies

  • text selection

  • OR explicitly selected node or node range

  • OR implicitly selected element

to the system clipboard.

Tip

Selected characters are automatically copied as system selection on platforms supporting system selection (X-Window) and automatically copied to an internal clipboard on other platforms.

Copy as Text

Copies as plain text explicit text or node selection to the system clipboard.

Paste Before

Pastes the content of system clipboard before

  • explicitly selected node or node range

  • OR implicitly selected element.

The system clipboard may contain one or several XML nodes or just plain text.

Paste

Pastes the content of system clipboard replacing

  • text selection

  • OR explicitly selected node or node range,

OR if there is no explicit selection, pastes the content of system clipboard into

  • element containing caret, at caret position.

The system clipboard may contain one or several XML nodes or just plain text.

Tip

Clicking with mouse button #2 (middle button or mouse wheel) can be used to paste the content of system selection on platforms supporting system selection and can be used to paste the content of an internal clipboard on other platforms (if allowed by grammar constraining the document, of course).

By default, this very handing feature is not enabled. You need to enable it using the Options dialog box.

Paste After

Pastes the content of system clipboard after

  • explicitly selected node or node range

  • OR implicitly selected element.

The system clipboard may contain one or several XML nodes or just plain text.

Delete

Deletes

  • text selection

  • OR explicitly selected node or node range

  • OR implicitly selected element.

Force Deletion

Like Delete except that deletion will be performed even if the grammar constraining the document forbids to do so.

Example 3.1. A use case for command Force Deletion

The content model of element <a> is child element <b> or a sequence of child element <c> followed by child element <d>.

A new <a> is by default created with the simplest possible content model, that is <b>. Then how to replace <b> by the sequence <c><d>? Deleting <b> is forbidden because it would give us an invalid <a>.

The answer is:

  1. Force the deletion of <b> using the command described here. This makes <a> temporarily invalid but also relaxes the constraints on it.

  2. Insert a <c>.

  3. Insert a <d>. Element <a> is now valid.


Note

This item is by default absent in the Edit menu. You need to explicitly enable it by checking "Enable the 'Edit|Force Deletion' menu item" in OptionsPreferences, General|Features section.

Replace

Displays the Edit tool. This dialog box can be used to specify an element or a text node replacing

  • explicitly selected node or node range

  • OR implicitly selected element.

Insert Before

Displays the Edit tool. This dialog box can be used to specify an element or a text node to be inserted just before

  • explicitly selected node or node range

  • OR implicitly selected element.

Insert

Displays the Edit tool. This dialog box can be used to specify an element or a text node to be inserted into the element containing the caret, right here, at caret position.

Insert After

Displays the Edit tool. This dialog box can be used to specify an element or a text node to be inserted just after

  • explicitly selected node or node range

  • OR implicitly selected element.

Convert

Displays the Edit tool. This dialog box can be used to specify an element or a text node replacing

  • text selection

  • OR explicitly selected node or node range

  • OR implicitly selected element.

Unlike Replace which creates an empty new element, Convert transfers the content of the selection to the new element which is the result of the conversion.

More precisely, in the case of the node selection:

  • When a single element is selected, all its children, and also all compatible attributes, are transferred to the result of the conversion.

    Example:

    <simpara id="p1">The <emphasis>little</emphasis> lamb.</simpara>

    converted to para gives

    <para id="p1">The <emphasis>little</emphasis> lamb.</para>

  • When several nodes or a single non-element node are selected, all these nodes are given a new parent element which is the result of the conversion.

    Example:

    <simpara>Once upon a time,</simpara>

    plus

    <simpara id="p1">the <emphasis>little</emphasis> girl.</simpara>

    can be converted to blockquote and that gives us

    <blockquote>
      <simpara>Once upon a time,</simpara>
      <simpara id="p1">the <emphasis>little</emphasis> girl.</simpara>
    </blockquote>

See also Wrap a variant of Convert.

Convert [wrap]

This command is a variant of Convert. The unique difference between Wrap and Convert is that, with Wrap, when a single element is selected, the selected element is given a new parent element.

Example, with Wrap (and not with Convert), it is possible to give a <blockquote> parent to the following <simpara>, when this <simpara> is implicitly or explicitly selected:

<simpara id="p1">The <emphasis>little</emphasis> lamb.</simpara>

That is, selecting blockquote using the Edit tool gives:

<blockquote>
  <simpara id="p1">The <emphasis>little</emphasis> lamb.</simpara>
</blockquote>

Split

Splits explicitly selected element in two parts, the split point being specified by caret position.

Unlike almost all other commands, this command requires the element to be explicitly selected.

Tip

A less generic form of the Split command is often bound to key Enter (for example, this is the case for XHTML, DITA and DocBook).

Typing Enter inside a paragraph or a list item will split this element in two parts.

Join

Joins explicitly selected element to its preceding sibling, an element of same type. This gives a single element containing the child nodes of the two joined elements. This command is the inverse command of Split.

Unlike almost all other commands, this command requires the element to be explicitly selected.

Tip

A less generic form of the Join command is often bound (for example, this is the case for XHTML, DITA and DocBook) to

  • key Backspace when the caret is at the beginning of a paragraph or a list item

  • and to key Delete when the caret is at the end of a paragraph or a list item.

Typing Backspace at the beginning of a paragraph or a list item joins this element to the preceding paragraph or a list item.

Typing Delete at the end of a paragraph or a list item joins this element to the following paragraph or a list item.