Skip to content
Permalink
Browse files

Merge branch 't/11102'

  • Loading branch information...
mlewand committed Dec 30, 2013
2 parents ac648cc + acd5db3 commit ac305ede7397f8ada8e227654c7b894c59bd11be
Showing with 17 additions and 7 deletions.
  1. +3 −0 CHANGES.md
  2. +14 −7 core/template.js
@@ -3,6 +3,9 @@ CKEditor 4 Changelog

## CKEditor 4.3.2

* [#11102](http://dev.ckeditor.com/ticket/11102): `CKEDITOR.template` improvements:
* added new line character support ([#11102](http://dev.ckeditor.com/ticket/11102)),
* added "\\'" substring support ([#11216](http://dev.ckeditor.com/ticket/11216)).
* [#11121](http://dev.ckeditor.com/ticket/11121): [Firefox] Fixed: High Contrast mode is enabled when editor is loaded in hidden iframe.
* [#11350](http://dev.ckeditor.com/ticket/11350): The default value of [`config.contentsCss`](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-contentsCss) is affected by [`CKEDITOR.getUrl`](http://docs.ckeditor.com/#!/api/CKEDITOR-method-getUrl).
* [#11097](http://dev.ckeditor.com/ticket/11097): Improved the [Autogrow](http://ckeditor.com/addon/autogrow) plugin performance when dealing with very big tables.
@@ -9,7 +9,12 @@
*/

( function() {
var cache = {};
var cache = {},
rePlaceholder = /{([^}]+)}/g,
reQuote = /'/g,
reEscapableChars = /([\\'])/g,
reNewLine = /\n/g,
reCarriageReturn = /\r/g;

/**
* Lightweight template used to build the output string from variables.
@@ -34,12 +39,14 @@
this.output = cache[ source ];
else {
var fn = source
// Escape all quotation marks (").
.replace( /'/g, "\\'" )
// Inject the template keys replacement.
.replace( /{([^}]+)}/g, function( m, key ) {
return "',data['" + key + "']==undefined?'{" + key + "}':data['" + key + "'],'";
} );
// Escape chars like slash "\" or single quote "'".
.replace( reEscapableChars, '\\$1' )
.replace( reNewLine, '\\n' )
.replace( reCarriageReturn, '\\r' )
// Inject the template keys replacement.
.replace( rePlaceholder, function( m, key ) {
return "',data['" + key + "']==undefined?'{" + key + "}':data['" + key + "'],'";
} );

fn = "return buffer?buffer.push('" + fn + "'):['" + fn + "'].join('');";
this.output = cache[ source ] = Function( 'data', 'buffer', fn );

0 comments on commit ac305ed

Please sign in to comment.
You can’t perform that action at this time.