Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
editor css
#1
Correct me if I'm wrong but wouldn't it be better to have the editor.css file in a styles subfolder, or a way to specify the location.

Also, the styles in this file are basicly a copy of some of the styles in your normal stylesheet, so when you edit your main stylesheet, you have to copy that over to that file again, correct?

Wouldn't it be more correct to just reverence to the main css file as default styling for the editor and if another style is prevered create a seperate editor.css . With some switch in the gsconfig.php to set it to defalt GS editor styles.
Reply
#2
(2014-12-17, 20:34:31)datiswous Wrote: Correct me if I'm wrong but wouldn't it be better to have the editor.css file in a styles subfolder, or a way to specify the location.

I recall that for CKEditor to find it automatically, the editor.css file has to be in the same location as template.php. You can configure CKE to get the css from anywhere, but it then becomes theme-specific.

It isn't necessary to have a separate file: you can use a symlink to the theme's css file. There may be some weird effects if CKE doesn't understand something, but usually that's sufficient (for me).
--
Nick.
Reply
#3
(2014-12-17, 21:42:19)hameau Wrote: It isn't necessary to have a separate file: you can use a symlink to the theme's css file.
Sorry, how do you do that? This is new for me.
Reply
#4
It is preferable to have a seperate file, more than likely your stylesheet will have wrappers and classes that are not present in the ckeditor frame.

editor.css is really contentsCss, I have no idea why it was named editor.css
editor.css is what cke loads for its own styles.

regardless

You can just set your own
contentsCss in ckeditor config or GSEDITOROPTIONS

PHP Code:
define('GSEDITOROPTIONS'"contentsCss:'/theme/editor.css'"); 

supposedly you can also pass an array of multiples
eg. ['/1.css', '/2.css']

in 3.3.x contentCss is looked for here
theme/TEMPLATE/editor.css
ckeditor will also look for its own in its folder for contents.css if not set

In 3.4 I might add an additional theme override in themes/editor.css

and probably change it to contents.css, so its not so confusing in the future.

to summarize

As of now if a theme wants to include a stylesheet to style the wysiwyg editor, then editor.css in your main theme folder needs to exist. (styles/editor.css would probably have been better, its too late now to change that though )

If a user wants to add their own and override this, then they can specify using contentsCss as i mentioned above.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#5
Thanks for the explanation, Shawn. I never got any further than my quick-fix. Generally, CKE just ignores anything it doesn't understand, so I left it at that. At least it avoids the need to maintain two files.

(2014-12-18, 00:35:52)shawn_a Wrote: In 3.4 I might add an additional theme override in themes/editor.css
and probably change it to contents.css, so its not so confusing in the future.

What's wrong with 'editor.css'? At least the name says what it styles. 'content.css' is less specific, imo.

(2014-12-17, 23:07:53)datiswous Wrote:
(2014-12-17, 21:42:19)hameau Wrote: It isn't necessary to have a separate file: you can use a symlink to the theme's css file.
Sorry, how do you do that? This is new for me.

It's like a link in Windows (in this case), so it appears as a file to the system, but it references another file. The link goes in the same folder as template.php, but it points to the real file in, e.g., the styles folder. You can certainly make the symlink if you have shell access to the server and may be able to do it from the hosting control panel.

However, see Shawn's explanation for more robust ways of styling the editor window.
--
Nick.
Reply
#6
indeed, it explains what it styles with regards to GS, but since ckeditor also has a different editor.css you will have 2 editor.css loading on your site, which can make for confusing debugging and explanation of which we are talking about which does what.

My point being not using the same style for ckeditor as editor.css is that your style probably has
rules for selectors like this
.section h3
.wrapper h3
.grid-4 h3

<div class="section"><h3>
get_content() <-- h3 in here wont be styled in backend but will be in front end, since selectors won't exist in the ckeditor instance because it is a fragment.
Now there are ways to hack this stuff into the editor also, but that is beyond this conversation.

so you might want special rules in editor.css to style these correctly in the editor but not want that extra stuff in your actual site style.

Same way your body styles wont be applied in ckeditor because there is none in the editor.


here are some more cke config for style ( note these refer to 4.3x )
http://docs.cksource.com/ckeditor_api/sy...ontentsCss
http://docs.cksource.com/ckeditor_api/sy....bodyClass
http://docs.cksource.com/ckeditor_api/sy...ml#.bodyId

And then there is styles, which i honestly are not familiar with, but someone needs to figure out how to incorporate this into themes practically and not break when switching themes.
stylesheetparser plugin
http://docs.ckeditor.com/#!/guide/dev_howtos_styles
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#7
Thanks for the info.
Reply




Users browsing this thread: 1 Guest(s)