Changeset 185
- Timestamp:
- 05/04/07 20:45:03 (2 years ago)
- Files:
-
- trunk/common/Editor.js (modified) (1 diff)
- trunk/common/Editor/Test.js (modified) (1 diff)
- trunk/common/Editor/Toolbar.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/common/Editor.js
r183 r185 43 43 arguments.callee.applySuper( this, arguments ); 44 44 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 ); 46 46 this.addComponent( this.iframe ); 47 47 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 ); 49 49 this.addComponent( this.textarea ); 50 50 51 this.toolbar = null; 51 this.toolbar = new this.constructor.Toolbar( this.element.id + "-toolbar", this ); 52 this.addComponent( this.toolbar ); 52 53 }, 53 54 trunk/common/Editor/Test.js
r183 r185 16 16 this.editor = new Editor( "editor" ); 17 17 this.addComponent( this.editor ); 18 this.editorToolbar = new Editor.Toolbar( "editor-toolbar" );19 this.addComponent( this.editorToolbar );20 this.editorToolbar.setEditor( this.editor );21 18 }, 22 19 trunk/common/Editor/Toolbar.js
r183 r185 11 11 12 12 Editor.Toolbar = new Class( Component, { 13 14 13 CLASSNAME_ROOT: "editor-state-", 15 14 16 15 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 ) { 22 17 arguments.callee.applySuper( this, arguments ); 18 this.editor = editor; 23 19 this.element.unselectable = "on"; 24 20 }, 25 21 26 22 27 /**28 * class: <code>Editor.Toolbar</code><br/>29 * @param editor <code>Editor</code> The editor controlled by this object. Note that this could easily30 * 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 */41 23 destroyObject: function() { 42 24 this.editor = null; … … 45 27 46 28 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 */ 62 30 63 31 eventMouseDown: function( event ) { 64 if( !this.editor )65 return;66 32 event.stop(); 67 33 }, 68 34 69 35 70 /**71 * class: <code>Editor.Toolbar</code><br/>72 * Listens to application-specific or application-enhanced native commands73 * (such as <code>insertLink</code>), routes native commands and ensures that74 * the toolbar button highlighting is updated.75 * @param event <code>Event</code> A prepared event object76 * @return boolean The result of <code>event.stop()</code>77 */78 36 eventClick: function( event ) { 79 if( !this.editor )80 return;81 37 var command = this.getMouseEventCommand( event ); 82 38 if( command ) {
