use of org.xwiki.edit.EditorManager in project xwiki-platform by xwiki.
the class TextAreaClass method displayEdit.
@Override
public void displayEdit(StringBuffer buffer, String name, String prefix, BaseCollection object, XWikiContext context) {
String editorType = getEditorType(context);
EditorManager editorManager = Utils.getComponent(EditorManager.class);
Editor<SyntaxContent> editor = editorManager.getDefaultEditor(SyntaxContent.class, editorType);
Map<String, Object> parameters = new HashMap<>();
String fieldName = prefix + name;
parameters.put("id", fieldName);
parameters.put("name", fieldName);
parameters.put("cols", getSize());
parameters.put("rows", getRows());
parameters.put("disabled", isDisabled());
parameters.put("sourceDocumentReference", object.getDocumentReference());
Syntax syntax = "puretext".equals(editorType) ? Syntax.PLAIN_1_0 : getObjectDocumentSyntax(object, context);
SyntaxContent syntaxContent = new SyntaxContent(object.getStringValue(name), syntax);
try {
buffer.append(editor.render(syntaxContent, parameters));
} catch (EditException e) {
LOGGER.error("Failed to display the text area property.", e);
}
}
Aggregations