JSFiddle - React, Tailwind, and code Playground
by a1click
HTML
<textarea name="textbox" id="textbox"></textarea>
CSS
body {
font-family: Arial, Verdana, Georgia;
font-size: 14px;
text-align: left;
margin: 0 0;
}
textarea {
position:absolute;
top:20px;
left:0px;
float:left;
width:100%;
height:100%;
background-color:#231d1c;
outline:none;
color:#bbb1b1;
padding-top: 10px;
padding-left: 10px;
padding-bottom: 10px;
}
JavaScript
jQuery(document).ready(function(){
jQuery('#textbox').keyup(function() {
replaceText("#textbox");
});
function replaceText(field) {
jQuery(field).val(jQuery(field).val().replace('@html','<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">\n<head>\n<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />\n<title>novo documento</title>\n\n</head>\n<body>\n\n</body>\n</html>')); // HTML
jQuery(field).val(jQuery(field).val().replace('@php_codigo','</?php\n\n?>')); // PHP
jQuery(field).val(jQuery(field).val().replace('@js','<script type="text/javascript">\n\n< /script>')); // JS
jQuery(field).val(jQuery(field).val().replace('@css','<style type"text/css">\n\n< /style>')); // CSS
jQuery(field).val(jQuery(field).val().replace('@Itext','<input type="text" name="" id="" val=""/>')); // INPUT ( text )
jQuery(field).val(jQuery(field).val().replace('@Ipass','<input type="password" name="" id="" val=""/>')); // INPUT ( password )
jQuery(field).val(jQuery(field).val().replace('@form','<form method="" id="" action="" name="">\n\n</form>')); // INPUT ( password )
jQuery(field).val(jQuery(field).val().replace('@php_select_while','$sql = mysql_query("SELECT * FROM tabela");\nwhile ( $dados = mysql_fetc_assoc ( $sql ) ){\n\n}')); // INPUT ( password )
jQuery(field).val(jQuery(field).val().replace('@php_select_simples','$sql = mysql_query("SELECT * FROM tabela");\n$dados = mysql_fetc_assoc ( $sql );')); // INPUT ( password )
}
});