From b0b542b41fad46a5fdb698d5f48bb97445be86f2 Mon Sep 17 00:00:00 2001
From: Evandro Jr
Date: Wed, 20 Aug 2014 11:29:39 -0300
Subject: [PATCH] fix post bugs and removes ballon text underline
---
plugins/comment_paragraph/public/comment_paragraph.js | 18 +++++++++++++-----
plugins/comment_paragraph/public/comment_paragraph_macro.js | 11 +++--------
2 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/plugins/comment_paragraph/public/comment_paragraph.js b/plugins/comment_paragraph/public/comment_paragraph.js
index 7481bf6..b30729e 100644
--- a/plugins/comment_paragraph/public/comment_paragraph.js
+++ b/plugins/comment_paragraph/public/comment_paragraph.js
@@ -1,20 +1,28 @@
function makeCommentable() {
- paragraphsTxt=""
-
+ paragraphsTxt="";
+ //Add p tag, when opening the editor. For some season it comes without p tag
foundCommentableParagraph = false;
jQuery('#article_body_ifr').contents().find('body').children('div.article_comments').each(function( index ) {
paragraphsTxt+="" + jQuery(this).html() + "
";
foundCommentableParagraph = true;
});
+ //undo the paragraph comment tags
if(foundCommentableParagraph === true){
- tinyMCE.activeEditor.setContent(paragraphsTxt)
+ tinyMCE.activeEditor.setContent(paragraphsTxt);
return;
}
+ //Wraps the paragraph using the chosen class
jQuery('#article_body_ifr').contents().find('body').children('p').each(function( index ) {
- paragraphsTxt+='' + jQuery(this).html() + '
'
+ text = jQuery(this).html().trim();
+ if(text!="" && text!="
"){
+ paragraphsTxt+='' + text + '
'
+ }
});
- tinyMCE.activeEditor.setContent(paragraphsTxt)
+ tinyMCE.activeEditor.setContent(paragraphsTxt);
+
+ //Workaround necessary to post the body of the article
+ tinymce.activeEditor.execCommand('mceInsertContent', false, " ");
}
diff --git a/plugins/comment_paragraph/public/comment_paragraph_macro.js b/plugins/comment_paragraph/public/comment_paragraph_macro.js
index 4c50ec6..3c0a9c2 100644
--- a/plugins/comment_paragraph/public/comment_paragraph_macro.js
+++ b/plugins/comment_paragraph/public/comment_paragraph_macro.js
@@ -13,7 +13,7 @@ jQuery(document).ready(function($) {
//Add marked text bubble
$("body").append('\
- ');
$("#comment-bubble").hide();
@@ -32,7 +32,6 @@ jQuery(document).ready(function($) {
$('#comment-bubble').mouseleave(function(){
this.hide();
$("#comment-bubble").css({top: 0, left: 0, position:'absolute'});
-// $("#comment-bubble").css({top: 0, left: 0, position:'absolute', 'background-color': 'yellow'});
});
//highlight area from the paragraph
@@ -45,10 +44,7 @@ jQuery(document).ready(function($) {
$("#comment-bubble").data("paragraphId", paragraphId)
var url = $('#link_to_ajax_comments_' + paragraphId).data('url');
$("#comment-bubble").data("url", url)
-// $("#comment-bubble").css({top: event.pageY-100, left: event.pageX-70, position:'absolute', 'background-color': 'yellow'});
$("#comment-bubble").show();
- // var onclickContent = $('#link_to_ajax_comments_' + paragraphId).attr('onclick');
- // $("#comment-bubble").attr('onclick', onclickContent);
var rootElement = $(this).get(0);
lastParagraph[paragraphId] = rootElement.innerHTML;
var selObj = rangy.getSelection();
@@ -81,11 +77,11 @@ jQuery(document).ready(function($) {
url: url
}).done(function() {
var button = jQuery('#page-comment-form-' + paragraphId + ' a')[0];
- //console.log(button);
button.click();
- //$('body').scrollTo('#page-comment-form-' + paragraphId + ' a');
+ window.location="#page-comment-form-" + paragraphId;
});
});
+
function processAnchor(){
var anchor = window.location.hash;
@@ -149,7 +145,6 @@ function toggleParagraph(paragraph) {
var visible = div.is(':visible');
if(!visible)
jQuery('div.comment-paragraph-loading-'+paragraph).addClass('comment-button-loading');
-
div.toggle('fast');
return visible;
}
--
libgit2 0.21.2