diff --git a/app/assets/javascripts/richtext.js b/app/assets/javascripts/richtext.js index 70909243b..cfba5c923 100644 --- a/app/assets/javascripts/richtext.js +++ b/app/assets/javascripts/richtext.js @@ -14,9 +14,6 @@ $(document).ready(function () { /* Disable all the edit buttons */ $(".richtext_doedit").prop("disabled", true); - /* Enable the preview buttons */ - $(".richtext_dopreview").prop("disabled", false); - /* * Install a click handler to switch to edit mode when the * edit button is pressed. @@ -28,8 +25,8 @@ $(document).ready(function () { preview.hide(); editor.show(); - $(this).siblings(".richtext_dopreview").prop("disabled", false); - $(this).prop("disabled", true); + $(this).parents(".richtext_container").find(".richtext_dopreview").prop("disabled", false).removeClass("active"); + $(this).prop("disabled", true).addClass("active"); }); /* @@ -56,7 +53,7 @@ $(document).ready(function () { preview.css("min-height", minHeight + "px"); preview.show(); - $(this).siblings(".richtext_doedit").prop("disabled", false); - $(this).prop("disabled", true); + $(this).parents(".richtext_container").find(".richtext_doedit").prop("disabled", false).removeClass("active"); + $(this).prop("disabled", true).addClass("active"); }); }); diff --git a/app/views/shared/_richtext_field.html.erb b/app/views/shared/_richtext_field.html.erb index 6f5b6d3d9..74d609cd5 100644 --- a/app/views/shared/_richtext_field.html.erb +++ b/app/views/shared/_richtext_field.html.erb @@ -1,5 +1,13 @@