Make WordPress Core

Opened 18 years ago

Closed 18 years ago

Last modified 17 years ago

#2385 closed defect (bug) (invalid)

Named links (anchors) broken by RTE

Reported by: moogle's profile 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 "".

Because most posts are viewed from many paths (ie:,, and 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 18 years ago.
Named link fix for TinyMCE

Download all attachments as: .zip

Change History (11)

#1 @westi
18 years ago

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

#2 @davidhouse
18 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) or Perhaps we could say that any links beginning with a hash are relative.

#3 @wendel279
18 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

#4 @skeltoac
18 years ago

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

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

18 years ago

Named link fix for TinyMCE

#5 @wendel279
18 years ago

  • Keywords bg|has-patch added

#6 @foolswisdom
18 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?

#7 @foolswisdom
18 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

#8 @foolswisdom
18 years ago

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

#9 @matt
18 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.

#10 @Nazgul
17 years ago

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