Documentation

Inline

format

Arguments
value String Object

Returns: Array

Apply formatting for inline tags, and also set classes, attributes, and styles for them.

If the value is a string with a tag, then all the selected inline tags will be converted to the specified tag, all attributes are keeping.

this.inline.format('span');

If the value is the object, all selected inline tags will be converted to the specified tag with the styles, attributes, and classes that are listed in the object.

Object's arguments:

tag String tag that will formatted inline tags
class String class or classes (space separated)
style Object style object
attr Object attribute object
type String set (by default) - remove all existing values (classes, attributes or style) and set specified values
add - add a value without removing the already existing values
toggle - if a value exists, remove it, if not add the specified one
remove - remove specified values
var obj = { tag: 'span' };
var obj = { tag: 'span', class: 'my-class' }
var obj = { tag: 'span', class: 'my-class-1 my-class-2' };
var obj = { tag: 'span', class: 'my-class', style: { color: 'red' } };
var obj = { tag: 'span', style: { color: 'red', 'font-style': 'italic' } };
var obj = { tag: 'span', class: 'my-class', attr: { 'data-name': 'my-header' } };
var obj = { tag: 'span', class: 'my-class', type: 'toggle' };

this.inline.format(obj);

clearFormat

Arguments
tags (optional) Array

Remove all classes, attributes, and styles from the selected inline tags. You can specify the argument for which tags to apply the removing of attributes.

this.inline.clearFormat();
this.inline.clearFormat(['span', 'mark']);

clearStyle

Arguments
tags (optional) Array

Remove styles from the selected inline tags. You can specify the argument for which tags to apply the removing of styles.

this.inline.clearStyle();
this.inline.clearStyle(['span', 'mark']);

clearClass

Arguments
tags (optional) Array

Remove classes from the selected inline tags. You can specify the argument for which tags to apply the removing of classes.

this.inline.clearClass();
this.inline.clearClass(['span', 'mark']);

clearAttr

Arguments
tags (optional) Array

Remove attributes from the selected inline tags. You can specify the argument for which tags to apply the removing of attributes.

this.inline.clearAttr();
this.inline.clearAttr(['span', 'mark']);

add

Arguments
value Object
tags (optional) Array

Add values without removing the already existing values. You can set the array of tags to which will be applied the formatting.

var args = {
    style: { color: 'red', 'font-style': 'italic' }
    class: 'my-class-1 my-class-2'
    attr: { 'data-name': 'my-name' }
};

this.inline.add(args);
this.inline.add(args, ['span', 'mark']);

toggle

Arguments
value Object
tags (optional) Array

If values exists, remove them, if not add the specified ones. You can set the array of tags to which will be applied the formatting.

var args = {
    style: { color: 'red', 'font-style': 'italic' }
    class: 'my-class-1 my-class-2'
    attr: { 'data-name': 'my-name' }
};

this.inline.toggle(args);
this.inline.toggle(args, ['span', 'mark']);

set

Arguments
value Object
tags (optional) Array

Remove all existing values (classes, attributes or style) and set specified values. You can set the array of tags to which will be applied the formatting.

var args = {
    style: { color: 'red', 'font-style': 'italic' }
    class: 'my-class-1 my-class-2'
    attr: { 'data-name': 'my-name' }
};

this.inline.set(args);
this.inline.set(args, ['span', 'mark']);

remove

Arguments
value Object
tags (optional) Array

Remove specified values. You can set the array of tags to which will be applied the formatting.

var args = {
    style: 'color font-style'
    class: 'my-class-1 my-class-2'
    attr: 'data-name data-toggle'
};

this.inline.remove(args);
this.inline.remove(args, ['span', 'mark']);