News:

Wondering if this will always be free?  See why free is better.

Main Menu

SMF 2.1 WYSIWYG

Started by kruimeltje, April 12, 2019, 01:15:31 PM

Previous topic - Next topic

kruimeltje

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 [nofollow].
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! :)

Kindred

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.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Sesquipedalian

Quote from: Kindred on April 12, 2019, 02:12:01 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.

Quote from: kruimeltje on April 12, 2019, 01:15:31 PM
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.

kruimeltje

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?


SychO

try to copy jquery.sceditor.default.css from the default theme to your custom theme and then edit it, it should do the trick
Checkout My Themes:
-

Potato  •  Ackerman  •  SunRise  •  NightBreeze

kruimeltje

Quote from: SychO 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
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.

Sesquipedalian

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.

SychO

@Sesquipedalian it seems that file only ever loads from the default theme, this is where it's "used" in the code


// 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,
);
Checkout My Themes:
-

Potato  •  Ackerman  •  SunRise  •  NightBreeze

Sesquipedalian

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.

Sesquipedalian

I promise you nothing.

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

maximus23

Hi,

Just modify by :

'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...

Sesquipedalian

Quote from: maximus23 on April 15, 2019, 02:00:16 PM
Hi,

Just modify by :

'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.

maximus23

QuoteThat 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...

kruimeltje

Quote from: Sesquipedalian on April 15, 2019, 02:03:51 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

Sesquipedalian

I promise you nothing.

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

Advertisement: