Changing Episerver PropertyList Modal Size
Tags: episerver, webdev
Published: 2019-05-05 04:40:08

---
title: Changing Episerver PropertyList Modal Size
published: true
tags: #Episerver, #WebDev
canonical_url: https://davidboland.site/blog/changing-episerver-propertylist-modal-size
---

# Episerver PropertyList Modal Size

## Quick Summary

I have worked with Episerver's PropertyList on several occasions, and the one problem that I have consistently run into is the fact that the modal that appears in the editor view is too small for some scenarios. Specifically, when using XhtmlString properties. 

![Default Modal Size](//images.ctfassets.net/9usgdrjsks5w/CDWYqotWhTbzLSxavKOCA/e30bd27822175d44ee7a0b822d463c7b/Default\_Modal\_Size.PNG)

[_Jump to implementation_](#implementation)

This becomes an issue for editors due to the fact that there is no horizontal scroll functionality in the modal. So if editors want to center content they may need to do some workarounds such as adding white space to have the TinyMCE center around the content they wish to see.

In looking for solutions to this problem, I was able to track down some CSS updates that could be made to resolve this. However, finding it wasn't the quick Google search I have come to appreciate. So I thought I would post it here with the hope it will be easier to find for the next person.

As I said I found this solution elsewhere, so props to [Minesh Shah](https://world.episerver.com/System/Users-and-profiles/Community-Profile-Card/?userid=517e12cf-fa98-dc11-b081-0018717a8c82) who posted what I found on the [Episerver forums](https://world.episerver.com/forum/developer-forum/-Episerver-75-CMS/Thread-Container/2016/3/editing-content-on-propertylist/).

#### Episerver TinyMCE 2.0 Configuration

I know with the latest updates to TinyMCE in Episerver 11 you are able to customize the size of the editor down to the content type based on your configuration. However, custom configurations can only be added to instances of IContentData. And pages that implement your custom PropertyList cannot access those XhtmlString properties to apply custom configurations. Plus I think it would be better from an editor experience to increase the size of the modal instead of decreasing the size of the rich text area. 

## Implementation

### Creating the Property

The process for creating a PropertyList is pretty straight forward. The implementation here you can find it in my [Github repo](https://github.com/debpu06/Alloy-Demo-Project/tree/feature-propertylist-modal-size) using the Alloy demo site. First, I created a custom type along with a property type definition.

```csharp
public class ContentProperty{ [Display(Name = "Title Content")] public virtual string Title { get; set; } [Display(Name = "Rich Text Content")] public virtual XhtmlString MainContentArea { get; set; }}[PropertyDefinitionTypePlugIn]public class ContentPropertyListTypeDefinition : PropertyList<contentproperty> { }
```

Then, I added the property to one of the Alloy page types, ProductPage.

```csharp
[EditorDescriptor(EditorDescriptorType = typeof(CollectionEditorDescriptor<contentproperty>))]
[Display(
    Name = "Example Property List",
    GroupName = SystemTabNames.Content)]
public virtual IList<contentproperty> PropertyListExample { get; set; }
```

And thats all you need to create the actual property.

![Page Property](//images.ctfassets.net/9usgdrjsks5w/2mUpo3fbe1BhmN0RhUIUrn/1a52aeecacacafa0c7a9470b925150b8/Page_Property.png)

### Adding the CSS

As you saw in the image at the start of the article, the _MainContentArea_ property does not fit within the modal. We can resolve this by updating the following:

First, update the __module.config__ in the root of the web project. If you do not have the module.config file, you can add it and include the following:

```XML
<?xml version="1.0" encoding="utf-8"?>
<module>
    <assemblies>
	    <!-- This adds the Alloy template assembly to the "default module" -->
        <add assembly="Alloy Demo Site"></add>
    </assemblies>
    <clientresources>
        <add name="epi-cms.widgets.base" path="Styles/Styles.css" resourcetype="Style"></add>
    </clientresources>
    <dojo>
        <paths>
            <add name="alloy" path="Scripts"></add>
        </paths>
    </dojo>
</module>
```

If you already have the config, add node with name __epi-cms.widgets.base__ under the __clientResources__ node if you don't have one already. That referenced CSS is where we will add our styling updates.

Second, update the CSS file referenced in the _module.config_. In this example, it will be in _~/ClientResources/Styles/Styles.css_. In that CSS file, add the following:

```CSS
.Sleek .epi-dialog-landscape .dijitDialogPaneContentArea {
    height: 500px !important;
}

.Sleek .epi-dialog-landscape, .Sleek .epi-dialog-portrait, .Sleek .epi-dialog--auto-height {
    width: auto !important;
    transform: translateX(-50%);
    left: 50% !important;
}
```

The CSS adjusts the height and width of the modal, and centers it on the page. 

![Final Modal Size](//images.ctfassets.net/9usgdrjsks5w/1VHNQZbKC113zfRmzyD6zc/c00d5aeae96fb2987b2793f6bd0d3e52/Final_Modal_Size.PNG)

## Final Thoughts

The final result provides a much better editor experience. As I mentioned before this is nothing new, but hopefully you were able to find this faster than I found the solution. As always, if you have any questions or thoughts on how to improve this solution, feel free to reach out.</contentproperty></contentproperty></contentproperty>