@@ -10344,8 +10344,8 @@ module.exports = function processSection(markdown, o) {
1034410344 if ( o . isEditable ( _markdown , o . originalMarkdown ) ) {
1034510345 var formHtml = o . buildSectionForm ( uniqueId , _markdown ) ;
1034610346 el . after ( formHtml ) ;
10347- var form = $ ( '#' + uniqueId ) ;
10348- o . insertEditLink ( uniqueId , el , form , onEdit , false , o ) ;
10347+ var _form = $ ( '#' + uniqueId ) ;
10348+ o . insertEditLink ( uniqueId , el , _form , onEdit , false , o ) ;
1034910349 // plan for swappable editors; will need to specify both constructor and onEditorSubmit
1035010350 function onEdit ( ) {
1035110351 var editor ;
@@ -10355,42 +10355,45 @@ module.exports = function processSection(markdown, o) {
1035510355 textarea : $ ( '#' + uniqueId + ' textarea' ) [ 0 ]
1035610356 } ) ;
1035710357 }
10358- form . find ( '.cancel' ) . click ( function inlineEditCancelClick ( e ) {
10358+ _form . find ( '.cancel' ) . click ( function inlineEditCancelClick ( e ) {
1035910359 e . preventDefault ( ) ;
10360- form . hide ( ) ;
10360+ _form . hide ( ) ;
1036110361 } ) ;
10362- form . find ( 'button.submit' ) . click ( function ( e ) {
10363- prepareAndSendSectionForm ( e , form , editor , _markdown ) ;
10362+ _form . find ( 'button.submit' ) . click ( function ( e ) {
10363+ prepareAndSendSectionForm ( e , _form , editor , _markdown ) ;
1036410364 } ) ;
1036510365 }
1036610366 }
1036710367
10368- function prepareAndSendSectionForm ( e , form , _editor , _markdown ) {
10368+ function prepareAndSendSectionForm ( e , __form , _editor , _markdown ) {
1036910369 message . html ( '<i class="fa fa-spinner fa-spin" style="color:#ccc;"></i>' ) ;
1037010370 if ( _editor ) {
1037110371 changes = _editor . richTextModule . value ( ) ; // rich editor
1037210372 } else {
10373- changes = form . find ( 'textarea' ) . val ( ) ;
10373+ changes = __form . find ( 'textarea' ) . val ( ) ;
1037410374 }
10375- o . submitSectionForm ( e , _markdown , changes , o ) ;
10375+ o . submitSectionForm ( e , _markdown , changes , o , el , __form ) ;
1037610376 }
1037710377
10378- // provide overridable default
10379- o . submitSectionForm = o . submitSectionForm || function submitSectionForm ( e , before , after , o ) {
10378+ // provide overridable default; though we have to explicitly pass in
10379+ // all this stuff so the section forms don't get crossed
10380+ o . submitSectionForm = o . submitSectionForm || function submitSectionForm ( e , before , after , o , _el , __form ) {
1038010381 e . preventDefault ( ) ;
1038110382 $ . post ( o . replaceUrl , {
1038210383 before : before , // encodeURI(before)
1038310384 after : after // encodeURI(after)
1038410385 } )
1038510386 . done ( function onComplete ( response ) {
1038610387 // we should need fewer things here:
10387- o . onComplete ( response , markdown , html , el , uniqueId , form , o ) ;
10388+ o . onComplete ( response , after , html , _el , uniqueId , __form , o ) ;
1038810389 } ) . error ( function onFail ( response ) {
1038910390 o . onFail ( response , uniqueId ) ;
1039010391 } ) . fail ( function onFail ( response ) {
1039110392 o . onFail ( response , uniqueId ) ;
1039210393 } ) ; // these don't work?
1039310394 }
10395+
10396+ return _form ;
1039410397 }
1039510398}
1039610399
0 commit comments