I have added tinyMCE editor in Order status history for comment field, the issue is when i get ajax response, editor disappears instead its showing normal textarea field, please find below screenshots of tinyMce editor field and ajax response field respectively:
I have used below code in this page to use tinyMCE editor:
<textarea name="history[comment]" id="history_comment" class="textarea" cols="80" rows="20"></textarea>
<script>
require([
'jquery',
'mage/adminhtml/wysiwyg/tiny_mce/setup'
], function(jQuery){
var config = {},
editor;
jQuery.extend(config, {
settings: {
theme_advanced_buttons1 : 'bold,italic,|,justifyleft,justifycenter,justifyright,|,' +
'fontselect,fontsizeselect,|,forecolor,backcolor,|,link,unlink,image,|,bullist,numlist,|,code',
theme_advanced_buttons2: null,
theme_advanced_buttons3: null,
theme_advanced_buttons4: null
}
});
editor = new tinyMceWysiwygSetup(
'history_comment',
config
);
editor.turnOn();
jQuery('#history_comment')
.addClass('wysiwyg-editor')
.data(
'wysiwygEditor',
editor
);
});
</script>