Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Section
Column
width60%
Info

This documentation refers to the latest trunk version of the Inline Edit code.

Inline Edit Overview

Allow 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 are contained within some kind of container element.
  2. The text you wish to make editable is itself contained within an element inside 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.


Creating Multiple Inline Edits

Code Block
javascript
javascript
fluid.inlineEdits(componentContainerId, 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

componentContainerId

The componentContainerId parameter is the ID of the root DOM node of the Inline Edit markup.

Column
Panel
borderColor#566b30
bgColor#fff
titleBGColor#D3E3C4
titleOn This Page
borderStylesolid
Table of Contents
minLevel2
maxLevel5
Panel
borderColor#321137
bgColor#fff
titleBGColor#c1b7c3
titleSee Also
borderStylesolid
Panel
borderColor#321137
bgColor#fff
titleBGColor#cccccc
titleStill need help?
borderStylesolid

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

Parameters

componentContainerId

The componentContainerId parameter is the ID of 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 described below, with the addition of a selector for identifying the editable elements. The default selector is defined as follows:

Code Block
javascript
javascript
selectors: {
    editables: ".inlineEditable"
}

...

Creator

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

Return: The Inline Edit component object.

Parameters

componentContainer

...

Name

Description

Values

Default

selectors

Javascript object containing selectors for various fragments of 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.

Code Block
javascript
javascript
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
  focus
Any values not provided will revert to the default.

Code Block
javascript
javascript
styles: {
    invitation: "invitation",
    defaultViewText: "invitation-text",
    focus: "focus"
}

paddings

Javascript object containing pixed 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.

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

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

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

Code Block
html
html
<div><span>
  <input type='text'/>
</div>span>

selectOnEdit

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

boolean

false

useDefaultViewText

Indicates whether or not the component should be filled in with default text when empty.

boolean

true

defaultViewText

The default text to use when filling in an empty component.

String

"Click here to edit"

...