- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2016 02:53 PM
I know that you can go into System Properties > UI Properties and edit the 'Configures the editing toolbar' sections to choose what show up, but it looks like this will affect other parts of the system instead of just the app I am working in.
We only want to remove it on one form for now. Right now I have this HTML field being populated with the contents of the KB article being attached to the ticket, and we are going to be sending the contents of the field to the caller in an email, and we want the user to be able to see what it will look like. (I had used the regex .replace() scripts floating around here remove the HTML tags that came up when the KB contents were copied into a regular string field in plain text, but that was inadequate). I think this is the
Is there a way to do this, maybe with a client script?
P.S. I have just over a month's worth of experience with ServiceNow, so let me know if I am posting this in the wrong place or something
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2016 03:21 PM
First thing that comes to mind is an on load client script.
function onLoad() {
var sheet = window.document.styleSheets[0];
sheet.insertRule('.mce-toolbar-grp { display: none !important; }', sheet.cssRules.length);
sheet.addRule('.mce-toolbar-grp ', 'display: none !important;', -1); // IE likes to be different
}
Give that a shot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2016 03:21 PM
First thing that comes to mind is an on load client script.
function onLoad() {
var sheet = window.document.styleSheets[0];
sheet.insertRule('.mce-toolbar-grp { display: none !important; }', sheet.cssRules.length);
sheet.addRule('.mce-toolbar-grp ', 'display: none !important;', -1); // IE likes to be different
}
Give that a shot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2016 03:30 PM
Sweet, that did the trick! I will ask tomorrow if they want it gone too, but the little breadcrumbs p >> i >> b still show up.
I can't image it would be a deal-breaker or anything, but can that be hidden too?
More importantly, where would I go to find documentation on the functions/variable names i.e. " sheet.insertRule('.mce-toolbar-grp "?
Because those things didn't seem come up in my searches on the wiki, or here on the community...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2016 04:03 PM
sure, hiding it is no problem. This code is actually just native to javascript and nothing servicenow specific. What it is doing is adding a CSS rule to the page that says to hide these elements with the specified class names. To find these class names I used Chrome's inspector tool (F12) to determine what class I would have to hide.
function onLoad() {
var sheet = window.document.styleSheets[0];
sheet.insertRule('.mce-toolbar-grp,.mce-statusbar { display: none !important; }', sheet.cssRules.length);
sheet.addRule('.mce-toolbar-grp,.mce-statusbar', 'display: none !important;', -1); // IE likes to be different
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2016 11:49 AM
Thanks, that will help a lot.
One last "what-if" question, though.
I went through the inspector tool and I can see where you got those classes from now, but when I looked for the classes for the "Add/Remove lines from script area" buttons, something concerned me. I was able to successfully hide it using its "span.label_right.pull-right" which seems much more generic than the .mce classes.
My question is what if there was another "span.label_right.pull-right" class somewhere else on the page that they didn't want to hide? For example, what if there was another HTML field or something? My current problem is solved nothing else was affected, but it doesn't seem like a perfect solution since I can't edit ServiceNow's code to include ids instead of classes, you know?