Namespace: ContentFrame

Granite.author. ContentFrame

ContentFrame module responsible for the edited content by opposition to the content of the EditorFrame

An iframe embeds the content of the page to be edited

Initialized by Granite.author.init

Source:
ContentFrame.js

Members


iframe :jQuery

The iframe object of the outer document.

It embeds the page to edit

Type:
  • jQuery
Source:
ContentFrame.js

location

Keeps track of the URL of the content that is currently loaded in the iframe

Source:
ContentFrame.js

Methods


currentLocation()

Returns the current location of the iframe
NB: To get the actual content path of the resource loaded in the Editor, refer to Granite.author.ContentFrame.getContentPath

Source:
ContentFrame.js

getContentPath()

Returns the content path of the resource opened in the Editor

Source:
ContentFrame.js

getDocument()

Returns the current document of the iframe

Source:
ContentFrame.js
Returns:
  • the iframe's document
Type
jQuery

getEditableConfigNode(path)

Returns the HTML node corresponding to the Editable config in the iframe for a given path

Parameters:
Name Type Description
path string

data-path attribute value of the editable

Source:
ContentFrame.js
Returns:
Type
jQuery

getEditableNode(path)

Returns the HTML node in the iframe corresponding to the Editable for a given path

Parameters:
Name Type Description
path string

data-path attribute value of the editable

Source:
ContentFrame.js
Returns:
Type
jQuery

getEditables( [root])

Returns all the Editables present in the iframe document
The Editables returned should be ordered according to the structure of the page

The logic here could be customized at two different levels, by either setting:

  • a findEditables function that will override the whole behavior of the method
  • a editableConstructor function that will only override the way Editables are instantiated
    This could be achieved by calling ContentFrame.setFindEditablesFunction() or ContentFrame.setEditableConstructor() prior to this method.
Parameters:
Name Type Argument Description
root jQuery <optional>

node or document

Source:
ContentFrame.js
Returns:

An ordered array of Editables

Type
Array.<Granite.author.Editable>

init()

Initialize the ContentFrame by loading the content page, and subscribing to messages sent by the iframe.
NB: This interacts with the scripts included by the content page (defined in cq.authoring.page)

Source:
ContentFrame.js
Fires:
  • Document#event:cq-contentframe-layout-change

load(url)

Make the iframe load the given URL

Parameters:
Name Type Description
url string

URL to be loaded

Source:
ContentFrame.js

loadEditables()

Loads all the Editables

Source:
ContentFrame.js
Fires:
Returns:

An array of all Granite.author.Editables in the content frame

Type
Array.<Granite.author.Editable>

loadEditablesAsync()

Loads all the Editables

Source:
ContentFrame.js
Fires:
Returns:

An array of all Granite.author.Editables in the content frame

Type
$.Promise

reload()

Reloads the current URL

Source:
ContentFrame.js

resetContentHeight( [autoHeight])

Resets the height of the ContentWrapper and ContentFrame; used to adjust the iframe height when a change occurs inside of the content page
This is called on cq-contentframe-layout-change event

Parameters:
Name Type Argument Description
autoHeight boolean <optional>

Allow a deep computation of the iFrame inner content height. The inner content is entirely redrawn before the inner document height is applied to the iFrame

Source:
ContentFrame.js

setEditableConstructor(cons)

Provides the Granite.author.Editables constructor function

Parameters:
Name Type Description
cons function

The constructor function used to instantiate Granite.author.Editables

Source:
ContentFrame.js
See:
  • ContentFrame.getEditables

setFindEditablesFunction(func)

Provides a function to be used when exploring the DOM for Granite.author.Editables

Parameters:
Name Type Description
func function

The function responsible for providing a list of Granite.author.Editable

Source:
ContentFrame.js
See:
  • ContentFrame.getEditables

showPlaceholder(condition)

Toggle all the placeholders elements of the iframe

NB: This causes a full rendering of the inner document

Parameters:
Name Type Description
condition boolean

Should the placeholders be displayed

Source:
ContentFrame.js