TinyMCE is one of the most trusted rich text editors on the web, used by millions of sites. Oorian's wrapper makes it easy to add professional content editing to your applications.
Basic Editor Setup
TmceEditor editor = new TmceEditor();
editor.setHeight("400px");
editor.setValue("<p>Start typing here...</p>");
body.addElement(editor);
Configuring the Toolbar
TmceEditor editor = new TmceEditor();
editor.setToolbar(
"undo redo | formatselect | " +
"bold italic underline strikethrough | " +
"alignleft aligncenter alignright alignjustify | " +
"bullist numlist outdent indent | " +
"link image table | removeformat"
);
editor.setPlugins("lists", "link", "image", "table");
body.addElement(editor);
Getting and Setting Content
// Get content
String html = editor.getContent();
// Set content
editor.setContent("<h1>Welcome</h1><p>This is new content.</p>");
// Handle content changes
editor.registerListener(this, ContentChangeEvent.class);
@Override
public void onEvent(ContentChangeEvent event)
{
String content = event.getContent();
autoSave(content);
}
Image Uploads
editor.setImagesUploadHandler(new ImageUploadHandler()
{
@Override
public String handleUpload(byte[] imageData, String filename)
{
// Save to storage and return URL
String url = storageService.saveImage(imageData, filename);
return url;
}
});
Custom Styles
editor.setContentCss("/css/editor-content.css");
editor.setStyleFormats(
new StyleFormat("Highlight", "span", "highlight"),
new StyleFormat("Code Block", "pre", "code-block")
);
Read-Only Mode
// For viewing content without editing
editor.setReadOnly(true);
// Toggle editing
public void enableEditing()
{
editor.setReadOnly(false);
}
Conclusion
TinyMCE integration brings professional content editing to Oorian. Configure toolbars, handle uploads, and manage content—all through Java code.