Jump to content

Default font and text size


Go to solution Solved by Nathan Explosion,

Recommended Posts

Please move this topic in corect section 

Can the default font and text size of the CKEditor text box be changed?

Tell me how it will happen??  I want to change the CKEditor default font and size in my forum. My forum is hosted on self hosting.Please advise me

Edited by Black Zero
Link to comment
Share on other sites

  • Solution
Marc Stridgen
This post was recognized by Marc Stridgen!

"Much appreciated :)"

Nathan Explosion was awarded the badge 'Helpful' and 10 points.

edit your globalTemplate template and add the following prior to the closing </body> and save your template.

<script>
	if(typeof CKEDITOR !='undefined'){
		CKEDITOR.addCss(".cke_editable{cursor:text; font-size: 20px; font-family: Georgia;}");
		CKEDITOR.config.font_defaultLabel='Georgia';
		CKEDITOR.config.fontSize_defaultLabel='20px';
	}
</script>

What does it do...

  1. If there is a CKEDITOR on the page then...
  2. It changes the CSS of the editor to be the font/font-size you want and then...
  3. It changes the label of the font dropdown box and...
  4. It changes the label of the font size dropdown box.

 

Could contain: Page, Text, Plot, Chart

Link to comment
Share on other sites

18 minutes ago, Nathan Explosion said:

edit your globalTemplate template and add the following prior to the closing </body> and save your template.

<script>
	if(typeof CKEDITOR !='undefined'){
		CKEDITOR.addCss(".cke_editable{cursor:text; font-size: 20px; font-family: Georgia;}");
		CKEDITOR.config.font_defaultLabel='Georgia';
		CKEDITOR.config.fontSize_defaultLabel='20px';
	}
</script>

What does it do...

  1. If there is a CKEDITOR on the page then...
  2. It changes the CSS of the editor to be the font/font-size you want and then...
  3. It changes the label of the font dropdown box and...
  4. It changes the label of the font size dropdown box.

 

Could contain: Page, Text, Plot, Chart

Its amazing dear
Its working now. Also tell me its left element so that it starts 😀 writing from default left

and if set default colour etc ???

Edited by Black Zero
Link to comment
Share on other sites

Change the addCss line to add the following (changing the code for the color as desired)

color:#27ae60 !important;

The "!important" is important.

Therefore...

<script>
	if(typeof CKEDITOR !='undefined'){
		CKEDITOR.addCss(".cke_editable{cursor:text; font-size: 20px; font-family: Georgia; color:#27ae60 !important}");
		CKEDITOR.config.font_defaultLabel='Georgia';
		CKEDITOR.config.fontSize_defaultLabel='20px';
	}
</script>

 

Link to comment
Share on other sites

You're going to need some extra CSS in your theme to change the displayed content to match what you want them to display - the above only controls the defaults used in the Editor, and anything entered will not have any html tags/styles added to them by default, so will need to be handled.

Example:

The above content is using the defaults on here...it's html code is:

<p>
	You&#39;re going to need some extra CSS in your theme to change the displayed content to match what you want them to display - the above only controls the defaults used in the Editor, and anything entered will not have any html tags/styles added to them by default, so will need to be handled.
</p>

However, if I manually change an element of the font it becomes...

<p>
	You&#39;re going to need some extra CSS in your theme to change the displayed content to match what you want them to display - <span style="color:#e74c3c;">the above only controls the def</span>aults used in the Editor, and anything entered will not have any html tags/styles added to them by def<span style="font-family:Comic Sans MS,cursive;">ault, so will need</span> to be handled.
</p>

...and that contains the styles that enforce the changes on the displayed content:

Could contain: Page, Text, File

You'll need something to handle the items that are not styled - I'm not a theme guy, so no idea what specific areas you'll have to modified in your theme.

Link to comment
Share on other sites

6 minutes ago, Nathan Explosion said:

You'll need something to handle the items that are not styled - I'm not a theme guy, so no idea what specific areas you'll have to modified in your theme.

I think you can solve it. Can you please find the solution for me. I can wait for that.

Link to comment
Share on other sites

3 hours ago, Black Zero said:

Tell me how it will happen??  I want to change the CKEditor default font and size in my forum. My forum is hosted on self hosting.Please advise me

You do not have an active self-hosted license, and your expired self-hosted license is associated to a domain that does not resolve. 

Please clarify how you are "self-hosting", and at what URL.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...