-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExtendedTinyMceInitialization.cs
59 lines (55 loc) · 2.44 KB
/
ExtendedTinyMceInitialization.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using Alloy_Demo_Site.Models.Blocks;
using Alloy_Demo_Site.Models.Pages;
using EPiServer.Cms.TinyMce.Core;
using EPiServer.Framework;
using EPiServer.Framework.Initialization;
using EPiServer.ServiceLocation;
namespace Alloy_Demo_Site.Business.Initialization
{
[ModuleDependency(typeof(TinyMceInitialization))]
public class ExtendedTinyMceInitialization : IConfigurableModule
{
public void Initialize(InitializationEngine context)
{
}
public void Uninitialize(InitializationEngine context)
{
}
public void ConfigureContainer(ServiceConfigurationContext context)
{
context.Services.Configure<TinyMceConfiguration>(config =>
{
// Add content CSS to the default settings.
config.Default()
.ContentCss("/static/css/editor.css")
.AddSetting("templates", new[]
{
new
{
title = "Article Template 1",
url = "../../Static/html/templates/article_template_1.html",
description = "Template w/title and text"
},
new
{
title = "Article Template 2",
url = "../../Static/html/templates/article_template_2.html",
description = "Template with title and image"
}
})
.AddPlugin($"{DefaultValues.EpiserverPlugins} template")
.Toolbar($"{DefaultValues.Toolbar} | template");
// This will clone the default settings object and extend it by
// limiting the block formats for the MainBody property of an ArticlePage.
config.For<ArticlePage>(t => t.MainBody)
.BlockFormats("Paragraph=p;Header 1=h1;Header 2=h2;Header 3=h3");
// Passing a second argument to For<> will clone the given settings object
// instead of the default one and extend it with some basic toolbar commands.
config.For<EditorialBlock>(t => t.MainBody, config.Empty())
.Plugins(DefaultValues.EpiserverPlugins)
.DisableMenubar()
.Toolbar("bold italic underline strikethrough");
});
}
}
}