Advertisement:

Author Topic: I wish to add an additional default Font Size into the editor  (Read 295 times)

Offline aegersz

  • SMF Hero
  • ******
  • Posts: 1,476
  • Gender: Male
  • "mods" junkie
    • dopetalk
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 145 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)

Offline Oldiesmann

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,865
  • Gender: Male
  • Ask me about the function DB :)
    • oldiesmann on Facebook
    • Oldiesmann on GitHub
    • https://www.linkedin.com/in/michaeleshom on LinkedIn
    • @oldiesmann on Twitter
    • Archie Comics Fan Forum
Re: I wish to add an additional default Font Size into the editor
« Reply #1 on: July 06, 2019, 02:30:22 AM »
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
Cincy Space - now open!

Offline br360

  • Support Specialist
  • SMF Hero
  • *
  • Posts: 2,379
    • GenXcommunity
Re: I wish to add an additional default Font Size into the editor
« Reply #2 on: July 06, 2019, 03:44:09 PM »
 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:

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

Replace with this:
Code: [Select]
                \'\': ', 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:

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

Then just add 11, after the 10 like this:

Code: [Select]
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

Offline aegersz

  • SMF Hero
  • ******
  • Posts: 1,476
  • Gender: Male
  • "mods" junkie
    • dopetalk
Re: I wish to add an additional default Font Size into the editor
« Reply #3 on: July 06, 2019, 07:35:25 PM »
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 145 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)

Offline aegersz

  • SMF Hero
  • ******
  • Posts: 1,476
  • Gender: Male
  • "mods" junkie
    • dopetalk
Re: I wish to add an additional default Font Size into the editor
« Reply #4 on: July 06, 2019, 09:12:22 PM »
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.
« Last Edit: July 06, 2019, 09:38:10 PM by aegersz »
The configuration of my Linux VPS (SMF 2.0 with 145 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)

Offline GigaWatt

  • The Smiley Guy
  • Support Specialist
  • SMF Hero
  • *
  • Posts: 2,030
  • Gender: Male
    • Macedonian electronics forum
Re: I wish to add an additional default Font Size into the editor
« Reply #5 on: July 06, 2019, 09:36:40 PM »
Ctrl + F5 ;)... works on most browsers ;).
"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?"..."

Offline aegersz

  • SMF Hero
  • ******
  • Posts: 1,476
  • Gender: Male
  • "mods" junkie
    • dopetalk
Re: I wish to add an additional default Font Size into the editor
« Reply #6 on: July 06, 2019, 09:40:50 PM »
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 145 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)