0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 22:52:40 +00:00

Change cursor finish position

Change cursor finish position
This commit is contained in:
Gazook89
2021-08-12 22:48:42 -05:00
parent 5258e9f0e6
commit b89c10a298

View File

@@ -104,10 +104,8 @@ const CodeEditor = createClass({
makeLink : function() {
const selection = this.codeMirror.getSelection(), t = selection.slice(0, 1) === '[' && selection.slice(-3) === ']()';
this.codeMirror.replaceSelection(t ? selection.slice(1, -3) : `[${selection}]()`, 'around');
if(selection.length === 0){
const cursor = this.codeMirror.getCursor();
this.codeMirror.setCursor({ line: cursor.line, ch: cursor.ch - 3 });
}
const cursor = this.codeMirror.getCursor();
this.codeMirror.setCursor({ line: cursor.line, ch: cursor.ch - 1 });
},
//=-- Externally used -==//