• Hi,
    I’m using “TinyMCE Advanced” 4.1.7 with WordPress 4.1
    “TinyMCE advanced” is a great plugin (I have been using it for a long time) but I recently found a problem when switching between visual mode and text mode.

    Here is an example of the problem.

    In text mode I insert the following code:
    <p>Click the button to display the time.</p>
    <button onclick=”getElementById(‘demo’).innerHTML=Date()”>What is the time?</button>
    <p id=”demo”></p>

    In the preview of the modifications the button works fine.

    Then I switch to visual mode, the button doesn’t work anymore.

    Then I switch back to text mode and found that the original code has been truncated as shown below :
    Click the button to display the time.
    <button>What is the time?</button>

    The only way I found to solve the problem is :
    1- edit the page in visual mode
    2- switch in text mode and insert the right code
    <button onclick=”getElementById(‘demo’).innerHTML=Date()”>What is the time?</button>
    <p id=”demo”></p>
    3- publish in text mode

    Thanks for assistance

    https://wordpress.org/plugins/tinymce-advanced/

Viewing 6 replies - 1 through 6 (of 6 total)
  • I am not sure if this will help you, but it is worth a shot. When I need to do some coding (and there has always been some problems with switching between visual and text), I click on the top toolbar that says TOOLS. It drops down “Source Code”. Click on it and it brings up a small popup that has the html and I scroll around to where I need the code placed. Close/ok, it is done and you never get out of visual exactly. I am not sure if it will not strip your code as I have never put in that piece of code.

    Thread Starter ggldb

    (@ggldb)

    Thank you for your suggestion.
    I tried to insert my code with the button “Source Code” but the effect is the same: the code is still stripped and the button doesn’t work.

    Well, it was worth a shot. Sorry it didn’t work for you.

    Plugin Author Andrew Ozz

    (@azaozz)

    By default TinyMCE strips all onclick, onmouseover, onerror, etc. HTML attributes as they are a security concern. This has nothing to do with the TinyMCE Advanced plugin. There is a way to allow some of them, but that needs to be done from a (small) TinyMCE plugin.

    Thread Starter ggldb

    (@ggldb)

    Thank you for the explanation.
    I’ll carry on using TinyMCE Advanced.
    I’ll put my code in “text mode” just before publishing the post.

    TinyMCE strips a lot more than just that.

    It strips line breaks, even <div>%nbsp;</div> gets stripped.

    It makes the text editor in wordpress virtually useless because if you ever switch to the visual editor it will distort your code.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Visual mode – Text mode’ is closed to new replies.