Linking Problem

rgraves - October 16, 2007 - 17:24
Project:TinyMCE
Version:5.x-1.9
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

I tried importing a page into Drupal (using the Import HTML module). The page imports fine and the links on it are working properly. However, when I go to edit a page using TinyMCE, it messes up some links.

e.g.
Say I have files in /department/unit/ and a link from one file to another within the same directory. The links are in the form <a href="filename.html">text</a>. So the href tag just has the filename, no directory or slashes at the beginning of the URL.

When I go to edit the page in TinyMCE, it changes all the hrefs in that form to <a href="/filename.html">text</a> (note the beginning slash). So then all those links are messed up.

If I disable TinyMCE and edit the page, it does not mess up the links.

Rob

#1

rgraves - October 17, 2007 - 13:53

Upon further investigation, this happens even when I create a page from scratch and not importing it so the importing part is irrelevant.

If I edit a page and click on the HTML (view source) button in tinymce, it has <a href="/filename.html"> where it shouldn't have the begining slash. If I click on the view source button on my browser (firefox), it says &lt;a href=&quot;filename.html&quot;&gt; within the textarea box. So it is TinyMCE that is somehow putting the slash in after the page loads.

Any ideas? This is a serious problem for us as we won't be able to move forward with our site if it messes up the links every time a person edits the page.

#2

rgraves - October 17, 2007 - 14:23

I think I fixed it although I had to go into the module code to do it.

In tinymce.module, I added the following code to the function tinymce_process_textarea:

$settings[] = 'convert_urls: false';

This was added above the line $tinymce_settings = implode(",\n    ", $settings);

Does anyone see a problem with this? Is it something that should be corrected for a patch to the tinymce module?

Rob

#3

juanhunglow - December 7, 2007 - 22:18

I was searching b/c I am having a problem with tinymce adding code to my links that I didn't, in my case it's adding more than just the '/' it is adding the file/location where my drupal install is located. I can manipulate this if I don't use the rich-text editor, but every time I go back into edit, it changes the link back.
I might have to try your fix.

 
 

Drupal is a registered trademark of Dries Buytaert.