mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-23 03:27:05 -04:00
Basic markdown renderer (#197)
* Add basic markdown it rendering * Add markdown preview * Add embedings for vimeo, youtube, gist * Add support for legacy shortcodes and link detection * Set "both" as editor default * Add markdown-it-task-lists * Add twemoji * Changed SlideShare short-code behaviour from embedding to generating a link * Extract markdown it parser debugger into separate component * Deactivate markdown it linkify for now * Add link safety attributes * Add one-click-embedding component and use it * Added embedding changes and deprecations to CHANGELOG.md Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de> Co-authored-by: Philip Molares <philip@mauricedoepke.de> Co-authored-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
parent
8ba2be7c70
commit
7189a63618
31 changed files with 637 additions and 16 deletions
|
@ -11,18 +11,22 @@ import 'codemirror/addon/search/match-highlighter'
|
|||
import 'codemirror/addon/selection/active-line'
|
||||
import 'codemirror/keymap/sublime.js'
|
||||
import 'codemirror/mode/gfm/gfm.js'
|
||||
import React, { useState } from 'react'
|
||||
import React from 'react'
|
||||
import { Controlled as ControlledCodeMirror } from 'react-codemirror2'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import './editor-window.scss'
|
||||
|
||||
const EditorWindow: React.FC = () => {
|
||||
export interface EditorWindowProps {
|
||||
onContentChange: (content: string) => void
|
||||
content: string
|
||||
}
|
||||
|
||||
const EditorWindow: React.FC<EditorWindowProps> = ({ onContentChange, content }) => {
|
||||
const { t } = useTranslation()
|
||||
|
||||
const [content, setContent] = useState<string>('')
|
||||
return (
|
||||
<ControlledCodeMirror
|
||||
className="h-100 w-100"
|
||||
className="h-100 w-100 flex-fill"
|
||||
value={content}
|
||||
options={{
|
||||
mode: 'gfm',
|
||||
|
@ -58,10 +62,7 @@ const EditorWindow: React.FC = () => {
|
|||
}
|
||||
}
|
||||
onBeforeChange={(editor, data, value) => {
|
||||
setContent(value)
|
||||
}}
|
||||
onChange={(editor, data, value) => {
|
||||
console.log('change!')
|
||||
onContentChange(value)
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue