Namespace: editables

Granite.author. editables

The Editable Store (array based) that contains all the Editables available on the page.

Source:
storage/editables.js

Methods


<static> add(editables)

Adds the passed Editables to the store

Parameters:
Name Type Description
editables Array.<Granite.author.Editable>

Editables to be added to the store (replaces if already existing)

Source:
storage/editables.js
Fires:

<static> clean()

Destroys all Editables from the store, and empties the store

Source:
storage/editables.js

<static> find(search)

Returns the stored Editables according to the search parameter

Parameters:
Name Type Description
search Object | String

Either a complex search or the path as a string

Source:
storage/editables.js
Returns:

Returns an array of found Editables

Type
Array.<Granite.author.Editable>

<static> getChildren(editable, all)

Returns the children of the passed Editable

Parameters:
Name Type Description
editable Granite.author.Editable

The Editable parent

all Boolean

All the children or only the direct descendant

Source:
storage/editables.js
Returns:

Returns all the children of the Editable

Type
Array.<Granite.author.Editable>

<static> getParent(editable, all)

Returns the parent of the passed Editable

Parameters:
Name Type Description
editable Granite.author.Editable

The Editable child

all Boolean

Indicates if we want to receive an array of all parents

Source:
storage/editables.js
Returns:

Returns the parent(s) of the given Editable or null

Type
Granite.author.Editable | Array.<Granite.author.Editable>

<static> getRoot()

Returns the root of the tree of Editables

Source:
storage/editables.js
Returns:

Returns the root of the tree of Editables

Type
Granite.author.Editable

<static> getSelectableParents(editable)

Returns the selectable parents (= those with actions available on them) of the passed Editable

Parameters:
Name Type Description
editable Granite.author.Editable

The Editable child

Source:
storage/editables.js
Returns:

Returns all the selectable parents of the Editable or null

Type
Array.<Granite.author.Editable>

<static> onReady(path, listener)

Registers a listener that would be executed when the Editable (at the given path) is ready

Parameters:
Name Type Description
path String

The path of the Editable

listener function

The listener function

Source:
storage/editables.js

<static> onTypeReady(type, listener)

Registers a listener that would be executed when the Editable (of the given type) is ready

Parameters:
Name Type Description
type String

The type (sling resource type) of the Editable

listener function

The listener function

Source:
storage/editables.js

<static> remove(editable, removeChildren)

Removes the passed Editables from the store

Parameters:
Name Type Description
editable Array.<Granite.author.Editable> | Granite.author.Editable

The Editables to remove

removeChildren Boolean

Indicates if it should remove the children of the Editables too

Source:
storage/editables.js

<static> set(editables)

Initializes the store with the passed Editables (cleans the store first)

Parameters:
Name Type Description
editables Array.<Granite.author.Editable>

The ordered (parent to children) Editables to be added in the store.

Source:
storage/editables.js