Ticket #118 (closed defect: fixed)

Opened 3 months ago

Last modified 2 months ago

CreateLink not working properly with 'multitag' selection

Reported by: onip Assigned to: jf.hovinne
Priority: major Milestone:
Component: Editor Version: trunk
Keywords: Cc:

Description

imagine you select all of some text <strong>some other text</strong>

and then create a link with that. Then tho 'a' tags would be created, but the second one would have href set with uniqueStamp() and not with the proper one. this happens because it is assumed in the source that only one anchor is present with that timestamp (break @line 1414 of r530). In a plugin i'm developing for university i've solved by putting all link in an array and then setting correct attributes to all of them. Hope this helps

Change History

09/02/08 20:52:21 changed by jf.hovinne

  • status changed from new to assigned.

Good call - is there a patch available?

09/03/08 08:54:42 changed by onip

This is the code I'm using currently in my plugin.

jQuery(wym._options.submitSelector).click( function()
					{
						var uStamp = wym.uniqueStamp();
						wym._exec( WYMeditor.CREATE_LINK , uStamp );
					
						var link = [];
						var nodes = wym._doc.body.getElementsByTagName(WYMeditor.A);
						for(var i = 0; i < nodes.length; i++)
						{
							if( jQuery( nodes[i] ).attr(WYMeditor.HREF) == uStamp )
							{
								link.push( nodes[i] );
							}
						}
						if( link.length )
						{
							jQuery(link)
							.attr(WYMeditor.HREF, jQuery(wym._options.hrefSelector).val())
							.attr(WYMeditor.TITLE,jQuery(wym._options.titleSelector).val());
						}

						window.close();
					});

09/09/08 21:52:44 changed by jf.hovinne

  • status changed from assigned to closed.
  • resolution set to fixed.

Fixed by r536.

We now use a jQuery selector instead of getElementsByTagName since #JQ1143 has been fixed.

Thanks for the feedback.