CMS MADE SIMPLE FORGE

TinyMCE

 

[#4151] Template container element detection and CSS application

avatar
Created By: Jonny Stephens (jonny)
Date Submitted: 2009-10-06 19:37

Assigned To:
Resolution: Fixed
State: Closed
Summary:
Template container element detection and CSS application
Detailed Description:
Thanks for all your hard work with tinyMCE.

It would be very useful if tinyMCE could automatically detect the containing
element of content blocks and apply any CSS rules declared for that element
within the editor.

e.g. if the template included  the following:

<div id="sidebar">
{content block="side"}
</div>

and the attached stylesheet included

#sidebar {background-color:#ddd;}
#sidebar h3 {font-size:1.2em;}
#sidebar p {color:#333;}

all these styles would be applied to relevant content within the tinyMCE editor
for {content block="side"}.

The purpose of this function would be to provide a rich but semantically clean 
WYSIWYG environment for end users without the need to apply wrapper elements
within the editor.

History

Comments
avatar
Date: 2009-10-06 20:15
Posted By: Morten Poulsen (silmarillion)

I can only agree that this would be very elegant... unfortunately, the TinyMCE
system does not support this. And as I'm only doing the module-integration into
CMSMS, not the TinyMCE-engine itself, I cannot make any progress for now until
the Tiny-people builts in functions allowing this.

Regards
Silmarillion
      
avatar
Date: 2009-10-07 16:35
Posted By: Jonny Stephens (jonny)

Thanks for your quick reply Mprten.

How does this sound, as a custom mod...

add a checkbox with onclick beside the WYSIWYG toggler to get the id from the
containing iframe, trim the "_ifr" and apply it as a class to the body#tinymce
element.

e.g.

<iframe frameborder="0" id="sidebar_ifr" src='javascript:""' style="width: 100%;
height: 400px;"/>

<body id="tinymce" class="mceContentBody CMSMSBody sidebar" spellcheck="false"
dir="ltr">

I may be wrong but, at a glance, it looks as if this could be implemented within
the module (tinyconfig.tpl and TinyMCE.module.php), without altering tinyMCE
itself.

Regards

Jonny


      
avatar
Date: 2016-01-05 07:32
Posted By: Mathieu Muths (airelibre) (airelibre)

With the new CMS Made Simple 2+ series, you can add a "cssname" parameter to
your content block in order to give the right stylesheet.

You can test this with TinyMCE 3.0-alpha1 but this needs tests
      
Updates

Updated: 2016-01-05 07:32
resolution_id: 5 => 7
state: Open => Closed

Updated: 2009-10-06 20:15
resolution_id: => 5