From: umherirrender Date: Sun, 17 Feb 2013 13:39:04 +0000 (+0100) Subject: [Regression] Do not trim spaces on edit preview or show changes X-Git-Tag: 1.31.0-rc.0~20663 X-Git-Url: https://git.cyclocoop.org/%27.%24link.%27?a=commitdiff_plain;h=5a6ff4865b840840276f9f2541af1ed69de79f26;p=lhc%2Fweb%2Fwiklou.git [Regression] Do not trim spaces on edit preview or show changes Since Ic05e5898 spaces are also trimmed on preview/show changes, which is bad, because the autosummary "/* Header */ " gets trimmed and the user text is direct written behind the slash. That is confusing and was not so, before this change. Force the trim on summary preview to have the right preview, because the spaces are trimmed on save. Change-Id: I0058ce31197f3ea8ffc5520f3f0f9e1bf6105066 --- diff --git a/includes/EditPage.php b/includes/EditPage.php index 4e3ea493b4..5434dabd4f 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -624,11 +624,8 @@ class EditPage { wfProfileOut( get_class( $this ) . "::importContentFormData" ); } - # Trim spaces on user supplied text - $summary = trim( $request->getText( 'wpSummary' ) ); - # Truncate for whole multibyte characters - $this->summary = $wgContLang->truncate( $summary, 255 ); + $this->summary = $wgContLang->truncate( $request->getText( 'wpSummary' ), 255 ); # If the summary consists of a heading, e.g. '==Foobar==', extract the title from the # header syntax, e.g. 'Foobar'. This is mainly an issue when we are using wpSummary for @@ -2453,6 +2450,8 @@ class EditPage { * @return String */ protected function getSummaryPreview( $isSubjectPreview, $summary = "" ) { + // avoid spaces in preview, gets always trimmed on save + $summary = trim( $summary ); if ( !$summary || ( !$this->preview && !$this->diff ) ) { return ""; }