Click here to Skip to main content
Click here to Skip to main content

Beginners introduction to the Jiffycms HTML Editor

By , 22 Mar 2009
 

Introduction

One of the things you will notice in ASP.NET today is that, by default, out of the box, there is no standard control representing a rich text editor. You will also notice that your only viable options are quite limited to:

  • FREETEXTBOX --while the name suggests it's free, what is free is only a subset of features, while the full version is on a pay basis.
  • FCKEditor --This is the most highly used editor in the market today due to it being Open Source; however, mainly it's just a client-side product with several contributors having written server-side wrappers around the client-side library. The problem with this though is that the web control is simply a wrapper.
  • You purchase a commercial license from third parties (quite pricey).

Jiffycms HTML Editor is a rich text Open Source HTML editor with commercial grade features, and is a great alternative to all three points above. It's written for ASP.NET, and uses ASP.NET AJAX Extensions to the full potential. It is also a rich server-side Web control requiring you to make very little effort to get it running as it uses the VS.NET designer at full potential too. There are just too many features, and to list each here is not going to be possible; instead, this article will focus on first time usage, and specifically how to move the CSS generated by the WebControl to an external CSS file.

Unlike most HTML editors, Jiffycms HTML Editor is a true Web Control without any extra dependencies, and is packaged as a single DLL. Since it is built on top of the AJAX Extensions library, which many people are already referencing in their pages due to their using the UpdatePanel or what not, the payload in the client library download size is minimized: something which you will incur on other third party editors out there today since they tend to use their own custom libraries.

Here in this post, I want to showcase how easy it is to use the Jiffycms HTML Editor in your pages and how to perform some optimizations to get the best performance from your web apps by using an external CSS stylesheet file.

Usage

First, let's try to start from the basics and define a new WebSite Project for the purposes of this tutorial:

Create new project VS.NET

Let's now download the Jiffycms HTML Editor DLL from CodePlex. Now that we have the DLL, which is Jiffycms.Net.Toolkit.dll, we are ready to add it to our Toolbox in VS.NET. Before you add it to your Toolbox, to help you in better organizing all your custom controls, you may want to create a new tab in the toolbox first and then add the control in there.

Add new tab in VS.NET Toolbox

Now, right click into your newly created tab empty area, and select "Choose Items" from the context menu. You can also simply drag and drop the DLL into the empty area.

Choose Items context menu

Browsing for Jiffycms HTML Editor dll

When you are done browsing to the DLL you downloaded from CodePlex, you should see it in your toolbox at this point, and you are ready to start using this fine component.

Jiffycms HTML Editor icon in toolbox

While you may not like working in Design view in VS.NET, dragging and dropping the control from the Toolbox onto your web form is going to allow the editor to make the initial configs in your web.config file automatically. The registrations it makes can be made manually, it's just a registration for a simple HttpHandler in web.config.

If you prefer to do this manually, then make the following entry under the path Configuration/httpHandlers section; for IIS 6, this is as follows:

<add verb="*" path="jiffycms.axd" 
     type="Jiffycms.Net.Toolkit.WebResourceHandler" />

For IIS 7, you need to make an entry under the Configuration/system.webServer/Handlers section, as follows:

<add verb="*" path="jiffycms.axd" name="WebResourceHandler" 
  type="Jiffycms.Net.Toolkit.WebResourceHandler" 
  preCondition="integratedMode" />

Note: If you are dragging and dropping the component from the Toolbox, this is already done for you.

After dragging and dropping the control at Design time, this is what the HTML editor looks like in Design view:

Jiffycms HTML Editor in designview

Oh great, we got design-time rendering of the editor. Now, it's a matter of playing with the various properties in the property grid. Upon running the page, you will notice lots of CSS output in the head section of your rendered page. While this is the default, you can chose to put the CSS in an external CSS file. Doing this will not only decrease the page payload, but since the CSS is in an external CSS file, it will get cached by the browser, so that subsequent requests will be served from the cache automatically.

Fortunately, this kind of change is not hard to do. You can use a design-time feature to collect all the runtime CSS generated by the control and manually copy it into an external CSS file.

CSS extraction tool

Just copy the CSS and paste it into an external style sheet, then reference the CSS file via the ExternalStyleSheet property:

Map external stylesheet to ExternalStyleSheet property

Note that every time you make a modification to the editor such as modify the styles in the designer or modify style dependent properties such as IconsMode, ToolbarMode etc., you will need to regenerate the CSS and update your CSS file manually. Fortunately, if you have decided to go this route, you might also be editing the CSS yourself so this may not be an inconvenience after all.

History

Update: 22 - March - 2009

A new article is now available dealing with the Image Gallery in Jiffycms HTML Editor.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Alessandro Zifiglio
Web Developer Typps.com
Italy Italy
Member
I'm alessandro and currently run www.typps.com

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralNo sample projects here or on codeplexmemberDewey21 Mar '09 - 20:06 
No sample projects?
 
That's really STRANGE!
GeneralRe: No sample projects here or on codeplexmemberAlessandro Zifiglio22 Mar '09 - 1:04 
hi, Follow this tutorial to getting started. There is a newer one you can find here : http://www.codeproject.com/KB/webforms/ImageGallery.aspx[^]
 
This addresses a key feature, being the image gallery. I shall be releasing more articles like this in the coming days. Once that objective has been reached, i'll include them all in 1 big sample project you can download from codeplex. If there is something special you are trying to do and confused, feel free to post on the jiffycms forums. Thanks for patience.
 
Alessandro Zifiglio
http://www.jiffycms.net
http://jiffycms.codeplex.com

GeneralRe: No sample projects here or on codeplexmemberDewey22 Mar '09 - 12:26 
Thanks for the reply, but it's clear that you don't understand the difference between a tutorial and a working project.
 
I think it's great that you provide tutorials, but for those of us that don't need them, it's MUCH faster to evaluate something(or extend it), to have something we don't have to sit there and type, or copy & paste boring step by step.
 
Since you MUST have the completed projects already, it boggles the mind why you just don't post them.
GeneralRe: No sample projects here or on codeplexmemberGfw23 Mar '09 - 0:08 
There is a download.
 
Follow the link to http://jiffycms.codeplex.com and look on the right hand side - you can download just the DLL or the full source. It took me about 5 minutes to downlaod and have it running is a sample aspx page. Smile | :)
GeneralRe: No sample projects here or on codeplexmemberDewey23 Mar '09 - 19:07 
Thanks, I did that, although it's not the same.
GeneralRe: No sample projects here or on codeplexmemberLars-Erik Kindblad23 Mar '09 - 10:10 
Since this is an open source project, why don't you invest some of your own time into creating a sample project based on this tutorial and sharing it with others? That's much better than whining.
GeneralRe: No sample projects here or on codeplexmemberDewey23 Mar '09 - 19:06 
Gee, if you follow that logic, why don't you create/expand everything that you know should be standard.
 
Yikes, keep your looney comments to yourself.
QuestionUpdatePanelmemberGfw21 Mar '09 - 0:19 
Love your editor - thanks.
 
The only problem that I had occurred when I placed the editor inside an UpdatePanel and added two buttons that: 1) Saved the text; and 2) Cleared the message. If I removed the UpdatePannel box, all worked. If I did a full postback (using triggers) for the buttons, all worked.
 
The error: Line: 128 Error: 'this._element.style' is null or not an object
 
Another suggestion is to wrap the 5 .JiffyCMS_Editor_htmlelementlabels that contain dashed border style with @media screen (leave dashes) and @media print using only border-style:none so the dashes are not visible when the test is printed to paper.
 
Gfw Smile | :)
AnswerRe: UpdatePanelmemberAlessandro Zifiglio21 Mar '09 - 7:37 
hi, thanks for the kind words and the suggestion for @media print. I will see what is the easiest way to incorporate this by default in the editor. I'm not clear with the error you got so i'll make some more tests and let you know.
 
In the meantime, if it's not too much trouble, try to paste a little sample code that shows the condition where you get an error on any pastecode site and provide the url here. Also let me know what browser you are using.
 
Alessandro Zifiglio
http://www.jiffycms.net
http://jiffycms.codeplex.com

GeneralRe: UpdatePanelmemberGfw22 Mar '09 - 2:12 
Sorry for teh delay in getting back to you - it ay have been a problem with my work machine. When I published to a live server, the error went away.
GeneralRe: UpdatePanelmemberAlessandro Zifiglio22 Mar '09 - 6:13 
ok cool. Thanks for the feedback.
 
Alessandro Zifiglio
http://www.jiffycms.net
http://jiffycms.codeplex.com

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130516.1 | Last Updated 22 Mar 2009
Article Copyright 2009 by Alessandro Zifiglio
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid