Hi Thomas!
This is not possible. Actually, the metadata handling is totally separated from the UI though it must be possible to load the script file defined. I tried this on a local installation and the error message that is showed in the console log seems clear enough to be able to fix the error if it occurs:
Thanks for replying.
The reason for why I want this feature to be handled by the UI:
* Addon #1 includes a EditorDescriptor and the .js-files
* Addon #2, not actually dependent on #1, but if #1 exists it would like to use a Editor (with different metadata) from #1
In #2 I want to use the Editor from #1 but with other metadata. I therefore created a new EditorDescriptor (and UIHint) in #2 and pointing to the Editor with using the the ClientEditingClass as in #1.
This works fine as long as #1 is also installed in the application, but I want #2 to be independent of #1 and therefore I just want the UI to fallback to the default Editor when the ClientEditingClass does not exist.
If I could find a way to pass in metadata with just assigning a UIHint on the property the problem would be solved as UIHint will fallback if there are no EditorDescriptor and ClientEditingClass defined for it.
Found a solution! :)
[EditorDescriptorRegistration(UIHint = "myhint", TargetType = typeof(string))]
public class TextDescriptor : EditorDescriptor
{
public TextDescriptor()
{
ClientEditingClass = "mymodule.myeditor.Editor";
}
public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
{
var uiHintAttribute = metadata.Attributes.OfType<UIHintAttribute>().FirstOrDefault();
object myValue;
uiHintAttribute.ControlParameters.TryGetValue("myKey", out myValue);
base.ModifyMetadata(metadata, attributes);
metadata.EditorConfiguration.Add("myProperty", myValue ?? "defaultValue");
}
}
Then use this EditorDescriptor with UIHint and pass in a control parameter:
[UIHint("myhint", null, "myKey", "myValue")]
public virtual string MyString { get; set; }
Is it possible to check if the editor for "ClientEditingClass" actually exist?
If I add a UIHint to a property and create the EditorDescriptor that specifies a ClientEditingClass that does not exist as a Dojo editor the entire Forms editor stops responding.
Model:
Descriptor: