Overview

The examples in this section aren't completely executable. Each of these just demonstrates an exemplary feature.

Simplest Editor Call

  CKEditor editor = new CKEditor(request, "fieldname");
  editor.setValue("This is some <strong>sample text</strong>.");
  //editor.useDiv(); // builds a div instead of a textarea
  editor.toString(); // builds the html/javascript code

Configuration of the Toolbar via Configuration File

The toolbar is defined inside the configuration file. That's why the 'toolbar'-property must be removed.

  CKEditor editor = new CKEditor(request, "fieldname");
  editor.setValue("This is some <strong>sample text</strong>.");
  editor.removeProperty("toolbar"); // we have to disable the default toolbar here
  editor.setProperty("customConfig", "path-to-your-config.js");
  editor.toString(); // builds the html/javascript code

Configuration of the Toolbar via API

  CKEditor editor = new CKEditor(request, "fieldname");
  editor.setValue("This is some <strong>sample text</strong>.");
  editor.setProperty("toolbar", "myToolbar");
  editor.setProperty("toolbar.myToolbar", 
      "[{ 'name': 'basics', 'items': [ 'Bold','Italic','Strike','-','About' ] }]");
  editor.toString(); // builds the html/javascript code