You are not logged in.
I've loaded the findreplace plugin but I want to move the icon as defined by my custom config:
["inserttable","toggleborders","separator","codebox","FR-findreplace"]
however, that only duplicates the icon and does not get rid of the one to the left of format block. How do I customize the location?
Thanks,
Will
Offline
The button is inserted by the plugin itself, so you adding an extra button doesnt really help you very much. Look at my post here :
http://xinha.gogo.co.nz/punbb/viewtopic.php?id=185
If you have any problems adopting the code I might be able to have a look at it for you.
Offline
thanks man.
I was able to hack the findreplace.js and delete all the lines they had with this
var joincfg = cfg.toolbar[0].join("|");
then i just call "FR-replace" button where I wanted in the config file.
Last edited by willeffects (2005-05-02 23:43:11)
Offline
I couldnt seem to do the same procedure for spell-checker.js , anyone know what I need to delete in that file?
Offline
an idea:
the plugins should only add their button if it doesn't yet exist in the toolbar!
so you can add the FR-replace - button where you need it and the plugin will use the button.
if you don't add the FR-replace to cfg.toolbar the plugin will do it for you.
all plugins would have to be rewritten, perhaps a general function would be needed.
Niko
Offline
that works i think
Offline
an idea:
the plugins should only add their button if it doesn't yet exist in the toolbar!
so you can add the FR-replace - button where you need it and the plugin will use the button.
if you don't add the FR-replace to cfg.toolbar the plugin will do it for you.all plugins would have to be rewritten, perhaps a general function would be needed.
To create a general function would be great, since the different plugins uses different
approaches...
I would think the function should :
- Check if button already exist, and replace
- If not, search the button array and place button infront or after
- If all fails, add the button cowardly at the end or beginning.
I might have forgotten something, but I would think this sounds like a correct way.
Could be called like :
PlaceTheButton(buttonName,potentialReplaceNameofOtherBtn,nameOfSearchBtn,[before/after]);
Using all the parameters every time would make it very bulletproof, and easy for the
logif for the plugins. The most important thing is that the function is optimized and fast, that
it doesnt use alot of CPU cycles. But I guess scanning the button array doesnt use any CPU
anyways, and Im just not that familiar with JS and therefore is extra carefull, hehe.
Just an idea,
Offline
yep, exactly like that!
but do we really need the 2nd parameter? (potentialReplaceNameofOtherBtn)
imho it would be enough to use just the first one!
...would you create a ticket for that? or would you even start coding
Niko
Offline
Ill create a ticket for that and I might try coding it, but my lack of really understanding the JS and the way things are buildt up Ill probably end up with a sollution that works, but could have been done much smarter. But as mentioned, I might try something later tonight,
regarding the second parameter I think we really do, correct me if Im wrong. Say I create a new plugin with the name "MyPlugin".
I would place the button like this as an example:
PlaceTheButton('myplugin','insertimage','before');
The pseudo logic applied would be :
We check if another button with the name myplugin exists and replace it, return true
If true; end;
If false:
We check if we can find the button insertimage, return true
If true:
Insert myplugin button before, end
If false:
Insert button at the beginning of the button array, end
So as far as I can see we do need the second parameter to make this function flexible. I usually dont
config the button array, I modify the main .js file (I know, dumb). The most important is to be flexible in
my opinion.
Offline
yep, thats it,
start coding!
(learning by doing - or try 'n error - however you like to call it)
but the function should not be too difficult i guess...
you might want to add this function in htmlarea.js:
HTMLArea.Config.prototype.addButton = function(id, where, position) {
}
...and it should be possible that where is null so we can insert a button just at the end/beginning of the toolbar
perhaps it would be an idea to allow for the 2nd parameter an array - so the function tries to find every items in this array and stops at the first found.
Niko
Offline
While you are at it, how about support for adding a linebreak as well?
Offline