You are not logged in.
Pages: 1
Does anybody know if you can use one toolbar for multiple area's?
I guess there are more people that would like this and would have thought of that?
Offline
Yes it is possible, I've got it working. You need to re-write a few (about 4 or 5) functions in htmlarea.js, but it works a treat. I would be interested to know if anyone else has done it too.
BTW, I love Xinha - I also use FCK and find Xinha so much easier to customize and understand. Cheers to the developers for such a great piece of software.
Offline
I've made an extra-textarea to edit
there are a lot of paragraphs - but only one (with checkbox) is in the above texarea - the other are in normal text or hidden fields
all you need is a function edit (onclick()) with xinha_editors['area_id'].setHTML() and a function save with
var $y=xinha_editors['area_id'].getHTML(); $y=$y.replace("\n"," ",$y); (Input tags don't like \n)
Offline
Um, I think it took me a lot more than that to create multiple editable areas with one toolbar. The way I have it set up is the toolbar at the top, then the normal website (I'm using it in a cms system) with certain parts of the page they can edit and other bits they can't (like the menus).
So I have multiple iframes in the page.
To do this I needed to the js edit and save as wilbur says, but I also needed to re-write the init functions so that only one toolbar is created. Then each iframe is created and a reference to it stored in the editor class.
I also needed to mod the event handlers so that they update the _iframe, _textarea and _doc pointers to use the correct text area before doing any editing.
Oh and I changed the activate and deactivate functions so the toolbar remains on, but only the iframes were deactivated when you wanted to edit a different iframe. - so only one has desginmode='on' set at any time.
Or have I got a bit carried away and done things the hard way?
I did look at ways to do it which would be backward compatible with xinha, but couldn't figure that out. So when xinha reaches v1.0 I will have to go and make all the changes again..... Would be great to know if there was an easier way to do it.
Offline
You might be able to do it as a plugin. Just put all the modified functions into a plugin that overwrites the original ones. That's essentially what I did with the GetHtml plugin. In this case it sounds like it might be a pretty big plugin, but it ought to work.
Offline
Thanks, I'll look into it (Could be a while though as I'm not short of things to do).
One of the biggest issues I had was with the table layout and panels / toolbar / iframe sizing. I got around that by disabling the relevant JS and putting the layout into the html source. Once I've worked bit more with the code I should be able to see an easy way to do it in JS.
I did also write a nice little mod which resizes the iframe height as you type to fit the content without scrollbars. That could be a good plugin too.
You might be able to do it as a plugin. Just put all the modified functions into a plugin that overwrites the original ones. That's essentially what I did with the GetHtml plugin. In this case it sounds like it might be a pretty big plugin, but it ought to work.
Offline
Ok, I have started to do a plugin which will do this - I'm planning on doing it by configuring Xinha to create multiple iframes within the document for each editable area and overload all the functions which I listed in the previous post. Unless anybody has a better idea :-
There is a ticket #110 which suggests the alternative approach of doing it by adding extra tags to the html and detecting whether you are in an editable region of the page when you try to change things. I don't really have time to test it though - I'm doing this during my lunch breaks so any time saving pointers are very welcome.
Offline
Wow i've been gone for a while, but thanks for the great replies! I'll look at your ticket soon.
Offline
Pages: 1