Make WordPress Core

Opened 10 years ago

Closed 9 years ago

Last modified 8 years ago

#2385 closed defect (bug) (invalid)

Named links (anchors) broken by RTE

Reported by: moogle Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.0
Component: Administration Keywords: RTE needs-patch anchors
Focuses: Cc:


A named link has two parts:
1) <a name="jump"></a>
2) <a href="#jump">

The WYSIWG editor in 2.0.1 replaces all relative "#jump" paths, in part #2, with "http://www.site.com/wp-admin/.../#jump".

Because most posts are viewed from many paths (ie: www.site.com/, www.site.com/2006/, and www.site.com/category/postsname/) relative paths are easiest to use. It is difficult and inefficient to hardcode an absolute path while writing a post that will work in all instances without a full page reload. The current best-case for hardcoded paths is to get the post-slug while editing, and build all the #2's based on that. When anyone clicks on that absolute path from the front-page or archives the browser will redirect them to the hardcoded path.

Can the WYSIWG editor be made to recognize the "#" symbol in a link and not "correct" those links to an absolute path?

Attachments (1)

2385.diff (794 bytes) - added by wendel279 10 years ago.
Named link fix for TinyMCE

Download all attachments as: .zip

Change History (11)

comment:1 @westi10 years ago

  • Keywords bg|needs-patch added
  • Milestone set to 2.1

comment:2 @davidhouse10 years ago

  • Keywords bg|2nd-opinion added

Absolute links are just generally easier. For example, if someone types 'feed' as a link href, then (depending on whether the URL of the post ends in a slash or not) it will either link to (say) http://example.com/2006/02/04/feed or http://example.com/2006/02/04/post/feed. Perhaps we could say that any links beginning with a hash are relative.

comment:3 @wendel27910 years ago

"Perhaps we could say that any links beginning with a hash are relative." -- I agree.
Does this change fix your problem, moogle?

Index: wp-includes/js/tinymce/tiny_mce.js
--- wp-includes/js/tinymce/tiny_mce.js  (revision 3504)
+++ wp-includes/js/tinymce/tiny_mce.js  (working copy)
@@ -2990,7 +2990,7 @@
        var baseURL = TinyMCE.prototype.parseURL(base_url);
        var relURL = TinyMCE.prototype.parseURL(relative_url);
-       if (relative_url == "" || relative_url.charAt(0) == '/' || relative_url.indexOf('://') != -1 || relative_url.indexOf('mailto:') != -1 || relative_url.indexOf('javascript:') != -1)
+       if (relative_url == "" || relative_url.charAt(0) == '#' || relative_url.charAt(0) == '/' || relative_url.indexOf('://') != -1 || relative_url.indexOf('mailto:') != -1 || relative_url.indexOf('javascript:') != -1)
                return relative_url;
        // Split parts

comment:4 @skeltoac10 years ago

  • Cc moogle added
  • Keywords bg|reporter-feedback added; bg|needs-patch removed

I like the looks of it. Has it been tested?

@wendel27910 years ago

Named link fix for TinyMCE

comment:5 @wendel27910 years ago

  • Keywords bg|has-patch added

comment:6 @foolswisdom9 years ago

This bug has not been updated for 7 months.

moogle did the change the address your problem?

wendel279, does the problem still exist? is the patch still relevant?

comment:7 @foolswisdom9 years ago

  • Keywords RTE needs-patch added; bg|reporter-feedback WYSIWG bg|2nd-opinion bg|has-patch removed

ENV: WP trunk r4415

Reproduced problem.

2385.diff applies (fuzzy) and does not seem to address problem. needs-patch

comment:8 @foolswisdom9 years ago

  • Keywords anchors added
  • Summary changed from Named links broken by WYSIWG editor to Named links (anchors) broken by RTE

comment:9 @matt9 years ago

  • Resolution set to invalid
  • Status changed from new to closed

If this is indeed an issue, it should be filed upstream in TinyMCE's bug tracker.

comment:10 @Nazgul8 years ago

  • Milestone 2.1 deleted
Note: See TracTickets for help on using tickets.