How can I change the Nicedit default font size of the text that is displayed in the Nicedit editor?

StackOverflow https://stackoverflow.com/questions/13436635

  •  30-11-2021
  •  | 
  •  

Вопрос

How can I change the Nicedit default font size of the text that is displayed in the Nicedit editor's Edit box?

See link to image here: http://4.bp.blogspot.com/-BDOmlcOIcBA/UKbZ-TFLfnI/AAAAAAAACKU/8LRYrZZRio8/s640/toggle0.jpg The Edit box is the yellow rctangle.

I am sure the code to edit the font property is like this:

area1 = new nicEditor({fullPanel : true}).panelInstance('peterText',{hasPanel : true});

or like:

area1 = new nicEditor({/*fullPanel : true*/buttonList : ['save','center','right','forecolor','bgcolor','image','fontSize','fontFamily','fontFormat','subscript','superscript','ol','ul','indent','link','unlink','xhtml']
  }).panelInstance('peterText',{hasPanel : true});

or something like:

  bkLib.onDomLoaded(function() {
        new nicEditor().panelInstance('area1');
        new nicEditor({fullPanel : true}).panelInstance('area2');
        new nicEditor({iconsPath : '../nicEditorIcons.gif'}).panelInstance('area3');
        new nicEditor({buttonList : ['fontSize','bold','italic','underline','strikeThrough','subscript','superscript','html','image']}).panelInstance('area4');
        new nicEditor({maxHeight : 100}).panelInstance('area5');
  });

Any ideas, anyone?

Это было полезно?

Решение

nicEdit uses html tags within the textarea's body to manage fonts/bold/underline etc. The trick is to supply the tags in the body of the textarea before you create the panel instance.

var body = document.getElementById('editor_body');
body.innerHTML = "<font face='verdana' color='green' size='6'><div align='left'>Hello!</div></font>";
new nicEditor({iconsPath:'edit/nicEditorIcons.gif'}).panelInstance('editor_body');
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top