0

In SharePoint 2013, I want to lock down (disable/gray out) the font highlight/font color buttons only when the user is focused on the page content zone (It should be enabled for any web parts and other things). These are the buttons (for sp2010 version) I am talking about. Does anyone know a way to do this (can be javascript/css)?

Thanks

enter image description here

0

They aren't traditional controls per sé, like on a Windows Form, so there isn't an easy way to disable them, i.e. greyed out and not usable. If it would be sufficient to remove them from the DOM (not visible on the page therefore the user can't interact with them), using jQuery:

$( document ).ready(function() {
    $("span#Ribbon.EditingTools.CPEditTab.Font-Medium-0-2-0.ms-cui-strip").hide();
});

Usually it's best to put that in a <script> block just before the body tag closes.

If you want them to appear greyed out and not be clickable, you would need to target potentially hundreds of nested elements and alter the colouring of the A, the pen, the strip of colour on the button etc.

Edit: if you really want it to look and act "disabled" I can come up with some code lines that would achieve such.

  • But does this keep it enabled for web parts and disabled for page content zones? – omega Jul 24 '15 at 15:08
  • There is a class I can add to it to make it look disabled, but if you click it the color picker box shows up and the button turns blue. I can hide it, but the main issue is how to hide it only when on page content zones. – omega Jul 24 '15 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.