From beabd32e6ab3bb0df471e6d05434485e93b59e0b Mon Sep 17 00:00:00 2001 From: Jack Woodgate <67034721+lampy255@users.noreply.github.com> Date: Wed, 26 Jun 2024 00:11:13 +1200 Subject: [PATCH] fix: Improve SmartText fraction regex pattern (#7141) Modify fraction regex statements to not match if directly preceded by a character --- app/editor/extensions/SmartText.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/editor/extensions/SmartText.ts b/app/editor/extensions/SmartText.ts index 3ddaa4970..0c16af8c4 100644 --- a/app/editor/extensions/SmartText.ts +++ b/app/editor/extensions/SmartText.ts @@ -4,8 +4,8 @@ import { InputRule } from "@shared/editor/lib/InputRule"; const rightArrow = new InputRule(/->$/, "→"); const emdash = new InputRule(/--$/, "—"); -const oneHalf = new InputRule(/1\/2$/, "½"); -const threeQuarters = new InputRule(/3\/4$/, "¾"); +const oneHalf = new InputRule(/(?:^|\s)1\/2$/, "½"); +const threeQuarters = new InputRule(/(?:^|\s)3\/4$/, "¾"); const copyright = new InputRule(/\(c\)$/, "©️"); const registered = new InputRule(/\(r\)$/, "®️"); const trademarked = new InputRule(/\(tm\)$/, "™️");