CustomFormat
Namespace: Wisej.Web.Ext.QuillJS
Assembly: Wisej.Web.Ext.QuillJS (4.1.0.0)
Represents a custom format definition for QuillJS.
- C#
- VB.NET
public class CustomFormat
Public Class CustomFormat
This class only describes a format: it's not used by QuillJSEditor and a custom format must be registered on the client using the QuillJS API.
Constructors
CustomFormat()
Initializes a new instance of CustomFormat.
Properties
AddToToolbar
Boolean: Returns or sets a value indicating whether to add this format to the toolbar.
AllowedAttributes
String[]: Returns or sets the names of the HTML attributes allowed for this format.
AllowNested
Boolean: Returns or sets a value indicating whether this format allows nested formats.
ClassName
String: Returns or sets the CSS class name for the format.
IsInline
Boolean: Returns or sets a value indicating whether this format is inline (true) or a block format (false).
TagName
String: Returns or sets the HTML tag name for the format, i.e. "span" or "div".
Methods
CreateBlock(tagName, className, addToToolbar, allowedAttributes)
Creates a new custom format for a block element.
| Parameter | Type | Description |
|---|---|---|
| tagName | String | The HTML tag name of the block element. |
| className | String | The optional CSS class name of the format. |
| addToToolbar | Boolean | Whether to add the format to the toolbar. The default is false. |
| allowedAttributes | String[] | The names of the allowed HTML attributes. |
Returns: CustomFormat. A new block (not inline) CustomFormat instance that allows nested formats.
Example:
Describing a block format rendered as an aside element:
var note = CustomFormat.CreateBlock("aside", "note");
CreateClass(tagName, className, isInline, allowNested, addToToolbar, allowedAttributes)
Creates a new custom format with a class.
| Parameter | Type | Description |
|---|---|---|
| tagName | String | The HTML tag name of the format. |
| className | String | The CSS class name of the format. |
| isInline | Boolean | Whether the format is inline. The default is true. |
| allowNested | Boolean | Whether the format allows nested formats. The default is true. |
| addToToolbar | Boolean | Whether to add the format to the toolbar. The default is false. |
| allowedAttributes | String[] | The names of the allowed HTML attributes. |
Returns: CustomFormat. A new CustomFormat instance.
Example:
Describing an inline format rendered as a span element with a CSS class:
var warning = CustomFormat.CreateClass("span", "text-warning");
CreateTag(tagName, isInline, allowNested, addToToolbar, allowedAttributes)
Creates a new custom format for a specific tag.
| Parameter | Type | Description |
|---|---|---|
| tagName | String | The HTML tag name of the format. |
| isInline | Boolean | Whether the format is inline. The default is true. |
| allowNested | Boolean | Whether the format allows nested formats. The default is true. |
| addToToolbar | Boolean | Whether to add the format to the toolbar. The default is false. |
| allowedAttributes | String[] | The names of the allowed HTML attributes. |
Returns: CustomFormat. A new CustomFormat instance.
Example:
Describing an inline format rendered as a mark element:
var highlight = CustomFormat.CreateTag("mark", true, true, true, "title");