Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Aiheen aloitti: aegersz - heinäkuu 05, 2019, 06:49:10 IP

Otsikko: I wish to add an additional default Font Size into the editor
Kirjoitti: aegersz - heinäkuu 05, 2019, 06:49:10 IP
Well hello again fourumfreaks,

I wish to add an additional default Font Size into the editor,

How do I go about that please ? It only has 8px, 10px, 12 px etc. but I need a 11px option and after more than 1000 times manually, i feel that it's time to set this value as a new item that I can choose from the drop down menu.

Faithfully,

that drugged forum guy  :P
Otsikko: Re: I wish to add an additional default Font Size into the editor
Kirjoitti: Oldiesmann - heinäkuu 06, 2019, 02:30:22 AP
Are you asking about 2.0 or 2.1? In 2.1 the editor only has font sizes 1-7 rather than things like 8px
Otsikko: Re: I wish to add an additional default Font Size into the editor
Kirjoitti: br360 - heinäkuu 06, 2019, 03:44:09 IP
 If you are trying to do this in 2.0.x, you have to make changes in a couple of places.

In GenericControls.template.php, find this:

                \'\': ', JavaScriptEscape($txt['font_size']), ',
                           \'1\': \'8pt\',
                           \'2\': \'10pt\',
                           \'3\': \'12pt\',
                           \'4\': \'14pt\',
                           \'5\': \'18pt\',
                           \'6\': \'24pt\',
                           \'7\': \'36pt\'


Replace with this:
                \'\': ', JavaScriptEscape($txt['font_size']), ',
                           \'1\': \'8pt\',
                           \'2\': \'10pt\',
                           \'3\': \'11pt\',
                           \'4\': \'12pt\',
                           \'5\': \'14pt\',
                           \'6\': \'18pt\',
                           \'7\': \'24pt\',
                           \'8\': \'36pt\'


In scripts/editor.js- find:

// Font maps (HTML => CSS size)
   this.aFontSizes = [
      0,
      8,
      10,
      12,
      14,
      18,
      24,
      36


Then just add 11, after the 10 like this:

this.aFontSizes = [
      0,
      8,
      10,
      11,
      12,
      14,
      18,
      24,
      36


I tested it and it works, just make sure to back up both files first
Otsikko: Re: I wish to add an additional default Font Size into the editor
Kirjoitti: aegersz - heinäkuu 06, 2019, 07:35:25 IP
YES, this in 2.0.15

@br360, Hey thanks buddy, you are a sweetie for going to all that trouble.

I will try it soon and yes, I always take backups
Otsikko: Re: I wish to add an additional default Font Size into the editor
Kirjoitti: aegersz - heinäkuu 06, 2019, 09:12:22 IP
I tried it but 11pt gives me 12pt and 36pt gives me undefined - could it be due to the browser caching the old javascript code ?

EDIT: yes, this is my problem. I just tried to do it from my phone's seldom used Opera browser and it's working perfectly there.

Now all i have to do is figure out how to hard refresh the code cache in Opera and Chrome.

I'll get back to you on that unless anyone can tell me how to do it - I haven't had to do it for ages and it may be in the Developer's tool or something ...

Thanks again.
Otsikko: Re: I wish to add an additional default Font Size into the editor
Kirjoitti: GigaWatt - heinäkuu 06, 2019, 09:36:40 IP
Ctrl + F5 ;)... works on most browsers ;).
Otsikko: Re: I wish to add an additional default Font Size into the editor
Kirjoitti: aegersz - heinäkuu 06, 2019, 09:40:50 IP
Thanks Gigawatt but i only wanted to clear the cache that holds javascript only so to refresh the Javscript cache only, I went into Opera's Settings > Clear browsing data > (tick) Cached Images and Files (only).

Works perfectly like it rolled off the production line at Simple Machines !