This is how you do it for CMS at least (check plugins section)
Guess it works similar in commerce?
Hi Daniel,
I would have hoped so, but can't find where to do the same in Commerce.
thanks
Hey Danie
Will this do what you are looking for: http://world.episerver.com/blogs/Linus-Ekstrom/Dates/2014/10/typed-property-settings/
You may be able to use the same approach with Commerce?
David
Hi David,
thanks, exactly what I'm looking for.
But I think there is a bug that breaks the the "All properties" view (same happens in the Alloy sample site, Episerver v9). When customizing the editor I get an exception. I'll log the bug in a seperate post.
Thanks
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at EPiServer.Cms.Shell.UI.ObjectEditing.EditorDescriptors.XhtmlStringEditorDescriptor.ModifyMetadata(ExtendedMetadata metadata, IEnumerable`1 attributes)
at EPiServer.Shell.ObjectEditing.ExtensibleMetadataProvider.ApplyExtendersToMetadata(ExtendedMetadata metadata, IEnumerable`1 attributes, IEnumerable`1 metadataHandlers)
at EPiServer.Shell.ObjectEditing.ExtensibleMetadataProvider.GetMetadataForProperties(ExtendedMetadata parent, Object container, Type containerType, IMetadataProvider customProvider)
at EPiServer.Shell.ObjectEditing.ExtendedMetadata.get_Properties()
at EPiServer.Cms.Shell.UI.ObjectEditing.SettingsPanelMetadataExtender.ModifyMetadata(ExtendedMetadata metadata, IEnumerable`1 attributes)
at EPiServer.Shell.ObjectEditing.ExtensibleMetadataProvider.ApplyExtendersToMetadata(ExtendedMetadata metadata, IEnumerable`1 attributes, IEnumerable`1 metadataHandlers)
at EPiServer.Shell.ObjectEditing.ExtensibleMetadataProvider.CreateMetadata(IEnumerable`1 attributes, Type containerType, Func`1 modelAccessor, Type modelType, String propertyName)
at System.Web.Mvc.AssociatedMetadataProvider.GetMetadataForType(Func`1 modelAccessor, Type modelType)
at EPiServer.Shell.UI.Rest.MetadataStore.Get(String id, String modelAccessor)
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass42.<BeginInvokeSynchronousActionMethod>b__41()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<>c__DisplayClass2a.<BeginInvokeAction>b__20()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult)
at EPiServer.Shell.Services.Rest.RestControllerBase.EndExecute(IAsyncResult asyncResult)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
[ServiceConfiguration(ServiceType = typeof (PropertySettings))] public class DefaultTinyMceSettings : PropertySettings<EPiServer.Editor.TinyMCE.TinyMCESettings> { public DefaultTinyMceSettings() { DisplayName = "Default Tiny MCE editor"; Description = "Default Tiny MCE editor settings"; IsDefault = true; } public override System.Guid ID { get { return new System.Guid("a6fe936f-190d-45e2-b83c-ccc0501a7312"); } } }
Quick update on this. I took your code and ensure I implemented the GetPropertySettings() method and all seems well. Following code worked for me:
[ServiceConfiguration(ServiceType = typeof(PropertySettings))] public class DefaultTinyMceSettings : PropertySettings<EPiServer.Editor.TinyMCE.TinyMCESettings> { public DefaultTinyMceSettings() { DisplayName = "Default Tiny MCE editor"; Description = "Default Tiny MCE editor settings"; IsDefault = true; } public override TinyMCESettings GetPropertySettings() { var settings = new TinyMCESettings(); var mainToolbar = new ToolbarRow(new List<string>() { TinyMCEButtons.Bold, TinyMCEButtons.Italic, TinyMCEButtons.Cut, TinyMCEButtons.Copy, TinyMCEButtons.Paste, TinyMCEButtons.EPiServerLink, TinyMCEButtons.Unlink }); settings.ToolbarRows.Add(mainToolbar); settings.Height = 20; settings.Width = 200; return settings; } public override System.Guid ID { get { return new System.Guid("a6fe936f-190d-45e2-b83c-ccc0501a7312"); } } }
Hi,
Does anyone know how to customize (adding/removing buttons) the TinyMCE in Commerce?
Thanks
Danie