Changeset 8629 for trunk/src/widget

Show
Ignore:
Timestamp:
05/16/07 07:45:46 (20 months ago)
Author:
liucougar
Message:

added an API to make the Editor2Toolbar widget more decoupled with Editor2

Location:
trunk/src/widget
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/widget/Editor2Plugin/DropDownList.js

    r8175 r8629  
    4242 
    4343dojo.declare("dojo.widget.Editor2ToolbarComboItem", dojo.widget.Editor2ToolbarDropDownButton,{ 
    44         // summary: dojo.widget.Editor2ToolbarComboItem provides an external loaded dropdown list 
     44        // summary: dojo.widget.Editor2ToolbarComboItem provides a realonly combobox in the toolbar 
    4545 
    4646        onMouseOver: function(e){ 
     
    6868                if(this._parentToolbar.checkAvailability()){ 
    6969                        var name = e.currentTarget.getAttribute("dropDownItemName"); 
    70                         var curInst = dojo.widget.Editor2Manager.getCurrentInstance(); 
     70                        var curInst = this.getMainComponent(); 
    7171                        if(curInst){ 
    7272                                var _command = curInst.getCommand(this._name); 
     
    143143                dojo.widget.Editor2ToolbarFormatBlockSelect.superclass.refreshState.call(this); 
    144144                if(this._lastState != dojo.widget.Editor2Manager.commandState.Disabled){ 
    145                         var curInst = dojo.widget.Editor2Manager.getCurrentInstance(); 
     145                        var curInst = this.getMainComponent(); 
    146146                        if(curInst){ 
    147147                                var _command = curInst.getCommand(this._name); 
     
    213213                dojo.widget.Editor2ToolbarFontSizeSelect.superclass.refreshState.call(this); 
    214214                if(this._lastState != dojo.widget.Editor2Manager.commandState.Disabled){ 
    215                         var curInst = dojo.widget.Editor2Manager.getCurrentInstance(); 
     215                        var curInst = this.getMainComponent(); 
    216216                        if(curInst){ 
    217217                                var _command = curInst.getCommand(this._name); 
     
    338338        onChange: function(e){ 
    339339                if(this._parentToolbar.checkAvailability()){ 
    340                         var curInst = dojo.widget.Editor2Manager.getCurrentInstance(); 
     340                        var curInst = this.getMainComponent(); 
    341341                        curInst.execCommand('inserthtml',e.target.getAttribute('dojoETDropDownItem'),'inserthtml');//'specialchar' 
    342342                } 
  • trunk/src/widget/Editor2Toolbar.js

    r8139 r8629  
    138138                } 
    139139        }, 
     140        getMainComponent: function(){ 
     141                return dojo.widget.Editor2Manager.getCurrentInstance(); 
     142        }, 
    140143        onMouseOver: function(){ 
    141                 var curInst = dojo.widget.Editor2Manager.getCurrentInstance(); 
     144                var curInst = this.getMainComponent(); 
    142145                if(curInst){ 
    143146                        var _command = curInst.getCommand(this._name); 
     
    160163                        e.preventDefault(); 
    161164                        e.stopPropagation(); 
    162                         var curInst = dojo.widget.Editor2Manager.getCurrentInstance(); 
     165                        var curInst = this.getMainComponent(); 
    163166                        if(curInst){ 
    164167                                var _command = curInst.getCommand(this._name); 
     
    171174        refreshState: function(){ 
    172175                // summary: update the state of the toolbar item 
    173                 var curInst = dojo.widget.Editor2Manager.getCurrentInstance(); 
     176                var curInst = this.getMainComponent(); 
    174177                var em = dojo.widget.Editor2Manager; 
    175178                if(curInst){ 
     
    250253                if(this._parentToolbar.checkAvailability()){ 
    251254                        var sv = this._domNode.value.toLowerCase(); 
    252                         var curInst = dojo.widget.Editor2Manager.getCurrentInstance(); 
     255                        var curInst = this.getMainComponent(); 
    253256                        if(curInst){ 
    254257                                var _command = curInst.getCommand(this._name); 
     
    263266                if(this._domNode){ 
    264267                        dojo.widget.Editor2ToolbarFormatBlockPlainSelect.superclass.refreshState.call(this); 
    265                         var curInst = dojo.widget.Editor2Manager.getCurrentInstance(); 
     268                        var curInst = this.getMainComponent(); 
    266269                        if(curInst){ 
    267270                                var _command = curInst.getCommand(this._name); 
     
    298301 
    299302//              itemNodeType: 'span', //all the items (with attribute dojoETItemName set) defined in the toolbar should be a of this type 
    300  
     303                itemManager: dojo.widget.Editor2ToolbarItemManager, 
    301304                postCreate: function(){ 
    302305                        var i=0,node,nodes = dojo.html.getElementsByClass("dojoEditorToolbarItem", this.domNode/*, this.itemNodeType*/); 
     
    306309                                var itemname = node.getAttribute("dojoETItemName"); 
    307310                                if(itemname){ 
    308                                         var item = dojo.widget.Editor2ToolbarItemManager.getToolbarItem(itemname); 
     311                                        var item = this.itemManager.getToolbarItem(itemname); 
    309312                                        if(item){ 
    310313                                                item.create(node, this);