");
window.frames["iframe_show322"].document.write(decodeHtml($("textarea#stepcodeTextarea322").val()));
window.frames["iframe_show322"].document.close();
$(window.frames["iframe_show322"]).load(function(){
$("#iframe_show322").height($("#iframe_show322").contents().find("body").height()+showittryitheight);
});
$("#iframe_show322").height($("#iframe_show322").contents().find("body").height()+showittryitheight);
setTimeout(function(){
},500);
});
<p>这里是没有用预格式的情况:</p>
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World");
}
}
<br/>
<br/>
<p>使用预格式的情况:</p>
<pre>
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World");
}
}
</pre>
<p>这里是没有用预格式的情况:</p>
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World");
}
}
<br/>
<br/>
<p>使用预格式的情况:</p>
<pre>
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World");
}
}
</pre>
");
window.frames["iframe322"].document.write(decodeHtml(code322));
window.frames["iframe322"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe322"]).load(function(){
$("#iframe322").height($("#iframe322").contents().find("body").height()+showittryitheight);
});
$("#iframe322").height($("#iframe322").contents().find("body").height()+showittryitheight);
alreadyWriteCode322 = code322;
$("#rendering322").hide();
$("#rendered322").show();
}
var tRereshRetry2DemoPanel322 = setInterval(rereshRetry2DemoPanel322,1000);
var binded322 = false;
$("textarea#stepcodeTextarea322").keyup(function(){
if(!binded322){
$(window).bind('beforeunload',function(){
binded322 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code322 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code322!=newCode){
// window.frames["iframe322"].document.write("
");
// window.frames["iframe322"].document.write(decodeHtml($("textarea#stepcodeTextarea322").val()));
// window.frames["iframe322"].document.close();
// $(window.frames["iframe322"]).load(function(){
// $("#iframe322").height($("#iframe322").contents().find("body").height()+showittryitheight);
// });
// code322 = newCode;
// }
});
$(".tryButton322").click(function(){
$("#tryDiv322").show();
$("#stepcodeTextarea322").focus();
$("#stepcodeTextarea322").height(200);
$("#iframe322").height(0);
window.frames["iframe322"].document.write("
");
window.frames["iframe322"].document.write(decodeHtml($("textarea#stepcodeTextarea322").val()));
window.frames["iframe322"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe322"]).load(function(){
$("#iframe322").height($("#iframe322").contents().find("body").height()+showittryitheight);
});
$("#iframe322").height($("#iframe322").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor322.focus();
editor322.setSize(null, "250");
$("#rendering322").hide();
$("#rendered322").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 editor322 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea322"), {
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);
}
}
});
editor322.on("change",function(doc){
if(!binded322){
$(window).bind('beforeunload',function(){
binded322 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code322 = newCode;
$("textarea#stepcodeTextarea322").val(newCode);
if(alreadyWriteCode322!=code322){
lastModifedTime322 = new Date().getTime();
$("#rendering322").show();
$("#rendered322").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor322 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor322.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv322").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|