substance
Version:
Substance is a JavaScript library for web-based content editing. It provides building blocks for realizing custom text editors and web-based publishing systems.
21 lines (17 loc) • 540 B
JavaScript
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