Geo*_*ale 4 javascript assert assertions ckeditor assertion
我想有选择地避免用CKEDITOR.replaceAll替换textareas.我不能简单地使用替换.我必须使用文档中提到的自定义断言函数.
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.
} );
Run Code Online (Sandbox Code Playgroud)
但是assert
在javascript中没有.断言的语法是什么?
在CKEDITOR文档中使用"断言功能" 具有误导性.assert
在javascript中没有.只需使用条件并return false
忽略特定的textarea
.
例:
CKEDITOR.replaceAll(function (textarea, config) {
if (textarea.classList.contains("ignore_me")) {
return false;
};
<...>
});
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
465 次 |
最近记录: |