mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-04 16:52:38 +00:00
Change cursor finish position
Change cursor finish position
This commit is contained in:
@@ -104,10 +104,8 @@ const CodeEditor = createClass({
|
|||||||
makeLink : function() {
|
makeLink : function() {
|
||||||
const selection = this.codeMirror.getSelection(), t = selection.slice(0, 1) === '[' && selection.slice(-3) === ']()';
|
const selection = this.codeMirror.getSelection(), t = selection.slice(0, 1) === '[' && selection.slice(-3) === ']()';
|
||||||
this.codeMirror.replaceSelection(t ? selection.slice(1, -3) : `[${selection}]()`, 'around');
|
this.codeMirror.replaceSelection(t ? selection.slice(1, -3) : `[${selection}]()`, 'around');
|
||||||
if(selection.length === 0){
|
const cursor = this.codeMirror.getCursor();
|
||||||
const cursor = this.codeMirror.getCursor();
|
this.codeMirror.setCursor({ line: cursor.line, ch: cursor.ch - 1 });
|
||||||
this.codeMirror.setCursor({ line: cursor.line, ch: cursor.ch - 3 });
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
//=-- Externally used -==//
|
//=-- Externally used -==//
|
||||||
|
|||||||
Reference in New Issue
Block a user