Bug #2274

Anchor is not placed around the selected text

Submitted:
2008-12-04 10:36:57 By: Anonymous
Open Priority: 3 Resolution: None Assigned to: None
User agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; nb-NO; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4
Screen info: 1280x1024x16

Description of problem:
When inserting an anchor, the selected text in the editor is not inside the anchor, the opening and closing tags are to the left of the selected text.
Tested on online full featured example version 3.2.1.1

Steps to reproduce:
1. Enter the text "This is an anchor example" and select the word anchor.
2. Click the "Insert/edit anchor" button, give a name and click Insert


The resulting HTML is:
<p>This is an <a name="test"></a>anchor example</p>

Expected result:
<p>This is an <a name="test">anchor</a> example</p>

Reported by: Chr., Id: 2387559

 

If you wish to follow or post a comment, you need to be registered and logged in.

Comments

User Image
  • 2009-03-05 06:43:44

Anonymous

Hmm. I have just retested this using the full editor on the TinyMCE site
and all works well. The trouble I am having is that a link like this:
<h2><a name="top"></a>Heading</h2>
just isn't working as an anchor when I run *my* application in IE6 (it
works on your example page). Pretty much everything else works:
<a name="top"></a>Heading
<h2><a name="top">Heading</a></h2>
<h2>Heading<a name="top"></a></h2>
Even this works:
<h3><a name="top"></a>Heading</h3>
It seems to only break for h1 and h2.

What a completely irritating and silly bug - somewhere in IE6 I think.
Unless others experience this problem I don't see how I can impose on you
to alter TinyMCE to avoid this problem and it is simple enough to grab the
anchor and move it to the end of the heading.


With regards to switching to spans, I have no real problem with that,
except that If I have something like:
<h1>heading</h1>
it might be nicer to end up with:
<h1 id="my_anchor">heading</h1>
rather than:
<h1><span id="my_anchor">heading</span></h1>

With my current configuration:
<h1><span id="my_anchor"></span>heading</h1>
would become:
<h1>heading</h1>
which would obviously not be good - the question would be is this done by
TinyMCE or my own cleanup code.

Cheers,

Scott

Comment by: Scott Eade

User Image
  • 2009-03-05 00:51:26

spocke

Anchors will probably be removed and replaced with spans since the name
attribute is deprecated in XHTML strict and HTML 5. I see no problems with
it on IE 6 though works the same as on IE 7 or FF.

User Image
  • 2009-01-29 23:41:08

Anonymous

This is nasty. The empty named anchors work in IE7 and Ff, but not in IE6.
Would love to see this fixed as most of my users are still running IE6!

Scott

Comment by: Scott Eade