#2385 closed defect (bug) (invalid)
Named links (anchors) broken by RTE
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Administration | Version: | 2.0 |
| Severity: | normal | Keywords: | RTE needs-patch anchors |
| Cc: | moogle |
Description
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)
Change History (11)
comment:2
davidhouse — 7 years ago
- Keywords bg|2nd-opinion added
"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
- Cc moogle added
- Keywords bg|reporter-feedback added; bg|needs-patch removed
I like the looks of it. Has it been tested?
comment:6
foolswisdom — 7 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
foolswisdom — 7 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
foolswisdom — 7 years ago
- Keywords anchors added
- Summary changed from Named links broken by WYSIWG editor to Named links (anchors) broken by RTE
- 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
Nazgul — 6 years ago
- Milestone 2.1 deleted

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.