Skip to content

Commit

Permalink
include volto-anchors as dependency and update import of github-slugger
Browse files Browse the repository at this point in the history
  • Loading branch information
tedw87 committed Apr 2, 2024
1 parent 9d339f8 commit b2cc084
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"url": "[email protected]:eea/volto-block-toc.git"
},
"dependencies": {
"github-slugger": "1.4.0",
"@eeacms/volto-anchros": "*",
"smoothscroll-polyfill": "^0.4.4"
},
"devDependencies": {
Expand Down Expand Up @@ -71,4 +71,4 @@
"cypress:open": "make cypress-open",
"prepare": "husky install"
}
}
}
6 changes: 3 additions & 3 deletions src/Block/variations/DefaultTocRenderer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ import PropTypes from 'prop-types';
import { map } from 'lodash';
import { List } from 'semantic-ui-react';
import { FormattedMessage, injectIntl } from 'react-intl';
import Slugger from 'github-slugger';
import AnchorLink from 'react-anchor-link-smooth-scroll';
import { toSlug } from '@eeacms/volto-anchors/helpers';
import { normalizeString } from './helpers';

const RenderListItems = ({ items, data }) => {
return map(items, (item) => {
const { id, level, title, override_toc, plaintext } = item;
const slug = override_toc
? Slugger.slug(normalizeString(plaintext))
: Slugger.slug(normalizeString(title)) || id;
? toSlug(normalizeString(plaintext))
: toSlug(normalizeString(title)) || id;
return (
item && (
<List.Item key={id} className={`item headline-${level}`} as="li">
Expand Down
6 changes: 3 additions & 3 deletions src/Block/variations/HorizontalMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import { map } from 'lodash';
import { Menu, Dropdown } from 'semantic-ui-react';
import { FormattedMessage, injectIntl } from 'react-intl';
import AnchorLink from 'react-anchor-link-smooth-scroll';
import Slugger from 'github-slugger';
import { toSlug } from '@eeacms/volto-anchors/helpers';
import { normalizeString } from './helpers';

const RenderMenuItems = ({ items }) => {
return map(items, (item) => {
const { id, level, title, override_toc, plaintext } = item;
const slug = override_toc
? Slugger.slug(normalizeString(plaintext))
: Slugger.slug(normalizeString(title)) || id;
? toSlug(normalizeString(plaintext))
: toSlug(normalizeString(title)) || id;
return (
item && (
<React.Fragment key={id}>
Expand Down

0 comments on commit b2cc084

Please sign in to comment.