Module: alfresco/navigation/_HtmlAnchorMixin

alfresco/navigation/_HtmlAnchorMixin

This mixin can be used to wrap HTML elements in a widget with an anchor element that allows users to use the browser context-menu to copy or open the link in a new tab or window. This works around the fact that all Aikau navigation is achieved via publishing requests to be handled by the Navigation Service.

This should be mixed into a widget and then the makeAnchor function should be called by the postCreate function (or any function called after the widgets DOM has been created). In order for this to work the getAnchorTargetSelectors should be overridden to return an array of the CSS selectors needed to identify the elements to be wrapped with an anchor element.

Author:
  • Dave Draper
  • Martin Doyle
License:
Source:

Members

cssRequirements :object[]

An array of the CSS files to use with this widget.
Type:
  • object[]
Default Value:
  • [{cssFile:"./css/_HtmlAnchorMixin.css"}]
Source:

excludeFromTabOrder :boolean

When set to true, the resulting anchor(s) will be removed from the page tab-order by setting their tabindex to -1.
Type:
  • boolean
Since:
  • 1.0.40
Default Value:
  • true
Source:

label :string

The title text to put on the generated link(s).
Type:
  • string
Default Value:
  • null
Source:

wrapAllChildren :boolean

When set to true, all of the direct children of this widget's root node will be wrapped in a single anchor, when makeAnchor() is called.
Type:
  • boolean
Since:
  • 1.0.40
Default Value:
  • false
Source:

Methods

_addAnchors(url)

This function is called for any menu item with a targetUrl. By default it addresses the known menu items DOM structures of the AlfMenuItem and AlfMenuBarItem. However, it can be extended or updated to handle the DOM structure of additional menu widgets.
Parameters:
Name Type Description
url string The URL to use for the anchor
Source:

getAnchorTargetSelectors() → {array}

This function should be overridden to provide an array of the CSS selectors to use to identify the elements to wrap in an anchor. By default this will return an empty array.
Source:
Returns:
Type
array

makeAnchor(url, type)

Parameters:
Name Type Description
url string The URL configured
type string The target configured
Source: