Copied to clipboard

Flag this post as spam?

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


  • greengiant83 88 posts 109 karma points
    Feb 23, 2011 @ 19:19
    greengiant83
    0

    How to prevent the WYSIWYG from rewriting link href attribute

    When I enter the following html into the WYSIWYG editor:

    <a href="thank-you/">Click here</a>

    it changes it to

    <a href="/thank-you/">Click here</a>

    That is to say it is making my perfectly valid relative url into a root relative url.  How can I prevent this? 

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 23, 2011 @ 19:25
    Jan Skovgaard
    0

    Hi greengiant

    Why do you want to prevent it?

    /Jan

  • greengiant83 88 posts 109 karma points
    Feb 23, 2011 @ 19:30
    greengiant83
    0

    I have textpages set up adjacent to each other at various spots in the document tree.  I would like to be able to specify the relative path so that computing the full path is not needed. For example consider this document tree:

     

    • My Event
    • Info
    • Register
    • My Other Event
    • Info
    • Register
    If relative url's are permitted on each of the Info pages, I can have a simple link to "Register/" instead of having to figure out the full path. IE "/My-Event/Register/" and "My-Other-Event/Register" respectively.

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 23, 2011 @ 19:32
    Jan Skovgaard
    0

    Figure out? Isn't that just a matter of using the umbraco.library:NiceUrl extension? Or am I missing something?

    :-)

    /Jan

  • greengiant83 88 posts 109 karma points
    Feb 23, 2011 @ 19:35
    greengiant83
    0

    I am new to Umbraco, so its possible I am not seeing something.  But lets say that these are simple textpage documents.  How would you use the NiceUrl extension? It seems to me that to use the niceurl extension you would have to have a specific xslt, user control (macro) or master page (template) involved somewhere.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 23, 2011 @ 19:49
    Jan Skovgaard
    0

    Well if you want to make simple textpage documents I'm not sure I get why you're using a CMS to handle the content if you don't benefit from the options you have by doing so?

    Yes you're right that it would require a XSLT macro...you can probably also generate the navigation using Razor or some user control using the same extension I suppose.

    It should be fairly easy for you to create an XSLT macro with some simple navigation for your page since there are some predefined snippets you can choose from, when creating a XSLT macro in the developer section. I bet it will take you less than 5 minutes to get it working, which is much faster than trying to make tinymce create relative url I guess :-)

    Hope this helps - otherwise just let us know :-)

    /Jan

  • greengiant83 88 posts 109 karma points
    Feb 23, 2011 @ 19:55
    greengiant83
    0

    While I am trying to keep this one little section simple, it doesn't mean the rest of the site isn't going to be more involved. And certainly, creating an xslt macro or something similiar would not take very long, but it would limit the flexibility.  If Umbraco's WYSIWYG would simply not rewrite the link, the solution would be even quicker than creating a little macro.

    So motivation aside, is there a way to prevent this behavior?

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 23, 2011 @ 19:59
    Jan Skovgaard
    0

    There probably is a way to do it but I must admit that I don't know how. But I suspect you would perhaps need to look in the source for tinyMce...

    Maybe some others know extactly where to look for this...but I'm really not sure it's worth the effort :-)

    /Jan

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 24, 2011 @ 08:58
    Jan Skovgaard
    0

    Hi again

    I must have been drunk or something when I answered this post last night.

    Please do forget what I wrote about using umbraco.library:NiceUrl on urls entered into the rich text editor field - Links from rte will be just be written out when fetching the contents from that field. Sorry about the confusion :-)

    Still don't know how to make a workaround though...

    /Jan

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Feb 24, 2011 @ 09:15
    Sebastiaan Janssen
    0

    I must be missing something here, but if you highlight "Click here" and click the "Insert/edit link" button, then choose a page in your tree, it should create the correct link regardless. No need to manually construct the href..

    That said, I have no idea as to why tinyMce adds the extra slash, I think it's got to do with some kind of obscure html compliance thing.

  • greengiant83 88 posts 109 karma points
    Feb 24, 2011 @ 22:15
    greengiant83
    0

    Sebastiaan,

    What your describing works perfectly.  What I am describing is a situation where the user manually enters the link's url.  The point of all this is that I want a relative url not an absolute one. Specifically I am going to have alot of content that is largely the same is going to be copied from place to place and I dont want to have to write code to fix the url's after the copy.

  • Nick Goloborodko 8 posts 29 karma points
    May 01, 2011 @ 17:42
    Nick Goloborodko
    0

    Just wondering, has anyone been able to resolve this issue? Here's an example url that get's auto-corrected and breaks things: <a href="skype:skype_username?call"></a> get converted by TinyMCE into  <a href="/skype:skype_username?call"></a> (and obviously will no longer launch skype and start a call... worse - it pops up an error message page when user clicks onto it.

    So far two things come to mind:

    1. Hard code it into the template it self where TinyMCE not all powerful. But giving our content editor access to the templates makes the my heard stand up.
    2. Use non WYSIWYG data type - our content editor doesn't know html :(
    3. Use javascript to remove it on the page it self... Again, ugly, ugly ugly...
    Surely, there must be a way to override this behaviour?
    Thanks in advance,
    Nick

     

  • Lesley 284 posts 143 karma points
    May 01, 2011 @ 19:22
    Lesley
    1

    Hi all,

    There is a TinyMCE config that will change this behaviour. In config/tinyMceConfig.config, add this to the <customConfig> section at the end of the file:

    <config key="relative_urls">true</config>

    Lesley

  • Lesley 284 posts 143 karma points
    May 01, 2011 @ 19:22
    Lesley
    0

    // removing my double post - sorry!

Please Sign in or register to post replies

Write your reply to:

Draft