Hoppa till innehåll
This package has changed name, was previously @soleil-api/output-util-helper.
More information

@soleil-se/output-util-helper

Utility for using Sitevision OutputUtil.

Install

Terminal window
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.

ParamTypeDescription
parentNodeNodeParent node where the portlet is located.
portletNameStringPortlet name.

Example

const output = outputUtilHelper.getPortletOutput(currentPage, 'Rubrik');

getPathOutput(parentNode, relPath)

Get unmodified HTML output from a path.

ParamTypeDescription
parentNodeNodeParent node containing the path.
relPathStringPath 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.

ParamTypeDescription
parentNodeNodeParent node where the portlet is located.
portletNameStringPortlet name.

Example

const output = outputUtilHelper.getHtmlFromPortlet(currentPage, 'Rubrik');

getPlainTextFromPortlet(parentNode, portletName)

Get plain output from a portlet with settings passed when instantiating.

ParamTypeDescription
parentNodeNodeParent node where the portlet is located.
portletNameStringPortlet name.

Example

const output = outputUtilHelper.getPlainTextFromPortlet(currentPage, 'Rubrik');

getHtmlFromPath(parentNode, relPath)

Get formatted HTML from a path node with settings passed when instantiating.

ParamTypeDescription
parentNodeNodeParent node where the portlet is located.
relPathStringPath 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.

ParamTypeDescription
parentNodeNodeParent node where the portlet is located.
relPathStringPath 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.

ParamTypeDescription
parentNodeNodeParent node where the portlet is located.
nodeNodeThe 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.

ParamTypeDescription
parentNodeNodeParent node where the portlet is located.
nodeNodeThe node to get plain text from.

Example

const output = outputUtilHelper.getPlainTextFromNode(currentPage, node);