Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
Section
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

Column
width60%
Info
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
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.

Creating Multiple Inline Edits

...


fluid.inlineEdits(componentContainer, options);

...

.

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.

Anchor
option_description
option_description

options

The options parameter is an optional data structure that configures the Inline Edit component(s), as described below in the fluid:Options section.

...

Anchor
events
events

Supported Events

The Inline Edit component fires the following events :

Event

Type

Description

Parameters

Parameter Description

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)

model: The current (new) value of the "model" structure representing the editable state of the component
oldModel: A snapshot of the old value of the model structure before the current edit operation started
source: An arbitrary object which optionally represents the "source" of the change, which can be checked by listeners to prevent cyclic events. Can often be undefined.

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)

newValue, oldValue: see parameters for modelChanged
editNode: A DOM node which holds the concrete editable control - this may vary in interpretation for different embodiments of the InlineEdit control but may, for example be an <input>, <textarea> or <select> node,
viewNode: A DOM node which holds the read-only representation of the editable value.

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

(newValue, oldValue, editNode, viewNode): See description for onFinishEdit

Functions

These functions are defined on the central that object returned from the inlineEdit construction function - for example with

...


var that = fluid.inlineEdit(componentContainer, options);

...


that.edit();

Switches the component into edit mode. The events onBeginEdit and afterBeginEdit will fire.

...


that.finish();

Switches the component out of edit mode into display mode, updating the displayed text with the current content of the edit field. The events onFinishEdit and afterFinishEdit will fire. If the model value has changed, there will be a call to modelUpdated in between these calls.

...


that.refreshView(source);

Updates the state of the inline editor in the DOM, based on changes that may have happened to the model.

...


that.tooltipEnabled();

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

...


that.updateModel(newValue, source);

Updates the component's internal representation of the text to a new value. If the value differs from the existing value, the modelChanged event will fire and the component will be re-rendered.

...


that.model

Not a function, but a data structure. This directly represents the "model" or state of the editable component. External users should consider this structure as read-only, and only make modifications through the updateModel call above.

...

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:

...

(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 our the component's CSS skin files. Just be sure to put the following in you your document:

Code Block
html
html
<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>

...

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