November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Hi,
The fastest way to overwrite the RTF settings for this specific field can be done using the EditroDescriptor:
[EditorDescriptorRegistration(TargetType = typeof(XhtmlString))]
public class EmailTemplateActorCollectionEditorDescriptor : EditorDescriptor
{
public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
{
base.ModifyMetadata(metadata, attributes);
if (metadata.ContainerType == typeof(EmailTemplateActorModel))
{
var settings = (TinyMceSettings)metadata.EditorConfiguration["settings"];
settings.Toolbar("code");
//add any other settings
}
}
}
Since EmailTemplateActorModel doesn't inherit from IContentData, you need to override the behavior on the metadata. This is how it should look:
You can also be more specific and manipulate directly the EditorDescriptor that configures the EmailTemplateActorModel which is this:
[EditorDescriptorRegistration(TargetType = typeof(IEnumerable<EmailTemplateActorModel>), UIHint = "EmailTemplateActorEditor")]
public class EmailTemplateActorCollectionEditorDescriptor : CollectionEditorDescriptor<EmailTemplateActorModel>
Hope it helps
Santiago.
Hi Santiago,
Thank you so much. Your code snippet works for modifying the editor descriptor for XhtmlString. When I adapt that to use the more specific selector for IEnumerable<EmailTemplateActorModel> I get errors when calling the base.ModifyMetadata(metadata, attributes) (adding duplicate key) and when accessing the metadata.EditorConfiguration["settings"] property (does not exist). Could you provide please the complete implementation for that specific registration?
Thanks,
Rich
After working with Optimizely support I had to tweak the attribute a bit to make this work.
[EditorDescriptorRegistration(TargetType = typeof(XhtmlString), EditorDescriptorBehavior = EditorDescriptorBehavior.PlaceLast)]
Once I deployed to the INTE environment I was seeing errors that I did not have locally and this solved that issue.
Also, I had to re-apply the TinyMCE configuration to include my default settings.
Hi Rich,
I don't suppose a blog post would be out of the question? to help share the knowledge and your experiences upon this.
Something brief that explains the situtation you where up against, what issues / errors you experienced along the way.
Who helped along the way.
Paul
I would like to enable the source code editor in TinyMCE for just the message field of the FormContainerBlock submission email. I don't see a way to do this since you can only configure interfaces of IContentData. I think the data type I'm trying to configure is the Body field of the EmailTemplateActorModel.
Below is a snippet from my TinyMCE configuration.
The error I get is: There is no implicit reference conversion from 'EPiServer.Forms.Implementation.Actors.EmailTemplateActorModel' to 'EPiServer.Core.IContentData'. CapCom.Epi.Cms
Is there any way to accomplish this other than enabling the HTML souce code option for all editor fields?