mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-23 11:37:02 -04:00
feat(sidebar): add gitlab snippet and github gist export
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
parent
5fd8c02637
commit
0db5a0856b
13 changed files with 624 additions and 33 deletions
19
frontend/src/hooks/common/use-note-filename.tsx
Normal file
19
frontend/src/hooks/common/use-note-filename.tsx
Normal file
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2024 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import { useMemo } from 'react'
|
||||
import { useNoteTitle } from './use-note-title'
|
||||
import sanitize from 'sanitize-filename'
|
||||
|
||||
/**
|
||||
* Returns a sanitized filename for the current note based on the title.
|
||||
* When no title is provided, the filename will be "untitled".
|
||||
*
|
||||
* @return The sanitized filename
|
||||
*/
|
||||
export const useNoteFilename = (): string => {
|
||||
const title = useNoteTitle()
|
||||
return useMemo(() => `${sanitize(title)}.md`, [title])
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue