Copied to clipboard

Flag this post as spam?

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


  • dan 54 posts 133 karma points
    Nov 04, 2014 @ 15:45
    dan
    0

    Using Script or Link Tags In TinyMCE

    Hi All

    I'm trying to use a script and link tag in the TinyMCE editor for pieces in my portfolio. The issue is no matter what I do they keep getting wrapped/removed.

     

    I found this link but it is for Umbraco 4 and doesnt work in version 7.1.4. Anyone have an idea how to do this?

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Nov 04, 2014 @ 16:01
    Dennis Aaen
    0

    Hi Dan,

    Here is a thread, about the same topic adding javascript in TinyMCE. http://our.umbraco.org/forum/umbraco-7/using-umbraco-7/57497-RTE-and-javascript

     

    You should be able to add links in to the TinyMCE.  If you donĀ“t have the option in the tool bar of your TinyMCE, then you need to go to the developer section (if you have access) --> data types, find the data type for the RTE, in ther you can configure what options the user should have.

    /Dennis

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Nov 04, 2014 @ 18:05
    Dennis Aaen
    0

    Hi Dan,

    Sorry I misunderstood the part of the link tag, you  mean of course a link tag to a stylesheet. If there a special reason why you need to be able to link to javascript and a stylesheet for example.

    Maybe you can use the approach where to use the textbox multiple to place the javascript or link tag in.

    The textbox multiple will not strip any of the script that you inserted into it.

    Hope this could be a solution for you.

    /Dennis

  • dan 54 posts 133 karma points
    Nov 04, 2014 @ 19:18
    dan
    0

    Yes, a link and script tags. The textbox doesnt work. The script does not load a src or execute js between the tags. The link tag doesnt load its href from the textbox either. When I check the page html, it never gets to the page.

  • dan 54 posts 133 karma points
    Nov 04, 2014 @ 19:50
    dan
    1

    Alternatively I'm not really fixed on getting this done in TinyMCE. If there was a code block plugin or something like that that would allow me free reign to put html/js/css would work.

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Nov 04, 2014 @ 20:07
    Dennis Aaen
    100

    Hi Dan,

    You can use the Textbox Multiple http://our.umbraco.org/documentation/using-umbraco/backoffice-overview/property-editors/Built-in-Property-Editors/Textbox-Multiple

    And lets say you give the field a alias of script, then if you are using dynmaic razor you can do this:

    @{       
       if (CurrentPage.HasValue("script")){
           @Html.Raw(CurrentPage.script)
       }          
    }

    And in strongly typed razor your can use this:

    @{ 
        if (Model.Content.HasValue("script")){
            @Html.Raw(Model.Content.GetPropertyValue<string>("script"))
        }
    }

    The @Html.Raw outputs the value unencoded, so you wil get the script tag out and link tag to the stylesheet. If you have access to the Umbraco TV, you can find a video about @Html.Raw here: http://umbraco.tv/videos/implementor/working-with-umbraco-data/razor-syntax/htmlraw/

    Hope this helps,

    /Dennis

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Nov 04, 2014 @ 20:35
    Dennis Aaen
    0

    Hi Dan,

    An option could also perhaps be to use the SimpleCodeEditor from Kraftvaerk, for you javascript and link tag.

    http://our.umbraco.org/projects/backoffice-extensions/kraftvaerksimplecodeeditor

    /Dennis

  • dan 54 posts 133 karma points
    Nov 06, 2014 @ 22:35
    dan
    0

    Thanks Dennis, your the man!

  • Marcin Zajkowski 112 posts 585 karma points MVP 7x c-trib
    May 22, 2016 @ 23:54
    Marcin Zajkowski
    0

    I know that this is an old topic, but just provided a solution for another Umbracian solving exactly this problem.

    Feel free to check it there: https://our.umbraco.org/forum/using-umbraco-and-getting-started/77417-cannot-insert-a-mailto-link-in-the-rich-text-editor#comment-247580 :)

Please Sign in or register to post replies

Write your reply to:

Draft