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

Started by aegersz, July 05, 2019, 06:49:10 PM

Previous topic - Next topic

aegersz

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
The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

Oldiesmann

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
Michael Eshom
Christian Metal Fans

br360

 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

aegersz

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
The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

aegersz

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.
The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

GigaWatt

"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

aegersz

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 !
The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

Advertisement: