function taskCounterExtension(editor) {
  editor.getTaskCount = () => {
    let found, count;

    if (editor.isViewer()) {
      count = editor.preview.$el.find('.task-list-item').length;
    } else if (editor.isMarkdownMode()) {
      found = editor.mdEditor.getValue().match(FIND_TASK_RX);
      count = found ? found.length : 0;
    } else {
      count = editor.wwEditor.get$Body().find('.task-list-item').length;
    }

    return count;
  };

  editor.getCheckedTaskCount = () => {
    let found, count;

    if (editor.isViewer()) {
      count = editor.preview.$el.find('.task-list-item.checked').length;
    } else if (editor.isMarkdownMode()) {
      found = editor.mdEditor.getValue().match(FIND_CHECKED_TASK_RX);
      count = found ? found.length : 0;
    } else {
      count = editor.wwEditor.get$Body().find('.task-list-item.checked').length;
    }

    return count;
  };
}
function taskCounterExtension(editor) {
  editor.getTaskCount = () => {
    let found, count;

    if (editor.isViewer()) {
      count = editor.preview.$el.find('.task-list-item').length;
    } else if (editor.isMarkdownMode()) {
      found = editor.mdEditor.getValue().match(FIND_TASK_RX);
      count = found ? found.length : 0;
    } else {
      count = editor.wwEditor.get$Body().find('.task-list-item').length;
    }

    return count;
  };

  editor.getCheckedTaskCount = () => {
    let found, count;

    if (editor.isViewer()) {
      count = editor.preview.$el.find('.task-list-item.checked').length;
    } else if (editor.isMarkdownMode()) {
      found = editor.mdEditor.getValue().match(FIND_CHECKED_TASK_RX);
      count = found ? found.length : 0;
    } else {
      count = editor.wwEditor.get$Body().find('.task-list-item.checked').length;
    }

    return count;
  };
}
function taskCounterExtension ( editor ) { editor . getTaskCount = ( ) => { let found , count ; if ( editor . isViewer ( ) ) { count = editor . preview . $el . find ( '.task-list-item' ) . length ; } else if ( editor . isMarkdownMode ( ) ) { found = editor . mdEditor . getValue ( ) . match ( FIND_TASK_RX ) ; count = found ? found . length : 0 ; } else { count = editor . wwEditor . get$Body ( ) . find ( '.task-list-item' ) . length ; } return count ; } ; editor . getCheckedTaskCount = ( ) => { let found , count ; if ( editor . isViewer ( ) ) { count = editor . preview . $el . find ( '.task-list-item.checked' ) . length ; } else if ( editor . isMarkdownMode ( ) ) { found = editor . mdEditor . getValue ( ) . match ( FIND_CHECKED_TASK_RX ) ; count = found ? found . length : 0 ; } else { count = editor . wwEditor . get$Body ( ) . find ( '.task-list-item.checked' ) . length ; } return count ; } ; }
task counter extension
@param {Editor} editor - editor instance
@ignore
task counter extension
taskCounterExtension - Extension for task counter