mirror of https://github.com/msgbyte/tailchat
refactor: move Markdown Editor and Markdown component into together
parent
f18973bad5
commit
53f812f733
@ -1,11 +1,13 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Editor } from '@bytemd/react';
|
import { Editor } from '@bytemd/react';
|
||||||
import { plugins } from './plugins';
|
|
||||||
import { uploadFile } from 'tailchat-shared';
|
import { uploadFile } from 'tailchat-shared';
|
||||||
import { Markdown } from '../Markdown';
|
import { Markdown } from '../Markdown';
|
||||||
import { createRoot } from 'react-dom/client';
|
import { createRoot } from 'react-dom/client';
|
||||||
|
import gfm from '@bytemd/plugin-gfm';
|
||||||
import 'bytemd/dist/index.css';
|
import 'bytemd/dist/index.css';
|
||||||
import './style.less';
|
import './editor.less';
|
||||||
|
|
||||||
|
export const plugins = [gfm()];
|
||||||
|
|
||||||
interface MarkdownEditorProps {
|
interface MarkdownEditorProps {
|
||||||
value: string;
|
value: string;
|
@ -1,5 +1,7 @@
|
|||||||
import { Loadable } from '../Loadable';
|
import { Loadable } from '../Loadable';
|
||||||
|
|
||||||
|
export { Markdown } from './render';
|
||||||
|
|
||||||
export const MarkdownEditor = Loadable(() =>
|
export const MarkdownEditor = Loadable(() =>
|
||||||
import('./editor').then((module) => module.MarkdownEditor)
|
import('./editor').then((module) => module.MarkdownEditor)
|
||||||
);
|
);
|
@ -1,11 +1,11 @@
|
|||||||
import { makeAbsoluteUrl } from '@/utils/url-helper';
|
import { makeAbsoluteUrl } from '@/utils/url-helper';
|
||||||
import React, { useCallback, useMemo } from 'react';
|
import React, { useCallback, useMemo } from 'react';
|
||||||
import { isValidStr, parseUrlStr } from 'tailchat-shared';
|
import { isValidStr, parseUrlStr } from 'tailchat-shared';
|
||||||
import { Loadable } from './Loadable';
|
import { Loadable } from '../Loadable';
|
||||||
import { Image } from 'tailchat-design';
|
import { Image } from 'tailchat-design';
|
||||||
import remarkGfm from 'remark-gfm';
|
import remarkGfm from 'remark-gfm';
|
||||||
import rehypeRaw from 'rehype-raw';
|
import rehypeRaw from 'rehype-raw';
|
||||||
import './Markdown.less';
|
import './render.less';
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
@ -1,6 +0,0 @@
|
|||||||
import gfm from '@bytemd/plugin-gfm';
|
|
||||||
|
|
||||||
export const plugins = [
|
|
||||||
gfm(),
|
|
||||||
// Add more plugins here
|
|
||||||
];
|
|
Loading…
Reference in New Issue