<style>

	.left_block {width:100%;}
</style>
<div class="r_block">
	<div class="r_block_head">
		Редактирование сообщения
	</div> 
	<div class="r_block_c">
		<textarea id="text" class="form-control maxMinW100" rows="10">{text}</textarea>
		<div id="topic_result" class="mt-10"></div>
		<div class="smile_input_forum">
			<button id="create_btn" onclick="edit_message('{id}');" type="button" class="btn2">Изменить</button>
			<div id="smile_btn" class="smile_btn visible-lg-inline-block type2" data-container="body" data-toggle="popover" data-placement="top" data-content="empty"></div>
		</div>
	</div>
</div>
<script>
	$(document).ready(function() {
		init_tinymce("text", "forum", "{file_manager_theme}", "{file_manager}", "{{md5($conf->code)}}");
		get_smiles('#smile_btn', 1);
	});

	$('#smile_btn').popover({ html: true, animation: true, trigger: "click" });
	$('#smile_btn').on('show.bs.popover', function () {
		$(document).mouseup(function (e) {
			var container = $(".popover-content");
			if (container.has(e.target).length === 0){
				$('#smile_btn').popover('hide'); selected = 'gcms_smiles';
			}
		});
	});

	function set_smile(elem){
		var smile =  "<img src=\""+$(elem).attr("src")+"\" class=\"g_smile\" height=\"20px\" width=\"20px\">";
		tinymce.activeEditor.insertContent(smile);
		$('#smile_btn').popover('hide'); selected = 'gcms_smiles';
	}
</script>