25. drop

Parameter syntax:

string

This command is intended to be bound to a mouse input. It is generally used by the macro-command which is bound to the drop appEvent in XMLmind XML Editor - Configuration and Deployment.

If the string parameter is an URL or an absolute filename, this command opens the corresponding document using command XXE.open.

Otherwise, the string parameter is assumed to be plain text or the string representation of one or more XML nodes. In this case, the drop command first attempts to paste this string at the drop location by working similarly to paste into. If this is not possible, the drop command then attempts to paste this string after the element containing the drop location (or after an ancestor of the element containing the drop location) by working similarly to paste after.

DITA topic example:

<binding>
  <appEvent name="drop" />
  <command name="dita.drop" parameter="%{value}" />
</binding>

<command name="dita.drop">
  <macro>
    <choice>
      <sequence>
        <match context="$clickedElement" 
               pattern="xref[@href]|xref[@href]//*|
                        link[@href]|link[@href]//*|
                        longdescref[@href]|
                        longquoteref[@href]" />
        <set variable="selectedElement" context="$clickedElement" 
             expression="(ancestor-or-self::*[@href])[last()]" />

        <set variable="dropped" context="$selectedElement"
             expression="relativize-uri(uri-or-file-name('%*'))" />
        <get expression="$dropped" />
        <command name="putAttribute" parameter="href '%_'" />

        <get expression="$dropped" />
        <command name="status" parameter="href='%_'" />
      </sequence>

      <!-- Default drop action. -->
      <command name="drop" parameter="%*" />
    </choice>
  </macro>
</command>