nop, not yet - we declined that functionality.

That range thing really sux. Instead, with a client we agreed on doing a 
button drop list for inserting needed text piece.

I have used:

function insertBlaghBlagh(command, argument) {
    if ( /* your wished check of is browser IE */ ) {
        var insertRange = this.document.selection.createRange();
        insertRange.pasteHTML(argument);
        insertRange.select();
        return true;
    } else {
        return this.document.execCommand(command, false, argument);
    }
}

USAGE:
insertBlaghBlagh("inserthtml", "bar1");
insertBlaghBlagh("inserthtml", "foobar");
insertBlaghBlagh("inserthtml", "barbar");


But thats, ofcourse, not the same as changing text on a fly.
So I'm also still interested in "on a fly replacement" solution. Maybe 
some day after the project I'll come back to this.


After making insertion button had thought on different approach: about 
catching key presses. As if user types "foo", then everything is ok - 
text (chars) appearance can be delayed and on a last sequence key simply 
inserted wished replacement of it. But then user types for example 
"football", because of catching his keys user will see nothing on screen 
till he types "t", and only then "foot" will appear - and thats weird.

nel wrote:
> Have you figured this out yet?  I'm still trying to make it work.
> You can do a getSelection() to get the Selection object in Mozilla.
> Then use http://developer.mozilla.org/en/docs/DOM:Selection to modify
> and read the cursor position.
> 
> The problem is, the Selection object methods are sort of difficult to
> work with, and i can't get it to work for the life of me.
> 
> -Najib
> 
_______________________________________________
dev-tech-editor mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-editor

Reply via email to