Adding a core command already registered on another element?


I’m looking to add a core command already in the Command Registry – in this case core:copy – on another element, and use that core command’s behavior instead of defining my own. (So using the system core:copy behavior instead.) How would I go about this? Thanks!


From TextEditor API: editor.copySelectedText().

Also, you can usually find the right method by looking at src/


Ah sorry, I wasn’t clear – this isn’t going to be using the TextEditor (it’s a rendered markdown file), so I can’t use the TextEditor API unfortunately.


I may be misunderstanding you, but it should be as easy as emitting the event. The big question is whether that command will work on whatever the other element is.


But this doesn’t work when the command is bound to atom-text-editor, but dispatched from an element that is not (a child of) an atom-text-editor right?


That is the issue – the event is emitting correctly but the element doesn’t know what to do with it.


So … I’m not sure I understand. But if core:copy is designed to work on TextEditors, but you’re proposing to use it on something other than a TextEditor … how is it supposed to work?