In order to get the the pathfilter module to work with tinymce you need to set convert_urls to FALSE.
I changed the module in order to have a check box in the config screen to enable/disable this functionality.
Find the patch attached.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sun’s picture

Status: Needs review » Needs work

Please explain what "convert_urls" does. Not only in this issue, but also in the form element's description.

Also, no configuration setting should contain a specific module name.

globetrotter’s picture

Status: Needs work » Needs review

Sorry, guess I was to short about this issue.

What pathfilter module does
This filter converts tags like "internal:node/45" into http://example.com/mysite/node/45. That way you can define internal links in your content which will work even if you move your site to another domain or subfolder.

What this patch is about
With the default settings of TinyMCE this doesn't work because if you enter a link like <a href="internal:node/45">link</a> it will automatically try to fix this link, eg. by prepending the current sites URL.

There is a TinyMCE setting called convert_urls which is set to TRUE by default. Setting it to FALSE will deactivate the behavior described above.

That's what this is all about, making another config option of TinyMCE available.

Hope this helps.
You still think the code needs work? The setting name (convert_urls)is not a module but a TinyMCE config name

globetrotter’s picture

find patch attached with revised help text

sun’s picture

Title: Pathfilter module doesn't work with Wysiwyg module (tinymce) » TinyMCE: Disable convert_urls option (for Pathfilter compatibility)
Status: Needs review » Needs work

The key issue I have then is the question whether we shouldn't disable this option by default, without adding a configuration setting for it.

Based on the description:

URLs are automatically converted (messed up) by default because the built-in browser logic works this way.

...this is some weird, unwanted, complex magic we do not want either way - with or without Pathfilter module. I could imagine that this URL conversion won't work with a bunch of other Drupal modules (and upcoming Drupal plugins for Wysiwyg API).

For this to happen, I need some more feedback from other TinyMCE users/developers.

globetrotter’s picture

You're right, I didn't fully understand it either what they "messed up" means and what it exactly does. What I understood is that this magic messes up our internal links, so I just wanted the "magic" to stop :)

sun’s picture

Title: TinyMCE: Disable convert_urls option (for Pathfilter compatibility) » TinyMCE: Disable convert_urls option
Category: feature » task
Status: Needs work » Needs review
FileSize
1022 bytes

Please test attached patch.

Alan D.’s picture

Hi Daniel

Firstly, fantastic work on the module.

+1 for turning this off, but it's behavior is dependent on relative_urls, which is more important.

http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/relative_urls

I know your looking at advanced interface options, but a simple hook / theme that is passed along the settings by reference and input format, would be an easy and quick solution for this and ? number of other issues (I've seen 4 or 5 without searching).
Eg:

<?php
  module_invoke($editor_type .'_settings_alter', $settings, $format);
  theme($editor_type .'_additional_settings', $settings, $format);
?>

For modules like path filter, a hook would be best, allowing the module to handle these settings.
For users, they generally only have a theme to modify, so a theme callback would be better

sun’s picture

Could you please explain why you need relative_urls to be enabled? Why should the editor munge your URLs at all?

Alan D.’s picture

We almost always develop on a test domain, in which a sub-folder is the typical location. Then after the content is ready, this is moved to the live domain. Clean URLs are always enabled.

Absolute URLs are created relative the document_base_url, eg: without convert_urls option

/my_drupal_install/node/23

So if the site is moved, all the old links are broken.

So we use filters to handle this, normally "Path filter", but will also be looking at Pathologic soon.

Using path filter, the desired URL is "internal:node/23", the resulting URL via TinyMCE is "/my_drupal_install/internal:node/23", thus breaking the filter.

Without filters, I would think that people would want absolute URL's, but using filters they would want relative URL's.

sun’s picture

This sounds more like an issue with Pathfilter to me then. It should be able to convert "internal:node/23" into either a relative or absolute URL.

As mentioned before, I think there are many other cases where TinyMCE should not munge the URL at all. And if you enter and use absolute URLs in your contents, that's not the fault of the editor.

Alan D.’s picture

It is TinyMCE that inserts the absolute URL with this setting prior to saving the body text.

The URL is "[filter tag]:[actual url]" so as soon as TinyMCE modifies this, it breaks the input filter during rendering. (I wish they called "input format", "output format")

To test, simply add the href "node/23" via the link popup and see whats saved in the database. I get "/node/23" which is document_base_url + href

Please note that I can not test the effects of "convert_urls" on things until tomorrow at work. From memory, this has no effects when you use "relative_urls = TRUE", it is only active when you use absolute URLs.

sun’s picture

If "convert_urls" is disabled (what this patch wants to do), then TinyMCE should not change or alter any URLs in the content. "convert_urls" is a global kill-switch.

Alan D.’s picture

Confirmed, sorry for my misunderstanding on the usage of this configuration option. I have run through some tests on the following setup and the patch works great.

project = "drupal"
version = "6.9"

project = "wysiwyg"
version = "6.x-2.x-dev"
datestamp = "1235348453"

Going back to http://drupal.org/node/369115#comment-1285502, the point I was trying to make, it would be nice to be able to actively modify the configuration with a hook. Users then can simply then modify these to their hearts content without clogging up the issue queue with settings requests. I just wanted to seed the idea.

Again, great work.

Cheers

sun’s picture

Status: Needs review » Fixed

Thanks. Committed to all branches.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.