From 6bb4b15777e0cd8b04f65659754245d4664a338d Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Fri, 13 Aug 2021 03:10:39 +0000 Subject: [PATCH] Preserve leading spaces when using the Quote function (#35677). MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Patch by Jens Krämer. git-svn-id: http://svn.redmine.org/redmine/trunk@21170 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- public/javascripts/jstoolbar/markdown.js | 4 ++-- public/javascripts/jstoolbar/textile.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/public/javascripts/jstoolbar/markdown.js b/public/javascripts/jstoolbar/markdown.js index ae2725269..902babab6 100644 --- a/public/javascripts/jstoolbar/markdown.js +++ b/public/javascripts/jstoolbar/markdown.js @@ -153,7 +153,7 @@ jsToolBar.prototype.elements.bq = { wiki: function() { this.encloseLineSelection('','',function(str) { str = str.replace(/\r/g,''); - return str.replace(/(\n|^) *([^\n]*)/g,"$1> $2"); + return str.replace(/(\n|^)( *)([^\n]*)/g,"$1> $2$3"); }); } } @@ -167,7 +167,7 @@ jsToolBar.prototype.elements.unbq = { wiki: function() { this.encloseLineSelection('','',function(str) { str = str.replace(/\r/g,''); - return str.replace(/(\n|^) *[>]? *([^\n]*)/g,"$1$2"); + return str.replace(/(\n|^) *(> ?)?( *)([^\n]*)/g,"$1$3$4"); }); } } diff --git a/public/javascripts/jstoolbar/textile.js b/public/javascripts/jstoolbar/textile.js index 76d2170cc..bc994d288 100644 --- a/public/javascripts/jstoolbar/textile.js +++ b/public/javascripts/jstoolbar/textile.js @@ -153,7 +153,7 @@ jsToolBar.prototype.elements.bq = { wiki: function() { this.encloseLineSelection('','',function(str) { str = str.replace(/\r/g,''); - return str.replace(/(\n|^) *([^\n]*)/g,"$1> $2"); + return str.replace(/(\n|^)( *)([^\n]*)/g,"$1> $2$3"); }); } } @@ -167,7 +167,7 @@ jsToolBar.prototype.elements.unbq = { wiki: function() { this.encloseLineSelection('','',function(str) { str = str.replace(/\r/g,''); - return str.replace(/(\n|^) *[>]? *([^\n]*)/g,"$1$2"); + return str.replace(/(\n|^) *(> ?)?( *)([^\n]*)/g,"$1$3$4"); }); } } -- 2.39.5