Report an issue
Class

CKEDITOR.template

class

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>'

Filtering

Properties

  • source : String

    readonly

    The current template source.

Methods

  • constructor( source ) → template

    Creates a template class instance.

    Parameters

    source : String

    The template source.

    Returns

    template
  • output( data, [ buffer ] ) → String | Number

    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

    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.