Friday, December 26, 2008

Predefine styles in HTML editor in MOSS

A quick note about predefining custom styles in a HTML editor:
Standard, the HTML editor detects CSS classes whose names have the prefix .ms-rteCustom. You can easily extend the OOTB styles by adding .ms-rteCustom-XXX to your custom stylesheet. The name "XXX" will then become available in the styles dropdown within the HTML editor.

Another option is to specify a unique CSS class name prefix. This give you the ability to present different custom styles for different HTML editors of the publishing page. To make a unique CSS class, you have to assign a PrefixStyleSheet property to the HTML field control.

<.PublishingWebControls:RichHtmlField id="Content" FieldName="PublishingPageContent" runat="server" PrefixStyleSheet="myUniqueClass"./>
Afterwards you can define the "myUniqueClassCustom" class in you custom stylesheet.
Warning: you have to append the word "Custom" to the class, otherwise it won't work! In my opinion, MS doesn't explain this very well...


Syntax = .[PrefixStyleSheetPropertyName]Custom-[TitleAvailableInEditor]

font-weight: bold;
font-size: 16px;

Read How to: Customize Styles for more information.

Sunday, December 7, 2008

Bug: Publishing Image aka RichImageField

In certain cases the RichImageField renders an HTML encoded image. It just renders image tags but doesn't render the image.

You have to build a webcontrol that inherits from RichImageField and decode the HTML.

Source: Publishing Images are shown in encoded Html/text instead of showing the image - temporary solution