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.app.api('module.inline.format', 'span');

or external call:

$R('#content', 'module.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.app.api('module.inline.format', obj);

//or external call
$R('#content', 'module.inline.format', obj);

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.app.api('module.inline.add', args);
this.app.api('module.inline.add', args, ['span', 'mark']);

//or external call
$R('#content', 'module.inline.add', args);
$R('#content', 'module.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.app.api('module.inline.toggle', args);
this.app.api('module.inline.toggle', args, ['span', 'mark']);

//or external call
$R('#content', 'module.inline.toggle', args);
$R('#content', 'module.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.app.api('module.inline.set', args);
this.app.api('module.inline.set', args, ['span', 'mark']);

// or external call
$R('#content', 'module.inline.set', args);
$R('#content', 'module.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.app.api('module.inline.remove', args);
this.app.api('module.inline.remove', args, ['span', 'mark']);

// or external call
$R('#content', 'module.inline.remove', args);
$R('#content', 'module.inline.remove', args, ['span', 'mark']);

clearformat

Remove all attributes from the selected inline tags.

this.app.api('module.inline.clearformat');

or external call:

$R('#content', 'module.inline.clearformat');

clearstyle

Remove the style attribute from the selected inline tags.

this.app.api('module.inline.clearstyle');

or external call:

$R('#content', 'module.inline.clearstyle');

clearclass

Remove the class attribute from the selected inline tags.

this.app.api('module.inline.clearclass');

or external call:

$R('#content', 'module.inline.clearclass');

clearattr

Remove all attributes (excepting class and style) from the selected inline tags.

this.app.api('module.inline.clearattr);

or external call:

$R('#content', 'module.inline.clearattr');