Commit f6769a0f12b7ec1ae6e32185bfc2224ff77b539f
1 parent
0932c9ae
Exists in
staging
and in
7 other branches
toggle comment and view article is now working
Showing
1 changed file
with
14 additions
and
1 deletions
Show diff stats
plugins/comment_paragraph/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 | } | ... | ... |