Announcement

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

#1 2007-11-26 11:53:09

AtmosJan
New member
Registered: 2007-11-26
Posts: 2

Execute Xinha command from other HTML elements

Hey

I've searched the documentation for some time, but cannet seem to find a solution to this rather simple question:

As the headline - tries to - explain: I'm trying to execute commands (for instance to make the text bold) from another HTML element on my page. But how is that done? I'm hiding the entire toolbar and want to have my own buttons as editor. Is there any way to do that?

Many thanks in advance. smile

/Jan

Offline

#2 2007-11-26 19:28:31

ray
Xinha Administrator
From: Germany
Registered: 2005-03-23
Posts: 521
Website

Re: Execute Xinha command from other HTML elements

var editor = xinha_editors.idOfYourTextarea; //first, you must get a reference to the object that represents the editor you want to perform commands on

Replace idOfYourTextarea with the according id of your textarea. This assumes that you use the xinha_editors array, as show in the NewbieGuide

var toolbar = editor._toolbarObjects;  // this object contains all the button objects, referenced by a rather arbitrary id
 
toolbar.bold.cmd(); // call the actual button command;  obviously you need the id of the button

Get Firebug and click yourself through the DOM to access the id's of the buttons, and get an overview what's going on inside all these objects

Have fun smile

Offline

#3 2007-11-28 08:35:45

AtmosJan
New member
Registered: 2007-11-26
Posts: 2

Re: Execute Xinha command from other HTML elements

Thanks for the answer.

Finally got it to work, but not quite the way you described big_smile

It seems that I dont need to point to the actual buttons id's. It's perfectly all right to call the commands on the editor it self. Like this:

xinha_editors["textarea" + sId].execCommand("bold");

Right?

/Jan

Offline

#4 2007-11-28 12:06:45

ray
Xinha Administrator
From: Germany
Registered: 2005-03-23
Posts: 521
Website

Re: Execute Xinha command from other HTML elements

Yes of course you are right as long as you don't want to use plugins

Offline

Board footer

Powered by FluxBB