how to prevent tinymce from stripping the 'style' attribute from input element?

前端 未结 4 1242
陌清茗
陌清茗 2020-12-18 04:25

I have been reading the official docs and blog posts and SO for hours, certain somewhere the answer would be posted already.. but no luck.

It seems that no amount

4条回答
  •  萌比男神i
    2020-12-18 05:21

    I am also using CodeIgniter and while I did set $config['global_xss_filtering'] = false; I still had the issue with the style attribute. So if none of the solutions worked for you, you can try encoding the tinyMCE data in base64 on submit and place it in a hidden field using Javascript:

    $('#hiddenField').val(window.btoa(tinyMCE.get('tinyMCEtextareaID').getContent()));
    

    This way you retain the original string and it can be easily decoded in PHP using:

    $htmlstring = base64_decode($_POST['hiddenField']);
    

提交回复
热议问题