Ticket #59 (assigned enhancement)

Opened 3 years ago

Last modified 3 years ago

Make Indent/Outdent buttons gray out when not applicable

Reported by: rostr Owned by: jf.hovinne
Priority: minor Milestone: 0.5
Component: Editor Version: trunk
Keywords: Cc:

Description

I have users that want to use the "indent" button to indent paragraphs (when it is obviously done with the css on the page.

Any chance we could gray out these buttons when they don't apply?

Change History

Changed 3 years ago by jf.hovinne

  • status changed from new to assigned

My quick fix:

Add the following to postInit:

$j(wym._doc).bind("keyup", {wym: wym}, toggleIndent);
$j(wym._doc).bind("click", {wym: wym}, toggleIndent);

And in $j(function() {}):

function toggleIndent(event) {
    
    var wym = event.data.wym;
    var container = wym.container();
    if(container && container.tagName.toLowerCase() == WYM_LI) {
        $j(wym._options.toolsSelector).find('.wym_tools_indent').show();
        $j(wym._options.toolsSelector).find('.wym_tools_outdent').show();
    } else {
        $j(wym._options.toolsSelector).find('.wym_tools_indent').hide();
        $j(wym._options.toolsSelector).find('.wym_tools_outdent').hide();
    }
};

A better solution than show/hide would be to update the images, but it requires a little bit more work.
Could be implemented as a plugin, if you have some time.

Perhaps the SAPI (planned for 0.5) will help.

Changed 3 years ago by jf.hovinne

  • priority changed from trivial to minor
  • milestone changed from 0.4 to 0.5
Note: See TracTickets for help on using tickets.