lib/commands/wrap-with-abbreviation.js
function getWrappingContentRange(editor) {
	if (editor.somethingSelected()) {
		const sel = editor.listSelections().filter(sel => sel.anchor !== sel.head)[0];
		if (sel) {
			return  comparePos(sel.anchor, sel.head) < 0
				? { from: sel.anchor, to: sel.head }
				: { from: sel.head, to: sel.anchor };
		}
	}

	// Nothing selected, find parent HTML node and return range for its content
	return getTagRangeForPos(editor, editor.getCursor());
}
function getWrappingContentRange(editor) {
	if (editor.somethingSelected()) {
		const sel = editor.listSelections().filter(sel => sel.anchor !== sel.head)[0];
		if (sel) {
			return  comparePos(sel.anchor, sel.head) < 0
				? { from: sel.anchor, to: sel.head }
				: { from: sel.head, to: sel.anchor };
		}
	}

	// Nothing selected, find parent HTML node and return range for its content
	return getTagRangeForPos(editor, editor.getCursor());
}
function getWrappingContentRange ( editor ) { if ( editor . somethingSelected ( ) ) { const sel = editor . listSelections ( ) . filter ( sel => sel . anchor !== sel . head ) [ 0 ] ; if ( sel ) { return comparePos ( sel . anchor , sel . head ) < 0 ? { from : sel . anchor , to : sel . head } : { from : sel . head , to : sel . anchor } ; } } // Nothing selected, find parent HTML node and return range for its content return getTagRangeForPos ( editor , editor . getCursor ( ) ) ; }
Returns content range that should be wrapped
@param {CodeMirror} editor
Returns content range that should be wrapped