Skip to content

Instantly share code, notes, and snippets.

@CheapSk8
Last active April 12, 2021 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CheapSk8/974faf88370bc5b16041b1fc434743eb to your computer and use it in GitHub Desktop.
Save CheapSk8/974faf88370bc5b16041b1fc434743eb to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="utf-8"?>
<module>
<assemblies>
<!-- This adds the template assembly to the "default module" -->
<add assembly="EpiSandbox" />
</assemblies>
<clientResources>
<add name="epi-cms.widgets.base" path="Styles/Styles.css" resourceType="Style"/>
</clientResources>
<dojo>
<!-- This maps "shell" to ~/ClientResources/Scripts for the dojo loader configuration -->
<paths>
<add name="shell" path="Scripts" />
</paths>
</dojo>
</module>
define("shell/editors/PreviewableTextArea", [
"dojo/_base/array",
"dojo/_base/declare",
"dojo/dom-construct",
"epi/shell/widget/ValidationTextarea", // added to change to ValidationTextarea from ValidationTextBox
"epi-cms/contentediting/editors/_PreviewableEditor"
], function (
array,
declare,
domConstruct,
TextArea, // added to change to ValidationTextarea from ValidationTextBox
_PreviewableEditor
) {
return declare([_PreviewableEditor], {
// tags:
// internal
required: false,
// controlParams: Array
// Properties to copy from this widget into the wrapped control
controlParams: ["regExp", "required", "invalidMessage"],
// this function creates the TextArea to override the TextBox that would otherwise display
buildRendering: function () {
this.control = new TextArea();
this.inherited(arguments);
},
_getRegExpAttr: function () {
return this.regExp || "";
}
});
});
using EPiServer.Cms.Shell.UI.ObjectEditing;
using EPiServer.Shell.ObjectEditing;
using EPiServer.Shell.ObjectEditing.EditorDescriptors;
using System;
using System.Collections.Generic;
namespace EpiSandbox.Business.EditorDescriptors
{
[EditorDescriptorRegistration(TargetType = typeof(string), UIHint = "previewtextarea")]
public class PreviewableTextareaDescriptor : EditorDescriptor
{
public PreviewableTextareaDescriptor()
{
base.ClientEditingClass = "shell/editors/PreviewableTextArea";
}
public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
{
base.ModifyMetadata(metadata, attributes);
if (metadata is ContentDataMetadata)
{
metadata.EditorConfiguration["style"] = "width:400px;";
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment