Index: src/webapp/components/inlineEdit/js/InlineEditIntegrations.js
===================================================================
--- src/webapp/components/inlineEdit/js/InlineEditIntegrations.js	(revision 9801)
+++ src/webapp/components/inlineEdit/js/InlineEditIntegrations.js	(working copy)
@@ -1,324 +1,431 @@
-/*
-Copyright 2008-2009 University of Cambridge
-Copyright 2008-2009 University of Toronto
-
-Licensed under the Educational Community License (ECL), Version 2.0 or the New
-BSD license. You may not use this file except in compliance with one these
-Licenses.
-
-You may obtain a copy of the ECL 2.0 License and BSD License at
-https://source.fluidproject.org/svn/LICENSE.txt
-*/
-
-/*global jQuery*/
-/*global fluid_1_2*/
-/*global tinyMCE*/
-/*global FCKeditor*/
-/*global FCKeditorAPI*/
-/*global fluid*/ //this global function will refer to whichever version of Fluid Infusion was first loaded
-
-fluid_1_2 = fluid_1_2 || {};
-
-(function ($, fluid) {
-
-    var configureInlineEdit = function (configurationName, container, options) {
-    	var defaults = fluid.defaults(configurationName); 
-        var assembleOptions = fluid.merge(defaults? defaults.mergePolicy: null, {}, defaults, options);
-        return fluid.inlineEdit(container, assembleOptions);
-    };
-
-    fluid.inlineEdit.normalizeHTML = function(value) {
-        var togo = $.trim(value.replace(/\s+/g, " "));
-        togo = togo.replace(/\s+<\//g, "</");
-        togo = togo.replace(/\<(\S+)[^\>\s]*\>/g, function(match) {
-            return match.toLowerCase();
-            });
-        return togo;
-    };
-    
-    fluid.inlineEdit.htmlComparator = function(el1, el2) {
-        return fluid.inlineEdit.normalizeHTML(el1) ===
-           fluid.inlineEdit.normalizeHTML(el2);
-    };
-
-    // Configuration for integrating tinyMCE
-    
-    /**
-     * Instantiate a rich-text InlineEdit component that uses an instance of TinyMCE.
-     * 
-     * @param {Object} componentContainer the element containing the inline editors
-     * @param {Object} options configuration options for the components
-     */
-    fluid.inlineEdit.tinyMCE = function (container, options) {
-        var inlineEditor = configureInlineEdit("fluid.inlineEdit.tinyMCE", container, options);
-        tinyMCE.init(inlineEditor.options.tinyMCE);
-        return inlineEditor;
-    };
-        
-    fluid.inlineEdit.tinyMCE.viewAccessor = function (editField) {
-        return {
-            value: function (newValue) {
-                var editor = tinyMCE.get(editField.id);
-                if (!editor) {
-                    return "";
-                }
-                if (newValue) {
-                    // without this, there is an intermittent race condition if the editor has been created on this event.
-                    $(editField).val(newValue); 
-                    editor.setContent(newValue, {format : 'raw'});
-                }
-                else {
-                    return editor.getContent();
-                }
-            }
-        };
-    };
-   
-    fluid.inlineEdit.tinyMCE.blurHandlerBinder = function (that) {
-        function focusEditor(editor) {
-            setTimeout(function () {
-                tinyMCE.execCommand('mceFocus', false, that.editField[0].id);
-                if ($.browser.mozilla && $.browser.version.substring(0, 3) === "1.8") {
-                    // Have not yet found any way to make this work on FF2.x - best to do nothing,
-                    // for FLUID-2206
-                    //var body = editor.getBody();
-                    //fluid.setCaretToEnd(body.firstChild, "");
-                    return;
-                }
-                editor.selection.select(editor.getBody(), 1);
-                editor.selection.collapse(0);
-            }, 10);
-        }
-        
-        that.events.afterInitEdit.addListener(function (editor) {
-            focusEditor(editor);
-            var editorBody = editor.getBody();
-
-            // NB - this section has no effect - on most browsers no focus events
-            // are delivered to the actual body
-            fluid.deadMansBlur(that.editField, $(editorBody), function () {
-                that.cancel();
-            });
-        });
-            
-        that.events.afterBeginEdit.addListener(function () {
-            var editor = tinyMCE.get(that.editField[0].id);
-            if (editor) {
-                focusEditor(editor);
-            } 
-        });
-    };
-   
-   
-    fluid.inlineEdit.tinyMCE.editModeRenderer = function (that) {
-        var options = that.options.tinyMCE;
-        options.elements = fluid.allocateSimpleId(that.editField);
-        var oldinit = options.init_instance_callback;
-        
-        options.init_instance_callback = function (instance) {
-            that.events.afterInitEdit.fire(instance);
-            if (oldinit) {
-                oldinit();
-            }
-        };
-        
-        tinyMCE.init(options);
-    };
-    
-      
-    fluid.defaults("fluid.inlineEdit.tinyMCE", {
-        tinyMCE : {
-            mode: "exact", 
-            theme: "simple"
-        },
-        useTooltip: true,
-        selectors: {
-            edit: "textarea" 
-        },
-        
-        styles: {
-            invitation: "fl-inlineEdit-richText-invitation"
-        },
-        displayAccessor: {
-            type: "fluid.inlineEdit.richTextViewAccessor"
-        },
-        editAccessor: {
-            type: "fluid.inlineEdit.tinyMCE.viewAccessor"
-        },
-        lazyEditView: true,
-        modelComparator: fluid.inlineEdit.htmlComparator,
-        blurHandlerBinder: fluid.inlineEdit.tinyMCE.blurHandlerBinder,
-        editModeRenderer: fluid.inlineEdit.tinyMCE.editModeRenderer
-    });
-    
-    
-    
-    // Configuration for integrating FCKEditor
-    
-    /**
-     * Instantiate a rich-text InlineEdit component that uses an instance of FCKeditor.
-     * 
-     * @param {Object} componentContainer the element containing the inline editors
-     * @param {Object} options configuration options for the components
-     */
-    fluid.inlineEdit.FCKEditor = function (container, options) {
-        return configureInlineEdit("fluid.inlineEdit.FCKEditor", container, options);
-    };
-    
-    fluid.inlineEdit.FCKEditor.complete = fluid.event.getEventFirer();
-    
-    fluid.inlineEdit.FCKEditor.complete.addListener(function (editor) {
-        var editField = editor.LinkedField;
-        var that = $.data(editField, "fluid.inlineEdit.FCKEditor");
-        if (that && that.events) {
-            that.events.afterInitEdit.fire(editor);
-        }
-    });
-    
-    fluid.inlineEdit.FCKEditor.blurHandlerBinder = function (that) {
-	    function focusEditor(editor) {
-            editor.Focus(); 
-        }
-        
-        that.events.afterInitEdit.addListener(
-            function (editor) {
-                focusEditor(editor);
-                var editorBody = editor.EditingArea.TargetElement;
-
-                // NB - this section has no effect - on most browsers no focus events
-                // are delivered to the actual body
-                //fluid.deadMansBlur(that.editField,
-                //         $(editorBody),
-                //           function () {
-                //               that.cancel();
-                //            });
-            }
-        );
-        that.events.afterBeginEdit.addListener(function () {
-            var editor = fluid.inlineEdit.FCKEditor.byId(that.editField[0].id);
-            if (editor) {
-                focusEditor(editor);
-            } 
-        });
-
-    };
-
-    fluid.inlineEdit.FCKEditor.byId = function (id) {
-        var editor = typeof(FCKeditorAPI) === "undefined"? null: FCKeditorAPI.GetInstance(id);
-        return editor;  
-    };
-    
-    fluid.inlineEdit.FCKEditor.editModeRenderer = function (that) {
-        var id = fluid.allocateSimpleId(that.editField);
-        $.data(fluid.unwrap(that.editField), "fluid.inlineEdit.FCKEditor", that);
-        var oFCKeditor = new FCKeditor(id);
-        // The Config object and the FCKEditor object itself expose different configuration sets,
-        // which possess a member "BasePath" with different meanings. Solve FLUID-2452, FLUID-2438
-        // by auto-inferring the inner path for Config (method from http://drupal.org/node/344230 )
-        var opcopy = fluid.copy(that.options.FCKEditor);
-        opcopy.BasePath = opcopy.BasePath + "editor/";
-        $.extend(true, oFCKeditor.Config, opcopy);
-        // somehow, some properties like Width and Height are set on the object itself
-
-        $.extend(true, oFCKeditor, that.options.FCKEditor);
-        oFCKeditor.Config.fluidInstance = that;
-        oFCKeditor.ReplaceTextarea();
-    };
-    
-    fluid.inlineEdit.FCKEditor.viewAccessor = function (editField) {
-        return {
-            value: function (newValue) {
-                var editor = fluid.inlineEdit.FCKEditor.byId(editField.id); 
-                if (!editor) {
-                	if (newValue) {
-                        $(editField).val(newValue);
-                	}
-                	return "";
-                }
-                if (newValue) {
-                    editor.SetHTML(newValue);
-                }
-                else {
-                    return editor.GetHTML();
-                }
-            }
-        };
-    };
-    
-    
-    fluid.defaults("fluid.inlineEdit.FCKEditor", {
-        selectors: {
-            edit: "textarea" 
-        },
-        
-        styles: {
-            invitation: "fl-inlineEdit-richText-invitation"
-        },
-      
-        displayAccessor: {
-            type: "fluid.inlineEdit.richTextViewAccessor"
-        },
-        editAccessor: {
-            type: "fluid.inlineEdit.FCKEditor.viewAccessor"
-        },
-        lazyEditView: true,
-        modelComparator: fluid.inlineEdit.htmlComparator,
-        blurHandlerBinder: fluid.inlineEdit.FCKEditor.blurHandlerBinder,
-        editModeRenderer: fluid.inlineEdit.FCKEditor.editModeRenderer,
-        FCKEditor: {
-            BasePath: "fckeditor/"    
-        }
-    });
-    
-    
-    // Configuration for integrating a drop-down editor
-    
-    /**
-     * Instantiate a drop-down InlineEdit component
-     * 
-     * @param {Object} container
-     * @param {Object} options
-     */
-    fluid.inlineEdit.dropdown = function (container, options) {
-        return configureInlineEdit("fluid.inlineEdit.dropdown", container, options);
-    };
-
-    fluid.inlineEdit.dropdown.editModeRenderer = function (that) {
-        var id = fluid.allocateSimpleId(that.editField);
-        that.editField.selectbox({
-            finishHandler: function () {
-                that.finish();
-            }
-        });
-        return {
-            container: that.editContainer,
-            field: $("input.selectbox", that.editContainer) 
-        };
-    };
-   
-    fluid.inlineEdit.dropdown.blurHandlerBinder = function (that) {
-        fluid.deadMansBlur(that.editField,
-                           $("div.selectbox-wrapper li", that.editContainer),
-                           function () {
-                               that.cancel();
-                           });
-    };
-
-
-    
-    fluid.defaults("fluid.inlineEdit.dropdown", {
-        applyEditPadding: false,
-        blurHandlerBinder: fluid.inlineEdit.dropdown.blurHandlerBinder,
-        editModeRenderer: fluid.inlineEdit.dropdown.editModeRenderer
-    });
-    
-    
-})(jQuery, fluid_1_2);
-
-
-// This must be written outside any scope as a result of the FCKEditor event model.
-// Do not overwrite this function, if you wish to add your own listener to FCK completion,
-// register it with the standard fluid event firer at fluid.inlineEdit.FCKEditor.complete
-function FCKeditor_OnComplete(editorInstance) {
-    fluid.inlineEdit.FCKEditor.complete.fire(editorInstance);
-}
\ No newline at end of file
+/*
+Copyright 2008-2009 University of Cambridge
+Copyright 2008-2009 University of Toronto
+
+Licensed under the Educational Community License (ECL), Version 2.0 or the New
+BSD license. You may not use this file except in compliance with one these
+Licenses.
+
+You may obtain a copy of the ECL 2.0 License and BSD License at
+https://source.fluidproject.org/svn/LICENSE.txt
+*/
+
+/*global setTimeout*/
+/*global jQuery, fluid_1_2, fluid*/
+/*global tinyMCE, FCKeditor, FCKeditorAPI, CKEDITOR*/
+
+fluid_1_2 = fluid_1_2 || {};
+
+(function ($, fluid) {
+
+    /*************************************
+     * Shared Rich Text Editor functions *
+     *************************************/
+     
+    fluid.inlineEdit.makeViewAccessor = function (editorGetFn, setValueFn, getValueFn) {
+        return function (editField) {
+            return {
+                value: function (newValue) {
+                    var editor = editorGetFn(editField);
+                    if (!editor) {
+                        if (newValue) {
+                            $(editField).val(newValue);
+                        }
+                        return "";
+                    }
+                    if (newValue) {
+                        setValueFn(editField, editor, newValue);
+                    }
+                    else {
+                        return getValueFn(editor);
+                    }
+                }
+            };
+        };
+    };
+    
+    var configureInlineEdit = function (configurationName, container, options) {
+        var defaults = fluid.defaults(configurationName); 
+        var assembleOptions = fluid.merge(defaults? defaults.mergePolicy: null, {}, defaults, options);
+        return fluid.inlineEdit(container, assembleOptions);
+    };
+
+    fluid.inlineEdit.normalizeHTML = function(value) {
+        var togo = $.trim(value.replace(/\s+/g, " "));
+        togo = togo.replace(/\s+<\//g, "</");
+        togo = togo.replace(/\<(\S+)[^\>\s]*\>/g, function(match) {
+            return match.toLowerCase();
+            });
+        return togo;
+    };
+    
+    fluid.inlineEdit.htmlComparator = function(el1, el2) {
+        return fluid.inlineEdit.normalizeHTML(el1) ===
+           fluid.inlineEdit.normalizeHTML(el2);
+    };
+
+
+    /************************
+     * Tiny MCE Integration *
+     ************************/
+    
+    /**
+     * Instantiate a rich-text InlineEdit component that uses an instance of TinyMCE.
+     * 
+     * @param {Object} componentContainer the element containing the inline editors
+     * @param {Object} options configuration options for the components
+     */
+    fluid.inlineEdit.tinyMCE = function (container, options) {
+        var inlineEditor = configureInlineEdit("fluid.inlineEdit.tinyMCE", container, options);
+        tinyMCE.init(inlineEditor.options.tinyMCE);
+        return inlineEditor;
+    };
+        
+    fluid.inlineEdit.tinyMCE.getEditor = function (editField) {
+        return tinyMCE.get(editField.id);
+    };
+    
+    fluid.inlineEdit.tinyMCE.setValue = function (editField, editor, value) {
+        // without this, there is an intermittent race condition if the editor has been created on this event.
+        $(editField).val(value); 
+        editor.setContent(value, {format : 'raw'});
+    };
+    
+    fluid.inlineEdit.tinyMCE.getValue = function (editor) {
+        return editor.getContent();
+    };
+    
+    var flTinyMCE = fluid.inlineEdit.tinyMCE; // Shorter alias for awfully long fully-qualified names.
+    flTinyMCE.viewAccessor = fluid.inlineEdit.makeViewAccessor(flTinyMCE.getEditor, 
+                                                               flTinyMCE.setValue,
+                                                               flTinyMCE.getValue);
+   
+    fluid.inlineEdit.tinyMCE.blurHandlerBinder = function (that) {
+        function focusEditor(editor) {
+            setTimeout(function () {
+                tinyMCE.execCommand('mceFocus', false, that.editField[0].id);
+                if ($.browser.mozilla && $.browser.version.substring(0, 3) === "1.8") {
+                    // Have not yet found any way to make this work on FF2.x - best to do nothing,
+                    // for FLUID-2206
+                    //var body = editor.getBody();
+                    //fluid.setCaretToEnd(body.firstChild, "");
+                    return;
+                }
+                editor.selection.select(editor.getBody(), 1);
+                editor.selection.collapse(0);
+            }, 10);
+        }
+        
+        that.events.afterInitEdit.addListener(function (editor) {
+            focusEditor(editor);
+            var editorBody = editor.getBody();
+
+            // NB - this section has no effect - on most browsers no focus events
+            // are delivered to the actual body
+            fluid.deadMansBlur(that.editField, $(editorBody), function () {
+                that.cancel();
+            });
+        });
+            
+        that.events.afterBeginEdit.addListener(function () {
+            var editor = tinyMCE.get(that.editField[0].id);
+            if (editor) {
+                focusEditor(editor);
+            } 
+        });
+    };
+   
+    fluid.inlineEdit.tinyMCE.editModeRenderer = function (that) {
+        var options = that.options.tinyMCE;
+        options.elements = fluid.allocateSimpleId(that.editField);
+        var oldinit = options.init_instance_callback;
+        
+        options.init_instance_callback = function (instance) {
+            that.events.afterInitEdit.fire(instance);
+            if (oldinit) {
+                oldinit();
+            }
+        };
+        
+        tinyMCE.init(options);
+    };
+    
+      
+    fluid.defaults("fluid.inlineEdit.tinyMCE", {
+        tinyMCE : {
+            mode: "exact", 
+            theme: "simple"
+        },
+        useTooltip: true,
+        selectors: {
+            edit: "textarea" 
+        },
+        
+        styles: {
+            invitation: "fl-inlineEdit-richText-invitation"
+        },
+        displayAccessor: {
+            type: "fluid.inlineEdit.richTextViewAccessor"
+        },
+        editAccessor: {
+            type: "fluid.inlineEdit.tinyMCE.viewAccessor"
+        },
+        lazyEditView: true,
+        modelComparator: fluid.inlineEdit.htmlComparator,
+        blurHandlerBinder: fluid.inlineEdit.tinyMCE.blurHandlerBinder,
+        editModeRenderer: fluid.inlineEdit.tinyMCE.editModeRenderer
+    });
+    
+    
+    /*****************************
+     * FCKEditor 2.x Integration *
+     *****************************/
+         
+    /**
+     * Instantiate a rich-text InlineEdit component that uses an instance of FCKeditor.
+     * 
+     * @param {Object} componentContainer the element containing the inline editors
+     * @param {Object} options configuration options for the components
+     */
+    fluid.inlineEdit.FCKEditor = function (container, options) {
+        return configureInlineEdit("fluid.inlineEdit.FCKEditor", container, options);
+    };
+    
+    fluid.inlineEdit.FCKEditor.getEditor = function (editField) {
+        var editor = typeof(FCKeditorAPI) === "undefined"? null: FCKeditorAPI.GetInstance(editField.id);
+        return editor;
+    };
+    
+    fluid.inlineEdit.FCKEditor.complete = fluid.event.getEventFirer();
+    
+    fluid.inlineEdit.FCKEditor.complete.addListener(function (editor) {
+        var editField = editor.LinkedField;
+        var that = $.data(editField, "fluid.inlineEdit.FCKEditor");
+        if (that && that.events) {
+            that.events.afterInitEdit.fire(editor);
+        }
+    });
+    
+    fluid.inlineEdit.FCKEditor.blurHandlerBinder = function (that) {
+	    function focusEditor(editor) {
+            editor.Focus(); 
+        }
+        
+        that.events.afterInitEdit.addListener(
+            function (editor) {
+                focusEditor(editor);
+            }
+        );
+        that.events.afterBeginEdit.addListener(function () {
+            var editor = fluid.inlineEdit.FCKEditor.getEditor(that.editField[0]);
+            if (editor) {
+                focusEditor(editor);
+            } 
+        });
+
+    };
+    
+    fluid.inlineEdit.FCKEditor.editModeRenderer = function (that) {
+        var id = fluid.allocateSimpleId(that.editField);
+        $.data(fluid.unwrap(that.editField), "fluid.inlineEdit.FCKEditor", that);
+        var oFCKeditor = new FCKeditor(id);
+        // The Config object and the FCKEditor object itself expose different configuration sets,
+        // which possess a member "BasePath" with different meanings. Solve FLUID-2452, FLUID-2438
+        // by auto-inferring the inner path for Config (method from http://drupal.org/node/344230 )
+        var opcopy = fluid.copy(that.options.FCKEditor);
+        opcopy.BasePath = opcopy.BasePath + "editor/";
+        $.extend(true, oFCKeditor.Config, opcopy);
+        // somehow, some properties like Width and Height are set on the object itself
+
+        $.extend(true, oFCKeditor, that.options.FCKEditor);
+        oFCKeditor.Config.fluidInstance = that;
+        oFCKeditor.ReplaceTextarea();
+    };
+
+    
+    fluid.inlineEdit.FCKEditor.setValue = function (editField, editor, value) {
+        editor.SetHTML(value);
+    };
+    
+    fluid.inlineEdit.FCKEditor.getValue = function (editor) {
+        return editor.GetHTML();
+    };
+    
+    var flFCKEditor = fluid.inlineEdit.FCKEditor;
+    
+    flFCKEditor.viewAccessor = fluid.inlineEdit.makeViewAccessor(flFCKEditor.getEditor,
+                                                                 flFCKEditor.setValue,
+                                                                 flFCKEditor.getValue);
+    
+    fluid.defaults("fluid.inlineEdit.FCKEditor", {
+        selectors: {
+            edit: "textarea" 
+        },
+        
+        styles: {
+            invitation: "fl-inlineEdit-richText-invitation"
+        },
+      
+        displayAccessor: {
+            type: "fluid.inlineEdit.richTextViewAccessor"
+        },
+        editAccessor: {
+            type: "fluid.inlineEdit.FCKEditor.viewAccessor"
+        },
+        lazyEditView: true,
+        modelComparator: fluid.inlineEdit.htmlComparator,
+        blurHandlerBinder: fluid.inlineEdit.FCKEditor.blurHandlerBinder,
+        editModeRenderer: fluid.inlineEdit.FCKEditor.editModeRenderer,
+        FCKEditor: {
+            BasePath: "fckeditor/"    
+        }
+    });
+    
+    
+    /****************************
+     * CKEditor 3.x Integration *
+     ****************************/
+    
+    fluid.inlineEdit.CKEditor = function (container, options) {
+        return configureInlineEdit("fluid.inlineEdit.CKEditor", container, options);
+    };
+    
+    fluid.inlineEdit.CKEditor.getEditor = function (editField) {
+        return CKEDITOR.instances[editField.id];
+    };
+    
+    fluid.inlineEdit.CKEditor.setValue = function (editField, editor, value) {
+        editor.setData(value);
+    };
+    
+    fluid.inlineEdit.CKEditor.getValue = function (editor) {
+        return editor.getData();
+    };
+    
+    var flCKEditor = fluid.inlineEdit.CKEditor;
+    flCKEditor.viewAccessor = fluid.inlineEdit.makeViewAccessor(flCKEditor.getEditor,
+                                                                flCKEditor.setValue,
+                                                                flCKEditor.getValue);
+                             
+    fluid.inlineEdit.CKEditor.focus = function (editor) {
+        setTimeout(function () {
+            // CKEditor won't focus itself except in a timeout.
+            editor.focus();
+        }, 0);
+    };
+    
+    // Special hacked HTML normalisation for CKEditor which spuriously inserts whitespace
+    // just after the first opening tag
+    fluid.inlineEdit.CKEditor.normalizeHTML = function(value) {
+        var togo = fluid.inlineEdit.normalizeHTML(value);
+        var angpos = togo.indexOf(">");
+        if (angpos !== -1 && angpos < togo.length - 1) {
+            if (togo.charAt(angpos + 1) !== " ") {
+                togo = togo.substring(0, angpos + 1) + " " + togo.substring(angpos + 1);
+            }
+        }
+        return togo;
+    };
+    
+    fluid.inlineEdit.CKEditor.htmlComparator = function(el1, el2) {
+        return fluid.inlineEdit.CKEditor.normalizeHTML(el1) ===
+           fluid.inlineEdit.CKEditor.normalizeHTML(el2);
+    };
+                                    
+    fluid.inlineEdit.CKEditor.blurHandlerBinder = function (that) {
+        that.events.afterInitEdit.addListener(fluid.inlineEdit.CKEditor.focus);
+        that.events.afterBeginEdit.addListener(function () {
+            var editor = fluid.inlineEdit.CKEditor.getEditor(that.editField[0]);
+            if (editor) {
+                fluid.inlineEdit.CKEditor.focus(editor);
+            }
+        });
+    };
+    
+    fluid.inlineEdit.CKEditor.editModeRenderer = function (that) {
+        var id = fluid.allocateSimpleId(that.editField);
+        $.data(fluid.unwrap(that.editField), "fluid.inlineEdit.CKEditor", that);
+        var editor = CKEDITOR.replace(id, that.options.CKEditor);
+        editor.on("instanceReady", function (e) {
+            fluid.inlineEdit.CKEditor.focus(e.editor);
+            that.events.afterInitEdit.fire(e.editor);
+        });
+    };                                                     
+    
+    fluid.defaults("fluid.inlineEdit.CKEditor", {
+        selectors: {
+            edit: "textarea" 
+        },
+        
+        styles: {
+            invitation: "fl-inlineEdit-richText-invitation"
+        },
+      
+        displayAccessor: {
+            type: "fluid.inlineEdit.richTextViewAccessor"
+        },
+        editAccessor: {
+            type: "fluid.inlineEdit.CKEditor.viewAccessor"
+        },
+        lazyEditView: true,
+        modelComparator: fluid.inlineEdit.CKEditor.htmlComparator,
+        blurHandlerBinder: fluid.inlineEdit.CKEditor.blurHandlerBinder,
+        editModeRenderer: fluid.inlineEdit.CKEditor.editModeRenderer,
+        CKEditor: {
+            // CKEditor-specific configuration goes here.
+        }
+    });
+    
+    
+    /************************
+     * Dropdown Integration *
+     ************************/    
+    /**
+     * Instantiate a drop-down InlineEdit component
+     * 
+     * @param {Object} container
+     * @param {Object} options
+     */
+    fluid.inlineEdit.dropdown = function (container, options) {
+        return configureInlineEdit("fluid.inlineEdit.dropdown", container, options);
+    };
+
+    fluid.inlineEdit.dropdown.editModeRenderer = function (that) {
+        var id = fluid.allocateSimpleId(that.editField);
+        that.editField.selectbox({
+            finishHandler: function () {
+                that.finish();
+            }
+        });
+        return {
+            container: that.editContainer,
+            field: $("input.selectbox", that.editContainer) 
+        };
+    };
+   
+    fluid.inlineEdit.dropdown.blurHandlerBinder = function (that) {
+        fluid.deadMansBlur(that.editField,
+                           $("div.selectbox-wrapper li", that.editContainer),
+                           function () {
+                               that.cancel();
+                           });
+    };
+
+
+    
+    fluid.defaults("fluid.inlineEdit.dropdown", {
+        applyEditPadding: false,
+        blurHandlerBinder: fluid.inlineEdit.dropdown.blurHandlerBinder,
+        editModeRenderer: fluid.inlineEdit.dropdown.editModeRenderer
+    });
+    
+    
+})(jQuery, fluid_1_2);
+
+
+// This must be written outside any scope as a result of the FCKEditor event model.
+// Do not overwrite this function, if you wish to add your own listener to FCK completion,
+// register it with the standard fluid event firer at fluid.inlineEdit.FCKEditor.complete
+function FCKeditor_OnComplete(editorInstance) {
+    fluid.inlineEdit.FCKEditor.complete.fire(editorInstance);
+}
Index: src/webapp/demos/inlineEdit/rich/html/inlineEdit.html
===================================================================
--- src/webapp/demos/inlineEdit/rich/html/inlineEdit.html	(revision 9801)
+++ src/webapp/demos/inlineEdit/rich/html/inlineEdit.html	(working copy)
@@ -1,69 +1,69 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-    <head>
-        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-        <title>Untitled</title>
-
-        <link rel="stylesheet" type="text/css" href="../../../../framework/fss/css/fss-reset.css" />
-        <link rel="stylesheet" type="text/css" href="../../../../framework/fss/css/fss-layout.css" />
-        <link rel="stylesheet" type="text/css" href="../../../../framework/fss/css/fss-theme-mist.css" />
-        <link rel="stylesheet" type="text/css" href="../../../../framework/fss/css/fss-theme-hc.css" />
-        <link rel="stylesheet" type="text/css" href="../../../../components/inlineEdit/css/InlineEdit.css" />
-        
-        <script type="text/javascript" src="http://tinymce-fluid.appspot.com/tiny_mce.js"></script>
-        
-        <script type="text/javascript" src="../../../../lib/jquery/core/js/jquery.js"></script>
-        <script type="text/javascript" src="../../../../lib/jquery/ui/js/jquery.ui.core.js"></script>
-        <script type="text/javascript" src="../../../../lib/jquery/plugins/tooltip/js/jquery.tooltip.js"></script>
-        <script type="text/javascript" src="../../../../framework/core/js/jquery.keyboard-a11y.js"></script>
-        <script type="text/javascript" src="../../../../framework/core/js/Fluid.js"></script>
-        <script type="text/javascript" src="../../../../components/inlineEdit/js/InlineEdit.js"></script>
-        <script type="text/javascript" src="../../../../components/inlineEdit/js/InlineEditIntegrations.js"></script>
-        <script type="text/javascript" src="../../../../components/undo/js/Undo.js"></script>
-        
-        <script type="text/javascript" src="../../../../tests/manual-tests/lib/fckeditor/fckeditor.js"></script>
-        
-        <script type="text/javascript" src="../js/inlineEdit.js"></script>
- 
-   </head>
-    <body>
- 
-       <h1>Example 4: Rich Text Inline Edit (using Tiny_MCE editor)</h1>
-        <div id="richEdit1">
-            <div class="flc-inlineEdit-text">
-                <p>After a hiatus, <strong>Portishead</strong> is back with their first studio 
-                album in 6 years. <em>Third</em> brings back the familiar and
-                the new, and none of this is best exemplified than in the track
-                <em>Machine Gun</em>. It seems that regardless of how <strong>Portishead</strong> 
-                sounds now, the one thing that has stayed constant is their refusal to be ordinary.
-                </p>
-            </div>
-            <div class="flc-inlineEdit-editContainer">
-                <textarea></textarea>
-                <button class="save">Save</button> <button class="cancel">Cancel</button>
-            </div>
-        </div>
-
-        
-        <h1>Example 5: Rich Text Inline Edit (using FCKEditor)</h1>
-        <div id="richEdit2">
-            <div class="flc-inlineEdit-text">
-                <p>After a hiatus, <strong>Portishead</strong> is back with their first studio 
-                album in 6 years. <em>Third</em> brings back the familiar and
-                the new, and none of this is best exemplified than in the track
-                <em>Machine Gun</em>. It seems that regardless of how <strong>Portishead</strong> 
-                sounds now, the one thing that has stayed constant is their refusal to be ordinary.
-                </p>
-            </div>
-            <div class="flc-inlineEdit-editContainer">
-                <textarea></textarea>
-                <button class="save">Save</button> <button class="cancel">Cancel</button>
-            </div>
-        </div>
-        
-        
-        <script type="text/javascript">
-            demo.initInlineEdit();
-        </script>        
-    </body>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+        <title>Rich Text Inline Edit Demo</title>
+
+        <link rel="stylesheet" type="text/css" href="../../../../framework/fss/css/fss-reset.css" />
+        <link rel="stylesheet" type="text/css" href="../../../../framework/fss/css/fss-layout.css" />
+        <link rel="stylesheet" type="text/css" href="../../../../framework/fss/css/fss-theme-mist.css" />
+        <link rel="stylesheet" type="text/css" href="../../../../framework/fss/css/fss-theme-hc.css" />
+        <link rel="stylesheet" type="text/css" href="../../../../components/inlineEdit/css/InlineEdit.css" />
+        
+        <script type="text/javascript" src="http://tinymce-fluid.appspot.com/tiny_mce.js"></script>
+        
+        <script type="text/javascript" src="../../../../lib/jquery/core/js/jquery.js"></script>
+        <script type="text/javascript" src="../../../../lib/jquery/ui/js/jquery.ui.core.js"></script>
+        <script type="text/javascript" src="../../../../lib/jquery/plugins/tooltip/js/jquery.tooltip.js"></script>
+        <script type="text/javascript" src="../../../../framework/core/js/jquery.keyboard-a11y.js"></script>
+        <script type="text/javascript" src="../../../../framework/core/js/Fluid.js"></script>
+        <script type="text/javascript" src="../../../../components/inlineEdit/js/InlineEdit.js"></script>
+        <script type="text/javascript" src="../../../../components/inlineEdit/js/InlineEditIntegrations.js"></script>
+        <script type="text/javascript" src="../../../../components/undo/js/Undo.js"></script>
+        
+        <script type="text/javascript" src="http://ckeditor-fluid.appspot.com/ckeditor.js"></script>
+        
+        <script type="text/javascript" src="../js/inlineEdit.js"></script>
+ 
+   </head>
+    <body>
+ 
+       <h1>Rich Text Inline Edit with Tiny MCE</h1>
+        <div id="richEdit1">
+            <div class="flc-inlineEdit-text">
+                <p>After a hiatus, <strong>Portishead</strong> is back with their first studio 
+                album in 6 years. <em>Third</em> brings back the familiar and
+                the new, and none of this is best exemplified than in the track
+                <em>Machine Gun</em>. It seems that regardless of how <strong>Portishead</strong> 
+                sounds now, the one thing that has stayed constant is their refusal to be ordinary.
+                </p>
+            </div>
+            <div class="flc-inlineEdit-editContainer">
+                <textarea></textarea>
+                <button class="save">Save</button> <button class="cancel">Cancel</button>
+            </div>
+        </div>
+
+        
+        <h1>Rich Text Inline Edit with CKEditor 3</h1>
+        <div id="richEdit2">
+            <div class="flc-inlineEdit-text">
+                <p>After a hiatus, <strong>Portishead</strong> is back with their first studio 
+                album in 6 years. <em>Third</em> brings back the familiar and
+                the new, and none of this is best exemplified than in the track
+                <em>Machine Gun</em>. It seems that regardless of how <strong>Portishead</strong> 
+                sounds now, the one thing that has stayed constant is their refusal to be ordinary.
+                </p>
+            </div>
+            <div class="flc-inlineEdit-editContainer">
+                <textarea></textarea>
+                <button class="save">Save</button> <button class="cancel">Cancel</button>
+            </div>
+        </div>
+        
+        
+        <script type="text/javascript">
+            demo.initRichInlineEdit();
+        </script>        
+    </body>
 </html>
\ No newline at end of file
Index: src/webapp/demos/inlineEdit/rich/js/inlineEdit.js
===================================================================
--- src/webapp/demos/inlineEdit/rich/js/inlineEdit.js	(revision 9801)
+++ src/webapp/demos/inlineEdit/rich/js/inlineEdit.js	(working copy)
@@ -1,90 +1,58 @@
-/*
-Copyright 2008-2009 University of Cambridge
-Copyright 2008-2009 University of Toronto
-Copyright 2008-2009 University of California, Berkeley
-
-Licensed under the Educational Community License (ECL), Version 2.0 or the New
-BSD license. You may not use this file except in compliance with one these
-Licenses.
-
-You may obtain a copy of the ECL 2.0 License and BSD License at
-https://source.fluidproject.org/svn/LICENSE.txt
-*/
-
-/*global jQuery*/
-/*global fluid*/
-/*global demo*/
-
-var demo = demo || {};
-(function ($, fluid) {
-
-    /**
-     * Initialize all rich text inline edit components present on the inline-edit 
-     * demo.
-     */
-    var inlineRichTextEditSetup = function () {
-        
-        var editors = [];
-        
-        /**
-         * Create cancel and save buttons for a rich inline editor.
-         * @param {Object} editor 
-         */
-        var makeButtons = function (editor) {
-            $(".save", editor.container).click(function(){
-                editor.finish();
-                return false;
-            });
-
-            $(".cancel", editor.container).click(function(){
-                editor.cancel();
-                return false;
-            });
-        };
-        
-        /**
-         * Create cancel and save buttons for all rich text editors.
-         * @param {Object} editors array of rich inline editors.
-         */
-        var makeAllButtons = function (editors) {
-            while (editors.length > 0) {
-                makeButtons(editors.pop());
-            }
-        };          
-        
-        /**
-         * Tiny MCE rich inline text editor example. 
-         */
-        editors.push(
-            fluid.inlineEdit.tinyMCE("#richEdit1", {
-                tinyMCE: {
-                        width: 1024,
-                        theme: "advanced",
-                        theme_advanced_toolbar_location : "top"
-                    }, 
-                componentDecorators: {
-                    type: "fluid.undoDecorator"
-                }
-            })
-        );
-        
-        /**
-         * FCK Editor rich inline text editor example. 
-         */
-        editors.push(
-            fluid.inlineEdit.FCKEditor("#richEdit2", {
-                FCKEditor: {BasePath: "../../../../tests/manual-tests/lib/fckeditor/"},
-                componentDecorators: {
-                    type: "fluid.undoDecorator"
-                }
-            })
-        );
-        
-        makeAllButtons(editors);
-    };
-
-        
-    demo.initInlineEdit = function () {        
-        inlineRichTextEditSetup();
-    };    
-})(jQuery, fluid);
\ No newline at end of file
+/*
+Copyright 2008-2009 University of Cambridge
+Copyright 2008-2009 University of Toronto
+Copyright 2008-2009 University of California, Berkeley
+
+Licensed under the Educational Community License (ECL), Version 2.0 or the New
+BSD license. You may not use this file except in compliance with one these
+Licenses.
+
+You may obtain a copy of the ECL 2.0 License and BSD License at
+https://source.fluidproject.org/svn/LICENSE.txt
+*/
+
+/*global jQuery, fluid, demo*/
+var demo = demo || {};
+
+(function ($, fluid) {
+        
+    demo.initRichInlineEdit = function () {
+        /**
+         * Create cancel and save buttons for a rich inline editor.
+         * @param {Object} editor 
+         */
+        var makeButtons = function (editor) {
+            $(".save", editor.container).click(function(){
+                editor.finish();
+                return false;
+            });
+
+            $(".cancel", editor.container).click(function(){
+                editor.cancel();
+                return false;
+            });
+        }; 
+
+        // Create a TinyMCE-based Rich Inline Edit component.
+        var tinyEditor = fluid.inlineEdit.tinyMCE("#richEdit1", {
+            tinyMCE: {
+                    width: 1024,
+                    theme: "advanced",
+                    theme_advanced_toolbar_location : "top"
+                }, 
+            componentDecorators: {
+                type: "fluid.undoDecorator"
+            }
+        });
+        makeButtons(tinyEditor);
+
+        // Create an CKEditor 3.x-based Rich Inline Edit component.
+        var ckEditor = fluid.inlineEdit.CKEditor("#richEdit2", {
+            componentDecorators: {
+                type: "fluid.undoDecorator"
+            }
+        });
+        makeButtons(ckEditor);    
+    };    
+
+})(jQuery, fluid);
