mirror of
https://github.com/slateblua/mathtype.git
synced 2026-07-22 05:43:32 +00:00
Add smart range replace
This commit is contained in:
parent
a95d1a9079
commit
4d3616c6d9
1 changed files with 3 additions and 3 deletions
6
main.ts
6
main.ts
|
|
@ -249,15 +249,15 @@ class MathTypeSuggest extends EditorSuggest<string> {
|
|||
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
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue