Variable Type HTML Input Field Toolbar Configuration

Jihye
Tera Contributor

Hello ServiceNow Community Team.

I am reaching out to you to ask some advice regarding of "Variable Type HTML Input Field Toolbar Configuration"

 

This is a input field with HTML Type.

How can I disable and hide those 5 icons in toolbar?

Jihye_0-1673029563934.png

I also checked All > System Properties > UI Properties. with this reference.

https://docs.servicenow.com/ko-KR/bundle/tokyo-platform-administration/page/administer/form-administ... 

 

But, it seems like it doesn't work. Also, I think if I make changes in system properties, the impact would be global.

 

I would be really appreciate if you can provide me any advice and guidance to hide few icons in toolbars and how can I apply only specific scope not global scope.

 

Thank you.

 

3 REPLIES 3

-O-
Kilo Patron
Kilo Patron

As far as I can see the only way to customize the toolbar is by crafting an (let's call it TinyMCE Options) widget and add that widget either to the Catalog Items page or as a variable of type Custom. The widget only needs the Client controller in which a callback is configured with the help of provider uiTinymceConfig:

 

api.controller = function (uiTinymceConfig) {
	uiTinymceConfig.setup = uiTinymceConfigSetup;

	function uiTinymceConfigSetup (ed) {
		ed.settings.toolbar = ["undo redo",
			//"formatselect",
			//"bold italic",
			//"alignleft aligncenter alignright alignjustify",
			//"bullist numlist outdent indent",
			//"link unlink",
			//"image",
			//"codesample code",
		].join(' | ');
	}
};

 

I have crafted such a Widget, have added to the Catalog Item page () and the result is that now the HTML editor only displays the two buttons not commented out:

2023-01-07-2.png

If I uncomment

 

			//"alignleft aligncenter alignright alignjustify",

 

I get those buttons too:

2023-01-07-3.png

 I guss if you want to set this globally, you can add the widget to the Catalog Item page, or if you want to set the options per Catalog Item, you can use Catalog Item specific configuration widgets. Or craft some mechanism where the configuration is kept in an instance table and the widgets looks it up and applies it when and if so configured.

Joakim1
Tera Guru

You should also be able to configure this with the sys_properties: glide.ui.html.toolbar and glide.ui.html.editor.v5.toolbar:

In the Value field, enter or remove buttons for each toolbar as a comma-separated list without spaces.

For the TinyMCE toolbar, use the following buttons. Use a vertical bar ("|") to add a section separator.


Button purpose Accepted button names

Formattingnewdocument, bold, italic, underline, strikethrough, justifyleft, justifycenter, justifyright, justifyfull, formatselect, fontselect, fontsizeselect, bullist, numlist, outdent, indent, blockquote, forecolor, removeformat, backcolor, sub, sup
Table functionstablecontrols
Editingcut, copy, paste, pastetext, search, replace, undo, redo
Extended functionslink, unlink, cleanup, code, hr, visualaid, charmap, image, media, preview, fullscreen (not supported by Internet Explorer)

https://docs.servicenow.com/bundle/vancouver-platform-administration/page/administer/form-administra...

It should also be possible to configure it for the field it self with editor.toolbar=  attribute:

In the Attributes field, input editor.toolbar= followed by the desired toolbar buttons.

For example, editor.toolbar=formatselect|bold italic underline strikethrough blockquote subscript superscript removeformat| bullist numlist outdent indent|undo redo|table hr|link unlink|image media code|visualblocks preview fullscreen.



https://docs.servicenow.com/bundle/vancouver-platform-administration/page/administer/workspace/conce...

Does all that apply to variables?
The links you quote seem to talk about fields.