Namespace: SidePanel

Granite.author.ui. SidePanel

The SidePanel usually contains the Granite.author.ui.assetFinder and Granite.author.ui.componentBrowser, and is positioned on the left of the screen, as an aside of the main "Content Panel".
It could have different variants/contents (js-sidePanel-empty, js-sidePanel-edit), and the current content is usually set by the current layer.

The SidePanel initializes itself on cq-editor-loaded

Source:
ui/ui.SidePanel.js

Members


<static> $anchor :jQuery

Content panel to which the SidePanel is anchored

Type:
  • jQuery
Source:
ui/ui.SidePanel.js

<static> $el :jQuery

Corresponding jQuery element

Type:
  • jQuery
Source:
ui/ui.SidePanel.js

Methods


<static> close(keepRestorable)

Close the SidePanel

Parameters:
Name Type Description
keepRestorable Boolean

true to keep allow to restore the SidePanel e.g. after a mode switch.

Source:
ui/ui.SidePanel.js

<static> getWidth()

Get the current width of the SidePanel

Source:
ui/ui.SidePanel.js
Returns:

The width of the SidePanel (0 if closed)

Type
Number

<static> init()

Initialize the SidePanel: open it if needed and bind events

Source:
ui/ui.SidePanel.js

<static> isOpened()

State whether the SidePanel is opened or not

Source:
ui/ui.SidePanel.js
Returns:

true if the SidePanel is opened; false otherwise

Type
Boolean

<static> loadContent(options)

Load and add new content to the SidePanel (nothing is done if the content is already present)

See /libs/wcm/core/content/editor/jcr:content/sidepanels/ for examples of content node structures of SidePanel's content

Parameters:
Name Type Description
options Object

The configuration object parameter

Properties
Name Type Description
selector String

The CSS selector of the content node to find in the SidePanel DOM

path String

The JCR path of the content node to load from server

Source:
ui/ui.SidePanel.js
Fires:
  • Document#event:foundation-contentloaded
Returns:

The HTML of the content retrieved

Type
Promise

<static> open(keepRestorable)

Open the SidePanel

Parameters:
Name Type Description
keepRestorable Boolean

true to keep allow to restore the SidePanel e.g. after a mode switch.

Source:
ui/ui.SidePanel.js

<static> restore()

Open or close the SidePanel depending on the keepRestorable parameter previously set during the call of the open/close method

Source:
ui/ui.SidePanel.js

<static> showContent(contentClassName)

Switch between the different SidePanel contents / variants
This function will only toggle the current SidePanel variant shown by another one that is already loaded (but hidden). See Granite.author.ui.SidePanel#loadContent if you want to load a custom variant.

Parameters:
Name Type Description
contentClassName String

The CSS class of the content to show. By default the following two variants are available: js-sidePanel-edit (default one) and js-sidePanel-empty (when no SidePanel is needed).

Source:
ui/ui.SidePanel.js

<static> showEmptyContent()

Shows a "blank" SidePanel

Source:
ui/ui.SidePanel.js