Problems changing the toolbar to the rich text editor widget

View: New views
7 Messages — Rating Filter:   Alert me  

Problems changing the toolbar to the rich text editor widget

by totalharmonicdistortion :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I'm not sure if this is the right place to be posting but here it goes
anyway. I'm happy to move this elsewhere.

I'm trying to change the toolbar buttons on the editor widget and I
can't seem to get it working.

I'm creating the widget like this. Nothing fancy.

The toolbar is always rendering the same no matter what I change the
button config too. Am I missing a step?

Thank you.


var myEditor = new YAHOO.widget.SimpleEditor('editor', myconfig);
myEditor.render();


var myconfig = {
     height: '300px',
     dompath: true,
     focusAtStart: true,
     buttons: [
                 { group: 'fontstyle', label: 'Text formatting',
                     buttons: [
                         { type: 'push', label: 'Ctrl + Shift + B',
value: 'bold' },
                         { type: 'push', label: 'Italic CTRL + SHIFT +
I', value: 'italic' },
                         { type: 'push', label: 'Underline CTRL + SHIFT +
U', value: 'underline' },
                         { type: 'push', label: 'Subscript', value:
'subscript', disabled: true },
                         { type: 'push', label: 'Superscript', value:
'superscript', disabled: true },
                         { type: 'color', label: 'Font Color', value:
'forecolor', disabled: true },
                         { type: 'color', label: 'Background Color',
value: 'backcolor', disabled: true },
                         { type: 'color', label: 'Background Color',
value: 'backcolor', disabled: true }
                     ]
                 },
                 { type: 'separator' },
                 { group: 'parastyle', label: 'Paragraph Style',
                     buttons: [
                     { type: 'select', label: 'Normal', value: 'heading',
disabled: true,
                         menu: [
                             { text: 'Normal', value: 'none', checked:
true },
                             { text: 'Header 1', value: 'h1' },
                             { text: 'Header 2', value: 'h2' },
                             { text: 'Header 3', value: 'h3' },
                             { text: 'Header 4', value: 'h4' },
                             { text: 'Header 5', value: 'h5' },
                             { text: 'Header 6', value: 'h6' }
                         ]
                     }
                     ]
                 },
                 { type: 'separator' },
                 { group: 'indentlist', label: 'Indenting and Lists',
                     buttons: [
                         { type: 'push', label: 'Indent', value:
'indent', disabled: true },
                         { type: 'push', label: 'Outdent', value:
'outdent', disabled: true },
                         { type: 'push', label: 'Create an Unordered
List', value: 'insertunorderedlist' },
                         { type: 'push', label: 'Create an Ordered List',
value: 'insertorderedlist' }
                     ]
                 }
             ]};



Re: Problems changing the toolbar to the rich text editor widget

by mattatlamplight :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

As you've pasted your code, myconfig doesn't exist when you start the editor and render() it - you only define myconfig afterwards.  So the editor's not going to know anything about the changes you want to make.

Put the var myconfig = ... before the call to
> var myEditor = new YAHOO.widget.SimpleEditor('editor', myconfig);
> myEditor.render();

and it should work.

Matt

--- In ydn-javascript@..., "totalharmonicdistortion" <totalharmonicdistortion@...> wrote:

>
> Hi,
>
> I'm not sure if this is the right place to be posting but here it goes
> anyway. I'm happy to move this elsewhere.
>
> I'm trying to change the toolbar buttons on the editor widget and I
> can't seem to get it working.
>
> I'm creating the widget like this. Nothing fancy.
>
> The toolbar is always rendering the same no matter what I change the
> button config too. Am I missing a step?
>
> Thank you.
>
>
> var myEditor = new YAHOO.widget.SimpleEditor('editor', myconfig);
> myEditor.render();
>
>
> var myconfig = {
>      height: '300px',
>      dompath: true,
>      focusAtStart: true,
>      buttons: [
>                  { group: 'fontstyle', label: 'Text formatting',
>                      buttons: [
>                          { type: 'push', label: 'Ctrl + Shift + B',
> value: 'bold' },
>                          { type: 'push', label: 'Italic CTRL + SHIFT +
> I', value: 'italic' },
>                          { type: 'push', label: 'Underline CTRL + SHIFT +
> U', value: 'underline' },
>                          { type: 'push', label: 'Subscript', value:
> 'subscript', disabled: true },
>                          { type: 'push', label: 'Superscript', value:
> 'superscript', disabled: true },
>                          { type: 'color', label: 'Font Color', value:
> 'forecolor', disabled: true },
>                          { type: 'color', label: 'Background Color',
> value: 'backcolor', disabled: true },
>                          { type: 'color', label: 'Background Color',
> value: 'backcolor', disabled: true }
>                      ]
>                  },
>                  { type: 'separator' },
>                  { group: 'parastyle', label: 'Paragraph Style',
>                      buttons: [
>                      { type: 'select', label: 'Normal', value: 'heading',
> disabled: true,
>                          menu: [
>                              { text: 'Normal', value: 'none', checked:
> true },
>                              { text: 'Header 1', value: 'h1' },
>                              { text: 'Header 2', value: 'h2' },
>                              { text: 'Header 3', value: 'h3' },
>                              { text: 'Header 4', value: 'h4' },
>                              { text: 'Header 5', value: 'h5' },
>                              { text: 'Header 6', value: 'h6' }
>                          ]
>                      }
>                      ]
>                  },
>                  { type: 'separator' },
>                  { group: 'indentlist', label: 'Indenting and Lists',
>                      buttons: [
>                          { type: 'push', label: 'Indent', value:
> 'indent', disabled: true },
>                          { type: 'push', label: 'Outdent', value:
> 'outdent', disabled: true },
>                          { type: 'push', label: 'Create an Unordered
> List', value: 'insertunorderedlist' },
>                          { type: 'push', label: 'Create an Ordered List',
> value: 'insertorderedlist' }
>                      ]
>                  }
>              ]};
>



Re: Problems changing the toolbar to the rich text editor widget

by totalharmonicdistortion :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Matt,

I've tried that but with no luck. Here is my code exactly as it appears.

$(function() {

         var myconfig = {
             height: '300px',
             dompath: true,
             focusAtStart: true,
             buttons: [
                 { group: 'fontstyle', label: 'Text formatting',
                     buttons: [
                         { type: 'push', label: 'Ctrl + Shift + B',
value: 'bold' },
                         { type: 'push', label: 'Italic CTRL + SHIFT +
I', value: 'italic' },
                         { type: 'push', label: 'Underline CTRL + SHIFT +
U', value: 'underline' },
                         { type: 'push', label: 'Subscript', value:
'subscript', disabled: true },
                         { type: 'push', label: 'Superscript', value:
'superscript', disabled: true },
                         { type: 'color', label: 'Font Color', value:
'forecolor', disabled: true },
                         { type: 'color', label: 'Background Color',
value: 'backcolor', disabled: true },
                         { type: 'color', label: 'Background Color',
value: 'backcolor', disabled: true }
                     ]
                 },
                 { type: 'separator' },
                 { group: 'parastyle', label: 'Paragraph Style',
                     buttons: [
                     { type: 'select', label: 'Normal', value: 'heading',
disabled: true,
                         menu: [
                             { text: 'Normal', value: 'none', checked:
true },
                             { text: 'Header 1', value: 'h1' },
                             { text: 'Header 2', value: 'h2' },
                             { text: 'Header 3', value: 'h3' },
                             { text: 'Header 4', value: 'h4' },
                             { text: 'Header 5', value: 'h5' },
                             { text: 'Header 6', value: 'h6' }
                         ]
                     }
                     ]
                 },
                 { type: 'separator' },
                 { group: 'indentlist', label: 'Indenting and Lists',
                     buttons: [
                         { type: 'push', label: 'Indent', value:
'indent', disabled: true },
                         { type: 'push', label: 'Outdent', value:
'outdent', disabled: true },
                         { type: 'push', label: 'Create an Unordered
List', value: 'insertunorderedlist' },
                         { type: 'push', label: 'Create an Ordered List',
value: 'insertorderedlist' }
                     ]
                 }
             ]
         };
             var Dom = YAHOO.util.Dom,
                 Event = YAHOO.util.Event;

             YAHOO.log('Create the Editor..', 'info', 'example');
             var myEditor = new YAHOO.widget.SimpleEditor('editor',
myconfig);
             myEditor.render();

         });


Here is my html (the textarea part anyway)

<div class="yui-skin-sam">
         <textarea name="editor" id="editor" cols="50" rows="10">

         </textarea>
     </div>


--- In ydn-javascript@..., "Matt" <matt@...> wrote:
>
> As you've pasted your code, myconfig doesn't exist when you start the
editor and render() it - you only define myconfig afterwards.  So the
editor's not going to know anything about the changes you want to make.

>
> Put the var myconfig = ... before the call to
> > var myEditor = new YAHOO.widget.SimpleEditor('editor', myconfig);
> > myEditor.render();
>
> and it should work.
>
> Matt
>
> --- In ydn-javascript@..., "totalharmonicdistortion"
totalharmonicdistortion@ wrote:
> >
> > Hi,
> >
> > I'm not sure if this is the right place to be posting but here it
goes

> > anyway. I'm happy to move this elsewhere.
> >
> > I'm trying to change the toolbar buttons on the editor widget and I
> > can't seem to get it working.
> >
> > I'm creating the widget like this. Nothing fancy.
> >
> > The toolbar is always rendering the same no matter what I change the
> > button config too. Am I missing a step?
> >
> > Thank you.
> >
> >
> > var myEditor = new YAHOO.widget.SimpleEditor('editor', myconfig);
> > myEditor.render();
> >
> >
> > var myconfig = {
> >      height: '300px',
> >      dompath: true,
> >      focusAtStart: true,
> >      buttons: [
> >                  { group: 'fontstyle', label: 'Text formatting',
> >                      buttons: [
> >                          { type: 'push', label: 'Ctrl + Shift + B',
> > value: 'bold' },
> >                          { type: 'push', label: 'Italic CTRL + SHIFT
+
> > I', value: 'italic' },
> >                          { type: 'push', label: 'Underline CTRL +
SHIFT +
> > U', value: 'underline' },
> >                          { type: 'push', label: 'Subscript', value:
> > 'subscript', disabled: true },
> >                          { type: 'push', label: 'Superscript',
value:
> > 'superscript', disabled: true },
> >                          { type: 'color', label: 'Font Color',
value:

> > 'forecolor', disabled: true },
> >                          { type: 'color', label: 'Background Color',
> > value: 'backcolor', disabled: true },
> >                          { type: 'color', label: 'Background Color',
> > value: 'backcolor', disabled: true }
> >                      ]
> >                  },
> >                  { type: 'separator' },
> >                  { group: 'parastyle', label: 'Paragraph Style',
> >                      buttons: [
> >                      { type: 'select', label: 'Normal', value:
'heading',
> > disabled: true,
> >                          menu: [
> >                              { text: 'Normal', value: 'none',
checked:

> > true },
> >                              { text: 'Header 1', value: 'h1' },
> >                              { text: 'Header 2', value: 'h2' },
> >                              { text: 'Header 3', value: 'h3' },
> >                              { text: 'Header 4', value: 'h4' },
> >                              { text: 'Header 5', value: 'h5' },
> >                              { text: 'Header 6', value: 'h6' }
> >                          ]
> >                      }
> >                      ]
> >                  },
> >                  { type: 'separator' },
> >                  { group: 'indentlist', label: 'Indenting and
Lists',
> >                      buttons: [
> >                          { type: 'push', label: 'Indent', value:
> > 'indent', disabled: true },
> >                          { type: 'push', label: 'Outdent', value:
> > 'outdent', disabled: true },
> >                          { type: 'push', label: 'Create an Unordered
> > List', value: 'insertunorderedlist' },
> >                          { type: 'push', label: 'Create an Ordered
List',
> > value: 'insertorderedlist' }
> >                      ]
> >                  }
> >              ]};
> >
>



Re: Re: Problems changing the toolbar to the rich text editor widget

by Dav Glass :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


The buttons object needs to belong to the toolbar object, not the
Editor's config:

http://gist.github.com/215317

Dav

On Sat, 07 Nov 2009, totalharmonicdistortion wrote:

> Hi Matt,
>
> I've tried that but with no luck. Here is my code exactly as it appears.
>
> $(function() {
>
>          var myconfig = {
>              height: '300px',
>              dompath: true,
>              focusAtStart: true,
>              buttons: [
>                  { group: 'fontstyle', label: 'Text formatting',
>                      buttons: [
>                          { type: 'push', label: 'Ctrl + Shift + B',
> value: 'bold' },
>                          { type: 'push', label: 'Italic CTRL + SHIFT +
> I', value: 'italic' },
>                          { type: 'push', label: 'Underline CTRL + SHIFT +
> U', value: 'underline' },
>                          { type: 'push', label: 'Subscript', value:
> 'subscript', disabled: true },
>                          { type: 'push', label: 'Superscript', value:
> 'superscript', disabled: true },
>                          { type: 'color', label: 'Font Color', value:
> 'forecolor', disabled: true },
>                          { type: 'color', label: 'Background Color',
> value: 'backcolor', disabled: true },
>                          { type: 'color', label: 'Background Color',
> value: 'backcolor', disabled: true }
>                      ]
>                  },
>                  { type: 'separator' },
>                  { group: 'parastyle', label: 'Paragraph Style',
>                      buttons: [
>                      { type: 'select', label: 'Normal', value: 'heading',
> disabled: true,
>                          menu: [
>                              { text: 'Normal', value: 'none', checked:
> true },
>                              { text: 'Header 1', value: 'h1' },
>                              { text: 'Header 2', value: 'h2' },
>                              { text: 'Header 3', value: 'h3' },
>                              { text: 'Header 4', value: 'h4' },
>                              { text: 'Header 5', value: 'h5' },
>                              { text: 'Header 6', value: 'h6' }
>                          ]
>                      }
>                      ]
>                  },
>                  { type: 'separator' },
>                  { group: 'indentlist', label: 'Indenting and Lists',
>                      buttons: [
>                          { type: 'push', label: 'Indent', value:
> 'indent', disabled: true },
>                          { type: 'push', label: 'Outdent', value:
> 'outdent', disabled: true },
>                          { type: 'push', label: 'Create an Unordered
> List', value: 'insertunorderedlist' },
>                          { type: 'push', label: 'Create an Ordered List',
> value: 'insertorderedlist' }
>                      ]
>                  }
>              ]
>          };
>              var Dom = YAHOO.util.Dom,
>                  Event = YAHOO.util.Event;
>
>              YAHOO.log('Create the Editor..', 'info', 'example');
>              var myEditor = new YAHOO.widget.SimpleEditor('editor',
> myconfig);
>              myEditor.render();
>
>          });
>
>
> Here is my html (the textarea part anyway)
>
> <div class="yui-skin-sam">
>          <textarea name="editor" id="editor" cols="50" rows="10">
>
>          </textarea>
>      </div>
>
>
> --- In ydn-javascript@..., "Matt" <matt@...> wrote:
> >
> > As you've pasted your code, myconfig doesn't exist when you start the
> editor and render() it - you only define myconfig afterwards.  So the
> editor's not going to know anything about the changes you want to make.
> >
> > Put the var myconfig = ... before the call to
> > > var myEditor = new YAHOO.widget.SimpleEditor('editor', myconfig);
> > > myEditor.render();
> >
> > and it should work.
> >
> > Matt
> >
> > --- In ydn-javascript@..., "totalharmonicdistortion"
> totalharmonicdistortion@ wrote:
> > >
> > > Hi,
> > >
> > > I'm not sure if this is the right place to be posting but here it
> goes
> > > anyway. I'm happy to move this elsewhere.
> > >
> > > I'm trying to change the toolbar buttons on the editor widget and I
> > > can't seem to get it working.
> > >
> > > I'm creating the widget like this. Nothing fancy.
> > >
> > > The toolbar is always rendering the same no matter what I change the
> > > button config too. Am I missing a step?
> > >
> > > Thank you.
> > >
> > >
> > > var myEditor = new YAHOO.widget.SimpleEditor('editor', myconfig);
> > > myEditor.render();
> > >
> > >
> > > var myconfig = {
> > >      height: '300px',
> > >      dompath: true,
> > >      focusAtStart: true,
> > >      buttons: [
> > >                  { group: 'fontstyle', label: 'Text formatting',
> > >                      buttons: [
> > >                          { type: 'push', label: 'Ctrl + Shift + B',
> > > value: 'bold' },
> > >                          { type: 'push', label: 'Italic CTRL + SHIFT
> +
> > > I', value: 'italic' },
> > >                          { type: 'push', label: 'Underline CTRL +
> SHIFT +
> > > U', value: 'underline' },
> > >                          { type: 'push', label: 'Subscript', value:
> > > 'subscript', disabled: true },
> > >                          { type: 'push', label: 'Superscript',
> value:
> > > 'superscript', disabled: true },
> > >                          { type: 'color', label: 'Font Color',
> value:
> > > 'forecolor', disabled: true },
> > >                          { type: 'color', label: 'Background Color',
> > > value: 'backcolor', disabled: true },
> > >                          { type: 'color', label: 'Background Color',
> > > value: 'backcolor', disabled: true }
> > >                      ]
> > >                  },
> > >                  { type: 'separator' },
> > >                  { group: 'parastyle', label: 'Paragraph Style',
> > >                      buttons: [
> > >                      { type: 'select', label: 'Normal', value:
> 'heading',
> > > disabled: true,
> > >                          menu: [
> > >                              { text: 'Normal', value: 'none',
> checked:
> > > true },
> > >                              { text: 'Header 1', value: 'h1' },
> > >                              { text: 'Header 2', value: 'h2' },
> > >                              { text: 'Header 3', value: 'h3' },
> > >                              { text: 'Header 4', value: 'h4' },
> > >                              { text: 'Header 5', value: 'h5' },
> > >                              { text: 'Header 6', value: 'h6' }
> > >                          ]
> > >                      }
> > >                      ]
> > >                  },
> > >                  { type: 'separator' },
> > >                  { group: 'indentlist', label: 'Indenting and
> Lists',
> > >                      buttons: [
> > >                          { type: 'push', label: 'Indent', value:
> > > 'indent', disabled: true },
> > >                          { type: 'push', label: 'Outdent', value:
> > > 'outdent', disabled: true },
> > >                          { type: 'push', label: 'Create an Unordered
> > > List', value: 'insertunorderedlist' },
> > >                          { type: 'push', label: 'Create an Ordered
> List',
> > > value: 'insertorderedlist' }
> > >                      ]
> > >                  }
> > >              ]};
> > >
> >
>
>

--
Dav Glass                                                                                                                                                                            
davglass@...                                                                                                                                                                    
blog.davglass.com                                                                                                                                                                    
                                                                                                                                                                                     
                                                                                                                                                                                     
+ Windows: n. - The most successful computer virus, ever. +                                                                                                                          
+ A computer without a Microsoft operating system is like a dog                                                                                                                      
    without bricks tied to its head +                                                                                                                                                
+ A Microsoft Certified Systems Engineer is to computing what a                                                                                                                      
   McDonalds Certified Food Specialist is to fine cuisine  +


Re: Problems changing the toolbar to the rich text editor widget

by totalharmonicdistortion :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Dav,

It seems the documentation is wrong.

I was going off these examples
http://developer.yahoo.com/yui/examples/editor/toolbar_editor.html

Thanks for your time though. It works now :-)

--- In ydn-javascript@..., Dav Glass <davglass@...> wrote:

>
>
> The buttons object needs to belong to the toolbar object, not the
> Editor's config:
>
> http://gist.github.com/215317
>
> Dav
>
> On Sat, 07 Nov 2009, totalharmonicdistortion wrote:
>
> > Hi Matt,
> >
> > I've tried that but with no luck. Here is my code exactly as it appears.
> >
> > $(function() {
> >
> >          var myconfig = {
> >              height: '300px',
> >              dompath: true,
> >              focusAtStart: true,
> >              buttons: [
> >                  { group: 'fontstyle', label: 'Text formatting',
> >                      buttons: [
> >                          { type: 'push', label: 'Ctrl + Shift + B',
> > value: 'bold' },
> >                          { type: 'push', label: 'Italic CTRL + SHIFT +
> > I', value: 'italic' },
> >                          { type: 'push', label: 'Underline CTRL + SHIFT +
> > U', value: 'underline' },
> >                          { type: 'push', label: 'Subscript', value:
> > 'subscript', disabled: true },
> >                          { type: 'push', label: 'Superscript', value:
> > 'superscript', disabled: true },
> >                          { type: 'color', label: 'Font Color', value:
> > 'forecolor', disabled: true },
> >                          { type: 'color', label: 'Background Color',
> > value: 'backcolor', disabled: true },
> >                          { type: 'color', label: 'Background Color',
> > value: 'backcolor', disabled: true }
> >                      ]
> >                  },
> >                  { type: 'separator' },
> >                  { group: 'parastyle', label: 'Paragraph Style',
> >                      buttons: [
> >                      { type: 'select', label: 'Normal', value: 'heading',
> > disabled: true,
> >                          menu: [
> >                              { text: 'Normal', value: 'none', checked:
> > true },
> >                              { text: 'Header 1', value: 'h1' },
> >                              { text: 'Header 2', value: 'h2' },
> >                              { text: 'Header 3', value: 'h3' },
> >                              { text: 'Header 4', value: 'h4' },
> >                              { text: 'Header 5', value: 'h5' },
> >                              { text: 'Header 6', value: 'h6' }
> >                          ]
> >                      }
> >                      ]
> >                  },
> >                  { type: 'separator' },
> >                  { group: 'indentlist', label: 'Indenting and Lists',
> >                      buttons: [
> >                          { type: 'push', label: 'Indent', value:
> > 'indent', disabled: true },
> >                          { type: 'push', label: 'Outdent', value:
> > 'outdent', disabled: true },
> >                          { type: 'push', label: 'Create an Unordered
> > List', value: 'insertunorderedlist' },
> >                          { type: 'push', label: 'Create an Ordered List',
> > value: 'insertorderedlist' }
> >                      ]
> >                  }
> >              ]
> >          };
> >              var Dom = YAHOO.util.Dom,
> >                  Event = YAHOO.util.Event;
> >
> >              YAHOO.log('Create the Editor..', 'info', 'example');
> >              var myEditor = new YAHOO.widget.SimpleEditor('editor',
> > myconfig);
> >              myEditor.render();
> >
> >          });
> >
> >
> > Here is my html (the textarea part anyway)
> >
> > <div class="yui-skin-sam">
> >          <textarea name="editor" id="editor" cols="50" rows="10">
> >
> >          </textarea>
> >      </div>
> >
> >
> > --- In ydn-javascript@..., "Matt" <matt@> wrote:
> > >
> > > As you've pasted your code, myconfig doesn't exist when you start the
> > editor and render() it - you only define myconfig afterwards.  So the
> > editor's not going to know anything about the changes you want to make.
> > >
> > > Put the var myconfig = ... before the call to
> > > > var myEditor = new YAHOO.widget.SimpleEditor('editor', myconfig);
> > > > myEditor.render();
> > >
> > > and it should work.
> > >
> > > Matt
> > >
> > > --- In ydn-javascript@..., "totalharmonicdistortion"
> > totalharmonicdistortion@ wrote:
> > > >
> > > > Hi,
> > > >
> > > > I'm not sure if this is the right place to be posting but here it
> > goes
> > > > anyway. I'm happy to move this elsewhere.
> > > >
> > > > I'm trying to change the toolbar buttons on the editor widget and I
> > > > can't seem to get it working.
> > > >
> > > > I'm creating the widget like this. Nothing fancy.
> > > >
> > > > The toolbar is always rendering the same no matter what I change the
> > > > button config too. Am I missing a step?
> > > >
> > > > Thank you.
> > > >
> > > >
> > > > var myEditor = new YAHOO.widget.SimpleEditor('editor', myconfig);
> > > > myEditor.render();
> > > >
> > > >
> > > > var myconfig = {
> > > >      height: '300px',
> > > >      dompath: true,
> > > >      focusAtStart: true,
> > > >      buttons: [
> > > >                  { group: 'fontstyle', label: 'Text formatting',
> > > >                      buttons: [
> > > >                          { type: 'push', label: 'Ctrl + Shift + B',
> > > > value: 'bold' },
> > > >                          { type: 'push', label: 'Italic CTRL + SHIFT
> > +
> > > > I', value: 'italic' },
> > > >                          { type: 'push', label: 'Underline CTRL +
> > SHIFT +
> > > > U', value: 'underline' },
> > > >                          { type: 'push', label: 'Subscript', value:
> > > > 'subscript', disabled: true },
> > > >                          { type: 'push', label: 'Superscript',
> > value:
> > > > 'superscript', disabled: true },
> > > >                          { type: 'color', label: 'Font Color',
> > value:
> > > > 'forecolor', disabled: true },
> > > >                          { type: 'color', label: 'Background Color',
> > > > value: 'backcolor', disabled: true },
> > > >                          { type: 'color', label: 'Background Color',
> > > > value: 'backcolor', disabled: true }
> > > >                      ]
> > > >                  },
> > > >                  { type: 'separator' },
> > > >                  { group: 'parastyle', label: 'Paragraph Style',
> > > >                      buttons: [
> > > >                      { type: 'select', label: 'Normal', value:
> > 'heading',
> > > > disabled: true,
> > > >                          menu: [
> > > >                              { text: 'Normal', value: 'none',
> > checked:
> > > > true },
> > > >                              { text: 'Header 1', value: 'h1' },
> > > >                              { text: 'Header 2', value: 'h2' },
> > > >                              { text: 'Header 3', value: 'h3' },
> > > >                              { text: 'Header 4', value: 'h4' },
> > > >                              { text: 'Header 5', value: 'h5' },
> > > >                              { text: 'Header 6', value: 'h6' }
> > > >                          ]
> > > >                      }
> > > >                      ]
> > > >                  },
> > > >                  { type: 'separator' },
> > > >                  { group: 'indentlist', label: 'Indenting and
> > Lists',
> > > >                      buttons: [
> > > >                          { type: 'push', label: 'Indent', value:
> > > > 'indent', disabled: true },
> > > >                          { type: 'push', label: 'Outdent', value:
> > > > 'outdent', disabled: true },
> > > >                          { type: 'push', label: 'Create an Unordered
> > > > List', value: 'insertunorderedlist' },
> > > >                          { type: 'push', label: 'Create an Ordered
> > List',
> > > > value: 'insertorderedlist' }
> > > >                      ]
> > > >                  }
> > > >              ]};
> > > >
> > >
> >
> >
>
> --
> Dav Glass                                                                                                                                                                            
> davglass@...                                                                                                                                                                    
> blog.davglass.com                                                                                                                                                                    
>                                                                                                                                                                                      
>                                                                                                                                                                                      
> + Windows: n. - The most successful computer virus, ever. +                                                                                                                          
> + A computer without a Microsoft operating system is like a dog                                                                                                                      
>     without bricks tied to its head +                                                                                                                                                
> + A Microsoft Certified Systems Engineer is to computing what a                                                                                                                      
>    McDonalds Certified Food Specialist is to fine cuisine  +
>



Re: Re: Problems changing the toolbar to the rich text editor widget

by Dav Glass :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Maybe not documented well enough, but not incorrect.

That example shows the default Toolbar config, not an Editor config.

The Toolbar config is passed in the Editor config under the toolbar
property.

Dav

On Sun, 08 Nov 2009, totalharmonicdistortion wrote:

> Hi Dav,
>
> It seems the documentation is wrong.
>
> I was going off these examples
> http://developer.yahoo.com/yui/examples/editor/toolbar_editor.html
>
> Thanks for your time though. It works now :-)
>
> --- In ydn-javascript@..., Dav Glass <davglass@...> wrote:
> >
> >
> > The buttons object needs to belong to the toolbar object, not the
> > Editor's config:
> >
> > http://gist.github.com/215317
> >
> > Dav
> >
> > On Sat, 07 Nov 2009, totalharmonicdistortion wrote:
> >
> > > Hi Matt,
> > >
> > > I've tried that but with no luck. Here is my code exactly as it appears.
> > >
> > > $(function() {
> > >
> > >          var myconfig = {
> > >              height: '300px',
> > >              dompath: true,
> > >              focusAtStart: true,
> > >              buttons: [
> > >                  { group: 'fontstyle', label: 'Text formatting',
> > >                      buttons: [
> > >                          { type: 'push', label: 'Ctrl + Shift + B',
> > > value: 'bold' },
> > >                          { type: 'push', label: 'Italic CTRL + SHIFT +
> > > I', value: 'italic' },
> > >                          { type: 'push', label: 'Underline CTRL + SHIFT +
> > > U', value: 'underline' },
> > >                          { type: 'push', label: 'Subscript', value:
> > > 'subscript', disabled: true },
> > >                          { type: 'push', label: 'Superscript', value:
> > > 'superscript', disabled: true },
> > >                          { type: 'color', label: 'Font Color', value:
> > > 'forecolor', disabled: true },
> > >                          { type: 'color', label: 'Background Color',
> > > value: 'backcolor', disabled: true },
> > >                          { type: 'color', label: 'Background Color',
> > > value: 'backcolor', disabled: true }
> > >                      ]
> > >                  },
> > >                  { type: 'separator' },
> > >                  { group: 'parastyle', label: 'Paragraph Style',
> > >                      buttons: [
> > >                      { type: 'select', label: 'Normal', value: 'heading',
> > > disabled: true,
> > >                          menu: [
> > >                              { text: 'Normal', value: 'none', checked:
> > > true },
> > >                              { text: 'Header 1', value: 'h1' },
> > >                              { text: 'Header 2', value: 'h2' },
> > >                              { text: 'Header 3', value: 'h3' },
> > >                              { text: 'Header 4', value: 'h4' },
> > >                              { text: 'Header 5', value: 'h5' },
> > >                              { text: 'Header 6', value: 'h6' }
> > >                          ]
> > >                      }
> > >                      ]
> > >                  },
> > >                  { type: 'separator' },
> > >                  { group: 'indentlist', label: 'Indenting and Lists',
> > >                      buttons: [
> > >                          { type: 'push', label: 'Indent', value:
> > > 'indent', disabled: true },
> > >                          { type: 'push', label: 'Outdent', value:
> > > 'outdent', disabled: true },
> > >                          { type: 'push', label: 'Create an Unordered
> > > List', value: 'insertunorderedlist' },
> > >                          { type: 'push', label: 'Create an Ordered List',
> > > value: 'insertorderedlist' }
> > >                      ]
> > >                  }
> > >              ]
> > >          };
> > >              var Dom = YAHOO.util.Dom,
> > >                  Event = YAHOO.util.Event;
> > >
> > >              YAHOO.log('Create the Editor..', 'info', 'example');
> > >              var myEditor = new YAHOO.widget.SimpleEditor('editor',
> > > myconfig);
> > >              myEditor.render();
> > >
> > >          });
> > >
> > >
> > > Here is my html (the textarea part anyway)
> > >
> > > <div class="yui-skin-sam">
> > >          <textarea name="editor" id="editor" cols="50" rows="10">
> > >
> > >          </textarea>
> > >      </div>
> > >
> > >
> > > --- In ydn-javascript@..., "Matt" <matt@> wrote:
> > > >
> > > > As you've pasted your code, myconfig doesn't exist when you start the
> > > editor and render() it - you only define myconfig afterwards.  So the
> > > editor's not going to know anything about the changes you want to make.
> > > >
> > > > Put the var myconfig = ... before the call to
> > > > > var myEditor = new YAHOO.widget.SimpleEditor('editor', myconfig);
> > > > > myEditor.render();
> > > >
> > > > and it should work.
> > > >
> > > > Matt
> > > >
> > > > --- In ydn-javascript@..., "totalharmonicdistortion"
> > > totalharmonicdistortion@ wrote:
> > > > >
> > > > > Hi,
> > > > >
> > > > > I'm not sure if this is the right place to be posting but here it
> > > goes
> > > > > anyway. I'm happy to move this elsewhere.
> > > > >
> > > > > I'm trying to change the toolbar buttons on the editor widget and I
> > > > > can't seem to get it working.
> > > > >
> > > > > I'm creating the widget like this. Nothing fancy.
> > > > >
> > > > > The toolbar is always rendering the same no matter what I change the
> > > > > button config too. Am I missing a step?
> > > > >
> > > > > Thank you.
> > > > >
> > > > >
> > > > > var myEditor = new YAHOO.widget.SimpleEditor('editor', myconfig);
> > > > > myEditor.render();
> > > > >
> > > > >
> > > > > var myconfig = {
> > > > >      height: '300px',
> > > > >      dompath: true,
> > > > >      focusAtStart: true,
> > > > >      buttons: [
> > > > >                  { group: 'fontstyle', label: 'Text formatting',
> > > > >                      buttons: [
> > > > >                          { type: 'push', label: 'Ctrl + Shift + B',
> > > > > value: 'bold' },
> > > > >                          { type: 'push', label: 'Italic CTRL + SHIFT
> > > +
> > > > > I', value: 'italic' },
> > > > >                          { type: 'push', label: 'Underline CTRL +
> > > SHIFT +
> > > > > U', value: 'underline' },
> > > > >                          { type: 'push', label: 'Subscript', value:
> > > > > 'subscript', disabled: true },
> > > > >                          { type: 'push', label: 'Superscript',
> > > value:
> > > > > 'superscript', disabled: true },
> > > > >                          { type: 'color', label: 'Font Color',
> > > value:
> > > > > 'forecolor', disabled: true },
> > > > >                          { type: 'color', label: 'Background Color',
> > > > > value: 'backcolor', disabled: true },
> > > > >                          { type: 'color', label: 'Background Color',
> > > > > value: 'backcolor', disabled: true }
> > > > >                      ]
> > > > >                  },
> > > > >                  { type: 'separator' },
> > > > >                  { group: 'parastyle', label: 'Paragraph Style',
> > > > >                      buttons: [
> > > > >                      { type: 'select', label: 'Normal', value:
> > > 'heading',
> > > > > disabled: true,
> > > > >                          menu: [
> > > > >                              { text: 'Normal', value: 'none',
> > > checked:
> > > > > true },
> > > > >                              { text: 'Header 1', value: 'h1' },
> > > > >                              { text: 'Header 2', value: 'h2' },
> > > > >                              { text: 'Header 3', value: 'h3' },
> > > > >                              { text: 'Header 4', value: 'h4' },
> > > > >                              { text: 'Header 5', value: 'h5' },
> > > > >                              { text: 'Header 6', value: 'h6' }
> > > > >                          ]
> > > > >                      }
> > > > >                      ]
> > > > >                  },
> > > > >                  { type: 'separator' },
> > > > >                  { group: 'indentlist', label: 'Indenting and
> > > Lists',
> > > > >                      buttons: [
> > > > >                          { type: 'push', label: 'Indent', value:
> > > > > 'indent', disabled: true },
> > > > >                          { type: 'push', label: 'Outdent', value:
> > > > > 'outdent', disabled: true },
> > > > >                          { type: 'push', label: 'Create an Unordered
> > > > > List', value: 'insertunorderedlist' },
> > > > >                          { type: 'push', label: 'Create an Ordered
> > > List',
> > > > > value: 'insertorderedlist' }
> > > > >                      ]
> > > > >                  }
> > > > >              ]};
> > > > >
> > > >
> > >
> > >
> >
> > --
> > Dav Glass                                                                                                                                                                            
> > davglass@...                                                                                                                                                                    
> > blog.davglass.com                                                                                                                                                                    
> >                                                                                                                                                                                      
> >                                                                                                                                                                                      
> > + Windows: n. - The most successful computer virus, ever. +                                                                                                                          
> > + A computer without a Microsoft operating system is like a dog                                                                                                                      
> >     without bricks tied to its head +                                                                                                                                                
> > + A Microsoft Certified Systems Engineer is to computing what a                                                                                                                      
> >    McDonalds Certified Food Specialist is to fine cuisine  +
> >
>
>

--
Dav Glass                                                                                                                                                                            
davglass@...                                                                                                                                                                    
blog.davglass.com                                                                                                                                                                    
                                                                                                                                                                                     
                                                                                                                                                                                     
+ Windows: n. - The most successful computer virus, ever. +                                                                                                                          
+ A computer without a Microsoft operating system is like a dog                                                                                                                      
    without bricks tied to its head +                                                                                                                                                
+ A Microsoft Certified Systems Engineer is to computing what a                                                                                                                      
   McDonalds Certified Food Specialist is to fine cuisine  +


Re: Re: Problems changing the toolbar to the rich text editor widget

by totalharmonicdistortion :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Appologies, I read the documentation the wrong way.

Thanks again.




________________________________
From: Dav Glass <davglass@...>
To: ydn-javascript@...
Sent: Sun, 8 November, 2009 12:00:10 PM
Subject: Re: [ydn-javascript] Re: Problems changing the toolbar to the rich text editor widget

   
Maybe not documented well enough, but not incorrect.

That example shows the default Toolbar config, not an Editor config.

The Toolbar config is passed in the Editor config under the toolbar
property.

Dav

On Sun, 08 Nov 2009, totalharmonicdistor tion wrote:

> Hi Dav,
>
> It seems the documentation is wrong.
>
> I was going off these examples
> http://developer. yahoo.com/ yui/examples/ editor/toolbar_ editor.html
>
> Thanks for your time though. It works now :-)
>
> --- In ydn-javascript@ yahoogroups. com, Dav Glass <davglass@.. .> wrote:
> >
> >
> > The buttons object needs to belong to the toolbar object, not the
> > Editor's config:
> >
> > http://gist. github.com/ 215317
> >
> > Dav
> >
> > On Sat, 07 Nov 2009, totalharmonicdistor tion wrote:
> >
> > > Hi Matt,
> > >
> > > I've tried that but with no luck. Here is my code exactly as it appears.
> > >
> > > $(function() {
> > >
> > >          var myconfig = {
> > >              height: '300px',
> > >              dompath: true,
> > >              focusAtStart: true,
> > >              buttons: [
> > >                  { group: 'fontstyle', label: 'Text formatting',
> > >                      buttons: [
> > >                          { type: 'push', label: 'Ctrl + Shift + B',
> > > value: 'bold' },
> > >                          { type: 'push', label: 'Italic CTRL + SHIFT +
> > > I', value: 'italic' },
> > >                          { type: 'push', label: 'Underline CTRL + SHIFT +
> > > U', value: 'underline' },
> > >                          { type: 'push', label: 'Subscript', value:
> > > 'subscript', disabled: true },
> > >                          { type: 'push', label: 'Superscript' , value:
> > > 'superscript' , disabled: true },
> > >                          { type: 'color', label: 'Font Color', value:
> > > 'forecolor', disabled: true },
> > >                          { type: 'color', label: 'Background Color',
> > > value: 'backcolor', disabled: true },
> > >                          { type: 'color', label: 'Background Color',
> > > value: 'backcolor', disabled: true }
> > >                      ]
> > >                  },
> > >                  { type: 'separator' },
> > >                  { group: 'parastyle', label: 'Paragraph Style',
> > >                      buttons: [
> > >                      { type: 'select', label: 'Normal', value: 'heading',
> > > disabled: true,
> > >                          menu: [
> > >                              { text: 'Normal', value: 'none', checked:
> > > true },
> > >                              { text: 'Header 1', value: 'h1' },
> > >                              { text: 'Header 2', value: 'h2' },
> > >                              { text: 'Header 3', value: 'h3' },
> > >                              { text: 'Header 4', value: 'h4' },
> > >                              { text: 'Header 5', value: 'h5' },
> > >                              { text: 'Header 6', value: 'h6' }
> > >                          ]
> > >                      }
> > >                      ]
> > >                  },
> > >                  { type: 'separator' },
> > >                  { group: 'indentlist' , label: 'Indenting and Lists',
> > >                      buttons: [
> > >                          { type: 'push', label: 'Indent', value:
> > > 'indent', disabled: true },
> > >                          { type: 'push', label: 'Outdent', value:
> > > 'outdent', disabled: true },
> > >                          { type: 'push', label: 'Create an Unordered
> > > List', value: 'insertunorderedlis t' },
> > >                          { type: 'push', label: 'Create an Ordered List',
> > > value: 'insertorderedlist' }
> > >                      ]
> > >                  }
> > >              ]
> > >          };
> > >              var Dom = YAHOO.util.Dom,
> > >                  Event = YAHOO.util.Event;
> > >
> > >              YAHOO.log('Create the Editor..', 'info', 'example');
> > >              var myEditor = new YAHOO.widget. SimpleEditor( 'editor',
> > > myconfig);
> > >              myEditor.render( );
> > >
> > >          });
> > >
> > >
> > > Here is my html (the textarea part anyway)
> > >
> > > <div class="yui-skin- sam">
> > >          <textarea name="editor" id="editor" cols="50" rows="10">
> > >
> > >          </textarea>
> > >      </div>
> > >
> > >
> > > --- In ydn-javascript@ yahoogroups. com, "Matt" <matt@> wrote:
> > > >
> > > > As you've pasted your code, myconfig doesn't exist when you start the
> > > editor and render() it - you only define myconfig afterwards.  So the
> > > editor's not going to know anything about the changes you want to make.
> > > >
> > > > Put the var myconfig = ... before the call to
> > > > > var myEditor = new YAHOO.widget. SimpleEditor( 'editor', myconfig);
> > > > > myEditor.render( );
> > > >
> > > > and it should work.
> > > >
> > > > Matt
> > > >
> > > > --- In ydn-javascript@ yahoogroups. com, "totalharmonicdisto rtion"
> > > totalharmonicdistor tion@ wrote:
> > > > >
> > > > > Hi,
> > > > >
> > > > > I'm not sure if this is the right place to be posting but here it
> > > goes
> > > > > anyway. I'm happy to move this elsewhere.
> > > > >
> > > > > I'm trying to change the toolbar buttons on the editor widget and I
> > > > > can't seem to get it working.
> > > > >
> > > > > I'm creating the widget like this. Nothing fancy.
> > > > >
> > > > > The toolbar is always rendering the same no matter what I change the
> > > > > button config too. Am I missing a step?
> > > > >
> > > > > Thank you.
> > > > >
> > > > >
> > > > > var myEditor = new YAHOO.widget. SimpleEditor( 'editor', myconfig);
> > > > > myEditor.render( );
> > > > >
> > > > >
> > > > > var myconfig = {
> > > > >      height: '300px',
> > > > >      dompath: true,
> > > > >      focusAtStart: true,
> > > > >      buttons: [
> > > > >                  { group: 'fontstyle', label: 'Text formatting',
> > > > >                      buttons: [
> > > > >                          { type: 'push', label: 'Ctrl + Shift + B',
> > > > > value: 'bold' },
> > > > >                          { type: 'push', label: 'Italic CTRL + SHIFT
> > > +
> > > > > I', value: 'italic' },
> > > > >                          { type: 'push', label: 'Underline CTRL +
> > > SHIFT +
> > > > > U', value: 'underline' },
> > > > >                          { type: 'push', label: 'Subscript', value:
> > > > > 'subscript', disabled: true },
> > > > >                          { type: 'push', label: 'Superscript' ,
> > > value:
> > > > > 'superscript' , disabled: true },
> > > > >                          { type: 'color', label: 'Font Color',
> > > value:
> > > > > 'forecolor', disabled: true },
> > > > >                          { type: 'color', label: 'Background Color',
> > > > > value: 'backcolor', disabled: true },
> > > > >                          { type: 'color', label: 'Background Color',
> > > > > value: 'backcolor', disabled: true }
> > > > >                      ]
> > > > >                  },
> > > > >                  { type: 'separator' },
> > > > >                  { group: 'parastyle', label: 'Paragraph Style',
> > > > >                      buttons: [
> > > > >                      { type: 'select', label: 'Normal', value:
> > > 'heading',
> > > > > disabled: true,
> > > > >                          menu: [
> > > > >                              { text: 'Normal', value: 'none',
> > > checked:
> > > > > true },
> > > > >                              { text: 'Header 1', value: 'h1' },
> > > > >                              { text: 'Header 2', value: 'h2' },
> > > > >                              { text: 'Header 3', value: 'h3' },
> > > > >                              { text: 'Header 4', value: 'h4' },
> > > > >                              { text: 'Header 5', value: 'h5' },
> > > > >                              { text: 'Header 6', value: 'h6' }
> > > > >                          ]
> > > > >                      }
> > > > >                      ]
> > > > >                  },
> > > > >                  { type: 'separator' },
> > > > >                  { group: 'indentlist' , label: 'Indenting and
> > > Lists',
> > > > >                      buttons: [
> > > > >                          { type: 'push', label: 'Indent', value:
> > > > > 'indent', disabled: true },
> > > > >                          { type: 'push', label: 'Outdent', value:
> > > > > 'outdent', disabled: true },
> > > > >                          { type: 'push', label: 'Create an Unordered
> > > > > List', value: 'insertunorderedlis t' },
> > > > >                          { type: 'push', label: 'Create an Ordered
> > > List',
> > > > > value: 'insertorderedlist' }
> > > > >                      ]
> > > > >                  }
> > > > >              ]};
> > > > >
> > > >
> > >
> > >
> >
> > --
> > Dav Glass
> > davglass@...
> > blog.davglass. com
> >
> >
> > + Windows: n. - The most successful computer virus, ever. +
> > + A computer without a Microsoft operating system is like a dog
> >     without bricks tied to its head +
> > + A Microsoft Certified Systems Engineer is to computing what a
> >    McDonalds Certified Food Specialist is to fine cuisine  +
> >
>
>

--
Dav Glass
davglass@gmail. com
blog.davglass. com


+ Windows: n. - The most successful computer virus, ever. +
+ A computer without a Microsoft operating system is like a dog
without bricks tied to its head +
+ A Microsoft Certified Systems Engineer is to computing what a
McDonalds Certified Food Specialist is to fine cuisine  +


 


      __________________________________________________________________________________
Get more done like never before with Yahoo!7 Mail.
Learn more: http://au.overview.mail.yahoo.com/