Announcement

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

#1 2006-03-31 10:17:34

Mousy
Xinha Community Member
From: Amsterdam, Netherlands
Registered: 2006-02-21
Posts: 10

One toolbar, multiple areas

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

#2 2006-04-04 08:52:57

steveo125
Xinha Community Member
Registered: 2006-04-04
Posts: 24

Re: One toolbar, multiple areas

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

#3 2006-04-04 09:33:29

wilbur
New member
Registered: 2006-04-03
Posts: 1

Re: One toolbar, multiple areas

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

#4 2006-04-04 12:13:33

steveo125
Xinha Community Member
Registered: 2006-04-04
Posts: 24

Re: One toolbar, multiple areas

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

#5 2006-04-04 14:19:34

wymsy
Xinha Community Member
From: Massachusetts, USA
Registered: 2005-04-01
Posts: 44
Website

Re: One toolbar, multiple areas

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

#6 2006-04-05 06:23:59

steveo125
Xinha Community Member
Registered: 2006-04-04
Posts: 24

Re: One toolbar, multiple areas

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.

wymsy wrote:

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

#7 2006-04-10 09:14:29

steveo125
Xinha Community Member
Registered: 2006-04-04
Posts: 24

Re: One toolbar, multiple areas

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

#8 2006-05-11 11:47:19

Mousy
Xinha Community Member
From: Amsterdam, Netherlands
Registered: 2006-02-21
Posts: 10

Re: One toolbar, multiple areas

Wow i've been gone for a while, but thanks for the great replies! I'll look at your ticket soon.

Offline

Board footer

Powered by FluxBB