﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
5128	Text content of <pre> element with attributes is removed when changing the formatting	Razvan Caliman	Garry Yao	"When trying to alter the formatting of a <pre> block that has attributes (like ""class"", ""style"", etc.) the text is removed from the editor.

'''Steps to reproduce:'''[[BR]]
1. Go to CKeditor and switch to ""Source"" mode[[BR]]
2. Paste <pre style=""color: green"">This is a bug.</pre>[[BR]]
3. Switch back to ""WYSIWYG"" mode [[BR]]
4. Select the text ""This is a bug""[[BR]]
5. Click the formatting dropdown and select ""Heading 1""[[BR]]


'''Result:'''[[BR]]
The text is removed from the editor.

'''Expected:'''[[BR]]
The text should change to new formatting and not be removed. 

'''Bug cause & solution:'''[[BR]]
The issue comes from a regular expression that doesn't check for  attributes of <pre> elements. It is found in CKEditor's styles plugin.

file: _source/plugins/styles/plugin.js[[BR]]
line: 770[[BR]]
method: splitIntoPres()[[BR]]

problem:[[BR]]
splitedHtml.replace( /<pre>([\s\S]*?)<\/pre>/gi, ...

'''solution:'''[[BR]]
splitedHtml.replace( /<pre[\s\S]*?>([\s\S]*?)<\/pre>/gi ...

"	Bug	closed	Normal	CKEditor 3.3	Core : Styles	3.0 Beta	fixed	Confirmed Review+	
