@@ -9,9 +9,9 @@ function initPage() {
99 menu . append ( createSideBarMenuItem ( key , config [ key ] , containExamples ) ) ;
1010 }
1111 initSelect ( ) ;
12- dragCode ( ) ;
1312 initEditor ( ) ;
1413 screenResize ( ) ;
14+ dragCode ( ) ;
1515}
1616
1717function screenResize ( ) {
@@ -32,7 +32,8 @@ function screenResize() {
3232 myWidth = document . documentElement . clientWidth ;
3333 myHeight = document . documentElement . clientHeight ;
3434 }
35- }
35+ mapHeight ( ) ;
36+ } ;
3637}
3738//初始化编辑器
3839function initCodeEditor ( ) {
@@ -45,6 +46,7 @@ function initCodeEditor() {
4546 }
4647 aceEditor . setValue ( $ ( '#editor' ) . val ( ) ) ;
4748 aceEditor . clearSelection ( ) ;
49+ aceEditor . moveCursorTo ( 0 , 0 ) ;
4850}
4951
5052//初始化编辑器以及预览内容
@@ -100,6 +102,10 @@ function loadPreview(content) {
100102 iFrame . document . open ( ) ;
101103 iFrame . document . write ( content ) ;
102104 iFrame . document . close ( ) ;
105+ iFrame . onload = function ( ) {
106+ mapHeight ( ) ;
107+ } ;
108+
103109}
104110
105111/**设置显示源码的拖拽效果**/
@@ -118,7 +124,7 @@ function dragCode() {
118124 }
119125 $ ( "#codePane" ) . width ( bottomX ) ;
120126 $ ( "#editor" ) . width ( bottomX ) ;
121- $ ( ".ace_content" ) . width ( bottomX * 0.8 ) ;
127+ aceEditor . resize ( ) ;
122128 $ ( "#preview" ) . css ( { 'left:' : ( myWidth - bottomX - 202 ) + "px" } ) ;
123129 $ ( "#innerPage" ) . width ( myWidth - bottomX - 202 ) ;
124130 aceEditor . resize ( ) ;
@@ -147,3 +153,7 @@ function initSelect() {
147153 selectMenu ( id ) ;
148154}
149155
156+ function mapHeight ( ) {
157+ $ ( "#innerPage" ) . contents ( ) . find ( "body" ) . height ( $ ( "#innerPage" ) . height ( ) ) ;
158+ }
159+
0 commit comments