@@ -473,7 +473,7 @@ var $exeDevice = {
473
473
// Get a JSON object and create a form
474
474
jsonToForm : function ( blocks ) {
475
475
for ( var i = 0 ; i < blocks . length ; i ++ ) {
476
- this . createBlockForm ( blocks [ i ] ) ;
476
+ this . createBlockForm ( blocks [ i ] , i ) ;
477
477
}
478
478
// Renew all the IDs
479
479
this . addBlockFormIds ( ) ;
@@ -519,7 +519,7 @@ var $exeDevice = {
519
519
} ,
520
520
521
521
// See jsonToForm. This adds a form block (at the end of the form)
522
- createBlockForm : function ( block ) {
522
+ createBlockForm : function ( block , instance ) {
523
523
524
524
$ ( ".udlContentFormBlockContent" ) . hide ( ) ;
525
525
var btnTxt = block . btnTxt ;
@@ -558,7 +558,7 @@ var $exeDevice = {
558
558
var contAlt2 = block . contAlt2 ;
559
559
var contAlt3 = block . contAlt3 ;
560
560
var html = '\
561
- <article class="udlContentFormBlock">\
561
+ <article class="udlContentFormBlock" id="udlContentTmpFormBlock' + instance + '" >\
562
562
<header class="udlContentFormBlockHeader">\
563
563
<h2><strong>' + _ ( "Block" ) + '</strong> <span class="udlContentFormBlockCounter"></span> <span class="udlContentFormBlockButtonTxtViewer">' + btnTxt + '</span></h2> \
564
564
<span class="udlContentFormBlockHeaderLinks">\
@@ -596,17 +596,24 @@ var $exeDevice = {
596
596
<li><a href="#" title="' + _ ( "Alternative content" ) + '" class="udl-a-3">' + _ ( "Visual aid" ) + '</a></li>\
597
597
</ul>\
598
598
</div>\
599
- <textarea cols="30" rows="10" class="udlContentEditor">' + contMain + ' </textarea>\
600
- <textarea cols="30" rows="1" class="udlContentEditorContent">' + contMain + ' </textarea>\
601
- <textarea cols="30" rows="1" class="udlContentEditorContent">' + contAlt1 + ' </textarea>\
602
- <textarea cols="30" rows="1" class="udlContentEditorContent">' + contAlt2 + ' </textarea>\
603
- <textarea cols="30" rows="1" class="udlContentEditorContent">' + contAlt3 + ' </textarea>\
599
+ <textarea cols="30" rows="10" class="udlContentEditor"></textarea>\
600
+ <textarea cols="30" rows="1" class="udlContentEditorContent"></textarea>\
601
+ <textarea cols="30" rows="1" class="udlContentEditorContent"></textarea>\
602
+ <textarea cols="30" rows="1" class="udlContentEditorContent"></textarea>\
603
+ <textarea cols="30" rows="1" class="udlContentEditorContent"></textarea>\
604
604
</div>\
605
605
</div>\
606
606
</article>\
607
607
' ;
608
608
$ ( "#udlContentFormBlocks" ) . append ( html ) ;
609
-
609
+ // Set the content of the textareas (#747)
610
+ var inst = $ ( "#udlContentTmpFormBlock" + instance ) ;
611
+ $ ( "textarea.udlContentEditor" , inst ) . val ( contMain ) ;
612
+ var eds = $ ( "textarea.udlContentEditorContent" , inst ) ;
613
+ eds . eq ( 0 ) . val ( contMain ) ;
614
+ eds . eq ( 1 ) . val ( contAlt1 ) ;
615
+ eds . eq ( 2 ) . val ( contAlt2 ) ;
616
+ eds . eq ( 3 ) . val ( contAlt3 ) ;
610
617
} ,
611
618
612
619
// After creating a form, add IDs to the elements so you can get the data and have no accessibility problems
0 commit comments