{extends file=$element.methods->getTemplatePath('general')}

{block name=input append}
	<script language="JavaScript" type="text/javascript" src="{$smarty.const.MODULE_REL_PATH}_3parties/suneditor/suneditor.min.js"></script>
	<link href="{$smarty.const.MODULE_REL_PATH}_3parties/suneditor/suneditor.min.css" rel="stylesheet" />

	<textarea
		id="{$element.id}"
		name="{$element.name}"
		style="width:{$element.style.width|default:500}px; height:{$element.style.height|default:200}px;"
	>{$element.value}</textarea>
{/block}


<script type="text/javascript">
	{block name=script}	{** don't append to this block, because the default block auto-instantiates a validator, and HTMLareas cannot validated in any way **}
		var SUNEDITOR_{$element.id} = SUNEDITOR.create((document.getElementById('{$element.id}')),{
			"mode": "inline",
			"resizingBar": true,
			"showPathLabel": true,
			"tabDisable": true,
			"width": "{$element.style.width|default:500}px",
			"height": "{$element.style.height|default:200}px",
			"font": [
				"Arial",
				"Tahoma",
				"Courier New,Courier",
			],
			"fontSize": [ 8, 10, 12, 14, 16, 18, 24, 36 ],
			"formats": [ "p", "h1", "h2", "h3" ],
			"colorList": [
				[
                    '#ff0000', '#ff5e00', '#ffe400', '#abf200', '#00d8ff', '#0055ff', '#6600ff', '#ff00dd', '#000000',
                    '#ffd8d8', '#fae0d4', '#faf4c0', '#e4f7ba', '#d4f4fa', '#d9e5ff', '#e8d9ff', '#ffd9fa', '#f1f1f1',
                    '#ffa7a7', '#ffc19e', '#faed7d', '#cef279', '#b2ebf4', '#b2ccff', '#d1b2ff', '#ffb2f5', '#bdbdbd',
                    '#f15f5f', '#f29661', '#e5d85c', '#bce55c', '#5cd1e5', '#6699ff', '#a366ff', '#f261df', '#8c8c8c',
                    '#980000', '#993800', '#998a00', '#6b9900', '#008299', '#003399', '#3d0099', '#990085', '#353535',
                    '#670000', '#662500', '#665c00', '#476600', '#005766', '#002266', '#290066', '#660058', '#222222'
				]
			],

			"imageFileInput": false, "imageRotation": false,
			"videoResizing": false, "videoHeightShow": false, "videoFileInput": false, "videoUrlInput": false, "videoRatioShow": false,
			"audioUrlInput": false,

			"linkProtocol": "",
			"buttonList": [[
				"bold",
				"underline",
				"italic",
				"strike",
				"subscript",
				"superscript",
				"fontColor",
				"hiliteColor",
				"removeFormat",
				"outdent",
				"indent",
				"align",
				"horizontalRule",
				"list",
				"lineHeight",
				"table",
				"link",
				"image",
				"fullScreen",
				"codeView",

				"font",
				"fontSize",
				"formatBlock",
			]],
		});

		SUNEDITOR_{$element.id}.onChange = function (contents, core) {
			SUNEDITOR_{$element.id}.save();
		}
	{/block}
</script>
