[Project_owners] Inserting text around selected text in Midas

David Murray lid2000 at tpg.com.au
Sat Nov 13 01:58:36 EST 2004


Actually, no, I'm still screwed. How can I use getSelection or something 
but get any HTML values as well? getSelection just seems to return 
plaintext (ie. "blah <b>blah</b> blah" would just return "blah blah blah").

David.
(again)


David Murray wrote:
> Ignore this, for I am a fool and didn't consider just grabbing the 
> selection, editing the string, then using insertHTML to dump it in instead.
> 
> *slaps forehead*
> 
> David.
> 
> David Murray wrote:
> 
>> Hi,
>>
>> I'm trying to insert text around selected text in Midas, for example:
>>
>> Blah blah blah blah blah.
>>
>> If 'blah blah blah' was selected and the text-inserter button thing 
>> was clicked to put a ! at the start and a ? at the end of the 
>> selection, it'd become:
>>
>> Blah !blah blah blah? blah.
>>
>> Or if nothing is selected, just !? appears.
>>
>> I can do it fairly easily in a straight textbox, however I need to be 
>> able to do it in the RTF editor. I was thinking set the caret at the 
>> start of the selection, insert the text/HTML, set the caret to the end 
>> of the selection, insert the text/HTML, then reselect the selection. 
>> This way the undo pile shouldn't get wiped.
>>
>> Only problem is, I can't figure out exactly how to *do* that. Any takers?
>>
>> David.
>>
>> _______________________________________________
>> Project_owners mailing list
>> Project_owners at mozdev.org
>> http://mozdev.org/mailman/listinfo/project_owners
>>
>>
>>
>>
> 
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners
> 
> 
> 
> 



More information about the Project_owners mailing list