【问题标题】:What's the syntax for CKEDITOR.replaceAll custom assertion functions?CKEDITOR.replaceAll 自定义断言函数的语法是什么?
【发布时间】:2016-04-06 20:55:16
【问题描述】:

我想选择性地避免用 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.
} );

但是 javascript 中没有 assert。断言的语法是什么?

【问题讨论】:

    标签: javascript ckeditor assert assertions assertion


    【解决方案1】:

    CKEDITOR documentation 中“断言函数”的使用具有误导性。 javascript 中没有assert。只需使用条件和return false 来忽略特定的textarea

    例子:

    CKEDITOR.replaceAll(function (textarea, config) {
        if (textarea.classList.contains("ignore_me")) {
            return false;
        };
        <...>
    });
    

    【讨论】:

    • 您说的完全正确,感谢您指出这一点。我有just fixed this 是我们的文档,这可能会在几天后在线更新。再次感谢!
    • @AnnaTomanek 很高兴为您提供帮助。感谢您如此迅速地修复文档!
    • 没问题,很高兴为您提供帮助。我们真正关心我们的文档,并全心全意地欢迎这样的反馈。团队真的很高兴发送一些赞成票作为一个小小的“谢谢”便条:) 再次对造成的任何不便表示歉意!
    • @AnnaTomanek 我们在这里经常使用 CKEDITOR。我们感谢您的产品和对细节的关注。 :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-12
    • 1970-01-01
    • 2017-12-22
    • 1970-01-01
    • 2014-09-03
    • 2014-10-06
    相关资源
    最近更新 更多