WYSIWYG HTML Editor returning unexpected results

I am using the tinymice WYSIWYG HTML Editor.

It seems to work fine on most things but is returning funky html when there are conditional statements in the html code

This is what is being loaded so as to use the HTML Editor...

It seems that The bad results are consistent with the editor stripping out the conditional comments that are used to handle the formatting in Outlook

            <%--WYSIWYG Editor Code--%>
    <script src="assets/js/jquery.min.js"></script>
    <script src="plugins/tinymce/tinymce.min.js"></script>
    <script>
        $(document).ready(function () {
            if ($("#ctl00_ContentPlaceHolder1_elm1").length > 0) {
                tinymce.init({
                    selector: "textarea#ctl00_ContentPlaceHolder1_elm1",
                    theme: "modern",
                    height: 300,
                    plugins: [
                        "advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker",
                        "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking",
                        "save table contextmenu directionality emoticons template paste textcolor",
                        "fullpage"
                    ],
                    toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | l      ink image | print preview media fullpage | forecolor backcolor emoticons",
                    style_formats: [
                        { title: 'Bold text', inline: 'b' },
                        { title: 'Red text', inline: 'span', styles: { color: '#ff0000' } },
                        { title: 'Red header', block: 'h1', styles: { color: '#ff0000' } },
                        { title: 'Example 1', inline: 'span', classes: 'example1' },
                        { title: 'Example 2', inline: 'span', classes: 'example2' },
                        { title: 'Table styles' },
                        { title: 'Table row 1', selector: 'tr', classes: 'tablerow1' }
                    ]
                });
            }
        });
    </script>

Open in new window

Larry Bristersr. DeveloperAsked:
Who is Participating?
 
lenamtlConnect With a Mentor Commented:
When you having an error this will break the code of other Javascript.

So you have to fix these errors.

First message is related to a value that cannot be NULL...

Second message a file or a page is not found, chance are good that both error are related as your code having a page request....
0
 
lenamtlConnect With a Mentor Commented:
Hi,

This seems related to your previous question.
My answer will be the same...
https://www.experts-exchange.com/questions/29084036/WYSIWYG-HTML-Editor.html#a42471636
Just add
entity_encoding : "raw",

Open in new window



 $(document).ready(function () {
            if ($("#ctl00_ContentPlaceHolder1_elm1").length > 0) {
                tinymce.init({
                    selector: "textarea#ctl00_ContentPlaceHolder1_elm1",
                    theme: "modern",
                    height: 300,
                   entity_encoding : "raw",
                    plugins: [
                        "advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker",
                        "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking",
                        "save table contextmenu directionality emoticons template paste textcolor",
                        "fullpage"
                    ],
                    toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | l      ink image | print preview media fullpage | forecolor backcolor emoticons",
                    style_formats: [
                        { title: 'Bold text', inline: 'b' },
                        { title: 'Red text', inline: 'span', styles: { color: '#ff0000' } },
                        { title: 'Red header', block: 'h1', styles: { color: '#ff0000' } },
                        { title: 'Example 1', inline: 'span', classes: 'example1' },
                        { title: 'Example 2', inline: 'span', classes: 'example2' },
                        { title: 'Table styles' },
                        { title: 'Table row 1', selector: 'tr', classes: 'tablerow1' }
                    ]
                });
            }
        });

Open in new window



You can for my codepen with your code
https://codepen.io/lenamtl/pen/BYwgez
0
 
Larry Bristersr. DeveloperAuthor Commented:
Hey lenmatyl
 That did not make any difference.
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
lenamtlCommented:
Do you have any error in Chrome console right click inspect?
0
 
Larry Bristersr. DeveloperAuthor Commented:
Hey lemantl
  When I run the page and it just loads there are some console errors that are unrelated... (SP1) below

However... when I activate the element on an ajax postback I see a 404 error but not sure how to tell if this relates? (SP2)

SP1
SP2
0
 
Larry Bristersr. DeveloperAuthor Commented:
Fixing the errors helped ALMOST everything

New question posted
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.