Skip to content

Commit b2cc084

Browse files
committed
include volto-anchors as dependency and update import of github-slugger
1 parent 9d339f8 commit b2cc084

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"url": "[email protected]:eea/volto-block-toc.git"
1919
},
2020
"dependencies": {
21-
"github-slugger": "1.4.0",
21+
"@eeacms/volto-anchros": "*",
2222
"smoothscroll-polyfill": "^0.4.4"
2323
},
2424
"devDependencies": {
@@ -71,4 +71,4 @@
7171
"cypress:open": "make cypress-open",
7272
"prepare": "husky install"
7373
}
74-
}
74+
}

src/Block/variations/DefaultTocRenderer.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ import PropTypes from 'prop-types';
88
import { map } from 'lodash';
99
import { List } from 'semantic-ui-react';
1010
import { FormattedMessage, injectIntl } from 'react-intl';
11-
import Slugger from 'github-slugger';
1211
import AnchorLink from 'react-anchor-link-smooth-scroll';
12+
import { toSlug } from '@eeacms/volto-anchors/helpers';
1313
import { normalizeString } from './helpers';
1414

1515
const RenderListItems = ({ items, data }) => {
1616
return map(items, (item) => {
1717
const { id, level, title, override_toc, plaintext } = item;
1818
const slug = override_toc
19-
? Slugger.slug(normalizeString(plaintext))
20-
: Slugger.slug(normalizeString(title)) || id;
19+
? toSlug(normalizeString(plaintext))
20+
: toSlug(normalizeString(title)) || id;
2121
return (
2222
item && (
2323
<List.Item key={id} className={`item headline-${level}`} as="li">

src/Block/variations/HorizontalMenu.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import { map } from 'lodash';
44
import { Menu, Dropdown } from 'semantic-ui-react';
55
import { FormattedMessage, injectIntl } from 'react-intl';
66
import AnchorLink from 'react-anchor-link-smooth-scroll';
7-
import Slugger from 'github-slugger';
7+
import { toSlug } from '@eeacms/volto-anchors/helpers';
88
import { normalizeString } from './helpers';
99

1010
const RenderMenuItems = ({ items }) => {
1111
return map(items, (item) => {
1212
const { id, level, title, override_toc, plaintext } = item;
1313
const slug = override_toc
14-
? Slugger.slug(normalizeString(plaintext))
15-
: Slugger.slug(normalizeString(title)) || id;
14+
? toSlug(normalizeString(plaintext))
15+
: toSlug(normalizeString(title)) || id;
1616
return (
1717
item && (
1818
<React.Fragment key={id}>

0 commit comments

Comments
 (0)