I want to trim the options down to just a few basic options like bold, underline, and italic . How do I remove unwanted buttons from the Rich Text Editor (font button, color button etc)?
I'm thinking I can do this somehow with JavaScript and CSS.
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.
Sign up to join this communityWith SharePoint Designer, in the option of the column you can disable "Rich Text". Or, in the list configuration, you can access de column options.
I've implemented the same thing a couple of days ago. The way I've done this was:
Create a control (don't forget to add a safe control entry for it):
<Control
ControlAssembly="$SharePoint.Project.AssemblyFullName$"
ControlClass="Project.CustomActions.Control1"
Sequence="1000"
Id="AdditionalPageHead">
</Control>
I needed this in the page edit mode. Your requirements might be different. If it's a new form, consider adding a custom action instead of a control:
<CustomAction
Id="Project.CustomActions.CustomAction1Id"
Location="CommandUI.Ribbon"
Sequence="1"
ControlAssembly="$SharePoint.Project.AssemblyFullName$"
ControlClass="Project.CustomActions.CustomAction">
</CustomAction>
Handle OnLoad event in the control class. The class needs to implement a WebControl
class:
protected override void OnLoad(EventArgs e)
{
this.EnsureChildControls();
base.OnLoad(e);
this.Visible = false;
if (Microsoft.SharePoint.SPContext.Current.FormContext.FormMode == SPControlMode.Edit)
{
SPRibbon ribbon = SPRibbon.GetCurrent(this.Page);
HideCustomActions(ribbon);
}
}
Hide custom actions:
ribbon.TrimById(buttonToTrim);
You can get the IDs of the Ribbon buttons using IE developer tool (F12):
P.S - Stackexchange's code formating options are ridicullous.