KezdőlapWebEszközök ›HTML-szerkesztő

Kód:

Kilátás:

\n\n

Sample page

\n\n"; if( localStorage.html_editor_text!="undefined" ) s = localStorage.html_editor_text; $("#codeArea").val(s); OnDraw(); window.onkeydown = keydown; }); $(window).unload( function() { localSave(); }); function keydown(e) { if( e.keyCode==9 ) //tab { e.preventDefault(); return; //Snapshot(); s = getSelect(area); var text = $("#codeArea").val(); fillString(text, '\u0009', s.start, s.end); pos = s.start+1; setCaret(pos); } } function OnNew() { cancelSaveFile(); var s="\n\n\n \n Sample page\n \n\n

Sample page

\n\n"; $("#codeArea").val(s); $("#iview").attr("srcdoc",s); $("#codeArea").focus(); } function OnOpen() { $("#fileElem").focus(); $("#fileElem").click(); } function OnSave() { $("#getFilename").css("display","inline"); } function OnDraw() { var s=$("#codeArea").val(); $("#iview").attr("srcdoc",s); $("#codeArea").focus(); } function localSave() { localStorage.html_editor_text = $("#codeArea").val(); } function loadFile() { var fileElem = document.getElementById("fileElem").files[0]; //var name = fileElem.name; var reader = new FileReader(); reader.onloadend = function(evt) { if( evt.target.readyState==FileReader.DONE ) { //localStorage.notepad_filename = name; //document.title = 'Notepad - '+name; //area.value = evt.target.result; s = evt.target.result; OSName = GetOS(); if( OSName=="Windows" ) s = s.replace(/\r\n/g,'\n'); $("#codeArea").val(s); OnDraw(); $("#codeArea").focus(); } }; reader.readAsText(fileElem); } function cancelSaveFile() { $("#getFilename").css("display","none"); } function saveFile() { $("#getFilename").css("display","none"); var name = $("#filename").val(); if( name=='' ) name="../../../index.html"; //localStorage.svg_filename = name; //document.title = "SVG - "+name; localSave(); //var blob = new Blob([area.value], {type: "text/plain;charset=utf-8"}); var s=$("#codeArea").val(); OSName = GetOS(); if( OSName=="Windows" ) s = s.replace(/\n/g,'\r\n'); var blob = new Blob([s], {type: "text/plain;charset=utf-8"}); saveAs(blob, name); }