Commit ff641cee authored by bbaer's avatar bbaer
Browse files

added reply + focus on editor

parent 93218961
Pipeline #1464 passed with stage
in 2 minutes and 17 seconds
......@@ -240,8 +240,8 @@ var QfqNS = QfqNS || {};
console.log("With data: " + argument.data);
that._handleNew(argument.data);
});
commentCOntroller.on('comment.edited', function() {
this._updateJSON();
commentController.on('comment.edited', function() {
that._updateJSON();
});
};
......
......@@ -120,6 +120,7 @@ var QfqNS = QfqNS || {};
n.Comment.prototype._deleteMe = function(e) {
console.log("Delete pressed for:");
console.log(this.comment);
};
n.Comment.prototype._editMe = function(e) {
......@@ -140,6 +141,8 @@ var QfqNS = QfqNS || {};
console.log("Reply to me:");
console.log(this.comment);
console.log(e);
this.eventEmitter.emitEvent('comment.reply',
n.EventEmitter.makePayload(this, this.comment));
};
n.Comment.prototype._updateComment = function(e) {
......@@ -148,7 +151,8 @@ var QfqNS = QfqNS || {};
this._updateText(e.data.text);
this.$comment.show();
e.data.$container.remove();
this.eventEmitter.emitEvent('comment.edited', n.EventEmitter.makePayload(this, this.comment));
this.eventEmitter.emitEvent('comment.edited',
n.EventEmitter.makePayload(this, this.comment));
};
})(QfqNS);
\ No newline at end of file
......@@ -113,6 +113,9 @@ var QfqNS = QfqNS || {};
commentObject.on('comment.edited', function(e) {
that.updateComment(e.data);
});
commentObject.on('comment.reply', function(e) {
that.requestReply(e.data);
});
};
n.CommentController.prototype.displayComments = function() {
......@@ -130,6 +133,7 @@ var QfqNS = QfqNS || {};
that._handleEditorSubmit(editor);
});
$editor.appendTo(this.$container);
editor.$textArea.focus();
};
n.CommentController.prototype._handleEditorSubmit = function(editor) {
......@@ -160,6 +164,10 @@ var QfqNS = QfqNS || {};
this.emitEvent("edit");
};
n.CommentController.prototype.requestReply = function(data) {
this.displayEditor();
};
n.CommentController.prototype.updateHeight = function() {
//this.height = this.$container.height();
//this.$container.css("max-height", this.height);
......@@ -170,7 +178,9 @@ var QfqNS = QfqNS || {};
var user = this._searchUsersByUid(users, comments[i].uid);
this.addComment(comments[i], user);
}
this.displayEditor();
if (comments.length === 0) {
this.displayEditor();
}
};
n.CommentController.prototype.exportComments = function() {
......
......@@ -41,7 +41,8 @@ var QfqNS = QfqNS || {};
});
this.$textArea = $("<div />", {
class: "qfqEditor",
contenteditable: true
contenteditable: true,
tabindex: 0
});
if (text) {
this.$textArea.html(text);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment