<script type="text/javascript" src="/skins/default/tiny_mce/tinymce.min.js"></script>

<script type="text/javascript">
	function mce_init($field) {
		if (undefined==tinymce.get($field)) {
			tinymce.init({
				selector: '#'+$field,
				setup: function(editor) {
					editor.on('change', function(e) {
						editor.save();
					});
				},
				plugins: [
					"advlist autolink lists link image charmap print preview anchor",
					"searchreplace visualblocks code fullscreen",
					"insertdatetime media table contextmenu paste responsivefilemanager"
				],
				language : 'ru', 
				toolbar: "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image responsivefilemanager",
				external_filemanager_path:"/skins/default/tiny_mce/filemanager/",
				relative_urls: false,
				external_plugins: { "filemanager" : "/skins/default/tiny_mce/filemanager/plugin.min.js"}
			});
		} else {
			tinymce.remove('#'+$field);
		}
	}
	{if $_cfg.core.use_wysiwyg}mce_init('{$field}');{/if}
</script>

<div class="form-group">
	<div class="col-lg-offset-3 col-lg-9">
		<a href="javascript:mce_init('{$field}');">[{t}Включить/выключить панель визуального редактирования{/t}]</a>
	</div>
</div>