Skip to content
Snippets Groups Projects
Commit ae66bc0a authored by Marius Dumitru Florea's avatar Marius Dumitru Florea
Browse files

XWIKI-13528: Add support for replacing the default WYSIWYG editor

* Small improvement (thanks tmortagne)
parent c38fb2f8
No related merge requests found
......@@ -83,9 +83,15 @@ public <D> List<Editor<D>> getEditors(Type dataType, String category)
public <D> Editor<D> getEditor(Type dataType, String hint)
{
DefaultParameterizedType editorType = new DefaultParameterizedType(null, Editor.class, dataType);
try {
return this.componentManagerProvider.get().getInstance(editorType, hint);
} catch (ComponentLookupException e) {
ComponentManager componentManager = this.componentManagerProvider.get();
if (componentManager.hasComponent(editorType, hint)) {
try {
return componentManager.getInstance(editorType, hint);
} catch (ComponentLookupException e) {
throw new RuntimeException(String.format("Failed to look up the [%s] editor with hint [%s]",
dataType.getTypeName(), hint), e);
}
} else {
// No such editor component found.
return null;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment