Da Technologien auf neuere Versionen aktualisiert werden, ändern sich auch die Möglichkeiten zum Erweitern oder Überschreiben der Out-of-the-Box-Funktionalität ein wenig, daher werde ich heute einen kleinen Blogartikel schreiben, um TinyMCE/RTE zu erweitern
Schritt 1-
Erstellen Sie eine Klasse namens „TinyMCEServiceCollectionExtensions.cs“. Sie können es beliebig benennen.
public static class TinyMCEServiceCollectionExtensions
{
public static IServiceCollection ConfigureTinyMCE(this IServiceCollection services)
{
services.Configure(o =>
{
o.Default()
.AddPlugin("media hr code table textcolor")
.Toolbar("formatselect styleselect | bold italic underline | epi-link anchor image epi-image-editor epi-personalized-content | bullist numlist outdent indent | searchreplace fullscreen | help")
.AppendToolbar("media code hr table")
.AddSetting("image_caption", true)
.AddSetting("image_advtab", true)
.ContentCss("/css/editor.css")
.AddSetting("image_class_list", new[]{
new { title = "None", value = ""},
new { title = "Image Right", value = "article-image right"},
new { title = "Image Full", value = "article-image full"}
});
});
return services;
}
}
Schritt 2
Rufen Sie diese Klassenmethode „ConfigureTinyMCE“ in der Startup.cs-Klasse auf.
public void ConfigureServices(IServiceCollection services)
{
///disable not needed
//services.TryAddEnumerable(ServiceDescriptor.Singleton(typeof(IFirstRequestInitializer), typeof(AddPagesInitializer)));
if (_webHostingEnvironment.IsDevelopment())
{
AppDomain.CurrentDomain.SetData("DataDirectory", Path.Combine(_webHostingEnvironment.ContentRootPath, "App_Data"));
services.Configure(options => options.Enabled = false);
}
services
.AddCmsAspNetIdentity()
.AddCms()
.AddAdminUserRegistration()
.ConfigureTinyMCE()
.AddTinyMceCustomizations()
.AddEmbeddedLocalization();
if (!_webHostingEnvironment.IsDevelopment())
{
services.AddCmsCloudPlatformSupport(Configuration);
}
}
Vielen Dank für das Lesen dieses Blogbeitrags. Ich hoffe, er hilft
Danke und Grüße
Ravindra S. Rathore