Drupal 5

Since it took me so long, i decided to write this down; perhaps it is of help for someone or someone else can comment a better method.

The problem: Internal drupal links like "node/123" in a textarea are not filtered to use the path, it would end up like this: "www.ursite.com/drupal/node/123", even if a path is set for that node. If i didn't wanted to use tinymce, this could have been easely cured by using a filter like pathfilter (http://drupal.org/project/pathfilter). But since I want to use tinymce, some fiddling around has to be done.

Here's what i did:

1. Installed Tinymce
2. Installed linktocontent -> http://drupal.org/project/linktocontent
3. installed pathfilter -> http://drupal.org/project/pathfilter
4. After setting it all up as described in the respective readme's, the only thing that i had to change was a small piece of code in linktocontent:
Find the function "insertAction" in "modules/tinymce/tinymce/jscripts/tiny_mce/plugins/linktomenu/jscripts/functions.js"

in that function change the line

// Create new anchor elements
var path = selectedNode.cells[0].firstChild.nodeValue;

to

// Create new anchor elements
var path = 'internal:' + selectedNode.cells[0].firstChild.nodeValue;

With a cleared cache this should function immediately. This will make all internal links use the format used for the pathfilter, which makes:

  "internal:admin/user"  ->  "http://example.com/mysite/admin/user"
  "internal:node/23"       ->  "http://example.com/mysite/node/23"
  "internal:node/99"       ->  "http://example.com/mysite/news/latest"

Side note: If you change the path to a node, the cache needs to be cleaned as well.

Drupal 6

The author in his drupal 6 version readme.txt suggests putting the following in your template.php and therefore none of the above is needed

function phptemplate_tinymce_theme($init, $textarea_name, $theme_name, $is_running) {
  $init = theme_tinymce_theme($init, $textarea_name, $theme_name, $is_running);
 
  // Disable conversion of relative URLs so we can use pathfilter.module
  // and it's "internal:node/99" style paths.
  if (isset($init)) {
    $init['convert_urls'] = 'false';
  }

  return $init;
}

Drupal 6 Caution

This phptemplate solution didn't work because it relies on the older TinyMCE.module. The WysiwigAPI module has superseded this in Drupal 6.

After searching, another solution which patches the settings ('convert_urls' and a few others) in the Wysiwig API module as found on this page: http://drupal.org/node/369115