Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Allan49 35 posts 55 karma points
    Nov 01, 2011 @ 17:40
    Allan49
    0

    TinyMCE manipulates my html tags

    Hi,

    TinyMCE keeps erasing the IFRAME tags that I need to have in my rich text. This is a legitimate content scenario and security is not a concern.

    In Joomla, there is a way to disable the tag manipulation feature in TintMCE.

    How do I do that in Umbraco?

    Thank you,

  • Mr A 216 posts 278 karma points
    Nov 01, 2011 @ 17:47
    Mr A
    0

    If you add iframe and the attributes of iframe under the tinymcesettings.config , the iframe tags will work , i havent tested yet , but i did something like this before which worked.

    cheers

  • Mike Chambers 636 posts 1253 karma points c-trib
    Nov 01, 2011 @ 18:33
    Mike Chambers
    1

    config/tinymceconfig.config is the file you are looking for...

    maybe the easiest approach is to add

    <config key="extended_valid_elements">iframe[src|width|height|name|align]</config>

    in the   customConfig section. (rather than adding into the validElements tag, also means that updating umbraco to a new version, should be easier to spot your modifications)

  • Allan49 35 posts 55 karma points
    Nov 01, 2011 @ 18:35
    Allan49
    0

    Thank you Mike and Mr. A for help.

     

  • Muhammad Humayun 49 posts 79 karma points
    Mar 12, 2012 @ 18:49
    Muhammad Humayun
    0

    Hi Mike

    Its still not working if i have added that config in customConfig

  • Mike Chambers 636 posts 1253 karma points c-trib
    Mar 12, 2012 @ 18:50
    Mike Chambers
    0

    You will also need to set tidy to false in the UmbracoSettings.config file

  • Muhammad Humayun 49 posts 79 karma points
    Mar 12, 2012 @ 23:03
    Muhammad Humayun
    0

    Cool, Thanks mate

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 12, 2012 @ 23:27
    Jan Skovgaard
    0

    Hi Muhammad

    What kind of HTML are you trying to use in the rich text editor? By disabling tidy you can end up with invalid code and if people copy/paste text from websites, word etc. all that unwanted formatting won't get stripped for sure.

    Are you sure what you're trying to achieve can't be done by using a macro that can be inserted into the rich text editor? If it's a specific element you need to insert you could perhaps add it to the "styles" dropdown by adding the element in a rte stylesheet in the "settings" section.

    I'm not saying you should not disable tidy, i'm just saying it's not neccesarily the best option :)

    /Jan

  • Mike Chambers 636 posts 1253 karma points c-trib
    Mar 13, 2012 @ 10:48
    Mike Chambers
    1

    Jan... my unserstanding is that tinymce will produce valid xhtml with the default umbraco settings... and tidy is just a catch all and actually in some instances we found that valid xhtml from tinymce is then being made invalid by tidy. (if memory serves was to do with numerics (eg set tinymce to export numerics, tidy then converts back to entities) ie without an entity declaration &nbsp; and other html entities are invalid xml, where as #160; is fine) Now I know this is dealt with in umbraco by forcing the tinymce content into a cdata section in the in-memory xml... but if tinymce is giving valid xhtml anyway and you want to navigate the richtext content via the xml dom as mentioned before, tidy's manipulation can cause contents of the cdata element to then not be valid xhtml.

    There is also the paste from word option that should deal with well... pasting from word.

    Macros in the content also throw up another issues... the "Aw Snap" when using any version of chrome, depending on if you add it to the end of a paragraph the rendermacro function has issues with adding extra paragrpah tags before/after or both when it comes to the front end view...  and I've never been able to get the render macro in the content editor to work :-(

    Maybe I've got the wrong end of the stick, but the above comes from my humble experience

    PS another option

    If you are wanting to paste html snippets that don't need umbraco elements (eg a content pickers etc) you could add in the tinymce support for templates...

     

  • Muhammad Humayun 49 posts 79 karma points
    Mar 13, 2012 @ 23:07
    Muhammad Humayun
    0

    Hi Jan

    Thanks for explaining that bit.

    Actually I'm focussed on the requirement of having an option for the editors to add as many as videos (iframe tags or others, generated by youtube/vimeo etc) in one variable (BodyText). I know i can have an extra document type with video as variable and then can have it as child nodes and then render them through xslt but it is actually not required by the customer as they want to have something like wordpress , i.e wordpress users just add http://youtube.com/v/videoid and it automatically renders the video on the front end.

    I have met the requirement by adding a plugin to the tinymce3 which can now be used to embed html in RTE so somehow it has solved the issue by following the solution given above and having embed html plugin together. But i'm still curious to know a better solution for this.

    I thank you guys for explaining things in detail. It is really appreciateable.

    Cheers

    Muhammad

  • Richard Barg 358 posts 532 karma points
    Mar 14, 2012 @ 19:15
    Richard Barg
    0

    re: "I have met the requirement by adding a plugin to the tinymce3 which can now be used to embed html in RTE "

    Muhammad,

    What is the name of the plug-in and can you provide a link to it.

     

    Thanks,

    Richard

     

     

     

  • Muhammad Humayun 49 posts 79 karma points
    Mar 14, 2012 @ 22:56
    Muhammad Humayun
    0

    That plugin's link is: http://our.umbraco.org/projects/wvd-media-tinymce-insert-embed-code

    You also need to do 2 things to let tinymce accept iframes followed by re-saving the web.config with just space in it.

    1.

    config/tinymceconfig.config
    add the following
    in the   customConfig section

     

    <configkey="extended_valid_elements">iframe[src|width|height|name|align]</config>

     

    2.

    config/UmbracoSettings.config

    set the following as false

        <TidyEditorContent>False</TidyEditorContent>
Please Sign in or register to post replies

Write your reply to:

Draft