diff --git a/main.ts b/main.ts index 3640d8d..93e0669 100644 --- a/main.ts +++ b/main.ts @@ -249,15 +249,15 @@ class MathTypeSuggest extends EditorSuggest { const editor = this.context.editor; const lineContent = editor.getLine(this.context.start.line); - if (!lineContent.startsWith("$") && !lineContent.endsWith("$")) { + if (lineContent.startsWith("$") && lineContent.endsWith("$")) { editor.replaceRange( - `$${value}$`, + value, this.context.start, this.context.end ); } else { editor.replaceRange( - value, + `$${value}$`, this.context.start, this.context.end );