Skip to content

Extending the Rich text model in Nikcio.UHeadless

Nikcio.UHeadless provides flexibility to extend and replace the rich text model to accommodate your specific needs. This documentation outlines two examples of how you can extend the model.

Example 1

  1. Create your rich text model:
using Nikcio.UHeadless.Base.Basics.EditorsValues.RichTextEditor.Models;
using Nikcio.UHeadless.Base.Properties.Commands;
public class MyRichText : BasicRichText
{
public string MyCustomProperty { get; set; }
public MyRichText(CreatePropertyValue createPropertyValue) : base(createPropertyValue)
{
MyCustomProperty = "Hello here is a property";
}
}
  1. Register the model in the UHeadless options:
.AddUHeadless(new()
{
PropertyServicesOptions = new()
{
PropertyMapOptions = new()
{
PropertyMappings = new()
{
map => map.AddEditorMapping<MyRichText>(Constants.PropertyEditors.Aliases.TinyMce)
}
}
}
})
Method NameDescription
AddAliasMappingAdds a mapping of a type to a content type alias and property type alias.
AddEditorMappingAdds a mapping of a type to an editor alias.

Make sure to replace the appropriate namespaces and class names with your custom implementations.