Skip to content

Commit 394a0ad

Browse files
committed
Fix tinymce after message posting
Fixes #894
1 parent 99bd437 commit 394a0ad

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

app/views/messages/created.js.erb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<% if @message.persisted? %>
2+
tinyMCE.remove()
23
$('#messages-new-partial')
34
.before("<%= j(render 'messages/message', message: @message, thread: @thread ) %>")
45
.html("<%= j(render 'messages/new') %>")
@@ -10,6 +11,11 @@
1011
el.scrollIntoView()
1112
window.scrollBy(0, -80) // Top fix header
1213
$(el).parent().addClass("new-message-highlight")
14+
// Without a setTimeout tinyMCE has a bug where in initializes
15+
// but it has no container so the editor is not selectable in FireFox.
16+
setTimeout(function() {
17+
tinyMCE.init(window.tinymceOpts)
18+
}, 1)
1319
<% end %>
1420
<%= render 'shared/flash' %>
1521
<% if flash[:alert].present? %>

0 commit comments

Comments
 (0)