mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-08 14:02:41 +00:00
Fixed cursor finish position
- tested on single words and multi word strings - tested removal of hyperlink - tested with highlighting selection from left to right, and right to left. - tested on empty strings
This commit is contained in:
@@ -103,9 +103,12 @@ 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}]()`);
|
||||||
const cursor = this.codeMirror.getCursor();
|
if ((selection.slice(0, 1) !== '[' || selection.slice(-3) !== ']()') || selection.length === 0){
|
||||||
this.codeMirror.setCursor({ line: cursor.line, ch: cursor.ch - 1 });
|
const cursor = this.codeMirror.getCursor();
|
||||||
|
console.log('hello');
|
||||||
|
this.codeMirror.setCursor({ line: cursor.line, ch: cursor.ch - 1 });
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//=-- Externally used -==//
|
//=-- Externally used -==//
|
||||||
|
|||||||
Reference in New Issue
Block a user