Documentation for a historical release of Infusion: 1.3
Please view the Infusion Documentation site for the latest documentation.
If you're looking for Fluid Project coordination, design, communication, etc, try the Fluid Project Wiki.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 39 Next »

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

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

fluid.inlineEdit(componentContainer, options);

Return: The Inline Edit component object.

On This Page
Still need help?

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

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 component(s), as described below in the Options section.


Supported Events

The Inline Edit component fires the following events:

Event

Type

Description

Parameters

Default Listener

modelChanged

default

This event is fired any time the model for the component has changed, that is, any time the value of the text associated with the component has changed.

model, oldModel, source

none

onBeginEdit

"preventable"

This event fires just before the component switches from 'view' mode into 'edit' mode. Because the event is preventable, listeners may prevent the component from actually entering edit mode.

 

none

afterBeginEdit

default

This event fires just after the component has finished entering 'edit' mode.

 

none

onFinishEdit

"preventable"

This event fires just before the component switches out of 'edit' mode, i.e. before the newly edited value is stored in the model. Because the event is preventable, listeners may prevent the new value from being stored in the model, i.e. they may cancel the edit.

newValue, oldValue, editNode, viewNode

none

afterFinishEdit

default

This event fires just after the newly edited value is stored in the model. Note that it only fires if the onFInishEdit event did not prevent the new value from being stored in the model.

newValue, oldValue, editNode, viewNode

none


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. NOTE that finishedEditing() is deprecated as of version 0.7, and will be removed entirely in version 0.9.

fluid.inlineEdit.render(source);

Prompts the component to render itself.

fluid.inlineEdit.tooltipEnabled();

Returns a boolean indicating whether or not the tooltip is enabled.

fluid.inlineEdit.updateModel(newValue, source);

Updates the component's internal representation of the text to a new value. The component will be re-rendered.


Options

The following options to the creator functions can be used to customize the behaviour of the Inline Edit component:

The options for the creation of multiple Inline Edits are the same as those for the creation of a single Inline Edit, with the addition of a selector for identifying the editable elements. The default selector is defined as follows:

selectors: {
    editables: ".inlineEditable"
}

Skinning

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

<link rel="stylesheet" type="text/css" href="css/fluid.layout.css" />
<link rel="stylesheet" type="text/css" href="css/fluid.states.css" />
<link rel="stylesheet" type="text/css" href="css/fluid.theme.mist.css" />
<link rel="stylesheet" type="text/css" href="css/fluid.theme.hc.css" />

and to attatch a class attribute that represents the skin you want to the components container, such as:

<div id="inlineEditContainer" class="fl-theme-mist">
...
</div>

The above code would make use of the theme.mist.css skin file.


Dependencies

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

<script type="text/javascript" src="Fluid-all.js"></script>

Alternatively, the individual file requirements are:

<script type="text/javascript" src="jquery/jquery-1.2.6.js"></script>
<script type="text/javascript" src="jquery/jARIA.js"></script>
<script type="text/javascript" src="jquery/jquery.keyboard-a11y.js"></script>
<script type="text/javascript" src="jquery/jquery.tooltip.js"></script>
<script type="text/javascript" src="fluid/Fluid.js"></script>
<script type="text/javascript" src="fluid/InlineEdit.js"></script>
  • No labels