Richtext-Editor nicEdit.js - remove tools from button list

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Richtext-Editor nicEdit.js - remove tools from button list

Post by jsetzer » 2018-07-14 11:11

Hi there,

I need to remove a couple of tools from the button list of the nicEdit richtext editor. I am using AppGini 5.72.1036.
chrome_2018-07-14_13-07-01.png
chrome_2018-07-14_13-07-01.png (11.77 KiB) Viewed 4410 times
I have to remove fontSize, fontFamily, fontFormat, image, upload, link, unlink, forecolor and bgcolor.

According to the nicEdit documentation (http://wiki.nicedit.com/w/page/515/Conf ... %20Options) I have found the buttonList-configuration in nicEdit.js, line 30:

Code: Select all

buttonList : ['save','bold','italic','underline','left','center','right','justify','ol','ul','fontSize','fontFamily','fontFormat','indent','outdent','image','upload','link','unlink','forecolor','bgcolor'],
My configuration after removing those buttons:

Code: Select all

buttonList : ['save','bold','italic','underline','left','center','right','justify','ol','ul', 'indent','outdent'],

Unfortunately the buttons still appear :| .

Does anyone know how to remove them?

Kind Regards,
Jan
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Richtext-Editor nicEdit.js - remove tools from button list

Post by pbottcher » 2018-07-14 13:01

Hi,

you need to modify the template/<TABLENAME>_templateDV.html file. search for the

new nicEditor and either replace

Code: Select all

new nicEditor({ fullPanel : true })

by

Code: Select all

 new nicEditor({ buttonList : ['bold','italic','underline','left','center','right','justify','ol','ul', 'indent','outdent'] })   //  this will change only this single nicEdit box

or by

Code: Select all

new nicEditor({ fullPanel : false })  // this will affect this nicEdit box and apply the settings from the nicEdit.js defintion.

Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Richtext-Editor nicEdit.js - remove tools from button list

Post by jsetzer » 2018-07-14 13:51

Thanks a lot, pböttcher, your solution works as expected! ;)

Unfortunately both files (nicEdit.js AND template/<TABLENAME>_templateDV.htm) will be overwritten on generation if I'm not careful enough.

Is there any solution using jQuery like...

Code: Select all

$j(function() {

	$j('#myEditor').nicEdit( /* ... configure or call some method ... */ );

});
... or something similar? I know we can adjust SELECT2 this way. So I'm wondering if we can do the same with nicEdit?!

Kind Regards,
Jan
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Richtext-Editor nicEdit.js - remove tools from button list

Post by pbottcher » 2018-07-14 14:57

Hi, you can try in the hooks/<TABLENAME>.php

Code: Select all

	function <TABLENAME>_footer($contentType, $memberInfo, &$args){
		$footer='';

		switch($contentType){
			case 'tableview':
				$footer='';
				break;

			case 'detailview':
				$footer='<script>
							bkLib.onDomLoaded(function() {
								setTimeout(function() {
									$j(\'div.nicEdit-panel\').children().slice(<AMOUNT OF BUTTON YOU WANT>).hide();
								},100);
							});
						 </script><%%FOOTER%%>
						';
				break;
replace <AMOUNT OF BUTTON YOU WANT> with the correct number you are looking for (e.g. 9)
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

User avatar
ronwill
Veteran Member
Posts: 228
Joined: 2015-08-08 10:12
Location: Cheltenham UK +Weatherford USA

Re: Richtext-Editor nicEdit.js - remove tools from button list

Post by ronwill » 2018-08-05 01:16

As an alternative, have you tried to use ckeditor instead of Nicedit. I use it on most my client text areas now.
Ron - Gloucestershire, UK: AppGini Pro V 23.15 Rev 1484 - LOVING IT!
Plugins: Mass Update + Search Page Maker + Summary Reports + Calendar + Messages
Bizzworxx: AppGiniHelper + Inline Detail View
Alejandro Landini: To-Do List + MPI + TV Field Editor
Other: Udemy Course

Post Reply