From 09633dda580a92e8779d5a9abeab9792ffdc2477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A1=97=E8=A7=92=E5=B0=8F=E6=9E=97?= <1013335014@qq.com> Date: Wed, 5 Jun 2024 15:46:16 +0800 Subject: [PATCH] =?UTF-8?q?Feat=EF=BC=9A=E9=99=8D=E7=BA=A7Formula=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E4=B8=AD=E8=BE=83=E6=96=B0=E7=9A=84js=E8=AF=AD?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/src/plugins/Formula.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simple-mind-map/src/plugins/Formula.js b/simple-mind-map/src/plugins/Formula.js index 5d628de3..19001625 100644 --- a/simple-mind-map/src/plugins/Formula.js +++ b/simple-mind-map/src/plugins/Formula.js @@ -101,7 +101,7 @@ class Formula { const m = [...insert.matchAll(/\$.+?\$/g)] const arr = insert.split(/\$.+?\$/g) for (let j = m.length - 1; j >= 0; j--) { - const exp = m[j]?.[0].slice(1, -1) ?? null // $...$ 之间的表达式 + const exp = m[j] && m[j][0] ? m[j][0].slice(1, -1) || null : null // $...$ 之间的表达式 if (exp !== null && exp.trim().length > 0) { const isLegal = this.checkFormulaIsLegal(exp) if (isLegal) {