The function mw.toolbar.insertTags (documentation) is currently bundled with the mediawiki.toolbar module, while it is useful without it as well. The advantage of that function over the jquery.textSelection module is that it works on the input for the edit comment, too. It should be possible to load and use it without having the old toolbar initialized (which is hidden when WikiEditor is used). So it should go to mediawiki.action.edit.js or something like that.
See also: T39084: WikiEditor: Toolbar should insert tags in edit summary input (if focussed)