How to use the @dpc-sdp/ripple-global/utils/helpers.js.getAnchorLinkName function in @dpc-sdp/ripple-global

To help you get started, we’ve selected a few @dpc-sdp/ripple-global examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dpc-sdp / ripple / packages / ripple-nuxt-tide / lib / core / anchorlinks.js View on Github external
return this.getAnchorHeadings(html).reduce((result, item) => {
      // Ignore empty headings.
      if (this.textExists(item.text)) {
        result.push({
          text: item.text,
          url: '#' + getAnchorLinkName(item.text)
        })
      }
      return result
    }, [])
  },
github dpc-sdp / ripple / packages / components / Organisms / Accordion / Accordion.vue View on Github external
titleId () {
      if (this.title) {
        return getAnchorLinkName(this.title)
      }
    }
  },
github dpc-sdp / ripple / packages / ripple-nuxt-tide / lib / pages / Tide.vue View on Github external
this.page.appDComponents.forEach(component => {
          if (component && component.name && component.data) {
            switch (component.name) {
              case 'rpl-markup':
                if (component.data.html) {
                  anchors.push(...anchorUtils.getAnchorLinks(component.data.html))
                }
                break
              case 'rpl-accordion':
                if (component.data.title) {
                  anchors.push({ text: component.data.title, url: `#${getAnchorLinkName(component.data.title)}` })
                }
                break
            }
          }
        })
        return anchors
github dpc-sdp / ripple / packages / ripple-nuxt-tide / lib / config / markup-plugins.js View on Github external
this.find('h2').map((i, element) => {
    const el = this.find(element)
    const idName = el.text()
    return el.attr('id', getAnchorLinkName(idName))
  })
}
github dpc-sdp / ripple / packages / ripple-nuxt-tide / lib / core / anchorlinks.js View on Github external
this.getAnchorHeadings(html).forEach(item => {
      const newAnchor = this.textExists(item.text) ? ` id="${getAnchorLinkName(item.text)}"` : ''
      const headingIndex = item.indexStart + offset + headingTagOffset
      newHTML = newHTML.slice(0, headingIndex) + newAnchor + newHTML.slice(headingIndex)
      offset += newAnchor.length
    })
    return newHTML