Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
Section
Column
width60%
Info

This documentation refers to the latest trunk version of the Inline Edit code. For documentation specific to the v0.4 released version, please see Inline Edit API - v0.4.

Inline Edit Overview

The Inline Edit allows users to edit content within the context of their work rather than going to an "edit mode". It can be applied to any text, assuming a very simple contract is maintained:

  1. The elements that are part of the Inline Edit component have some kind of container element.
  2. The text you wish to make editable is within the component container.

You can optionally provide your own markup that will be used for the edit mode, but if not, default markup is provided.


Creation

Creating a single Inline Edit

Code Block
javascript
javascript
fluid.inlineEdit(componentContainer, options);

Return: The Inline Edit component object.

Creating Multiple Inline Edits

Code Block
javascript
javascript

fluid.inlineEdits(componentContainer, options);

Return: An array of the Inline Edit component objects.

This function will find any elements within the given container that are identified as 'editables' and apply the Inline Edit component to them.

Column
Panel
borderColor#321137
bgColor#fff
titleBGColor#aab597
borderStylesolid
titleStatus

This component is in Production status

solid
Panel
borderStyle
borderColor#566b30
bgColor#fff
titleBGColor#D3E3C4
borderStylesolid
titleOn This Page
Table of Contents
toc
maxLevel
5
minLevel2maxLevel5
  • Inline Edit
  • Inline Edit Tutorial
    Panel
    borderColor#321137
    bgColor#fff
    titleBGColor#c1b7c3
    borderStylesolid
    titleSee Also
    borderStylesolid
    Panel
    borderColor#321137
    bgColor#fff
    titleBGColor#cccccc
    borderStylesolid
    titleStill need help?borderStylesolid

    Join the fluidinfusion-talk users mailing list and ask your questions there.

    Parameters

    componentContainer

    The componentContainer parameter is a selector, a single-element jQuery, or a DOM element representing the component's containerspecifying the root DOM node of the Inline Edit markup.

    Anchor
    option_description
    option_description

    options

    The options parameter is an optional collection of name-value pairs that configure data structure that configures the Inline Edit component(s), as described below in the fluid:Options section.

    ...

    Anchor

    ...

    events

    ...

    events

    ...

    Default

    ...

    selectors

    ...

    Supported Events

    The Inline Edit component

    ...

    The object can contain any subset of the following keys:
      text
      editContainer
      edit
    Any values not provided will revert to the default.

    ...

    
    selectors: {
        text: ".text",
        editContainer: ".editContainer",
        edit: ".edit"
    }
    

    ...

    styles

    ...

    Javascript object containing CSS style names that will be applied to the Inline Edit component.

    ...

    The object can contain any subset of the following keys:
      invitation
      defaultViewText
      tooltip
      focus
    Any values not provided will revert to the default.

    ...

    
    styles: {
          invitation: "inlineEdit-invitation",
          defaultViewText: "inlineEdit-invitation-text",
          tooltip: "inlineEdit-tooltip",
          focus: "inlineEdit-focus"
    }
    

    ...

    paddings

    ...

    Javascript object containing pixel values that will configure the size of the edit field.

    ...

    The object can contain any subset of the following keys:
      edit
      minimumEdit
      minimumView
    Any values not provided will revert to the default.

    ...

    
    paddings: {
        edit: 10,
        minimumEdit: 80,
        minimumView: 60
    }
    

    ...

    finishedEditing

    ...

    A function that will be called each time the Inline Edit component leaves edit mode. This function can be used to communicate changes in the field to the server, or to take any other action desired by the implementor.

    ...

    a function

    ...

    
    finishedEditing: function () {
    }
    

    ...

    editModeInjector

    ...

    A function that creates the editable field based on the display text. This function is used if no edit container is provided in the markup.

    a function that returns an object of the following form:

    ...

    
    return {
      container: editContainer, // container element
                                // for the edit field
      field: editField  // the edit field itself
    };
    

    a function that creates the edit field based on the following template:

    ...

    
    <span>
      <input type='text'/>
    </span>
    

    ...

    selectOnEdit

    ...

    Indicates whether or not to automatically select the editable text when the component switches into edit mode.

    ...

    boolean

    ...

    false

    ...

    defaultViewText

    ...

    The default text to use when filling in an empty component. Set to empty to suppress this behaviour

    ...

    string

    ...

    "Click here to edit"

    ...

    useTooltip

    ...

    Indicates whether or not the component should display a custom ("invitation") tooltip on mouse hover

    ...

    boolean

    ...

    false

    ...

    tooltipText

    ...

    The text to use for the tooltip to be displayed when hovering the mouse over the component

    ...

    string

    ...

    "Click item to edit"

    ...

    tooltipId

    ...

    The id to be used for the DOM node holding the tooltip

    ...

    string

    ...

    "tooltip"

    ...

    tooltipDelay

    ...

    The delay, in ms, between starting to hover over the component and showing the tooltip

    ...

    number

    ...

    2000

    Functions

    ...

    
    fluid.inlineEdit.edit();
    

    Switches the component into edit mode.

    ...

    
    fluid.inlineEdit.finish();
    

    Switches the component out of edit mode into display mode, updating the displayed text with the current content of the edit field. Calls the finishedEditing function provided in the options, if it exists.

    Creating Multiple Inline Edits

    ...

    
    fluid.inlineEdits(componentContainer, options);
    

    This function will find any elements within the given container that are identified as 'editables' and apply the Inline Edit component to them.

    Parameters

    componentContainer

    The componentContainer parameter is a selector, a single-element jQuery, or a DOM element specifying the root DOM node of the Inline Edit markup.

    options

    The options parameter is an optional collection of name-value pairs that configure the Inline Edit components. The available options are the same as those for the creation of a single Inline edit (described above), with the addition of a selector for identifying the editable elements. The default selector is defined as follows:

    ...

    fires the following events (for more information about events in the Fluid Framework, see Events for Component Users):

    Include Page
    Inline Edit Events
    Inline Edit Events
    Include Page
    Inline Edit Functions
    Inline Edit Functions
    Include Page
    Inline Edit Configuration Options
    Inline Edit Configuration Options
    nopaneltrue

    ...

    Skinning

    This component can be skinned "out of the box" when you include the component's CSS files. Just be sure to put the following in your document:

    Code Block
    html
    html
    
    <link rel="stylesheet" type="text/css" href="components/inlineEdit/css/InlineEdit.css" />
    

    ...

    Dependencies

    The Inline Edit dependencies can be met by including the minified Fluid-allInfusionAll.js file in the header of the HTML file:

    Code Block
    html
    html
    <script type="text/javascript" src="Fluid-allInfusionAll.js"></script>
    

    Alternatively, the individual file requirements are:

    Include Page

    ...

    Inline Edit Dependencies
    Inline Edit Dependencies
    nopaneltrue