");
window.frames["iframe_show323"].document.write(decodeHtml($("textarea#stepcodeTextarea323").val()));
window.frames["iframe_show323"].document.close();
$(window.frames["iframe_show323"]).load(function(){
$("#iframe_show323").height($("#iframe_show323").contents().find("body").height()+showittryitheight);
});
$("#iframe_show323").height($("#iframe_show323").contents().find("body").height()+showittryitheight);
setTimeout(function(){
},500);
});
<h1>标题1</h1>
<h2>标题2</h2>
<h3>标题3</h3>
<h4>标题4</h4>
<h5>标题5</h5>
<h1>标题1</h1>
<h2>标题2</h2>
<h3>标题3</h3>
<h4>标题4</h4>
<h5>标题5</h5>
");
window.frames["iframe323"].document.write(decodeHtml(code323));
window.frames["iframe323"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe323"]).load(function(){
$("#iframe323").height($("#iframe323").contents().find("body").height()+showittryitheight);
});
$("#iframe323").height($("#iframe323").contents().find("body").height()+showittryitheight);
alreadyWriteCode323 = code323;
$("#rendering323").hide();
$("#rendered323").show();
}
var tRereshRetry2DemoPanel323 = setInterval(rereshRetry2DemoPanel323,1000);
var binded323 = false;
$("textarea#stepcodeTextarea323").keyup(function(){
if(!binded323){
$(window).bind('beforeunload',function(){
binded323 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code323 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code323!=newCode){
// window.frames["iframe323"].document.write("
");
// window.frames["iframe323"].document.write(decodeHtml($("textarea#stepcodeTextarea323").val()));
// window.frames["iframe323"].document.close();
// $(window.frames["iframe323"]).load(function(){
// $("#iframe323").height($("#iframe323").contents().find("body").height()+showittryitheight);
// });
// code323 = newCode;
// }
});
$(".tryButton323").click(function(){
$("#tryDiv323").show();
$("#stepcodeTextarea323").focus();
$("#stepcodeTextarea323").height(200);
$("#iframe323").height(0);
window.frames["iframe323"].document.write("
");
window.frames["iframe323"].document.write(decodeHtml($("textarea#stepcodeTextarea323").val()));
window.frames["iframe323"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe323"]).load(function(){
$("#iframe323").height($("#iframe323").contents().find("body").height()+showittryitheight);
});
$("#iframe323").height($("#iframe323").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor323.focus();
editor323.setSize(null, "250");
$("#rendering323").hide();
$("#rendered323").hide();
});
var mixedMode = {
name: "htmlmixed",
scriptTypes: [{matches: /\/x-handlebars-template|\/x-mustache/i,
mode: null},
{matches: /(text|application)\/(x-)?vb(a|script)/i,
mode: "vbscript"}]
};
var editor323 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea323"), {
lineNumbers: true,
styleActiveLine: true,
matchBrackets: true,
mode:"text/html",
theme:"eclipse",
selectionPointer: true,
lineWrapping: true,
extraKeys: {
"Alt-/": "autocomplete",
"Ctrl-F": "findPersistent",
"F8": function(cm) {
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
},
"Esc": function(cm) {
if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
}
}
});
editor323.on("change",function(doc){
if(!binded323){
$(window).bind('beforeunload',function(){
binded323 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code323 = newCode;
$("textarea#stepcodeTextarea323").val(newCode);
if(alreadyWriteCode323!=code323){
lastModifedTime323 = new Date().getTime();
$("#rendering323").show();
$("#rendered323").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor323 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor323.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv323").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|