仅将 CKEditor Wordcount 应用于特定字段

Apply CKEditor Wordcount to only a particular field

如何将 'maxWordCount: 50' 设置仅应用于带有 "simple" class 的文本区域?这可能吗?如果不是,它是否可以应用于名称字段[141]的所有文本区域字段?目前,所有字段都会自动应用 maxWordCount 设置。谢谢!

CKEDITOR.config.extraPlugins = 'media,autolink,wordcount,notification';
CKEDITOR.config.allowedContent = true;
CKEDITOR.config.skin = 'moonocolor';
CKEDITOR.config.scayt_autoStartup = true;
CKEDITOR.config.wordcount = {
  maxWordCount: 50
};

function ckeditor(elems) {
  $(elems).each(function(i, elem) {
    var height = '200px';
    if ($(elem).hasClass('short')) {
      height = '75px';
    }

    if ($(elem).hasClass('simple')) {
      CKEDITOR.replace(elem, {
        toolbar: [
          { name: 'clipboard', items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', 'Undo', 'Redo' ] },
          { name: 'editing', items: [ 'Scayt' ] },
          { name: 'links', items: [ 'Link', 'Unlink', 'Autolink', 'Media', 'Source'] },
          { name: 'insert', items: [ 'Table', 'SpecialChar', 'Templates', 'Maximize'] },
          { name: 'basicstyles', items: [ 'Bold', 'Italic', 'Strike', 'Underline', 'RemoveFormat' ] },
          { name: 'paragraph', items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent' ] }
        ],
        height: height
      });

    }
    else if($(elem).hasClass('nofontstyling')) {

      CKEDITOR.replace(elem, {
        toolbar: [
          { name: 'clipboard', items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] },
          { name: 'editing', items: [ 'Scayt' ] },
          { name: 'links', items: [ 'Link', 'Unlink', 'Autolink' ] },
          { name: 'insert', items: [ 'Media', 'Table', 'Anchor', 'SpecialChar', 'Templates', 'Maximize', 'Source' ] },
          '/',
          { name: 'basicstyles', items: [ 'Bold', 'Italic', 'Strike', 'Underline', '-', 'CopyFormatting', 'RemoveFormat' ] },
          { name: 'paragraph', items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock' ] }
        ],
        height: height
      });

    }
    else {
      CKEDITOR.replace(elem, {
        height: height
      });
    }
  });
}



$(document).ready(function() {
  ckeditor($('textarea.editor'));
});
<textarea name="fields[141]" id="fields[141]" class="simple editor">&lt;p&gt; content goes here  &lt;/p&gt;</textarea>
<textarea name="fields[30]" id="fields[30]" class=" editor"></textarea>

这应该有效...

 CKEDITOR.config.extraPlugins = 'media,autolink,wordcount,notification';
CKEDITOR.config.allowedContent = true;
CKEDITOR.config.skin = 'moonocolor';
CKEDITOR.config.scayt_autoStartup = true;

function ckeditor(elems) {
  $(elems).each(function(i, elem) {
    var height = '200px';
    if ($(elem).hasClass('short')) {
      height = '75px';
    }

    if ($(elem).hasClass('simple')) {
      CKEDITOR.replace(elem, {
        toolbar: [
          { name: 'clipboard', items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', 'Undo', 'Redo' ] },
          { name: 'editing', items: [ 'Scayt' ] },
          { name: 'links', items: [ 'Link', 'Unlink', 'Autolink', 'Media', 'Source'] },
          { name: 'insert', items: [ 'Table', 'SpecialChar', 'Templates', 'Maximize'] },
          { name: 'basicstyles', items: [ 'Bold', 'Italic', 'Strike', 'Underline', 'RemoveFormat' ] },
          { name: 'paragraph', items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent' ] }
        ],
        height: height,
         wordcount:
                    { maxWordCount: 50}
      });

    }
    else if($(elem).hasClass('nofontstyling')) {

      CKEDITOR.replace(elem, {
        toolbar: [
          { name: 'clipboard', items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] },
          { name: 'editing', items: [ 'Scayt' ] },
          { name: 'links', items: [ 'Link', 'Unlink', 'Autolink' ] },
          { name: 'insert', items: [ 'Media', 'Table', 'Anchor', 'SpecialChar', 'Templates', 'Maximize', 'Source' ] },
          '/',
          { name: 'basicstyles', items: [ 'Bold', 'Italic', 'Strike', 'Underline', '-', 'CopyFormatting', 'RemoveFormat' ] },
          { name: 'paragraph', items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock' ] }
        ],
        height: height
      });

    }
    else {
      CKEDITOR.replace(elem, {
        height: height
      });
    }
  });
}



$(document).ready(function() {
  ckeditor($('textarea.editor'));
});