Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2009-05-21 14:44:23

Ybuche
New member
Registered: 2009-04-29
Posts: 3

Focus on editor when a web page is loaded

Folks,

Sorry if my english is not very good...

So the problem is : When the page is successfully loaded, the focus isn't on the editor.

I was wondering how i could focus on the editor when a web page is loaded... I tough that xinha_config.autofocus=true would do the job but it's not working in the context i'm using Xinha i guess.

I've been searching in forums and i finally found a way to get it done. Just want to share it with newbies like me in Xinha stuff...

In the config script you call on the web page, just do it :

//Make the editors
xinha_editors=Xinha.makeEditors(xinha_editors,xinha_config,xinha_plugins);

//Use generate instead of Xinha.startEditors (i saw it in a post...)
xinha_editors["ID of the editor"].generate();

//Add this line to declare the function who will be called when the editor is fully loaded (when you can see it in the web page)
xinha_editors["ID of the editor"].whenDocReady(whatToDoWhenEditorIsLoaded);

And then somewhere in the config script, add the function :
function whatToDoWhenEditorIsLoaded() {
    xinha_editors["ID of the editor"].activateEditor();
    xinha_editors["ID of the editor"].focusEditor();
}

Have fun !

Offline

Board footer

Powered by FluxBB