Skip to content

Commit 46df9dd

Browse files
committed
Fix #747 - Could not add escaped HTML tags.
1 parent 2028619 commit 46df9dd

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

exe/webui/scripts/idevices/udl-content/edition/udl-content.js

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ var $exeDevice = {
473473
// Get a JSON object and create a form
474474
jsonToForm : function(blocks){
475475
for (var i=0;i<blocks.length;i++) {
476-
this.createBlockForm(blocks[i]);
476+
this.createBlockForm(blocks[i],i);
477477
}
478478
// Renew all the IDs
479479
this.addBlockFormIds();
@@ -519,7 +519,7 @@ var $exeDevice = {
519519
},
520520

521521
// See jsonToForm. This adds a form block (at the end of the form)
522-
createBlockForm : function(block){
522+
createBlockForm : function(block,instance){
523523

524524
$(".udlContentFormBlockContent").hide();
525525
var btnTxt = block.btnTxt;
@@ -558,7 +558,7 @@ var $exeDevice = {
558558
var contAlt2 = block.contAlt2;
559559
var contAlt3 = block.contAlt3;
560560
var html = '\
561-
<article class="udlContentFormBlock">\
561+
<article class="udlContentFormBlock" id="udlContentTmpFormBlock'+instance+'">\
562562
<header class="udlContentFormBlockHeader">\
563563
<h2><strong>'+_("Block")+'</strong> <span class="udlContentFormBlockCounter"></span> <span class="udlContentFormBlockButtonTxtViewer">'+btnTxt+'</span></h2> \
564564
<span class="udlContentFormBlockHeaderLinks">\
@@ -596,17 +596,24 @@ var $exeDevice = {
596596
<li><a href="#" title="'+_("Alternative content")+'" class="udl-a-3">'+_("Visual aid")+'</a></li>\
597597
</ul>\
598598
</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>\
604604
</div>\
605605
</div>\
606606
</article>\
607607
';
608608
$("#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);
610617
},
611618

612619
// After creating a form, add IDs to the elements so you can get the data and have no accessibility problems

0 commit comments

Comments
 (0)