• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

EcrituresNumeriques / stylo / 14055709846

25 Mar 2025 09:08AM UTC coverage: 31.446% (-0.2%) from 31.659%
14055709846

Pull #1364

github

web-flow
Merge 0a2e90b45 into 273c36e1a
Pull Request #1364: chore: ajout d'une menu sur l'interface d'écriture collaborative

464 of 689 branches covered (67.34%)

Branch coverage included in aggregate %.

0 of 248 new or added lines in 7 files covered. (0.0%)

1 existing line in 1 file now uncovered.

4396 of 14766 relevant lines covered (29.77%)

2.24 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/front/src/components/collaborative/ArticleTableOfContents.jsx
NEW
1
import React, { useCallback } from 'react'
×
NEW
2
import { ArrowLeft } from 'react-feather'
×
NEW
3
import { useTranslation } from 'react-i18next'
×
NEW
4
import { useDispatch, useSelector } from 'react-redux'
×
NEW
5
import { useRouteMatch } from 'react-router-dom'
×
NEW
6
import { usePandocAnchoring } from '../../hooks/pandoc.js'
×
7

NEW
8
import styles from './ArticleTableOfContents.module.scss'
×
9

NEW
10
export default function ArticleTableOfContents({ onBack }) {
×
NEW
11
  const { t } = useTranslation()
×
NEW
12
  const dispatch = useDispatch()
×
NEW
13
  const articleStructure = useSelector((state) => state.articleStructure)
×
NEW
14
  const getAnchor = usePandocAnchoring()
×
NEW
15
  const routeMatch = useRouteMatch()
×
NEW
16
  const hasHtmlAnchors = routeMatch.path === '/article/:id/preview'
×
NEW
17
  const handleTableOfContentsEntryClicked = useCallback(
×
NEW
18
    ({ target }) => {
×
NEW
19
      hasHtmlAnchors
×
NEW
20
        ? document
×
NEW
21
            .querySelector(`#${target.dataset.headingAnchor}`)
×
NEW
22
            ?.scrollIntoView()
×
NEW
23
        : dispatch({
×
NEW
24
            type: 'UPDATE_EDITOR_CURSOR_POSITION',
×
NEW
25
            lineNumber: parseInt(target.dataset.index, 10),
×
NEW
26
            column: 0,
×
NEW
27
          })
×
NEW
28
    },
×
NEW
29
    [hasHtmlAnchors]
×
NEW
30
  )
×
31

NEW
32
  if (articleStructure.length === 0) {
×
NEW
33
    return <></>
×
NEW
34
  }
×
35

NEW
36
  const title = onBack ? (
×
NEW
37
    <h2
×
NEW
38
      className={styles.title}
×
NEW
39
      onClick={onBack}
×
NEW
40
      style={{ cursor: 'pointer', userSelect: 'none' }}
×
41
    >
NEW
42
      <span onClick={onBack} style={{ display: 'flex' }}>
×
NEW
43
        <ArrowLeft style={{ strokeWidth: 3 }} />
×
NEW
44
      </span>
×
NEW
45
      <span>{t('toc.title')}</span>
×
NEW
46
    </h2>
×
47
  ) : (
NEW
48
    <h2 className={styles.title}>{t('toc.title')}</h2>
×
49
  )
50

NEW
51
  return (
×
NEW
52
    <>
×
NEW
53
      <header>{title}</header>
×
NEW
54
      <ul>
×
NEW
55
        {articleStructure.map((item) => (
×
NEW
56
          <li
×
NEW
57
            className={styles.headlineItem}
×
NEW
58
            key={`line-${item.index}-${item.line}`}
×
NEW
59
            role="button"
×
NEW
60
            tabIndex={0}
×
NEW
61
            data-index={item.index}
×
NEW
62
            data-heading-anchor={getAnchor(item.line)}
×
NEW
63
            onClick={handleTableOfContentsEntryClicked}
×
64
          >
NEW
65
            {item.title}
×
NEW
66
          </li>
×
NEW
67
        ))}
×
NEW
68
      </ul>
×
NEW
69
    </>
×
70
  )
NEW
71
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc