[Project_owners] Inserting text around selected text in Midas

Jed jedbro at gmx.net
Thu Nov 18 12:35:25 EST 2004


David, for undo/redo capabilities, I think you're looking for this:
http://kb.mozillazine.org/index.phtml?title=Dev_:_Extensions_:_Example_Code_:_Inserting_text_at_cursor

-Jed

David Murray wrote:

> Thanks! That works! Now all I have to do is get undo/redo to work and 
> I'm set!
>
> David.
>
>
> Omar Khan wrote:
>
>> Try this bookmarklet that I whipped up.
>> It this what you mean?
>>
>> <a href="javascript:
>> var selection = window.getSelection();
>> var rangeCount = selection.rangeCount;
>> if(rangeCount >= 0)
>> {
>>     var rangeAt = selection.getRangeAt(0);
>>     var rangeTwo = document.createRange();
>>     rangeTwo.setStart(rangeAt.endContainer,rangeAt.endOffset);
>>     rangeTwo.insertNode(document.createTextNode('?'));
>>     rangeAt.insertNode(document.createTextNode('!'));
>> }
>> void 0;
>> ">Insert ! ?</a>
>>
>
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners
>
>





More information about the Project_owners mailing list