Utility for using Sitevision OutputUtil.
Install
npm i @soleil-se/output-util-helper
Usage
import OutputUtilHelper from '@soleil-se/output-util-helper';
const outputUtilHelper = new OutputUtilHelper({ removeIds: false, // If Ids should be removed. removeDivs: false, // If divs should be removed. removeClasses: false, // If classes should be removed. removeToolbar: true, // If toolbar should be removed. addMargins: true, // If a div with class "sv-use-margins" should be added so that Sitevision fonts work properly.});
getPortletOutput(parentNode, portletName)
Get unmodified HTML output from a portlet.
Param | Type | Description |
---|---|---|
parentNode | Node | Parent node where the portlet is located. |
portletName | String | Portlet name. |
Example
const output = outputUtilHelper.getPortletOutput(currentPage, 'Rubrik');
getPathOutput(parentNode, relPath)
Get unmodified HTML output from a path.
Param | Type | Description |
---|---|---|
parentNode | Node | Parent node containing the path. |
relPath | String | Path to node. |
Example
const output = outputUtilHelper.getPathOutput(currentPage, 'Page Content/Innehåll/Rubrik');
getHtmlFromPortlet(parentNode, portletName)
Get formatted HTML output from a portlet with settings passed when instantiating.
Param | Type | Description |
---|---|---|
parentNode | Node | Parent node where the portlet is located. |
portletName | String | Portlet name. |
Example
const output = outputUtilHelper.getHtmlFromPortlet(currentPage, 'Rubrik');
getPlainTextFromPortlet(parentNode, portletName)
Get plain output from a portlet with settings passed when instantiating.
Param | Type | Description |
---|---|---|
parentNode | Node | Parent node where the portlet is located. |
portletName | String | Portlet name. |
Example
const output = outputUtilHelper.getPlainTextFromPortlet(currentPage, 'Rubrik');
getHtmlFromPath(parentNode, relPath)
Get formatted HTML from a path node with settings passed when instantiating.
Param | Type | Description |
---|---|---|
parentNode | Node | Parent node where the portlet is located. |
relPath | String | Path to node. |
Example
const output = outputUtilHelper.getHtmlFromPath(currentPage, 'Page Content/Innehåll/Rubrik');
getPlainTextFromPath(parentNode, relPath)
Get plain text from a path node with settings passed when instantiating.
Param | Type | Description |
---|---|---|
parentNode | Node | Parent node where the portlet is located. |
relPath | String | Path to node. |
Example
const output = outputUtilHelper.getPlainTextFromPath(currentPage, 'Page Content/Innehåll/Rubrik');
getHtmlFromNode(parentNode, node)
Get formatted HTML from a node with settings passed when instantiating.
Param | Type | Description |
---|---|---|
parentNode | Node | Parent node where the portlet is located. |
node | Node | The node to get HTML from. |
Example
const output = outputUtilHelper.getHtmlFromNode(currentPage, node);
getPlainTextFromNode(parentNode, node)
Get plain text from node with settings passed when instantiating.
Param | Type | Description |
---|---|---|
parentNode | Node | Parent node where the portlet is located. |
node | Node | The node to get plain text from. |
Example
const output = outputUtilHelper.getPlainTextFromNode(currentPage, node);