Commit 1ba6ed0a9a3bc00526beec799ed04df92eca9973
1 parent
b54cf5a0
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
Corrigido: Quando clico em qualquer porção do texto, mesmo sem seleção, mostra o…
… balão para comentar, isso é estranho, não indica se estou comentando no paragrafo todo ou apenas naquele ponto do texto, etc... Corrigido: O número de comentários ao lado deve ser um link, ou seja, ao passar o mouse o cursor deve mudar Corrigido: Em que momento irá ser desfeita Seria interessante ser possível desfazer uma seleção de um trecho, quando eu seleciono não consigo desfazer a seleção até que eu faça uma seleção nova
Showing
2 changed files
with
70 additions
and
56 deletions
Show diff stats
plugins/comment_paragraph/public/comment_paragraph_macro.js
| @@ -111,6 +111,7 @@ jQuery(document).ready(function($) { | @@ -111,6 +111,7 @@ jQuery(document).ready(function($) { | ||
| 111 | $("#comment-bubble").hide(); | 111 | $("#comment-bubble").hide(); |
| 112 | //Undo previous highlight from the paragraph | 112 | //Undo previous highlight from the paragraph |
| 113 | $('.comment_paragraph').mousedown(function(){ | 113 | $('.comment_paragraph').mousedown(function(){ |
| 114 | + $("#comment-bubble").hide(); | ||
| 114 | var paragraphId = $(this).data('paragraph'); | 115 | var paragraphId = $(this).data('paragraph'); |
| 115 | $(this).find('.commented-area').replaceWith(function() { | 116 | $(this).find('.commented-area').replaceWith(function() { |
| 116 | return $(this).html(); | 117 | return $(this).html(); |
| @@ -120,10 +121,23 @@ jQuery(document).ready(function($) { | @@ -120,10 +121,23 @@ jQuery(document).ready(function($) { | ||
| 120 | rootElement.innerHTML = lastParagraph[paragraphId]; | 121 | rootElement.innerHTML = lastParagraph[paragraphId]; |
| 121 | } | 122 | } |
| 122 | }); | 123 | }); |
| 124 | + | ||
| 125 | + function getSelectionText() { | ||
| 126 | + var text = ""; | ||
| 127 | + if (window.getSelection) { | ||
| 128 | + text = window.getSelection().toString(); | ||
| 129 | + } else if (document.selection && document.selection.type != "Control") { | ||
| 130 | + text = document.selection.createRange().text; | ||
| 131 | + } | ||
| 132 | + return text; | ||
| 133 | + } | ||
| 123 | 134 | ||
| 124 | //highlight area from the paragraph | 135 | //highlight area from the paragraph |
| 125 | $('.comment_paragraph').mouseup(function(event){ | 136 | $('.comment_paragraph').mouseup(function(event){ |
| 126 | deselectAll(); | 137 | deselectAll(); |
| 138 | + //Don't do anything if there is no selected text | ||
| 139 | + if(getSelectionText().length == 0) | ||
| 140 | + return; | ||
| 127 | var paragraphId = $(this).data('paragraph'); | 141 | var paragraphId = $(this).data('paragraph'); |
| 128 | var currentMousePos = { x: -1, y: -1 }; | 142 | var currentMousePos = { x: -1, y: -1 }; |
| 129 | currentMousePos.x = event.pageX; | 143 | currentMousePos.x = event.pageX; |
| @@ -250,6 +264,6 @@ jQuery(document).keyup(function(e) { | @@ -250,6 +264,6 @@ jQuery(document).keyup(function(e) { | ||
| 250 | // on press ESC key... | 264 | // on press ESC key... |
| 251 | if (e.which == 27) { | 265 | if (e.which == 27) { |
| 252 | // closing side comment box | 266 | // closing side comment box |
| 253 | - side_comment_box_opened = jQuery("div.side-comment").filter("div[style!='display: block;']").css('display', 'none'); | 267 | + side_comment_box_opened = jQuery("div.side-comment").hide(); |
| 254 | } | 268 | } |
| 255 | }); | 269 | }); |
plugins/comment_paragraph/public/style.css
| 1 | - | ||
| 2 | #article .article-comments-list, | 1 | #article .article-comments-list, |
| 3 | #article .article-comments-list ul, | 2 | #article .article-comments-list ul, |
| 4 | #article .article-comments-list li { | 3 | #article .article-comments-list li { |
| 5 | - margin: 10px 0 10px 0; | 4 | + margin: 10px 0 10px 0; |
| 6 | } | 5 | } |
| 7 | 6 | ||
| 8 | div.article-comments-list-more{ | 7 | div.article-comments-list-more{ |
| @@ -41,7 +40,6 @@ div.article-comments-list-more{ | @@ -41,7 +40,6 @@ div.article-comments-list-more{ | ||
| 41 | 40 | ||
| 42 | .comment_paragraph{ | 41 | .comment_paragraph{ |
| 43 | padding: 0px; | 42 | padding: 0px; |
| 44 | - | ||
| 45 | } | 43 | } |
| 46 | 44 | ||
| 47 | .article-body{ | 45 | .article-body{ |
| @@ -51,90 +49,92 @@ div.article-comments-list-more{ | @@ -51,90 +49,92 @@ div.article-comments-list-more{ | ||
| 51 | } | 49 | } |
| 52 | 50 | ||
| 53 | .triangle-right { | 51 | .triangle-right { |
| 54 | - position:relative; | ||
| 55 | - padding:15px; | ||
| 56 | - margin:1em 0 3em; | ||
| 57 | - color:#fff; | ||
| 58 | - background:#075698; /* default background for browsers without gradient support */ | ||
| 59 | - /* css3 */ | ||
| 60 | - background:-webkit-gradient(linear, 0 0, 0 100%, from(#2e88c4), to(#075698)); | ||
| 61 | - background:-moz-linear-gradient(#2e88c4, #075698); | ||
| 62 | - background:-o-linear-gradient(#2e88c4, #075698); | ||
| 63 | - background:linear-gradient(#2e88c4, #075698); | ||
| 64 | - -webkit-border-radius:10px; | ||
| 65 | - -moz-border-radius:10px; | ||
| 66 | - border-radius:10px; | 52 | + position:relative; |
| 53 | + padding:15px; | ||
| 54 | + margin:1em 0 3em; | ||
| 55 | + color:#fff; | ||
| 56 | + background:#075698; /* default background for browsers without gradient support */ | ||
| 57 | + /* css3 */ | ||
| 58 | + background:-webkit-gradient(linear, 0 0, 0 100%, from(#2e88c4), to(#075698)); | ||
| 59 | + background:-moz-linear-gradient(#2e88c4, #075698); | ||
| 60 | + background:-o-linear-gradient(#2e88c4, #075698); | ||
| 61 | + background:linear-gradient(#2e88c4, #075698); | ||
| 62 | + -webkit-border-radius:10px; | ||
| 63 | + -moz-border-radius:10px; | ||
| 64 | + border-radius:10px; | ||
| 67 | } | 65 | } |
| 68 | 66 | ||
| 69 | .triangle-right:after { | 67 | .triangle-right:after { |
| 70 | - content: ""; | ||
| 71 | - position: absolute; | ||
| 72 | - bottom: -20px; | ||
| 73 | - left: 50px; | ||
| 74 | - border-width: 20px 0 0 20px; | ||
| 75 | - border-style: solid; | ||
| 76 | - border-color: #075698 transparent; | ||
| 77 | - display: block; | ||
| 78 | - width: 0; | 68 | + content: ""; |
| 69 | + position: absolute; | ||
| 70 | + bottom: -20px; | ||
| 71 | + left: 50px; | ||
| 72 | + border-width: 20px 0 0 20px; | ||
| 73 | + border-style: solid; | ||
| 74 | + border-color: #075698 transparent; | ||
| 75 | + display: block; | ||
| 76 | + width: 0; | ||
| 79 | } | 77 | } |
| 80 | 78 | ||
| 81 | .triangle-border { | 79 | .triangle-border { |
| 82 | - position: relative; | ||
| 83 | - padding: 15px; | ||
| 84 | - margin: 1em 0 3em; | ||
| 85 | - border: 5px solid #5a8f00; | ||
| 86 | - color: #333; | ||
| 87 | - background: #fff; | ||
| 88 | - -webkit-border-radius: 10px; | ||
| 89 | - -moz-border-radius: 10px; | ||
| 90 | - border-radius: 10px; | 80 | + position: relative; |
| 81 | + padding: 15px; | ||
| 82 | + margin: 1em 0 3em; | ||
| 83 | + border: 5px solid #5a8f00; | ||
| 84 | + color: #333; | ||
| 85 | + background: #fff; | ||
| 86 | + -webkit-border-radius: 10px; | ||
| 87 | + -moz-border-radius: 10px; | ||
| 88 | + border-radius: 10px; | ||
| 91 | } | 89 | } |
| 92 | 90 | ||
| 93 | .comment-picture {width: 50px;} | 91 | .comment-picture {width: 50px;} |
| 94 | .comment-text {display: inline-block;} | 92 | .comment-text {display: inline-block;} |
| 95 | .comment-replies .comment-text {display: inline-block;} | 93 | .comment-replies .comment-text {display: inline-block;} |
| 96 | .comment-from-owner .comment-created-at { | 94 | .comment-from-owner .comment-created-at { |
| 97 | - display: block; | ||
| 98 | - width: 100%;} | 95 | + display: block; |
| 96 | + width: 100%; | ||
| 97 | +} | ||
| 99 | .comment-replies .comment-text {display: block;} | 98 | .comment-replies .comment-text {display: block;} |
| 100 | #article .article-comment .comment-details h4 {display: none;} | 99 | #article .article-comment .comment-details h4 {display: none;} |
| 101 | #article .article-comments-list .comment-replies {padding-left: 20px;} | 100 | #article .article-comments-list .comment-replies {padding-left: 20px;} |
| 102 | #comment_title{ | 101 | #comment_title{ |
| 103 | - display: none; | 102 | + display: none; |
| 104 | } | 103 | } |
| 105 | 104 | ||
| 106 | div[class^='comments_list_toggle_paragraph_'] { | 105 | div[class^='comments_list_toggle_paragraph_'] { |
| 107 | - border-style: solid; | ||
| 108 | - border-width: 1px; | ||
| 109 | - border-color: #ccc; | ||
| 110 | - padding: 5px; | ||
| 111 | - background-color: whitesmoke; | ||
| 112 | - width: 250px; | 106 | + border-style: solid; |
| 107 | + border-width: 1px; | ||
| 108 | + border-color: #ccc; | ||
| 109 | + padding: 5px; | ||
| 110 | + background-color: whitesmoke; | ||
| 111 | + width: 250px; | ||
| 113 | } | 112 | } |
| 114 | 113 | ||
| 115 | div[class^='comment-paragraph-loading-'] { | 114 | div[class^='comment-paragraph-loading-'] { |
| 116 | - background-color: whitesmoke; | ||
| 117 | - z-index: 99; | ||
| 118 | - right: -230px; | 115 | + background-color: whitesmoke; |
| 116 | + z-index: 99; | ||
| 117 | + right: -230px; | ||
| 119 | } | 118 | } |
| 120 | 119 | ||
| 121 | #content .comment-balloon div[class^='comment-wrapper-']{ | 120 | #content .comment-balloon div[class^='comment-wrapper-']{ |
| 122 | - background: none; | 121 | + background: none; |
| 123 | } | 122 | } |
| 124 | 123 | ||
| 125 | .side-comment{ | 124 | .side-comment{ |
| 126 | - z-index: 199; | 125 | + z-index: 199; |
| 127 | } | 126 | } |
| 128 | 127 | ||
| 129 | .side-comments-counter { | 128 | .side-comments-counter { |
| 130 | - border: 1px solid #57ad68; | ||
| 131 | - padding: 3px; | ||
| 132 | - border-radius: 3px; | ||
| 133 | - color: #666; | 129 | + border: 1px solid #57ad68; |
| 130 | + padding: 3px; | ||
| 131 | + border-radius: 3px; | ||
| 132 | + color: #666; | ||
| 133 | + cursor: pointer; | ||
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | #comments_list{ | 136 | #comments_list{ |
| 137 | - display: none; | 137 | + display: none; |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | .article-comment-inner {border-bottom: 1px solid #ddd;} | 140 | .article-comment-inner {border-bottom: 1px solid #ddd;} |
| @@ -150,7 +150,7 @@ div[class^='comment-paragraph-loading-'] { | @@ -150,7 +150,7 @@ div[class^='comment-paragraph-loading-'] { | ||
| 150 | .article-comment .comment-details {margin-bottom: 10px;} | 150 | .article-comment .comment-details {margin-bottom: 10px;} |
| 151 | 151 | ||
| 152 | #content .comment-actions .menu-submenu ul { | 152 | #content .comment-actions .menu-submenu ul { |
| 153 | - right: 100%; | ||
| 154 | - position: absolute; | 153 | + right: 100%; |
| 154 | + position: absolute; | ||
| 155 | } | 155 | } |
| 156 | 156 |