Rana Omer Hussain's RegEdit

My Weblog registry is a directory which stores settings and options for my Professional Life

Archive for the tag “EDITOR”

ULSViewer tool

Are you already using ULSviewer tool? Great! If not, please download your copy from the following site:

ULS Viewer

It is an excellent tool to read error messages from the SharePoint logs. You may have noticed that SP 2010 throws an error with correlation ID which is meaningless for the users. It doesn’t tell anything to the user about the error. You can use ULSviewer to search the error in the logs using the correlation ID. Error log gives you complete description of the error.

PowerShell Demo Tools

Several people who attended my PowerShell talk at SPC09 have been asking for the “Start-Demo” Script I used to demo PowerShell commands without having to type them in front of a live audience.  

The script I used is really just a slightly modified version of this one 

http://blogs.msdn.com/powershell/archive/2007/06/03/new-and-improved-start-demo.aspx 

iI recommend just using the version provided by the PowerShell team.

Also, I recommend pairing this with the Sysinternals tool ZoomIt to allow for zooming and underlining elements on the screen.

This is a free tool available from the Sysinternals website: http://technet.microsoft.com/en-us/sysinternals/default.aspx

PowerShell Scripting Editor

If you’re anything like me, you like to script in an organized fashion. Notepad just doesn’t quite do it for me, so be sure to check out the new PowerGUI Script Editor (comes with PowerGUI), which has built in intelli-sense and color coding!

Insert JavaScript into a Content Editor Web Part (CEWP)

In the 2007 version of SharePoint, we had the Source Editor included in the Content Editor Web Part as our way of inputting JavaScript directly onto a page. The process on how to do this has changed a little bit in the new 2010 version. Follow below on how to successfully perform the same task.

Instead of having a Source Editor to directly paste in our code, we need to first create a simple text file and paste and save our code there. Once saved, upload that file to SharePoint. I am using the Site Assets library for this demo and a JavaScript that displays today’s date. After you have uploaded the file, right-click on the file and select Copy Shortcut.

Now, go to your desired page and put the page in edit mode. Add in the Content Editor Web Part located under the Media and Content category. Once added select the web part and use the ribbon UI to navigate to the Web Part Properties screen.

On the web part properties screen, paste in the URL link to your uploaded JavaScript file. Click Ok on the properties screen and, if your JavaScript is valid, it should display the desired results! Simple and easy!

Ref : Insert JavaScript into a Content Editor Web Part By sptwentyten

Custom Styles for SharePoint 2010 Rich Html Field

A typical requirement from a client is to be able to incorporate their own custom styles for the Rich Html Field. Allowing their public relations department to apply nice text formating for paragraphs with some Comic Sans Hotness might not be the best practice in here, so let’s be careful out there. The best scenario is only to allow custom formatting for headings, paragraphs and maybe a few different table styles but let’s go!

First, open up the page layout containing the HTML editor and add PrefixStyleSheet property for the RichHtmlField:

<PublishingWebControls:RichHtmlField id=”Content” FieldName=”PublishingPageContent” PrefixStyleSheet=”my-rte” runat=”server” />

Now, the default value for the property is ms-rte. We are going to redefine this to my-rte. Do not use any uppercase characters in the property value as apparently those wont work. Deploy the page and open it in edit mode to see the desired effect. The styles collections are now empty in the Ribbon.

We now have to define our own styles prefixed with the string my-rte. I’d suggest that you put these style declarations in a separate stylesheet to avoid javascript errors caused by complicated and hard-to-parse stylesheets. Let’s name our new stylesheet rte.css and add a few declarations there.

The Markup Collection

Let’s say I want to have an option to add a level 1 heading or an H1 tag for the given page via the Markup Styles dropdown list:

Step 1 – introduce the tag:

H1.my-rteElement-H1 { -ms-name:”my level 1 heading”; }

Step 2 – add the styles to the tag:

.my-rteElement-H1 { font-size: 150%; }

Save the rte.css and make a reference for it in your master page, page layout or even use an alernative css. If you want your clients to be able to edit the styles themself, you could upload the rte.css in the Style Library and reference it there.

I have saved the file directly in the 14-hive /_layouts/my/ -folder and use a quick reference in the master page:

<SharePoint:CssRegistration ID=”CssRegistration1″ runat=”server” Name=”/_layouts/my/rte.css” />

Deploy and reload the page, fire up the edit mode and navigate to the ribbon where you can see your new style in action.

Adding new elements is easy once you get to know the logic. Here’s an example of a parapgraph with nice rounded corners and superb font on modern browsers (note that I have combined the introduction and style values in one declaration):

P.my-rteElement-P { -ms-name:”My CSS Rounded Paragraph”; background: #808; color: #fff; border: 3px solid #f0f; text-transform: uppercase; text-align: center; -webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px; box-shadow: 0 0 20px #000; -moz-box-shadow: 0 0 20px #000; -webkit-box-shadow: 0 0 20px #000; padding: 10px; font: bold 2em Comic Sans MS; }

The Styles Collection

The Styles collection can be populated with the same way by changing the Element-suffix into Style ie.:

.my-rteStyle-MePinky { -ms-name:”I am pink”; color: #f0f; }

Other Items

I’d suggest that you check out the default HTML editor styles in /Style Library/en-us/Themable/Core Styles/htmleditorstyles for quick reference how to style the other elements, including table styles on the Ribbon.

Ref : Custom Style by Tuukka Uskali

Post Navigation

Follow

Get every new post delivered to your Inbox.

Join 321 other followers