From 66bbbbcf057e409b7768c9b0fc0c81620ec279e5 Mon Sep 17 00:00:00 2001 From: dimden Date: Wed, 24 Aug 2022 16:55:22 +0300 Subject: [PATCH] Fix breaking editor Fixes #413 --- public/js/news/profile_comment.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/public/js/news/profile_comment.js b/public/js/news/profile_comment.js index 13c7d533..21e535cc 100644 --- a/public/js/news/profile_comment.js +++ b/public/js/news/profile_comment.js @@ -1,7 +1,7 @@ var ProfileComment = { displayEditor: function(eventId) { - var commentDiv = $('#event_'+eventId+' div.content') - var eventActions = $('#event_'+eventId+'_actions') + var commentDiv = $('#event_'+eventId+' div.content').first() + var eventActions = $('#event_'+eventId+'_actions').first() eventActions.find('a#editLink').css('display', 'none') @@ -10,15 +10,14 @@ var ProfileComment = { }, cancelEditor: function(eventId) { - var eventActions = $('#event_'+eventId+'_actions') - var commentDiv = $('#event_'+eventId+' div.content') + var eventActions = $('#event_'+eventId+'_actions').first() + var commentDiv = $('#event_'+eventId+' div.content').first() eventActions.find('a#editLink').css('display', 'inline') commentDiv.text(commentDiv.find('textarea').text()) }, update: function(eventId, csrfToken) { - var eventActions = $('#event_'+eventId+'_actions') - var commentDiv = $('#event_'+eventId+' div.content') + var commentDiv = $('#event_'+eventId+' div.content').first() var self = this console.log(commentDiv.find('textarea').val()) $.post('/event/'+eventId+'/update_profile_comment', {