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.

Initialized on Document#event: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

<static> TAB_CLASSES :Object

CSS Classes corresponding to the different tabs of the SidePanel

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

Methods


<private, static> _getTab(tabClass)

Get the Coral.Tab corresponding to the passed tabClass

Parameters:
Name Type Description
tabClass String

The CSS class of the SidePanel tab to toggle

Source:
ui/ui.SidePanel.js
Returns:

The corresponding Coral.Tab element

Type
Coral.Tab

<private, static> _hideContentBackdrop()

Hides the dialog backdrop over the content

Source:
ui/ui.SidePanel.js

<private, static> _showContentBackdrop()

Displays the dialog backdrop over the content

Source:
ui/ui.SidePanel.js

<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> getSelectedTabClass()

Get the tabClass of the selected tab

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()

Show a "blank" SidePanel

Source:
ui/ui.SidePanel.js

<static> toggleTab(tabClass, enable)

Toggle a tab from the SidePanel (enable or disable it)
If the tab is already opened, it will also switch to the nearest available tab

Parameters:
Name Type Description
tabClass String

The CSS class of the SidePanel tab to toggle

enable Boolean

Indicates if the tab should be enabled or disabled

Source:
ui/ui.SidePanel.js