Skip to main content

CustomFormat

Namespace: Wisej.Web.Ext.QuillJS

Assembly: Wisej.Web.Ext.QuillJS (4.1.0.0)

Represents a custom format definition for QuillJS.

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​

Instance member CustomFormat()​

Initializes a new instance of CustomFormat.

Properties​

Instance member AddToToolbar​

Boolean: Returns or sets a value indicating whether to add this format to the toolbar.

Instance member AllowedAttributes​

String[]: Returns or sets the names of the HTML attributes allowed for this format.

Instance member AllowNested​

Boolean: Returns or sets a value indicating whether this format allows nested formats.

Instance member ClassName​

String: Returns or sets the CSS class name for the format.

Instance member IsInline​

Boolean: Returns or sets a value indicating whether this format is inline (true) or a block format (false).

Instance member TagName​

String: Returns or sets the HTML tag name for the format, i.e. "span" or "div".

Methods​

Static member CreateBlock(tagName, className, addToToolbar, allowedAttributes)​

Creates a new custom format for a block element.

ParameterTypeDescription
tagNameStringThe HTML tag name of the block element.
className optionalStringThe optional CSS class name of the format.
addToToolbar optionalBooleanWhether to add the format to the toolbar. The default is false.
allowedAttributesString[]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");

Static member CreateClass(tagName, className, isInline, allowNested, addToToolbar, allowedAttributes)​

Creates a new custom format with a class.

ParameterTypeDescription
tagNameStringThe HTML tag name of the format.
classNameStringThe CSS class name of the format.
isInline optionalBooleanWhether the format is inline. The default is true.
allowNested optionalBooleanWhether the format allows nested formats. The default is true.
addToToolbar optionalBooleanWhether to add the format to the toolbar. The default is false.
allowedAttributesString[]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");

Static member CreateTag(tagName, isInline, allowNested, addToToolbar, allowedAttributes)​

Creates a new custom format for a specific tag.

ParameterTypeDescription
tagNameStringThe HTML tag name of the format.
isInline optionalBooleanWhether the format is inline. The default is true.
allowNested optionalBooleanWhether the format allows nested formats. The default is true.
addToToolbar optionalBooleanWhether to add the format to the toolbar. The default is false.
allowedAttributesString[]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");