Skip to content

Commit b7739ae

Browse files
committed
Panel: Generate header id manually
We use [email protected] to generate our header id. [email protected] is reported to be unsafe and contains vulnerabilities [1]. As a step towards removing [email protected] as a dependencies, let's replace all usage of the 'string' methods with suitable equivalents. [1] - jprichardson/string.js#212
1 parent 86dc5ea commit b7739ae

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/Panel.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@
8181
import md from './utils/markdown.js'
8282
import panelSwitch from './PanelSwitch.vue'
8383
import retriever from './Retriever.vue'
84-
85-
const string = require('string');
8684
8785
export default {
8886
components: {
@@ -299,7 +297,7 @@
299297
if (this.headerContent) {
300298
const panelHeaderText = jQuery(this.headerContent).wrap('<div></div>').parent().find(':header').text();
301299
if (panelHeaderText) {
302-
this.$refs.cardContainer.setAttribute('id', string(panelHeaderText).slugify().toString());
300+
this.$refs.cardContainer.setAttribute('id', String(panelHeaderText).trim().toLowerCase().replace(/\s+/g, '-'));
303301
}
304302
} else if (this.$refs.headerWrapper.innerHTML) {
305303
const header = jQuery(this.$refs.headerWrapper.innerHTML).wrap('<div></div>').parent().find(':header');

0 commit comments

Comments
 (0)