Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix tinymce after message posting
Fixes #894
  • Loading branch information
nikolai-b committed Dec 13, 2019
1 parent 99bd437 commit 394a0ad
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/views/messages/created.js.erb
@@ -1,4 +1,5 @@
<% if @message.persisted? %>
tinyMCE.remove()
$('#messages-new-partial')
.before("<%= j(render 'messages/message', message: @message, thread: @thread ) %>")
.html("<%= j(render 'messages/new') %>")
Expand All @@ -10,6 +11,11 @@
el.scrollIntoView()
window.scrollBy(0, -80) // Top fix header
$(el).parent().addClass("new-message-highlight")
// Without a setTimeout tinyMCE has a bug where in initializes
// but it has no container so the editor is not selectable in FireFox.
setTimeout(function() {
tinyMCE.init(window.tinymceOpts)
}, 1)
<% end %>
<%= render 'shared/flash' %>
<% if flash[:alert].present? %>
Expand Down

0 comments on commit 394a0ad

Please sign in to comment.