karthick2014 / jwysiwyg

Automatically exported from code.google.com/p/jwysiwyg
0 stars 0 forks source link

Helpful and simple modification: Add a tooltip to each toolbar button #58

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Helpful and simple modification:

If you want a helpful tooltip for when you hover over each toolbar button,
just modify line 542 in the jquery.wysiwyg.js file

from: $('<a><!-- --></a>').addClass(className || cmd)
to: $('<a><!-- --></a>').addClass(className || cmd).attr({ title: cmd })

this will add a title attribute to every toolbar button

Original issue reported on code.google.com by mastermi...@gmail.com on 7 Nov 2008 at 2:33

GoogleCodeExporter commented 8 years ago
Nick Henzen send me this patch for that propose:

{{{
        appendMenu : function( title, cmd, args, className, fn )
        {
            var self = this;
            var args = args || [];

            $('<li></li>').append(
                $('<a><!-- --></a>').addClass(className || cmd).attr('title', title)
            ).mousedown(function() {
                if ( fn ) fn.apply(self); else self.editorDoc.execCommand(cmd, false,
args);
                if ( self.options.autoSave ) self.saveContent();
            }).appendTo( this.panel );
        },

        appendControls : function()
        {
            for ( var name in this.options.controls )
            {
                var control = this.options.controls[name];

                if ( control.separator )
                {
                    if ( control.visible !== false )
                        this.appendMenuSeparator();
                }
                else if ( control.visible )
                {
                    this.appendMenu(
                        control.title || name,
                        control.command || name, control.arguments || [],
                        control.className || control.command || name || 'empty',
control.exec
                    );
                }
            }
        },  
}}}

I think the button must be enough explained and adding tool tips may clear the
obvious. Also, it will be needed a language tool.

This doesn't mean that I not considering to adding tool tips.

Regards,

Original comment by joksnet on 10 Nov 2008 at 5:28

GoogleCodeExporter commented 8 years ago
This Code is not working for me help me

Original comment by ksivasa...@gmail.com on 10 Dec 2008 at 12:46

GoogleCodeExporter commented 8 years ago
I needed something like this and made a modification that works.
How do I put tooltips in spanish? simple:

In the TOOLBAR object add a extra property 'title' with what you want in each 
object
of the toolbar

TOOLBAR : {
            bold          : { visible : true, tags : ['b', 'strong'], css : {
fontWeight : 'bold' }, title: 'Negrita' },

Then change two more lines, the function 'appendMenu'
appendMenu : function( cmd, args, className, fn, title )

And the line where its called (adding the title parameter):
this.appendMenu(
  control.command || name, control.arguments || [], 
  control.className || control.command || name || 'empty', 
  control.exec,
  control.title
);

Its working fine.
The only problem is you got to add the title to all objects. Otherwise it won't 
show.

Original comment by crom...@gmail.com on 2 May 2009 at 6:30

GoogleCodeExporter commented 8 years ago
Change
control.title
to
control.title || control.command || name

Original comment by AndreyKo...@gmail.com on 11 Aug 2009 at 11:50

GoogleCodeExporter commented 8 years ago

Original comment by akzhan.a...@gmail.com on 8 Dec 2009 at 11:11