November Happy Hour will be moved to Thursday December 5th.

Customize TinyMce

Vote:
 

Hi,

Does anyone know how to customize (adding/removing buttons) the TinyMCE in Commerce?

Thanks

Danie

#145541
Mar 05, 2016 17:37
Vote:
 

This is how you do it for CMS at least (check plugins section)

http://world.episerver.com/documentation/Items/Developers-Guide/Episerver-CMS/9/Editing/Customizing-the-TinyMCE-editor/

Guess it works similar in commerce?

#145543
Edited, Mar 05, 2016 19:22
Vote:
 

Hi Daniel,

I would have hoped so, but can't find where to do the same in Commerce.

thanks

#145562
Mar 07, 2016 9:46
Vote:
 

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

#145570
Mar 07, 2016 11:24
Vote:
 

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"); }
}
}





#145588
Edited, Mar 07, 2016 21:31
Vote:
 

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"); }
    }
}



#145633
Mar 08, 2016 15:53
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.