I would like to selectively avoid replacing textareas with CKEDITOR.replaceAll. I cannot simply use replace instead. I must use custom assertion functions mentioned in the documentation.
http://docs.ckeditor.com/#!/api/CKEDITOR-method-replaceAll
// Selectively replace <textarea> elements, based on custom assertions.
CKEDITOR.replaceAll( function( textarea, config ) {
// An assertion function that needs to be evaluated for the <textarea>
// to be replaced. It must explicitely return "false" to ignore a
// specific <textarea>.
// You can also customize the editor instance by having the function
// modify the "config" parameter.
} );
But there is no assert
in javascript. What's the syntax for the assertions?
The use of "assertion function" in the CKEDITOR documentation is misleading. There is no assert
in javascript. Just use a conditional and return false
to ignore a specific textarea
.
Example:
CKEDITOR.replaceAll(function (textarea, config) {
if (textarea.classList.contains("ignore_me")) {
return false;
};
<...>
});