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 branches found
No related tags found
No related merge requests found
...@@ -83,9 +83,15 @@ public <D> List<Editor<D>> getEditors(Type dataType, String category) ...@@ -83,9 +83,15 @@ public <D> List<Editor<D>> getEditors(Type dataType, String category)
public <D> Editor<D> getEditor(Type dataType, String hint) public <D> Editor<D> getEditor(Type dataType, String hint)
{ {
DefaultParameterizedType editorType = new DefaultParameterizedType(null, Editor.class, dataType); DefaultParameterizedType editorType = new DefaultParameterizedType(null, Editor.class, dataType);
try { ComponentManager componentManager = this.componentManagerProvider.get();
return this.componentManagerProvider.get().getInstance(editorType, hint); if (componentManager.hasComponent(editorType, hint)) {
} catch (ComponentLookupException e) { 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. // No such editor component found.
return null; 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