Announcement

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

#1 2011-11-06 01:58:33

KMH
New member
Registered: 2011-08-19
Posts: 6

Show/Hide Panels

I have an editor with both a left and a right panel and I wanted to give users an option to hide them if the actual HTML area got to narrow to really use (Slight modification of the code in this post)

  // Add a button to toggle the panels.
   xinha_config.registerButton({
     id       : "panels",
     tooltip  : "Toggle Panels",
     image    : _editor_url + "plugins/PanelToggle/img/panels.gif",
     textMode : false,
     action   : function(editor) { editor._togglePanels(editor); }
   });
   xinha_config.toolbar[1].splice(1, 0, "separator");
   xinha_config.toolbar[1].splice(1, 0, "panels");
   // the button action function code
    Xinha.prototype._togglePanels = function(editor) {
     if (editor._panelsVisible == true) {
       editor.hidePanels(['right']);
       editor.hidePanels(['left']);
       editor._panelsVisible = false;
     } else {
       editor.showPanels(['right']);
       editor.showPanels(['left']);
       editor._panelsVisible = true;
     }
   };
   // initial visibility setting
   Xinha.prototype._panelsVisible = true;

This goes in the config file.  I created a "PanelToggle" plugin folder that only has the button image in it.  You could point it to a button image anywhere you want though.

Offline

Board footer

Powered by FluxBB