Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#8819 closed Bug (invalid)

InsertHtml in chrome not working to replace first or last words within a paragraph

Reported by: Dave Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc:

Description

I've spent a few hours stepping through ckeditor trying to figure out what's going on here but have now run out of time.

I'm trying to replace the selected text with the selected text wrapped in a span and it works fine in firefox but under chrome it won't work for the first or last word within a span.

Have tried with the nightlies with no better results.

Attachments (1)

ipad_tooltips.tar.gz (2.5 KB) - added by Dave 13 years ago.
plugin demonstration of problem

Download all attachments as: .zip

Change History (4)

Changed 13 years ago by Dave

Attachment: ipad_tooltips.tar.gz added

plugin demonstration of problem

comment:1 Changed 13 years ago by Dave

Here are the contents of the ckeditor which will demonstrate the problem. If you try to add a tooltip to a word within the last paragraph it works except if it's the first or last word selected.

<p>
	lauhfgAER Q;ERG Edit</p>
<p>
	&nbsp;</p>
<p>
	<img alt="" src="/assets/images/music_lloyd.jpg" style="width: 267px; height: 400px;" /></p>
<p>
	addition of new content with tertiary menu</p>

comment:2 Changed 13 years ago by Jakub Ś

Keywords: chrome inserthtml removed
Resolution: invalid
Status: newclosed

First you remove the test and then you try to wrap it into span.
Don't you think this is not the way it should be done? :)

Instead of

var edited_text = '<span class="ipad_tooltip" title="'+dialog_string+'">'+selected_text+'</title>';
editor.insertHtml(edited_text);

please use

var attributes = {};
						attributes.title = 'ipad_tooltip';
						attributes.class = 'ipad_tooltip';
						var style = new CKEDITOR.style( { element : 'span', attributes : attributes } );
						style.type = CKEDITOR.STYLE_INLINE; // need to override... dunno why.
						style.apply( editor.document );	

This is the correct way to wrap tags around selection.

comment:3 Changed 13 years ago by Dave

Thank you, That worked, though I don't see what was wrong with the original way. Given it worked in firefox it seems like a bug that it wouldn't work in Chrome.

In any case, the following lines caused an error (InternalError: missing name after . operator) with ckpackager.jar.

attributes.title = 'ipad_tooltip'; // ('ipad_tooltip' isn't quite right)
attributes.class = 'ipad_tooltip';

They worked fine when I changed them to:

attributes['title'] = dialog_string;
attributes['class'] = 'ipad_tooltip';

I haven't been able to change the status on this bug, but given it's relevant I didn't want to create a new bug report.

Last edited 13 years ago by Dave (previous) (diff)
Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy