Announcement

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

#1 2006-03-08 13:20:20

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

Registering button for multiple DOM context nodes

Hi guys,

i'm trying to figure out if it's possible to register a button for 2 different type of context nodes.
I'm rewriting the TableOperations plugin and am trying to add the possibility to add table header elements.

I want to use the properties popup for both the th's and td's.

The registerButton documentation shows:

 * 2. config.registerButton({
 *      id       : "my-hilite",      // the ID of your button
 *      tooltip  : "Hilite text",    // the tooltip
 *      image    : "my-hilite.gif",  // image to be displayed in the toolbar
 *      textMode : false,            // disabled in text mode
 *      action   : function(editor) { // called when the button is clicked
 *                   editor.surroundHTML('<span class="hilite">', '</span>');
 *                 },
 *      context  : "p"               // will be disabled if outside a <p> element
 *    });

and my code looks like:

      var id = "ATO-" + btn[0];
      cfg.registerButton(id, HTMLArea._lc(btn[2], "AdvancedTableOperations"), editor.imgURL(btn[0] + ".gif", "AdvancedTableOperations"), false,
      function(editor, id) 
      {
        self.buttonPress(editor, id);
      }, btn[1]);

In the code above the btn[1] is the context node which is initialized with:

  ["cell-prop",          "td", "Cell properties"]

I tried to do something like:

  ["cell-prop",          "td,th", "Cell properties"]
  or 
  ["cell-prop",          "td|th", "Cell properties"]

But both were without succes. Can somebody help me out?

Offline

#2 2006-03-12 18:37:26

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

Re: Registering button for multiple DOM context nodes

Oh well I figured it out. If you would like to have it inside the codebase please let me know.
I made it so that you are now able to attach a button to multiple context nodes by using the | character.

I also started working on the TableOperations to support TH elements instead of just TD's. I've got it working, but want to test it a little more.


Ciao!

Offline

Board footer

Powered by FluxBB