Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#6 | wysiwyg-HEAD.convert_urls.patch | 1022 bytes | sun |
#3 | wysiwyg_convert_urls_patch.patch | 1.56 KB | globetrotter |
wysiwyg_convert_urls_patch.patch | 1.4 KB | globetrotter |
Comments
Comment #1
sunPlease 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.
Comment #2
globetrotter CreditAttribution: globetrotter commentedSorry, guess I was to short about this issue.
What pathfilter module does
This filter converts tags like
"internal:node/45"
intohttp://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
Comment #3
globetrotter CreditAttribution: globetrotter commentedfind patch attached with revised help text
Comment #4
sunThe 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:
...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.
Comment #5
globetrotter CreditAttribution: globetrotter commentedYou'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 :)
Comment #6
sunPlease test attached patch.
Comment #7
Alan D. CreditAttribution: Alan D. commentedHi 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:
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
Comment #8
sunCould you please explain why you need relative_urls to be enabled? Why should the editor munge your URLs at all?
Comment #9
Alan D. CreditAttribution: Alan D. commentedWe 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.
Comment #10
sunThis 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.
Comment #11
Alan D. CreditAttribution: Alan D. commentedIt 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.
Comment #12
sunIf "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.
Comment #13
Alan D. CreditAttribution: Alan D. commentedConfirmed, 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
Comment #14
sunThanks. Committed to all branches.