|
@@ -4,8 +4,9 @@
|
|
|
class MarkdownLinkUtil {
|
|
class MarkdownLinkUtil {
|
|
|
|
|
|
|
|
constructor() {
|
|
constructor() {
|
|
|
- this.linePartOfLink = /^(\[+(.*)+\])(\(+(.*)+\))/;
|
|
|
|
|
- this.isInTable = this.isInTable.bind(this);
|
|
|
|
|
|
|
+ // https://regex101.com/r/1UuWBJ/7
|
|
|
|
|
+ this.linePartOfLink = /(\[+(.*)+\]){1}(\(+(.*)+\)){1}/;
|
|
|
|
|
+ this.isInLink = this.isInLink.bind(this);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
getSelectedTextInEditor(editor) {
|
|
getSelectedTextInEditor(editor) {
|
|
@@ -16,7 +17,7 @@ class MarkdownLinkUtil {
|
|
|
editor.getDoc().replaceSelection(link);
|
|
editor.getDoc().replaceSelection(link);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- isInTable(editor) {
|
|
|
|
|
|
|
+ isInLink(editor) {
|
|
|
const curPos = editor.getCursor();
|
|
const curPos = editor.getCursor();
|
|
|
return this.linePartOfLink.test(editor.getDoc().getLine(curPos.line));
|
|
return this.linePartOfLink.test(editor.getDoc().getLine(curPos.line));
|
|
|
}
|
|
}
|