[wp-trac] Re: [WordPress Trac] #6737: TinyMCE converts relative links incorrectly (adds wp-admin)

WordPress Trac wp-trac at lists.automattic.com
Sat Apr 19 18:49:45 GMT 2008


#6737: TinyMCE converts relative links incorrectly (adds wp-admin)
-----------------------------------+----------------------------------------
 Reporter:  Otto42                 |        Owner:  azaozz
     Type:  defect                 |       Status:  new   
 Priority:  high                   |    Milestone:  2.5.1 
Component:  TinyMCE                |      Version:  2.5   
 Severity:  critical               |   Resolution:        
 Keywords:  2nd-opinion has-patch  |  
-----------------------------------+----------------------------------------
Comment (by azaozz):

 Replying to [comment:6 Otto42]:
 > That patch would work, but seems a bit odd to me. I think this makes
 more sense:
 >
 > 1. 'document_base_url' => get_option('url') should be in the TinyMCE
 initArray all the time. It doesn't make sense that this is set wrong,
 ever.
 ...

 Unfortunately it's more complicated than that. If set, 'document_base_url'
 affects not only what's entered in the Link and Image popups, but all URLs
 used by the editor.

 I've tested it quite a bit and it seems to work well with the current
 version, but it had some problems few weeks ago, especially when
 'document_base_url' is different than the baseURL setting passed to the
 editor before init (baseURL refers to the installation directory and can
 be https:// too).

 Also TinyMCE's documentation suggests that "document_base_url" should only
 be used when "relative_urls" is set to true:
 {{{
 This option is only used when the relative_urls option is set to true.
 ...
 This (document_base_url) may affect how other paths are interpreted, such
 as
 calls to tinyMCE.windowManager.open, so you may want to use absolute
 paths.
 }}}
 Since we have "relative_urls" set to false, "document_base_url" may behave
 unexpectedly in some circumstances and the combination
 {{{
 'convert_urls' => false,
 'relative_urls' => false,
 'document_base_url' => get_option('siteurl'),
 }}}
 is not recommended.

 I was reluctant to make this patch in the first place, but it seems to
 work well in the current (3.0.7) version. However we should avoid setting
 'convert_urls' => false, together with 'document_base_url'. They both
 affect the way TinyMCE recalculates the URLs that come from the browser
 (each browser interprets and corrects the URLs internally a bit
 different).

 Another possibility would be to pre-fill the site URL in the Image popup,
 similar to how "http://" is pre-filled in the Link popup.

 Yet another possibility would be to make a small plugin to easily control
 all these settings, as the users that want to use the (not recommended)
 relative URLs seem to be just a few. That way they would be able to turn
 these settings on, test them and eventually turn them off if something
 doesn't work well.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/6737#comment:7>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list