Tiny MCE has been the de facto standard for WYSIWYG
editors for many years and is a very powerful editor. Piranha CMS currently supports version 5.0.3
of Tiny MCE and the editor is used in inline
mode for all editors in the interface.
The Tiny MCE editor can be installed by adding the following NuGet package:
PM> install-package Piranha.Manager.TinyMCE
By default the following tools are enabled by the editor:
The editor can be customized either through code, or by creating a JSON
config file with the editor configuration.
// editorconfig.json
{
"plugins": "autoresize autolink code hr paste lists piranhalink piranhaimage",
"toolbar": "bold italic | bullist numlist hr | alignleft aligncenter alignright | formatselect | piranhalink piranhaimage",
"blockformats": "Paragraph=p;Header 1=h1;Header 2=h2;Header 3=h3;Header 4=h4;Code=pre;Quote=blockquote",
"styleformats": [
{
"title": "Lead",
"tag": "p",
"type": "block",
"classes": "lead"
}
]
}
The configuration is the applied from the method Configure
in your Startup.cs
.
// Startup.cs
public void Configure(IApplicationBuilder app, IApi api)
{
...
Piranha.Manager.Editor.EditorConfig.FromFile("editorconfig.json");
...
}
// Startup.cs
public void Configure(IApplicationBuilder app, IApi api)
{
...
Piranha.Manager.Editor.EditorConfig.Current.Plugins = ...
Piranha.Manager.Editor.EditorConfig.Current.Toolbar = ...
Piranha.Manager.Editor.EditorConfig.Current.BlockFormats = ...
Piranha.Manager.Editor.EditorConfig.Current.StyleFormats =
new List<Piranha.Manager.Editor.EditorStyle>
{
...
}
...
}