Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit 0d5b97b

Browse files
committed
Narrow-down textarea selector for submitting comment, otherwise it takes the wrong one (typically if file/folder is shared).
1 parent 0330898 commit 0d5b97b

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

core/src/plugins/meta.comments/class.CommentsPanel.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,13 @@ Class.create("CommentsPanel", {
6363
// Warning, method is called statically, there is no "this"
6464
loadInfoPanel : function(container, node){
6565

66+
console.log(container, container.down("textarea"), container.down("textarea.comments_textarea"));
67+
6668
container.down("#comments_container");
67-
container.down("textarea").observe("focus", function(){
69+
container.down("textarea.comments_textarea").observe("focus", function(){
6870
pydio.UI.disableAllKeyBindings();
6971
});
70-
container.down("textarea").observe("blur", function(){
72+
container.down("textarea.comments_textarea").observe("blur", function(){
7173
pydio.UI.enableAllKeyBindings();
7274
});
7375

@@ -120,19 +122,19 @@ Class.create("CommentsPanel", {
120122

121123
var submitComment = function(){
122124

123-
if(!container.down('textarea').getValue()) {
125+
if(!container.down('textarea.comments_textarea').getValue()) {
124126
return;
125127
}
126128
var conn = new Connexion();
127129
conn.setParameters({
128130
file: node.getPath(),
129131
get_action: "post_comment",
130-
content: container.down('textarea').getValue()
132+
content: container.down('textarea.comments_textarea').getValue()
131133
});
132134
conn.setMethod('POST');
133135
conn.onComplete = function(transport){
134136
CommentsPanel.prototype.commentObjectToDOM($H(transport.responseJSON), container, node);
135-
container.down('textarea').setValue("");
137+
container.down('textarea.comments_textarea').setValue("");
136138
CommentsPanel.prototype.refreshScroller(container);
137139
$("comments_container").scrollTop = 10000;
138140
};
@@ -145,7 +147,7 @@ Class.create("CommentsPanel", {
145147
submitComment();
146148
});
147149

148-
container.down('textarea').observe("keydown", function(e){
150+
container.down('textarea.comments_textarea').observe("keydown", function(e){
149151
if(e.keyCode == Event.KEY_RETURN && e.ctrlKey){
150152
submitComment();
151153
return false;

core/src/plugins/meta.comments/manifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<div class="panelHeader infoPanelGroup" colspan="2"><span class="icon-comments-alt" data-ajxpAction="comments" title="AJXP_MESSAGE[meta.comments.1]"></span>AJXP_MESSAGE[meta.comments.1]</div>
2626
<div id="comments_container"></div>
2727
<div id="comments_form">
28-
<textarea placeholder="AJXP_MESSAGE[meta.comments.2]"></textarea>
28+
<textarea class="comments_textarea" placeholder="AJXP_MESSAGE[meta.comments.2]"></textarea>
2929
<div><input type="button" value="AJXP_MESSAGE[meta.comments.3]" id="comments_submit"></div>
3030
</div>
3131
</div>

0 commit comments

Comments
 (0)