Commit b826b0e688fff2e89c51d0ef5eefa57e8e1c8123

Authored by Evandro Jr
1 parent ee1e174b
Exists in master

toggle comment and view article is now working

Showing 1 changed file with 14 additions and 1 deletions   Show diff stats
public/comment_paragraph.js
1 1 function makeCommentable() {
2 2 paragraphsTxt=""
  3 +
  4 + foundCommentableParagraph = false;
  5 + jQuery('#article_body_ifr').contents().find('body').children('div.article_comments').each(function( index ) {
  6 + paragraphsTxt+="<p>" + jQuery(this).html() + "</p>";
  7 + console.log(jQuery(this).html())
  8 + foundCommentableParagraph = true;
  9 + });
  10 +
  11 + if(foundCommentableParagraph === true){
  12 + tinyMCE.activeEditor.setContent(paragraphsTxt)
  13 + return;
  14 + }
  15 +
3 16 jQuery('#article_body_ifr').contents().find('body').children('p').each(function( index ) {
4   - paragraphsTxt+='<p><div class="macro article_comments" data-macro="comment_paragraph_plugin/allow_comment" data-macro-paragraph_id="' + index + '">' + jQuery(this).html() + '</p></div>'
  17 + paragraphsTxt+='<p><div class="macro article_comments" data-macro="comment_paragraph_plugin/allow_comment" data-macro-paragraph_id="' + index + '">' + jQuery(this).html() + '</div></p><br>'
5 18 });
6 19 tinyMCE.activeEditor.setContent(paragraphsTxt)
7 20 }
... ...