all files / packages/link/ LinkCommand.js

0% Statements 0/6
100% Branches 0/0
0% Functions 0/2
0% Lines 0/6
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21                                         
import { AnnotationCommand } from '../../ui'
 
class LinkCommand extends AnnotationCommand {
  canFuse() { return false }
 
  /*
    On link creation we collapse the selection, as this is a condition for the
    EditLinkTool to be shown (see EditAnnotationCommand)
  */
  executeCreate(params) {
    let result = super.executeCreate(params)
    let editorSession = this._getEditorSession(params)
    editorSession.transaction((tx) => {
      tx.setSelection(tx.selection.collapse())
    })
    return result
  }
}
 
export default LinkCommand