@@ -676,34 +676,34 @@ var page_options = {
676
676
var tab_title = part_title . toLowerCase ( ) . replace ( " " , "_" ) ;
677
677
678
678
if ( $ ( '#part_' + tab_title ) . size ( ) === 0 ) {
679
- $ . get ( page_options . new_part_url ,
680
- {
679
+ $ . get ( page_options . new_part_url , {
681
680
title : part_title
682
681
, part_index : $ ( '#new_page_part_index' ) . val ( )
683
682
, body : ''
684
- }
685
- , function ( data , status ) {
683
+ } , function ( data , status ) {
686
684
$ ( '#submit_continue_button' ) . remove ( ) ;
687
685
// Add a new tab for the new content section.
688
686
$ ( data ) . appendTo ( '#page_part_editors' ) ;
689
687
page_options . tabs . tabs ( 'add' , '#page_part_new_' + $ ( '#new_page_part_index' ) . val ( ) , part_title ) ;
690
688
page_options . tabs . tabs ( 'select' , $ ( '#new_page_part_index' ) . val ( ) ) ;
691
689
692
- // turn the new textarea into a wymeditor.
693
- $ ( '#page_parts_attributes_' + $ ( '#new_page_part_index' ) . val ( ) + "_body" ) . wymeditor ( wymeditor_boot_options ) ;
694
-
695
690
// hook into wymedtior to instruct it to select this new tab again once it has loaded.
696
691
WYMeditor . onload_functions . push ( function ( ) {
692
+ $ ( '#page_part_new_' + $ ( '#new_page_part_index' ) . val ( ) ) . appendTo ( '#page_part_editors' ) ;
697
693
page_options . tabs . tabs ( 'select' , $ ( '#new_page_part_index' ) . val ( ) ) ;
698
694
} ) ;
699
695
696
+ // turn the new textarea into a wymeditor.
697
+ WYMeditor . init ( ) ;
698
+
700
699
// Wipe the title and increment the index counter by one.
701
700
$ ( '#new_page_part_index' ) . val ( parseInt ( $ ( '#new_page_part_index' ) . val ( ) , 10 ) + 1 ) ;
702
701
$ ( '#new_page_part_title' ) . val ( '' ) ;
703
702
704
703
page_options . tabs . find ( '> ul li a' ) . corner ( 'top 5px' ) ;
705
704
706
705
$ ( '#new_page_part_dialog' ) . dialog ( 'close' ) ;
706
+ $ ( '#new_page_part_dialog' ) . remove ( ) ;
707
707
}
708
708
) ;
709
709
} else {
0 commit comments