edlftt
edlftt

Reputation:

How do you programatically remove (not disable) a button from TinyMCE?

I can disable the table button using this:

  tinyMCE.activeEditor.controlManager.get('divId_table').setDisabled(true)

but what I'm interested in is actually hiding it. Any idea on how to accomplish that?

Thank you!

Upvotes: 7

Views: 4302

Answers (4)

andyk
andyk

Reputation: 10008

First, you have to use the advanced theme.

Then, add this option in the TinyMCE init code.

tinyMCE.init({
    ...
    theme_advanced_disable : "bold, justifyleft, justifyright"
});

I hope this might help someone.

source

list of elements' name here

Upvotes: 7

Abhijit
Abhijit

Reputation: 1173

incase ur trying to hide a specific button, use the following code.

$('.mce_cut').hide() //hides cut button

lookup other button titles using firebug in case u wish to hide something specific.

Incase you are looking to hide specific editor's button, modifiy the jquery selector to select correct sibling/descendent.

alternately, try this .. tinyMCE.activeEditor.controlManager.controls.ctl00_SPWebPartManager1_g_5005db96_e035_4197_a958_75f008b35061_ctl00_tbKeywords_cut.remove()

Note that ctl00_SPWebPartManager1_g_5005db96_e035_4197_a958_75f008b35061_ctl00_tbKeywords is my asp.net control's id. Don't bother about this if ur not using Asp.net serverside textbox control. In case you are.. <% theTextBoxID.ClientID %> gets u that.

Upvotes: 0

Thariama
Thariama

Reputation: 50840

Use the following (using jQuery; a non-jQuery approch is easily built):

var elem = $(ed.id+'_'+'divId_table')
elem.addClass('mceButtonDisabled');
elem.removeClass('mceButtonEnabled');

Upvotes: -1

Andrew Ensley
Andrew Ensley

Reputation: 11697

I'm not familiar with TinyMCE myself, but since you appear to have javascript access to the element itself, all you need to do is set it's display property to "none".

document.getElementById("theButton").style.display = "none";

Upvotes: 5

Related Questions