Announcement

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

#1 2005-04-13 07:11:21

guillaumed
Xinha Administrator
From: Lyon, France
Registered: 2005-02-23
Posts: 85

New multi configuration plugin to whom who are interested..

MultiConfiguration plugin realized : http://www.studiogdo.com/xinha/multi.zip

See result there :  http://www.studiogdo.com/xinha/multi.html

Offline

#2 2005-04-13 14:28:00

mmcw
New member
Registered: 2005-02-19
Posts: 4

Re: New multi configuration plugin to whom who are interested..

Very nice but how to get less options?

Last edited by mmcw (2005-04-13 14:28:17)

Offline

#3 2005-04-14 00:34:19

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

Re: New multi configuration plugin to whom who are interested..

You can't, Guillaume's solution is to progressivly load the plugins, but once loaded they are there for good I believe


James Sleeman

Offline

#4 2005-04-14 04:03:07

adamp
Xinha Pro
Registered: 2005-03-14
Posts: 77

Re: New multi configuration plugin to whom who are interested..

You could surely hide the divs they sit in? The functions may still be loaded, but if they're not visible they can't really be used.

Offline

#5 2005-04-14 09:02:00

gea
New member
Registered: 2005-03-03
Posts: 4

Re: New multi configuration plugin to whom who are interested..

hello guillaumed

thank you very much. this plugin is a absolut must have for me. its an ideal solution, not only if you have
more than one textarea, because you can hide things that you normally dont need.

now i tried to setup a default configuration based on your examples with multiple textareas each with their own configs.
(i suppose you need multiple  configs or you cant extend multiple textarea toolbars independent)

i failed (i think because of my poor javascript experience)
maybe someone could give me a tip.

the problem is in in step5 Part II
without step5 Part II everythink works perfectly:


guenther



<!--areascript-->
   <link rel="stylesheet" href="/content/xinha/examples/full_example.css" />
   <script type="text/javascript">
              _editor_url = "/content/xinha/";
              _editor_lang = "de";
   </script>

   <!-- Load up the actual editor core  from /div/xinha-->
   <script type="text/javascript" src="/content/xinha/htmlarea.js"></script>


  <script type="text/javascript">
    xinha_editors = null;
    xinha_init    = null;
    xinha_plugins = null;


    // This contains the names of textareas we will make into Xinha editors
    xinha_init = xinha_init ? xinha_init : function()
    {

       /** STEP 1
*******************
        * load plugins
        **************/

      xinha_plugins = xinha_plugins ? xinha_plugins :
      [
        'ContextMenu',
        'CharacterMap',
        'DynamicCSS',
        'EnterParagraphs',
        'FullPage',
        'InsertAnchor',
        'ListType',
        'Linker',
        'MultiConfigurations',
        'Stylist',
        'SuperClean',
        'TableOperations'
      ];
      if(!HTMLArea.loadPlugins(xinha_plugins, xinha_init)) return;


       /** STEP 2    Set areaids
****************************************
        * example 'TextArea1','TextArea2'
        ********************************/
      xinha_editors = xinha_editors ? xinha_editors :
      [
        'spalte0','fliesstext1'
      ];


      /** STEP 3
***************************************************************
      * create a default configuration to be used by all editors
      *************************************************************/

      init_config = new HTMLArea.Config();
      init_config.toolbar = [[
        'undo', 'redo', 'separator',
        'copy', 'cut', 'paste', 'separator',
        'formatblock','bold', 'italic', 'underline', 'separator',
        'justifyleft', 'justifycenter', 'justifyright','justifyfull', 'separator',
        'unorderedlist', 'orderedlist', 'separator',
        'outdent', 'indent', 'separator', 'htmlmode']];

      init_config.statusBar = false;
      init_plugins = ['ContextMenu', 'SuperClean', 'MultiConfigurations', 'CharacterMap'];

      init_config.width  = 660;
      init_config.height = 250;

      init_config.formatblock = {
        "&mdash; Absatz &mdash;"  : '',
        "Absatz /h1": 'h1',
        "Absatz /h2": 'h2',
        "Absatz /h3": 'h3',
        "Absatz /h4": 'h4',
        "Absatz /h5": 'h5',
        "Absatz /h6": 'h6',
        "Normaler Absatz /p"   : 'p'
      };


       /** STEP 4
***************************************************************
        * Finally we "start" the editors, this turns the textareas into
        * Xinha editors.
        ************************************************************************/


      xinha_editors = HTMLArea.makeEditors(xinha_editors, init_config, init_plugins);
      HTMLArea.startEditors(xinha_editors);

      // create others configurations
      confs = [{toolbar : [['lefttoright', 'righttoleft', 'separator', 'fontname', 'space', 'fontsize', 'separator', 'strikethrough', 'subscript', 'superscript', 'separator', 'forecolor','hilitecolor', 'inserthorizontalrule', 'separator', 'createlink', 'insertimage', 'inserttable']],
                init    : function(config, editor){
                          },
                plugins : ['InsertAnchor', 'Stylist']},
               {toolbar : [[]],
                init    : function(config){config.statusBar=true;},
                plugins : ['TableOperations']}];
      var multi = new MultiConfigurations.Config(confs, 0);
     
      for (var i in xinha_editors) {
        var editor = xinha_editors[i];
        editor._multi = multi;
      }
    }

   


       /** STEP 5 optional (needed for special configurations of textareas or if you use plugin "MultiConfigurations")
***************************************************************
        * special Config for textareas 2..n
        ************************************************************************/

                     
/***************************************************************
      * create a special configuration to be used by editor fliesstext1
      *******************************************************************/

      init_config.toolbar.fliesstext1 = [[
        'undo', 'redo', 'separator',
        'copy', 'cut', 'paste', 'separator',
        'formatblock','bold', 'italic', 'underline', 'separator',
        'justifyleft', 'justifycenter', 'justifyright','justifyfull', 'separator',
        'unorderedlist', 'orderedlist', 'separator',
        'outdent', 'indent', 'separator', 'htmlmode']];

      init_config.statusBar.fliesstext1 = false;
      init_plugins.fliesstext1 = ['ContextMenu', 'SuperClean', 'MultiConfigurations', 'CharacterMap'];

      init_config.width.fliesstext1  = 660;
      init_config.height.fliesstext1 = 250;

      init_config.formatblock.fliesstext1 = {
        "&mdash; Absatz &mdash;"  : '',
        "Absatz /h1": 'h1',
        "Absatz /h2": 'h2',
        "Absatz /h3": 'h3',
        "Absatz /h4": 'h4',
        "Absatz /h5": 'h5',
        "Absatz /h6": 'h6',
        "Normaler Absatz /p"   : 'p'
      };


      //option css for this textarea
      //init_editors.fliesstext1.config.pageStyle = HTMLArea._geturlcontent('/content/user/vorlagen/xinha_fliesstext1.css');
       

      // create others configurations PartII
      confs.fliesstext1 = [{toolbar.fliesstext1 : [['lefttoright', 'righttoleft', 'separator', 'fontname', 'space', 'fontsize', 'separator', 'strikethrough', 'subscript', 'superscript', 'separator', 'forecolor','hilitecolor', 'inserthorizontalrule', 'separator', 'createlink', 'insertimage', 'inserttable']],
                init.fliesstext1    : function(config, editor){
                          },
                plugins.fliesstext1 : ['InsertAnchor', 'Stylist']},
               {toolbar.fliesstext1 : [[]],
                init.fliesstext1    : function(config){config.statusBar=true;},
                plugins.fliesstext1 : ['TableOperations']}];
      var multi = new MultiConfigurations.Config(confs.fliesstext1, 0);

      for (var i in xinha_editors.fliesstext1) {
        var editor.fliesstext1 = xinha_editors.fliesstext1[i];
        editor._multi.fliesstext1 = multi;
      }


    window.onload = xinha_init;
</script>

Offline

#6 2005-04-16 16:20:15

guillaumed
Xinha Administrator
From: Lyon, France
Registered: 2005-02-23
Posts: 85

Re: New multi configuration plugin to whom who are interested..

Having less options can be done by hidding the div as adamp suggest also, but I'm trying another look.. Anyway it will arrive soon... that's why I haven't done it yet..

Another point is that this plugin which is very close to plugin and xinha initialization shows me (not a very good english sentence, but why everybody doesn't speak french... tongue) a scheduling problem. Due to threading lack of control in Javascript, at several places, to postpone a method after an initialization, the setTimeout is used with an arbitrary time (the better example is in Stylist...) ... But this is not what we should do because you can never control when this will be done.. See tiket 125 and 93...
And also plugins dependency is not enough controled, so you postpone some intialization to another (sometime just for button configuration reasons..).
We should discuss more about formalizing that or the editor will be decorated with a lot of plugin properties and get very difficult to understand when there will be several plugins..

I propose to "force" the plugins to follow specific programming rules as :

All the plugin properties should be defined on the plugin structure and each editor should have one unique array of plugins instance (where the properties can be found and not on the editor)
All plugins must be initialized with the onGenerate and updateToolbar..
Plugin should be able to replace Xinha method (for example the FullPage should be able to overload a part of the initFrame method, the Linker also...)
All plugins should be able to declare their required plugins (the onGenerate and updateToolbar will follow this dependency in calling order)
All the delayed calls should be "centralized" in a kind of scheduler where each plugin can be referenced..

Any opinion?

PS : gea takes me time to have a look and I will answer if I can...

Offline

#7 2005-04-16 16:52:13

guillaumed
Xinha Administrator
From: Lyon, France
Registered: 2005-02-23
Posts: 85

Re: New multi configuration plugin to whom who are interested..

gea,

Seems that your step5 is not inside the xinha_init method... Then not done when it should be..

The way it is done in the example (thanks to gogo???) is brillant (I like this code style) but not easy to understand at first..

Offline

Board footer

Powered by FluxBB