Advertisement:

Author Topic: SMF 2.1 WYSIWYG  (Read 553 times)

Offline kruimeltje

  • Semi-Newbie
  • *
  • Posts: 15
SMF 2.1 WYSIWYG
« on: April 12, 2019, 01:15:31 PM »
Hi,

I made a copy of the default theme and changed the colors, just to get more into CSS.
When I was testing (to check for possible forgotten color changes) I tried the wysiwyg-editor.
when I used that editor I saw, through inspection (F12), that the jquery of the default theme was loaded 'html, p, code::before, table' of jquery.sceditor.default.css via ajax.googleapis.com.
I found out when typing in the quick_reply box, because I made the theme gray with white font and the standard fontcolor is black.
After turning the wysiwyg off the fontcolor is white again and the body of minified.css is loaded.

wysiwyg on: jquery.sceditor.default
wysiwyg off: minified.css

Now I wonder why/how that happened, purely to understand how it works.
I tried to find out more about jquery, but I still don't get it to be honest.

SMF version: 2.1 RC1

Thanks in advance! :)

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 57,977
  • Gender: Male
    • Kindred-999 on GitHub
Re: SMF 2.1 WYSIWYG
« Reply #1 on: April 12, 2019, 02:12:01 PM »
I'm not sure I understand your question...

when the wysiwyg is not used, there is no need to load the resources -- so we don't.
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline Sesquipedalian

  • The Mad Doctor
  • Lead Developer
  • Sr. Member
  • *
  • Posts: 755
  • Gender: Male
  • It works! ... in theory.
    • Sesquipedalian on GitHub
Re: SMF 2.1 WYSIWYG
« Reply #2 on: April 12, 2019, 04:56:51 PM »
when the wysiwyg is not used, there is no need to load the resources -- so we don't.

Strictly speaking, in SMF 2.1 the "Disable WYSIWYG editor" setting merely tells SCEditor to only show its plain text mode. SCEditor itself is loaded in either case.

Now I wonder why/how that happened, purely to understand how it works.

SCEditor uses an iframe containing an editable HTML document to present its WYSIWYG view, and a normal textarea element to show the plain text view. The file jquery.sceditor.default.css styles the document inside the iframe, while jquery.sceditor.css styles the textarea.

Note that being inside an iframe means that the editable document does not inherit any CSS rules from the containing page, whereas the textarea does inherit them. That's why changes to index.css can affect the plain text view (i.e. the textarea) but not the WYSIWYG view (i.e. content of the iframe).
I promise you nothing.

Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

Offline kruimeltje

  • Semi-Newbie
  • *
  • Posts: 15
Re: SMF 2.1 WYSIWYG
« Reply #3 on: April 14, 2019, 03:56:06 PM »
Thanks for your reply @Sesquipedalin!

would it be possible to use two different jquery.sceditor.default.css files? One for the default theme and one for the grey one.
If yes, where should I allocate which file is loaded to style the iframe associated with the correct theme?


Online SychO

  • Customizer
  • Sophist Member
  • *
  • Posts: 1,087
  • Gender: Male
    • SychO9 on GitHub
    • SychO
Re: SMF 2.1 WYSIWYG
« Reply #4 on: April 14, 2019, 04:11:23 PM »
try to copy jquery.sceditor.default.css from the default theme to your custom theme and then edit it, it should do the trick

Imazighen

Offline kruimeltje

  • Semi-Newbie
  • *
  • Posts: 15
Re: SMF 2.1 WYSIWYG
« Reply #5 on: April 15, 2019, 10:01:42 AM »
try to copy jquery.sceditor.default.css from the default theme to your custom theme and then edit it, it should do the trick
Thanks for the tip.

I've tried it. Unfortunately, it doesn't work.
It still loads the stylesheet of default theme : Themes/default/css/jquery.sceditor.default.css

Also have tried to rename the file to theme name (default to curve grey): jquery.sceditor.curve grey.css, but that does not work either.

Offline Sesquipedalian

  • The Mad Doctor
  • Lead Developer
  • Sr. Member
  • *
  • Posts: 755
  • Gender: Male
  • It works! ... in theory.
    • Sesquipedalian on GitHub
Re: SMF 2.1 WYSIWYG
« Reply #6 on: April 15, 2019, 11:55:50 AM »
That's odd. SychO's advice should have worked. To help rule out the possibility of a caching issue, toggle the "Minimize CSS and JavaScript files" setting and check if that makes any difference. If not, please open a new bug report on GitHub so that I don't forget to look into this.
I promise you nothing.

Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

Online SychO

  • Customizer
  • Sophist Member
  • *
  • Posts: 1,087
  • Gender: Male
    • SychO9 on GitHub
    • SychO
Re: SMF 2.1 WYSIWYG
« Reply #7 on: April 15, 2019, 12:12:00 PM »
@Sesquipedalian it seems that file only ever loads from the default theme, this is where it's "used" in the code

Code: [Select]
// Set up the SCEditor options
$sce_options = array(
'style' => $settings['default_theme_url'] . '/css/jquery.sceditor.default.css',
'emoticonsCompat' => true,
'colors' => 'black,maroon,brown,green,navy,grey,red,orange,teal,blue,white,hotpink,yellow,limegreen,purple',
'format' => 'bbcode',
'plugins' => '',
'bbcodeTrim' => true,
);

Imazighen

Offline Sesquipedalian

  • The Mad Doctor
  • Lead Developer
  • Sr. Member
  • *
  • Posts: 755
  • Gender: Male
  • It works! ... in theory.
    • Sesquipedalian on GitHub
Re: SMF 2.1 WYSIWYG
« Reply #8 on: April 15, 2019, 01:34:37 PM »
That's what I suspected, but I was on my phone at the time and couldn't quickly check.
I promise you nothing.

Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

Offline Sesquipedalian

  • The Mad Doctor
  • Lead Developer
  • Sr. Member
  • *
  • Posts: 755
  • Gender: Male
  • It works! ... in theory.
    • Sesquipedalian on GitHub
Re: SMF 2.1 WYSIWYG
« Reply #9 on: April 15, 2019, 01:49:40 PM »
I promise you nothing.

Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

Offline maximus23

  • Native Language Support Specialist
  • SMF Super Hero
  • *
  • Posts: 11,269
  • Gender: Male
  • Smf 2.1 RC2
    • Smf Français Forum non Officiel
Re: SMF 2.1 WYSIWYG
« Reply #10 on: April 15, 2019, 02:00:16 PM »
Hi,

Just modify by :

Code: [Select]
'style' => $settings['theme_url'] . '/css/jquery.sceditor.default.css',
?

:)
Pas de support par PM ou Courrier...Veuillez utiliser le forum pour vous avoir une réponse rapide à votre demande d'aide. Merci.
Amitiés et à Bientôt...
No support by PM or Mail...You will get better and faster responses in the support forums. Thank you.
Have a nice day...

Offline Sesquipedalian

  • The Mad Doctor
  • Lead Developer
  • Sr. Member
  • *
  • Posts: 755
  • Gender: Male
  • It works! ... in theory.
    • Sesquipedalian on GitHub
Re: SMF 2.1 WYSIWYG
« Reply #11 on: April 15, 2019, 02:03:51 PM »
Hi,

Just modify by :

Code: [Select]
'style' => $settings['theme_url'] . '/css/jquery.sceditor.default.css',
?

:)

That wouldn't be good enough, I'm afraid. If the CSS file wasn't present in the user's selected theme, that code would fail. But you are on the right track. The fix that will be included in RC3 can be seen here: https://github.com/SimpleMachines/SMF2.1/pull/5602/files
I promise you nothing.

Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

Offline maximus23

  • Native Language Support Specialist
  • SMF Super Hero
  • *
  • Posts: 11,269
  • Gender: Male
  • Smf 2.1 RC2
    • Smf Français Forum non Officiel
Re: SMF 2.1 WYSIWYG
« Reply #12 on: April 15, 2019, 02:11:11 PM »
Quote
That wouldn't be good enough, I'm afraid. If the CSS file wasn't present in the user's selected theme, that code would fail. But you are on the right track. The fix that will be included in RC3 can be seen here: https://github.com/SimpleMachines/SMF2.1/pull/5602/files

Ok thanks for the fix. :)
Pas de support par PM ou Courrier...Veuillez utiliser le forum pour vous avoir une réponse rapide à votre demande d'aide. Merci.
Amitiés et à Bientôt...
No support by PM or Mail...You will get better and faster responses in the support forums. Thank you.
Have a nice day...

Offline kruimeltje

  • Semi-Newbie
  • *
  • Posts: 15
Re: SMF 2.1 WYSIWYG
« Reply #13 on: April 15, 2019, 03:25:12 PM »

That wouldn't be good enough, I'm afraid. If the CSS file wasn't present in the user's selected theme, that code would fail. But you are on the right track. The fix that will be included in RC3 can be seen here: https://github.com/SimpleMachines/SMF2.1/pull/5602/files [nofollow]

I have adjusted the code, in sources/subs-editor.php, as in the pull on Github and can confirm that it works.

Thanks for the fast fix!  :D

Offline Sesquipedalian

  • The Mad Doctor
  • Lead Developer
  • Sr. Member
  • *
  • Posts: 755
  • Gender: Male
  • It works! ... in theory.
    • Sesquipedalian on GitHub
Re: SMF 2.1 WYSIWYG
« Reply #14 on: April 15, 2019, 05:01:17 PM »
No problem.
I promise you nothing.

Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.