mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-23 11:37:02 -04:00
added upload functionality (#758)
Co-authored-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de> Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de> Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
8ce344512c
commit
0c0841639a
20 changed files with 401 additions and 73 deletions
|
@ -7,11 +7,12 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
import React, { Fragment, useCallback, useEffect, useRef, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useSelector } from 'react-redux'
|
||||
import { useParams } from 'react-router'
|
||||
import useMedia from 'use-media'
|
||||
import { useApplyDarkMode } from '../../hooks/common/use-apply-dark-mode'
|
||||
import { useDocumentTitle } from '../../hooks/common/use-document-title'
|
||||
import { ApplicationState } from '../../redux'
|
||||
import { setDocumentContent } from '../../redux/document-content/methods'
|
||||
import { setDocumentContent, setNoteId } from '../../redux/document-content/methods'
|
||||
import { setEditorMode } from '../../redux/editor/methods'
|
||||
import { extractNoteTitle } from '../common/document-title/note-title-extractor'
|
||||
import { MotdBanner } from '../common/motd-banner/motd-banner'
|
||||
|
@ -40,6 +41,7 @@ const TASK_REGEX = /(\s*[-*] )(\[[ xX]])( .*)/
|
|||
|
||||
export const Editor: React.FC = () => {
|
||||
const { t } = useTranslation()
|
||||
const { id } = useParams<EditorPathParams>()
|
||||
const untitledNote = t('editor.untitledNote')
|
||||
const markdownContent = useSelector((state: ApplicationState) => state.documentContent.content)
|
||||
const isWide = useMedia({ minWidth: 576 })
|
||||
|
@ -90,6 +92,10 @@ export const Editor: React.FC = () => {
|
|||
|
||||
const isFirstDraw = useFirstDraw()
|
||||
|
||||
useEffect(() => {
|
||||
setNoteId(id)
|
||||
}, [id])
|
||||
|
||||
useEffect(() => {
|
||||
if (!isFirstDraw && !isWide && editorMode === EditorMode.BOTH) {
|
||||
setEditorMode(EditorMode.PREVIEW)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue