Forum closed. New forum available at http://community.wymeditor.org/

Relative Hyperlinks

Support forum for WYMeditor.

Relative Hyperlinks

Postby adamb78 on Wed Mar 25, 2009 4:18 pm

Is there any trick for getting the editor to show relative hyperlinks? If you click on HTML view it has either been putting in the full URL (IE) or a weird URL starting at the root of the location of the WYMEditor js (like http://mysite.com/lib/wymeditor/the/real/link.

We were using Tiny before on this same installation and didn't have this issue.
adamb78
 
Posts: 5
Joined: Wed Mar 25, 2009 4:10 pm

Re: Relative Hyperlinks

Postby eadevel on Thu Mar 26, 2009 6:43 pm

eadevel
 
Posts: 22
Joined: Thu Sep 27, 2007 12:00 pm

Re: Relative Hyperlinks

Postby adamb78 on Sun Mar 29, 2009 1:23 am

I saw that thread, and the one it linked to. But I haven't seen a simple "this is what you do to get it work." I can't believe everyone is having this issue with no straightforward solution.

Can anyone offer that solution in a few straightforward steps?
adamb78
 
Posts: 5
Joined: Wed Mar 25, 2009 4:10 pm

Re: Relative Hyperlinks

Postby bally on Wed Apr 01, 2009 5:01 pm

using 0.5-b2

I've seen the other posts also. I'm adding links like:

Code: Select all
$.wymeditors(0).insert('<h6><a href="'+this.href+'" title="">'+$(this).text()+'</a></h6>');


The source URL is absolute (eg. http://mydomain.org/whatever) but is added with ../../etc.

Can anyone at least explain where this behavior is happening? I've gone through the source and cannot figure out how/why these URLs get changed. From the fix mentioned, it appears that this is supposed to be a feature, not a bug. Can someone explain that, also? I'd be happy to try to patch this if, well, if I knew what to patch. But, also, I don't really understand why it happens in the first place.

FWIW, I cannot have these kinds of links as I'm using the editor to create a newsletter email. This makes the links quite useless.
bally
 
Posts: 4
Joined: Mon Dec 15, 2008 12:27 am

Re: Relative Hyperlinks

Postby eadevel on Thu Apr 02, 2009 6:20 pm

I've tried to explain where's the issue:
http://forum.wymeditor.org/forum/viewtopic.php?f=3&t=57#p1650

Basically it's a IE thing and has to do with innerHTML function.
Try reading the link above and if you come up with a solution, please let us know!! :wink:
eadevel
 
Posts: 22
Joined: Thu Sep 27, 2007 12:00 pm

Re: Relative Hyperlinks

Postby adamb78 on Sat Apr 04, 2009 3:46 pm

I'm not a developer, but I know that it works OK with Tiny. Maybe there is something in the way Tiny does things that can be copied into WYMEditor?
adamb78
 
Posts: 5
Joined: Wed Mar 25, 2009 4:10 pm

Re: Relative Hyperlinks

Postby adamb78 on Fri May 08, 2009 5:20 pm

I got a comment on the jquery ticket: http://dev.jquery.com/ticket/1029

They said:
"Here are some possible workarounds that may work in your situation: If you know you are creating an A or IMG element, create it and set its attributes explicitly rather than using an HTML string to do it. For reading, grab the elements with a selector and use .attr() to get the href or src attributes."

Does anyone know how to patch WYMEditor to do that?
adamb78
 
Posts: 5
Joined: Wed Mar 25, 2009 4:10 pm

Re: Relative Hyperlinks

Postby mr_lundis on Tue Jan 05, 2010 9:08 pm

WYMeditor already sets these attributes directly when the elements are created, it's when the html() method gets called things get messy. And unfortunately, I see no easy fix other than implementing a completely js-based html/dom-parser. I've played around a little bit with innerXhtml by Steven Tucker, and done some minor modifications to it. But I never got around to implement it, as it's still rather slow and a bit untested.

Jhon Resig has also done something similar, and his implementation is a lot faster. But it only goes one way. If anyone feels up to it then implementing a combination of the two could be a good solution. I know Jean-François (the guy in charge of the 0.5 development) would appreciate it!

Cheers! ;)
Jonatan Lundin - designer, developer and forum moderator. You should follow me on Twitter!
mr_lundis
 
Posts: 335
Joined: Sun Dec 02, 2007 10:59 am
Location: Sweden


Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest