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

EcrituresNumeriques / stylo / 14067433582

25 Mar 2025 06:31PM UTC coverage: 31.801%. First build
14067433582

push

github

web-flow
chore: ajout d'une menu sur l'interface d'écriture collaborative (#1364)

* chore: ajout d'une menu sur l'interface d'écriture collaborative

* chore: affiche les métadonnées en lecture seule

470 of 703 branches covered (66.86%)

Branch coverage included in aggregate %.

3 of 281 new or added lines in 9 files covered. (1.07%)

4483 of 14872 relevant lines covered (30.14%)

2.26 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
  const title = onBack ? (
×
NEW
33
    <h2
×
NEW
34
      className={styles.title}
×
NEW
35
      onClick={onBack}
×
NEW
36
      style={{ cursor: 'pointer', userSelect: 'none' }}
×
37
    >
NEW
38
      <span onClick={onBack} style={{ display: 'flex' }}>
×
NEW
39
        <ArrowLeft style={{ strokeWidth: 3 }} />
×
NEW
40
      </span>
×
NEW
41
      <span>{t('toc.title')}</span>
×
NEW
42
    </h2>
×
43
  ) : (
NEW
44
    <h2 className={styles.title}>{t('toc.title')}</h2>
×
45
  )
46

NEW
47
  return (
×
NEW
48
    <>
×
NEW
49
      <header>{title}</header>
×
NEW
50
      <ul>
×
NEW
51
        {articleStructure?.map((item) => (
×
NEW
52
          <li
×
NEW
53
            className={styles.headlineItem}
×
NEW
54
            key={`line-${item.index}-${item.line}`}
×
NEW
55
            role="button"
×
NEW
56
            tabIndex={0}
×
NEW
57
            data-index={item.index}
×
NEW
58
            data-heading-anchor={getAnchor(item.line)}
×
NEW
59
            onClick={handleTableOfContentsEntryClicked}
×
60
          >
NEW
61
            {item.title}
×
NEW
62
          </li>
×
NEW
63
        ))}
×
NEW
64
      </ul>
×
NEW
65
    </>
×
66
  )
NEW
67
}
×
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