@@ -10344,8 +10344,8 @@ module.exports = function processSection(markdown, o) {
10344
10344
if ( o . isEditable ( _markdown , o . originalMarkdown ) ) {
10345
10345
var formHtml = o . buildSectionForm ( uniqueId , _markdown ) ;
10346
10346
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 ) ;
10349
10349
// plan for swappable editors; will need to specify both constructor and onEditorSubmit
10350
10350
function onEdit ( ) {
10351
10351
var editor ;
@@ -10355,42 +10355,45 @@ module.exports = function processSection(markdown, o) {
10355
10355
textarea : $ ( '#' + uniqueId + ' textarea' ) [ 0 ]
10356
10356
} ) ;
10357
10357
}
10358
- form . find ( '.cancel' ) . click ( function inlineEditCancelClick ( e ) {
10358
+ _form . find ( '.cancel' ) . click ( function inlineEditCancelClick ( e ) {
10359
10359
e . preventDefault ( ) ;
10360
- form . hide ( ) ;
10360
+ _form . hide ( ) ;
10361
10361
} ) ;
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 ) ;
10364
10364
} ) ;
10365
10365
}
10366
10366
}
10367
10367
10368
- function prepareAndSendSectionForm ( e , form , _editor , _markdown ) {
10368
+ function prepareAndSendSectionForm ( e , __form , _editor , _markdown ) {
10369
10369
message . html ( '<i class="fa fa-spinner fa-spin" style="color:#ccc;"></i>' ) ;
10370
10370
if ( _editor ) {
10371
10371
changes = _editor . richTextModule . value ( ) ; // rich editor
10372
10372
} else {
10373
- changes = form . find ( 'textarea' ) . val ( ) ;
10373
+ changes = __form . find ( 'textarea' ) . val ( ) ;
10374
10374
}
10375
- o . submitSectionForm ( e , _markdown , changes , o ) ;
10375
+ o . submitSectionForm ( e , _markdown , changes , o , el , __form ) ;
10376
10376
}
10377
10377
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 ) {
10380
10381
e . preventDefault ( ) ;
10381
10382
$ . post ( o . replaceUrl , {
10382
10383
before : before , // encodeURI(before)
10383
10384
after : after // encodeURI(after)
10384
10385
} )
10385
10386
. done ( function onComplete ( response ) {
10386
10387
// 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 ) ;
10388
10389
} ) . error ( function onFail ( response ) {
10389
10390
o . onFail ( response , uniqueId ) ;
10390
10391
} ) . fail ( function onFail ( response ) {
10391
10392
o . onFail ( response , uniqueId ) ;
10392
10393
} ) ; // these don't work?
10393
10394
}
10395
+
10396
+ return _form ;
10394
10397
}
10395
10398
}
10396
10399
0 commit comments