Announcement

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

#1 2005-03-10 07:19:19

fstuurman
New member
Registered: 2005-03-10
Posts: 6
Website

toolbar question

Hi,
I am trying to move some icons of plugins speciually for my cms onto the second or third
toolbar. In htmlarea3 this could be done by:

editor.config.toolbar[3].push("separator", "sas-image", "sas-link" , "anchor-link");

but the icons end up on the first toolbar at the end.

Do I have to use a different method?
Thanks and kind regards Fred Stuurman

Offline

#2 2005-03-11 00:15:36

gogo
Xinha Leader
From: New Zealand
Registered: 2005-02-11
Posts: 1,015
Website

Re: toolbar question

fstuurman wrote:

Hi,
I am trying to move some icons of plugins speciually for my cms onto the second or third
toolbar. In htmlarea3 this could be done by:

editor.config.toolbar[3].push("separator", "sas-image", "sas-link" , "anchor-link");

but the icons end up on the first toolbar at the end.

Do I have to use a different method?
Thanks and kind regards Fred Stuurman

It's tricky at the moment, basically for sme unknown reason, back before I had even released the htmlarea-fork, let alone Xinha, I changes the toolbar to require explicit "linebreak" items to break lines in the toolbar.  I don't know why I did it, and I regret doing it because it really isn't a good idea, but I don't want to change it back just yet as the whole toolbar thing needs a rework anyway to make it easier for plugins to put stuff in sensible places.

For now, best if you define your own toolbar in the configuration object, see htmlarea.js.


James Sleeman

Offline

#3 2005-03-11 13:41:50

akaEdge
Xinha Community Member
From: London
Registered: 2005-03-05
Posts: 16

Re: toolbar question

Basically the structure of the toolbar has changed since htmlArea it now looks like this:

  this.toolbar =
  [
    ["popupeditor","separator"],
    ["formatblock","fontname","fontsize","bold","italic","underline","strikethrough","separator"],
    ["forecolor","hilitecolor","textindicator","separator"],
    ["subscript","superscript"],
    ["linebreak","justifyleft","justifycenter","justifyright","justifyfull","separator"],
    ["insertorderedlist","insertunorderedlist","outdent","indent","separator"],
    ["inserthorizontalrule","createlink","insertimage","inserttable","separator"],
    ["undo","redo"], (HTMLArea.is_gecko ? [] : ["cut","copy","paste"]),["separator"],
    ["killword","removeformat","toggleborders","lefttoright", "righttoleft", "separator","htmlmode","about"]
  ];

You may notice that there are more square brackets now.

Effectively when you write

editor.config.toolbar[3].push("separator", "sas-image", "sas-link" , "anchor-link");

You are asking to insert the separator and your three buttons after the fourth set of square brackets (zero based numbering) This means it is after the subscript superscript buttons and before the line break in the next set - this means it is at the end of the first line!

If you change the number 3 in your push statement you can move your button around *almost* where ever you like. I say almost, because you many want to put a button in between say the subscript and superscript buttons, and to do that you will need to alter your push statement slightly to the following:

editor.config.toolbar[3] = ["subscript", "sas-image", "superscript"];

akaEdge

Offline

#4 2005-03-16 05:06:17

fstuurman
New member
Registered: 2005-03-10
Posts: 6
Website

Re: toolbar question

Thanks,
That helped.
Kind regards Fred

Offline

#5 2010-11-17 10:38:48

zerok
Xinha Community Member
Registered: 2010-10-21
Posts: 24

Re: toolbar question

I see the DefinitionList plugin
& see

cfg.toolbar.push(toolbar);

But I want to insert this buttons near  ul & ol lists

How can I do it ?

Last edited by zerok (2010-11-17 13:25:29)

Offline

#6 2010-11-17 12:10:01

ejucovy
Xinha Community Member
From: NY
Registered: 2010-11-15
Posts: 35
Website

Re: toolbar question

Hmm .. I don't see any obvious good way.  I think the toolbar system might need an overhaul to make this easier.  (But correct me if I'm wrong and it's easier than it looks.)

If you're willing to hack your copy of the code, you can do this:

1) comment out the "cfg.toolbar.push(toolbar);" line in DefinitionList, so that the plugin doesn't insert the buttons itself
2) in your config, explicitly add the buttons "dl", "dd" and "dt" where you want them using the xinha_config.toolbar parameter.  For example (basing this off examples/XinhaConfig.js),

  xinha_config.toolbar =                                                                                                                                                                     
  [                                                                                                                                                                                         
    ["popupeditor"],                                                                                                                                                                         
    ["separator","formatblock","fontname","fontsize","bold","italic","underline","strikethrough"],                                                                                           
    ["separator","forecolor","hilitecolor","textindicator"],                                                                                                                                 
    ["separator","subscript","superscript"],                                                                                                                                                 
    ["linebreak","separator","justifyleft","justifycenter","justifyright","justifyfull"],                                                                                                   
    ["linebreak","insertorderedlist","insertunorderedlist", "dl", "dt", "dd"],
  ];

Offline

#7 2010-11-17 13:20:13

zerok
Xinha Community Member
Registered: 2010-10-21
Posts: 24

Re: toolbar question

can't find where comment pushing buttons in DefinitionList plugin.

I tried some :

      cfg.registerButton(id, this._lc(btn[1]), editor.imgURL("ed_" + btn[0] + ".gif", "DefinitionList"), false,
             function(editor, id) {
               // dispatch button press event
               self.buttonPress(editor, id);
             });
      toolbar.push(id);

&

  cfg.toolbar.push(toolbar);

but I have two variant of buttons in toolbar
the first one  - that I push in config - this buttons don't react on over focus of editor (they are equally off focus & on focus)
the second variant - is after button "about" in toolbar & it react on\off focus

Offline

#8 2010-11-17 14:04:59

ejucovy
Xinha Community Member
From: NY
Registered: 2010-11-15
Posts: 35
Website

Re: toolbar question

You should comment out the line "cfg.toolbar.push(toolbar);" in DefinitionList.js, first of all.

Then, you need to add it to your own xinha config -- where you set up the Xinha editor for the page.  What does your Xinha config Javascript look like?

Offline

#9 2010-11-17 15:00:48

zerok
Xinha Community Member
Registered: 2010-10-21
Posts: 24

Re: toolbar question

I use some changed examples/XinhaConfig.js

remove stilist run plugin & comment

//   xinha_config.stylistLoadStylesheet(_editor_url + "examples/files/stylist.css");

add

   'DefinitionList',
&

   'SuperClean',

that all

so all plugins

  xinha_plugins = xinha_plugins ? xinha_plugins :
  [
   'DefinitionList',
   'CharacterMap',
   'ContextMenu',
   'InsertNote',
   'SmartReplace',
   'ExtendedFileManager',
   'Linker',
   'SuperClean',
   'TableOperations',
   'UnFormat'
  ];

  xinha_config.toolbar =
  [
    ["popupeditor"],
    ["separator","formatblock","fontname","fontsize","bold","italic","underline","strikethrough"],
    ["separator","forecolor","hilitecolor","textindicator"],
    ["separator","subscript","superscript"],
    ["linebreak","separator","justifyleft","justifycenter","justifyright","justifyfull"],
    ["separator","insertorderedlist","insertunorderedlist", "dl", "dd", "dt", "outdent","indent"],
    ["separator","inserthorizontalrule","createlink","insertimage","inserttable"],
    ["linebreak","separator","undo","redo","selectall","print"], (Xinha.is_gecko ? [] : ["cut","copy","paste","overwrite","saveas"]),
    ["separator","killword","clearfonts","removeformat","toggleborders","splitblock","lefttoright", "righttoleft"],
    ["separator","htmlmode","showhelp","about"]
  ];

Last edited by zerok (2010-11-17 15:03:14)

Offline

#10 2010-11-17 15:07:01

ejucovy
Xinha Community Member
From: NY
Registered: 2010-11-15
Posts: 35
Website

Re: toolbar question

Hmm, that configuration should work.  You should have only one copy of the dl/dd/dt buttons, as long as you removed the right line from DefinitionList.js

Maybe your browser is caching an old copy of DefinitionList.js?  Can you clear the cache or try it in a different browser?

Offline

#11 2010-11-17 15:09:11

zerok
Xinha Community Member
Registered: 2010-10-21
Posts: 24

Re: toolbar question

one moment, hm. I try

Offline

#12 2010-11-17 15:13:01

zerok
Xinha Community Member
Registered: 2010-10-21
Posts: 24

Re: toolbar question

WOW it works! it is realy cache! Thanx

Offline

#13 2010-11-17 18:34:32

gogo
Xinha Leader
From: New Zealand
Registered: 2005-02-11
Posts: 1,015
Website

Re: toolbar question

ejcovey: See the addToolbarElement method in Xinha.js, DefinitionList doesn't use it (it just pushes onto the toolbar), but could, and probably should insert it's buttons somewhere around the standard list buttons.

In it's simplest form it takes as three parameters
  1: the button id (previously registered with registerButton)
  2: the id of the button you want to insert this button relative to
  3: one of, -1 for "insert before", 0 for "replace" and 1 for "insert after"


James Sleeman

Offline

#14 2010-11-17 19:52:42

zerok
Xinha Community Member
Registered: 2010-10-21
Posts: 24

Re: toolbar question

gogo, DefinitionList is a plugin of ejcovey ?

Offline

#15 2010-11-17 19:55:10

gogo
Xinha Leader
From: New Zealand
Registered: 2005-02-11
Posts: 1,015
Website

Re: toolbar question

ejucovy is a new and welcome developer to Xinha :-)


James Sleeman

Offline

#16 2010-11-17 20:37:42

ejucovy
Xinha Community Member
From: NY
Registered: 2010-11-15
Posts: 35
Website

Re: toolbar question

zerok, no, DefinitionList isn't my plugin, i just happened to know it was there smile

gogo, thanks for the tip, and the welcome! - i filed the toolbar reordering idea at http://trac.xinha.org/ticket/1561, and i'll try to commit the fix soon.

Offline

#17 2010-11-18 12:29:58

ejucovy
Xinha Community Member
From: NY
Registered: 2010-11-15
Posts: 35
Website

Re: toolbar question

I made the changes to the DefinitionList plugin and closed that ticket.  zerok, if you want to use a xinha trunk checkout, you can remove your local changes now smile

Offline

#18 2010-11-18 13:52:56

zerok
Xinha Community Member
Registered: 2010-10-21
Posts: 24

Re: toolbar question

how can I can use trunk checkout ?

Offline

#19 2010-11-18 17:10:20

zerok
Xinha Community Member
Registered: 2010-10-21
Posts: 24

Re: toolbar question

I find http://svn.xinha.org/trunk/ and make checkout
I have some difference - I havent DoubleClick plugin there. (I compare  xinha096 & checkout  version)

Offline

#20 2010-11-18 17:25:44

ejucovy
Xinha Community Member
From: NY
Registered: 2010-11-15
Posts: 35
Website

Re: toolbar question

zerok, see http://trac.xinha.org/wiki/Documentatio … tedPlugins

* DoubleClick will still work (you don't need to make any changes)
* but its functionality is now in core instead of a plugin

Offline

Board footer

Powered by FluxBB