Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > WYSIWOG Defining styles View modes: 
User avatar
Member
Member
pavel.1991-tut - 4/10/2013 5:08:55 AM
   
WYSIWOG Defining styles
1) I've read in documentation that I can define styles for editor in CMSAdminControls\CKeditor\plugins\styles\styles\default.js.
This is from documentation:

CKEDITOR.stylesSet.add( 'default',

[

{ name : 'Blue Title' , element : 'h3', styles : { 'color' : 'Blue' } },

{ name : 'Red Title' , element : 'h3', styles : { 'color' : 'Red' } },

{ name : 'Marker: Yellow' , element : 'span', styles : { 'background-color' : 'Yellow' } },

{ name : 'Marker: Green' , element : 'span', styles : { 'background-color' : 'Lime' } },

{ name : 'Big' , element : 'big' },

{ name : 'Small' , element : 'small' },

{ name : 'Typewriter' , element : 'tt' },

{ name : 'Computer Code' , element : 'code' },

{ name : 'Keyboard Phrase' , element : 'kbd' },

{ name : 'Sample Text' , element : 'samp' },

{ name : 'Variable' , element : 'var' },

{ name : 'Deleted Text' , element : 'del' },

{ name : 'Inserted Text' , element : 'ins' },

{ name : 'Cited Work' , element : 'cite' },

{ name : 'Inline Quotation' , element : 'q' },

{ name : 'Language: RTL' , element : 'span', attributes : { 'dir' : 'rtl' } },

{ name : 'Language: LTR' , element : 'span', attributes : { 'dir' : 'ltr' } },

{

name : 'Image on Left',

element : 'img',

attributes :

{

'style' : 'padding: 5px; margin-right: 5px',

'border' : '2',

'align' : 'left'

}

},

{

name : 'Image on Right',

element : 'img',

attributes :

{

'style' : 'padding: 5px; margin-left: 5px',

'border' : '2',

'align' : 'right'

}

},

{ name : 'Borderless Table', element : 'table', styles: { 'border-style': 'hidden', 'background-color' : '#E6E6FA' } },

{ name : 'Square Bulleted List', element : 'ul', styles : { 'list-style-type' : 'square' } }

]);

When I define this code in file default.js, all these styles will be always in editor. But I need that on some pages there be one styles set and on other pages be another styles set in editor. What do I do to have opportunity to choose what styles set will be used in editor?

2) And one more question. I've created html of my page and css for it. This is css:

.home a
{
...
}

.home p
{
...
}

.home h1
{
...
}

And this is html:

<section class="home">

</section>


I inserted editable web-part inside "<section class="home"></section>". But in editor I can't see formatted html because editable web-part uses iframe which is inserted inside my html and because of iframe my css doesn't work. What do I do for my css to work? I mean that I want to see text in editor as it will look after editing.

User avatar
Kentico Consulting
Kentico Consulting
richards@kentico.com - 4/11/2013 5:08:52 AM
   
RE:WYSIWOG Defining styles
Hi,

The only way I can think of achieving the first question would be to manually edit the pages in CMS desk where the ckeditor is loaded and then configure the ckeditor.

I have never worked with this before but if you read carefully in that documentation you will you how to do it. Especially see section Defining Styles.

You may find the documentation at:
http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Styles

And to answer the second question - it is not possible to see formatted text inside editable text web part. You may however use Static Html web part for this. You will however lose the option for editing the text inside Page tab.

Kind regards,
Richard Sustek

User avatar
Member
Member
pavel.1991-tut - 4/11/2013 7:07:35 AM
   
RE:WYSIWOG Defining styles
I've read that if I need to apply styles set, I have to add this string to config.js "config.stylesSet = 'Name of styles set'". If I do this, this styles set will be in all editors. But I need one styles set for some editors and another one for other editors. Can I do this somehow?

User avatar
Kentico Consulting
Kentico Consulting
richards@kentico.com - 4/11/2013 7:15:02 AM
   
RE:WYSIWOG Defining styles
Hi,

I've gone through the options and unfortunately I dont know how this would be possible. You would need to go through the pages in CMS where the ckeditor is loaded and then add there some configuration settings manually.

At this point I would prefer you to add styles to the main config.js. It will be easy to manage and easy to implement.

Im sorry for this inconviniences, but not everyhing is easily possible.

Kind regards,
Richard Sustek

User avatar
Member
Member
pavel.1991-tut - 4/11/2013 7:47:47 AM
   
RE:WYSIWOG Defining styles
Ok, and last question. When I add editable web-part, I can choose editor css stylesheet in properties of web-part. But where can I choose editor css stylesheet when in document type I create the field with HTML area (Formatted text) control??

User avatar
Kentico Consulting
Kentico Consulting
richards@kentico.com - 4/11/2013 8:21:51 AM
   
RE:WYSIWOG Defining styles
Hi,

Im not sure I fully understand your question - could you be more specific? If you create a document type with any fields you are then displaying those document type by e.g. repeater, is that correct?

Well - anything that gets "printed" on the front page inherits from the default CSS Stylesheet which can be found at Site manager -> Development -> CSS stylesheets.

Is that what you were asking?

Kind regards,
Richard Sustek

User avatar
Member
Member
pavel.1991-tut - 4/11/2013 8:49:46 AM
   
RE:WYSIWOG Defining styles
For example, I've created document type with some fields. These fields use HTML area (Formatted text) control. Then I create page with my new document type. I need to fill fields. But I can't choose stylesheet for editors. Of course I can set stylesheet for editors at Site manager -> Development -> CSS stylesheets -> editor's stylesheet. But in this way this stylesheet will be used by all editors. I need to set another editor css stylesheet for some fields in document type. How do I do this? When I add editable web-part on a page I can set editor css stylesheet in properties.

User avatar
Kentico Consulting
Kentico Consulting
richards@kentico.com - 4/11/2013 9:01:46 AM
   
RE:WYSIWOG Defining styles
Hi,

Well, you may have to do this by defining differrent classes. I mean - you are using some kind of transformation for displaying the document types, is that right? Well in that particular webpart responsible for displaying records of documents you edit the transformation so that the fields you want have the classes you want.

Could you please make me some screenshots of how would you like it to work?

You cant set the the HTML editor css stylesheet in e.g. repeater because this webpart doesnt use ckeditor.

Kind regards,
Richard Sustek