Textbox.io 2.x Documentation : editor.filters.predicate.addOutput()

Create a predicate based output filter for an editor instance with editor.filters.predicate.addOutput().

The predicate based output filter modifies content when requested from the editor with: editor.content.get().

Example

editor.filters.predicate.addOutput(matchingFn, callback)
// A matching function identifying elements that are not allowed in the output
var disallowed = function(element) {
	var name = element.nodeName.toLowerCase()
    return name === 'iframe' || name === 'embed';
};
// Create an out filter identifying tags that are not allowed and removing them
editor.filters.predicate.addInput(disallowed, function(elements) {
    $(elements).remove();
});

Parameters

matchingFnFunctionSpecify a named function that returns the elements you wish to pass to the callback function.
callbackFunctionA function to process the array of matched elements.

Returns

No return value.

See Also

Filtering Content