Commit b0b542b41fad46a5fdb698d5f48bb97445be86f2

Authored by Evandro Jr
1 parent dd4246ea

fix post bugs and removes ballon text underline

plugins/comment_paragraph/public/comment_paragraph.js
1 1 function makeCommentable() {
2   - paragraphsTxt=""
3   -
  2 + paragraphsTxt="";
  3 + //Add p tag, when opening the editor. For some season it comes without p tag
4 4 foundCommentableParagraph = false;
5 5 jQuery('#article_body_ifr').contents().find('body').children('div.article_comments').each(function( index ) {
6 6 paragraphsTxt+="<p>" + jQuery(this).html() + "</p>";
7 7 foundCommentableParagraph = true;
8 8 });
9 9  
  10 + //undo the paragraph comment tags
10 11 if(foundCommentableParagraph === true){
11   - tinyMCE.activeEditor.setContent(paragraphsTxt)
  12 + tinyMCE.activeEditor.setContent(paragraphsTxt);
12 13 return;
13 14 }
14 15  
  16 + //Wraps the paragraph using the chosen class
15 17 jQuery('#article_body_ifr').contents().find('body').children('p').each(function( index ) {
16   - 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>'
  18 + text = jQuery(this).html().trim();
  19 + if(text!="" && text!="<br>"){
  20 + paragraphsTxt+='<p><div class="macro article_comments" data-macro="comment_paragraph_plugin/allow_comment" data-macro-paragraph_id="' + index + '">' + text + '</div></p><br>'
  21 + }
17 22 });
18   - tinyMCE.activeEditor.setContent(paragraphsTxt)
  23 + tinyMCE.activeEditor.setContent(paragraphsTxt);
  24 +
  25 + //Workaround necessary to post the body of the article
  26 + tinymce.activeEditor.execCommand('mceInsertContent', false, " ");
19 27 }
20 28  
... ...
plugins/comment_paragraph/public/comment_paragraph_macro.js
... ... @@ -13,7 +13,7 @@ jQuery(document).ready(function($) {
13 13  
14 14 //Add marked text bubble
15 15 $("body").append('\
16   - <a href="#" id="comment-bubble" style="width:120px;height:105px;">\
  16 + <a href="#" id="comment-bubble" style="width:120px;height:105px;text-decoration: none">\
17 17 <div align="center" class="triangle-right" >Comentar<br>+</div>\
18 18 </a>');
19 19 $("#comment-bubble").hide();
... ... @@ -32,7 +32,6 @@ jQuery(document).ready(function($) {
32 32 $('#comment-bubble').mouseleave(function(){
33 33 this.hide();
34 34 $("#comment-bubble").css({top: 0, left: 0, position:'absolute'});
35   -// $("#comment-bubble").css({top: 0, left: 0, position:'absolute', 'background-color': 'yellow'});
36 35 });
37 36  
38 37 //highlight area from the paragraph
... ... @@ -45,10 +44,7 @@ jQuery(document).ready(function($) {
45 44 $("#comment-bubble").data("paragraphId", paragraphId)
46 45 var url = $('#link_to_ajax_comments_' + paragraphId).data('url');
47 46 $("#comment-bubble").data("url", url)
48   -// $("#comment-bubble").css({top: event.pageY-100, left: event.pageX-70, position:'absolute', 'background-color': 'yellow'});
49 47 $("#comment-bubble").show();
50   - // var onclickContent = $('#link_to_ajax_comments_' + paragraphId).attr('onclick');
51   - // $("#comment-bubble").attr('onclick', onclickContent);
52 48 var rootElement = $(this).get(0);
53 49 lastParagraph[paragraphId] = rootElement.innerHTML;
54 50 var selObj = rangy.getSelection();
... ... @@ -81,11 +77,11 @@ jQuery(document).ready(function($) {
81 77 url: url
82 78 }).done(function() {
83 79 var button = jQuery('#page-comment-form-' + paragraphId + ' a')[0];
84   - //console.log(button);
85 80 button.click();
86   - //$('body').scrollTo('#page-comment-form-' + paragraphId + ' a');
  81 + window.location="#page-comment-form-" + paragraphId;
87 82 });
88 83 });
  84 +
89 85  
90 86 function processAnchor(){
91 87 var anchor = window.location.hash;
... ... @@ -149,7 +145,6 @@ function toggleParagraph(paragraph) {
149 145 var visible = div.is(':visible');
150 146 if(!visible)
151 147 jQuery('div.comment-paragraph-loading-'+paragraph).addClass('comment-button-loading');
152   -
153 148 div.toggle('fast');
154 149 return visible;
155 150 }
... ...