OpenCms Documentation

Writing native editor widgets

 Show GitHub edit links  Hide GitHub edit links
In OpenCms since: 8.5 Documented since: 10.5 Latest revision for: 10.5 Valid for OpenCms: 13.0

Adding your own widget for the content editor is fairly easy. Each widget has server-side and client-side code. There are two ways to implement your own widget:

  • Implementing native widgets: This means that you write the widget in Java for the server-side part and in plain Java Script for the client-side part.
  • Implementing GWT widgets: This means that you write the widget using GWT and that way you implement all the code in Java.

Here we show an example for a native widget.

In this topic, we only show the output of the example. To understand it, view the source (with an additional explanation) on GitHub.

The example widget in action

The figure shows the demo content using the widget. It's used in the upper two editor field sequences. The last sequence shows the default string widget shipped with the core.

Fig. [custom_widget_example]: The custom widget is used in a demo content