From aebcb79ba29298226027a34c30eb229329c7ed61 Mon Sep 17 00:00:00 2001 From: Pisces000221 <1786762946@qq.com> Date: Wed, 1 Oct 2014 10:32:15 +0800 Subject: [PATCH] Fix an issue about bold/italic toggling with CJK --- src/intro.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/intro.js b/src/intro.js index c001077..36fafbb 100644 --- a/src/intro.js +++ b/src/intro.js @@ -139,8 +139,8 @@ function toggleBold(editor) { start = text.slice(0, startPoint.ch); end = text.slice(startPoint.ch); - start = start.replace(/^(.*)?(\*|\_){2}(\S+.*)?$/, '$1$3'); - end = end.replace(/^(.*\S+)?(\*|\_){2}(\s+.*)?$/, '$1$3'); + start = start.replace(/^(.*)?(\*|\_){2}(.*)?$/, '$1$3'); + end = end.replace(/^(.*)?(\*|\_){2}(.*)?$/, '$1$3'); startPoint.ch -= 2; endPoint.ch -= 2; cm.setLine(startPoint.line, start + end); @@ -174,8 +174,8 @@ function toggleItalic(editor) { start = text.slice(0, startPoint.ch); end = text.slice(startPoint.ch); - start = start.replace(/^(.*)?(\*|\_)(\S+.*)?$/, '$1$3'); - end = end.replace(/^(.*\S+)?(\*|\_)(\s+.*)?$/, '$1$3'); + start = start.replace(/^(.*)?(\*|\_)(.*)?$/, '$1$3'); + end = end.replace(/^(.*)?(\*|\_)(.*)?$/, '$1$3'); startPoint.ch -= 1; endPoint.ch -= 1; cm.setLine(startPoint.line, start + end);