Ruby on Rails Monday, January 20, 2020

My app was working before I tried adding images in the richtext field Now the form field doesn't clear on submit and everything appends to the element I'm appending to from my javascript channel file (room.js) wrapped in <div class="trix-content"> So the problem is it doesn't display until the page is refreshed then they're displayed from the database and the form field doesn't clear

$('#message_holder').append('<div class="container-right"><div class="subscript">' + data.sender_name + '<br>' + data.msg_time + '</div>' + data.content.body  + '</div>');

Here it is in page source appended to the bottom of <div id="message_holder">

<div class="container-right">  				<div class="subscript">fugee<br>Mon, 20 Jan 2020 20:13:46 +0000</div>  				<div class="trix-content">    <div>hey<action-text-attachment sgid="BAh7CEkiCGdpZAY6BkVUSSI4Z2lkOi8vaWduYXR6bW91c2UvQWN0aXZlU3RvcmFnZTo6QmxvYi8xMj9leHBpcmVzX2luBjsAVEkiDHB1cnBvc2UGOwBUSSIPYXR0YWNoYWJsZQY7AFRJIg9leHBpcmVzX2F0BjsAVDA=--931b645abd976e02a37e809257c4837f7c4fda64" content-type="image/jpeg" url="http://localhost:3000/rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBFUT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--bffdde6476172b543d8e5dd879a742b559406b74/Katana2.jpg" filename="Katana2.jpg" filesize="26982" width="410" height="512" previewable="true" presentation="gallery"><figure class="attachment attachment--preview attachment--jpg">      <img src="http://localhost:3000/rails/active_storage/representations/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBFUT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--bffdde6476172b543d8e5dd879a742b559406b74/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCam9VY21WemFYcGxYM1J2WDJ4cGJXbDBXd2RwQWdBRWFRSUFBdz09IiwiZXhwIjpudWxsLCJwdXIiOiJ2YXJpYXRpb24ifX0=--69a726fe314cc814b26ade236a1f8e8b78481edd/Katana2.jpg">      <figcaption class="attachment__caption">        <span class="attachment__name">Katana2.jpg</span>        <span class="attachment__size">26.3 KB</span>    </figcaption>  </figure></action-text-attachment>  </div>  </div>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/224b03d3-2851-41d4-9b42-0880875691bd%40googlegroups.com.

No comments:

Post a Comment