General developer forum

Moodle 3.5+ text editor removes embeded code and html attributes

 
Picture of Suraj Kumar
Moodle 3.5+ text editor removes embeded code and html attributes
 

I have not changed any default Moodle related settings regarding embed code, multimedia filter. Thus, the settings are default. 

What I see, Even if the description of course category in the database field is -

<---------content start---------/>

<h3 style="margin-top:0px;margin-bottom:15px;">Welcome</h3>

<iframe width="560" height="315" src="https://www.youtube.com/embed/wHw3ZLcnjuI" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

<div  id="prg-mmmba-vTranscript" >

<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean gravida, tortor in blandit imperdiet, erat libero aliquet ipsum, ut ultrices augue erat a nunc.</p>

</div>

<---------content end---------/>

But, when it is shown in editor on edit of category, iframe content & the id attribute of div tag is discarded in the editor and the description content is shown like this -

<---------content start---------/>

<h3 style="margin-top:0px;margin-bottom:15px;">Welcome</h3>

<div>

<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean gravida, tortor in blandit imperdiet, erat libero aliquet ipsum, ut ultrices augue erat a nunc.</p>

</div>

<---------content end---------/>

Has anyone faced this issue or any suggested solution?

 
Average of ratings: -
Picture of Suraj Kumar
Re: Moodle 3.5+ text editor removes embeded code and html attributes
 

Yeah, I noticed that the editor options for editor on - Course Category edit page & other pages are different.

On other pages, editor options have generally included these two options besides others required options  -

'trusttext' => false,

'noclean'   => true,


But, for Course Category edit page editor has options on 

page - /course/classes/editcategory_form.php

/* some options have been removed from array intensionally*/

array(

            'trusttext' => true,

        );


So, trusttext => true & noclean is not set here. 


On setting, trusttext => false & noclean=>true, works well for edit category page.


I am not sure if this is the only option.



 
Average of ratings: Useful (1)