Show
Ignore:
Timestamp:
06/07/08 09:08:53 (4 years ago)
Author:
ray
Message:

update to new dialog plugins: separation of code into several files to reduce loading time

Location:
branches/new-dialogs-merge/modules/InsertTable
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/new-dialogs-merge/modules/InsertTable/insert_table.js

    r1008 r1011  
    3737        var self = this; 
    3838 
    39    editor.config.btnList.inserttable[3] = function() { self.show(); } 
     39        editor.config.btnList.inserttable[3] = function() { self.show(); } 
    4040} 
    4141 
     
    4747InsertTable.prototype.onGenerateOnce = function() 
    4848{ 
    49         this.prepareDialog(); 
    50         this.loadScripts(); 
     49        InsertTable.loadAssets(); 
    5150}; 
    52  
    53 InsertTable.prototype.loadScripts = function() 
     51InsertTable.loadAssets = function() 
    5452{ 
    55   var self = this; 
    56   if(!this.methodsReady) 
    57         { 
    58                 Xinha._getback(_editor_url + 'modules/InsertTable/pluginMethods.js', function(getback) { eval(getback); self.methodsReady = true; }); 
    59                 return; 
    60         } 
     53        var self = InsertTable; 
     54        if (self.loading) return; 
     55        self.loading = true; 
     56        Xinha._getback(_editor_url + 'modules/InsertTable/dialog.html', function(getback) { self.html = getback; self.dialogReady = true; }); 
     57        Xinha._getback(_editor_url + 'modules/InsertTable/pluginMethods.js', function(getback) { eval(getback); self.methodsReady = true; }); 
    6158}; 
    6259 
    6360InsertTable.prototype.onUpdateToolbar = function() 
    6461{  
    65   if (!(this.dialogReady && this.methodsReady)) 
     62  if (!(InsertTable.dialogReady && InsertTable.methodsReady)) 
    6663        { 
    6764          this.editor._toolbarObjects.inserttable.state("enabled", false); 
    6865        } 
     66        else this.onUpdateToolbar = null; 
    6967}; 
    7068 
     
    7472        var editor = this.editor; 
    7573 
    76         if(!this.html) // retrieve the raw dialog contents 
    77         { 
    78                 Xinha._getback(_editor_url + 'modules/InsertTable/dialog.html', function(getback) { self.html = getback; self.prepareDialog(); }); 
    79                 return; 
    80         } 
    81  
    82         // Now we have everything we need, so we can build the dialog. 
    83                  
    84         var dialog = this.dialog = new Xinha.Dialog(editor, this.html, 'Xinha',{width:400}) 
     74        var dialog = this.dialog = new Xinha.Dialog(editor, InsertTable.html, 'Xinha',{width:400}) 
    8575        // Connect the OK and Cancel buttons 
    8676        dialog.getElementById('ok').onclick = function() {self.apply();} 
  • branches/new-dialogs-merge/modules/InsertTable/pluginMethods.js

    r1008 r1011  
    11InsertTable.prototype.show = function(image) 
    22{ 
    3         var editor = this.editor; 
     3  if (!this.dialog) this.prepareDialog(); 
     4 
     5  var editor = this.editor; 
    46 
    57  var values =