Changeset 185

Show
Ignore:
Timestamp:
05/04/07 20:45:03 (2 years ago)
Author:
ydnar
Message:

bugid:47825; toolbar, iframe and textarea are now initialized based on DOM ID instead of position or separately (in the case of toolbar)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/common/Editor.js

    r183 r185  
    4343        arguments.callee.applySuper( this, arguments ); 
    4444         
    45         this.iframe = new this.constructor.Iframe( this.element.getElementsByTagName( "iframe" )[ 0 ], this ); 
     45        this.iframe = new this.constructor.Iframe( this.element.id + "-iframe", this ); 
    4646        this.addComponent( this.iframe ); 
    4747 
    48         this.textarea = new this.constructor.Textarea( this.element.getElementsByTagName( "textarea" )[ 0 ], this ); 
     48        this.textarea = new this.constructor.Textarea( this.element.id + "-textarea", this ); 
    4949        this.addComponent( this.textarea ); 
    5050         
    51         this.toolbar = null; 
     51        this.toolbar = new this.constructor.Toolbar( this.element.id + "-toolbar", this ); 
     52        this.addComponent( this.toolbar ); 
    5253    }, 
    5354     
  • trunk/common/Editor/Test.js

    r183 r185  
    1616        this.editor = new Editor( "editor" ); 
    1717        this.addComponent( this.editor ); 
    18         this.editorToolbar = new Editor.Toolbar( "editor-toolbar" ); 
    19         this.addComponent( this.editorToolbar ); 
    20         this.editorToolbar.setEditor( this.editor ); 
    2118    }, 
    2219     
  • trunk/common/Editor/Toolbar.js

    r183 r185  
    1111 
    1212Editor.Toolbar = new Class( Component, { 
    13  
    1413    CLASSNAME_ROOT: "editor-state-",  
    1514 
    1615 
    17     /** 
    18      * class: <code>Editor.Toolbar</code><br/> 
    19      * @param element <code>Node</code>  The dom object for the textarea. 
    20      */ 
    21     initObject: function( element ) { 
     16    initObject: function( element, editor ) { 
    2217        arguments.callee.applySuper( this, arguments ); 
     18        this.editor = editor; 
    2319        this.element.unselectable = "on"; 
    2420    }, 
    2521     
    2622 
    27     /** 
    28      * class: <code>Editor.Toolbar</code><br/>  
    29      * @param editor <code>Editor</code> The editor controlled by this object. Note that this could easily 
    30      * be a collection of editors.  The editor may also update this object with state information.  
    31      */ 
    32     setEditor: function( editor ) { 
    33         this.editor = editor; 
    34     }, 
    35  
    36  
    37     /** 
    38      * class: <code>Editor.Toolbar</code><br/> 
    39      * Remove or null dom references. 
    40      */ 
    4123    destroyObject: function() { 
    4224        this.editor = null; 
     
    4527 
    4628 
    47     /* events */ 
    48  
    49     /** 
    50      * class: <code>Editor.Toolbar</code><br/> 
    51      * Adjust to a changed screen size. 
    52      * @param event  <code>Event</code> A prepared event object. 
    53      */ 
    54     reflow: function( event ) { 
    55         arguments.callee.applySuper( this, arguments ); 
    56         if( !this.editor ) 
    57             DOM.addClassName( this.element, "disabled" ); 
    58         else 
    59             DOM.removeClassName( this.element, "disabled" ); 
    60     }, 
    61      
     29    /* events */     
    6230     
    6331    eventMouseDown: function( event ) { 
    64         if( !this.editor ) 
    65             return; 
    6632        event.stop(); 
    6733    }, 
    6834 
    6935     
    70     /** 
    71      * class: <code>Editor.Toolbar</code><br/> 
    72      * Listens to application-specific or application-enhanced native commands  
    73      * (such as <code>insertLink</code>), routes native commands and ensures that 
    74      * the toolbar button highlighting is updated. 
    75      * @param event  <code>Event</code> A prepared event object  
    76      * @return boolean  The result of <code>event.stop()</code> 
    77      */ 
    7836    eventClick: function( event ) { 
    79         if( !this.editor ) 
    80             return; 
    8137        var command = this.getMouseEventCommand( event ); 
    8238        if( command ) {