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.

Terminal window
npm i @soleil-se/output-util-helper
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.
});

Get unmodified HTML output from a portlet.

ParamTypeDescription
parentNodeNodeParent node where the portlet is located.
portletNameStringPortlet name.
const output = outputUtilHelper.getPortletOutput(currentPage, 'Rubrik');

Get unmodified HTML output from a path.

ParamTypeDescription
parentNodeNodeParent node containing the path.
relPathStringPath to node.
const output = outputUtilHelper.getPathOutput(currentPage, 'Page Content/Innehåll/Rubrik');

getHtmlFromPortlet(parentNode, portletName)

Section titled “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.
const output = outputUtilHelper.getHtmlFromPortlet(currentPage, 'Rubrik');

getPlainTextFromPortlet(parentNode, portletName)

Section titled “getPlainTextFromPortlet(parentNode, portletName)”

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

ParamTypeDescription
parentNodeNodeParent node where the portlet is located.
portletNameStringPortlet name.
const output = outputUtilHelper.getPlainTextFromPortlet(currentPage, 'Rubrik');

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

ParamTypeDescription
parentNodeNodeParent node where the portlet is located.
relPathStringPath to node.
const output = outputUtilHelper.getHtmlFromPath(currentPage, 'Page Content/Innehåll/Rubrik');

Get plain text from a path node with settings passed when instantiating.

ParamTypeDescription
parentNodeNodeParent node where the portlet is located.
relPathStringPath to node.
const output = outputUtilHelper.getPlainTextFromPath(currentPage, 'Page Content/Innehåll/Rubrik');

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.
const output = outputUtilHelper.getHtmlFromNode(currentPage, 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.
const output = outputUtilHelper.getPlainTextFromNode(currentPage, node);