CKEditor 4 Documentation

CKEDITOR.template

Files

Lightweight template used to build the output string from variables.

// HTML template for presenting a label UI.
var tpl = new CKEDITOR.template( '<div class="{cls}">{label}</div>' );
alert( tpl.output( { cls: 'cke-label', label: 'foo'} ) ); // '<div class="cke-label">foo</div>'
Defined By

Properties

CKEDITOR.template
view source
: Stringreadonly

The current template source.

The current template source.

Defined By

Methods

CKEDITOR.template
view source
new( source ) : CKEDITOR.template
Creates a template class instance. ...

Creates a template class instance.

Parameters

  • source : String

    The template source.

Returns

CKEDITOR.template
view source
( data, [buffer] ) : String/Number
Processes the template, filling its variables with the provided data. ...

Processes the template, filling its variables with the provided data.

Parameters

  • data : Object

    An object containing properties whose values will be used to fill the template variables. The property names must match the template variables names. Variables without matching properties will be kept untouched.

  • buffer : Array (optional)

    An array that the output data will be pushed into. The number of entries appended to the array is unknown.

Returns

  • String/Number

    If buffer has not been provided, the processed template output data; otherwise the new length of buffer.