Update RTE for step description [SCI-3111]

This commit is contained in:
Oleksii Kriuchykhin 2019-03-19 17:42:49 +01:00
parent 7db53fad7c
commit eb3d1ea6fe
3 changed files with 11 additions and 5 deletions

View file

@ -150,7 +150,7 @@
animateSpinner(null, false);
initPreviewModal();
DragNDropSteps.clearFiles();
TinyMCE.refresh();
TinyMCE.init('#step_description_textarea');
$("#new-step-checklists fieldset.nested_step_checklists ul").each(function () {
enableCheckboxSorting(this);
});
@ -253,7 +253,6 @@
initEditableHandsOnTable($form);
applyCancelCallBack();
TinyMCE.refresh();
SmartAnnotation.preventPropagation('.atwho-user-popover');
//Rerender tables
@ -513,7 +512,7 @@
$('#step_name').focus();
});
TinyMCE.refresh();
TinyMCE.init('#step_description_textarea');
});
},

View file

@ -184,7 +184,7 @@ var TinyMCE = (function() {
destroyAll: function() {
_.each(tinyMCE.editors, function(editor) {
if (editor) {
editor.destroy();
editor.remove();
initHighlightjs();
}
});

View file

@ -29,7 +29,14 @@
<div class="tab-pane active" role="tabpanel" id="new-step-main">
<%= f.text_field :name, label: t("protocols.steps.new.name"), placeholder: t("protocols.steps.new.name_placeholder") %>
<div class="form-group">
<%= f.tiny_mce_editor(:description, data: { object_type: 'step', object_id: @step.id }) %>
<%= f.tiny_mce_editor(:description,
id: :step_description_textarea,
hide_label: false,
value: sanitize_input(@step.description),
data: {
object_type: 'step',
object_id: @step.id,
highlightjs_path: asset_path('highlightjs-github-theme') } ) %>
</div>
</div>
<div class="tab-pane" role="tabpanel" id="new-step-checklists">