@uiw/react-md-editor 3.10.2 → 3.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -9
- package/dist/mdeditor.css +959 -321
- package/dist/mdeditor.js +43804 -57871
- package/dist/mdeditor.min.css +1 -1
- package/dist/mdeditor.min.js +1 -1
- package/esm/Editor.js +1 -1
- package/esm/Editor.js.map +2 -2
- package/esm/components/TextArea/Markdown.js +2 -3
- package/esm/components/TextArea/Markdown.js.map +2 -2
- package/esm/components/TextArea/index.css +17 -25
- package/esm/components/TextArea/index.less +17 -27
- package/esm/components/Toolbar/Child.css +2 -2
- package/esm/components/Toolbar/Child.less +3 -2
- package/esm/components/Toolbar/index.css +12 -12
- package/esm/components/Toolbar/index.less +12 -12
- package/esm/index.css +5 -5
- package/esm/index.less +6 -5
- package/lib/Editor.js +1 -1
- package/lib/Editor.js.map +2 -2
- package/lib/components/TextArea/Markdown.js +2 -3
- package/lib/components/TextArea/Markdown.js.map +2 -2
- package/lib/components/TextArea/index.less +17 -27
- package/lib/components/Toolbar/Child.less +3 -2
- package/lib/components/Toolbar/index.less +12 -12
- package/lib/index.less +6 -5
- package/markdown-editor.css +36 -44
- package/package.json +4 -3
- package/src/Editor.tsx +1 -0
- package/src/__test__/editor.test.tsx +1 -1
- package/src/components/TextArea/Markdown.tsx +1 -2
- package/src/components/TextArea/index.less +17 -27
- package/src/components/Toolbar/Child.less +3 -2
- package/src/components/Toolbar/index.less +12 -12
- package/src/index.less +6 -5
package/esm/Editor.js
CHANGED
|
@@ -89,7 +89,7 @@ var InternalMDEditor = (props, ref) => {
|
|
|
89
89
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
90
90
|
|
|
91
91
|
}, []);
|
|
92
|
-
var cls = [className, prefixCls, state.preview ? prefixCls + "-show-" + state.preview : null, state.fullscreen ? prefixCls + "-fullscreen" : null].filter(Boolean).join(' ').trim();
|
|
92
|
+
var cls = [className, 'wmde-markdown-var', prefixCls, state.preview ? prefixCls + "-show-" + state.preview : null, state.fullscreen ? prefixCls + "-fullscreen" : null].filter(Boolean).join(' ').trim();
|
|
93
93
|
useMemo(() => propsValue !== state.markdown && dispatch({
|
|
94
94
|
markdown: propsValue || ''
|
|
95
95
|
}), [propsValue, state.markdown]); // eslint-disable-next-line react-hooks/exhaustive-deps
|
package/esm/Editor.js.map
CHANGED
|
@@ -100,8 +100,8 @@
|
|
|
100
100
|
"forwardRef",
|
|
101
101
|
"Markdown"
|
|
102
102
|
],
|
|
103
|
-
"mappings": ";;;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,UAA3B,EAAuCC,OAAvC,EAAgDC,MAAhD,EAAwDC,mBAAxD,QAAmF,OAAnF;AACA,OAAOC,eAAP,MAA0E,6BAA1E;AACA,OAAOC,QAAP,MAAyC,uBAAzC;AACA,OAAOC,OAAP,MAAoB,sBAApB;AACA,OAAOC,OAAP,MAAoB,sBAApB;AACA,SAASC,WAAT,EAAsBC,gBAAtB,QAAwD,YAAxD;AACA,SAASC,OAAT,EAAkBC,aAAlB,QAAkE,WAAlE;AACA;;;;AAoGA,SAASC,gBAAT,CAA0BC,IAA1B,EAA8D;AAAA,MAApCA,IAAoC;AAApCA,IAAAA,IAAoC,GAAJ,EAAI;AAAA;;AAC5DC,EAAAA,MAAM,CAACC,IAAP,CAAYF,IAAZ,EAAkBG,OAAlB,CAA2BC,OAAD,IAAa;AACrCJ,IAAAA,IAAI,CAACI,OAAD,CAAJ,GAAgB,KAAhB;AACD,GAFD;AAGA,SAAOJ,IAAP;AACD;;AAED,IAAMK,gBAAgB,GAAG,CACvBC,KADuB,EAEvBC,GAFuB,KAGpB;AACH,aA0BID,KAAK,IAAI,EA1Bb;AAAA,MAAM;AACJE,IAAAA,SAAS,GAAG,aADR;AAEJC,IAAAA,SAFI;AAGJC,IAAAA,KAAK,EAAEC,UAHH;AAIJC,IAAAA,QAAQ,GAAGjB,WAAW,EAJlB;AAKJkB,I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AGiD,SAAD,IAAe;AACvBlC,UAAAA,QAAQ,CAAC;AAAE3B,YAAAA,MAAM,EAAE6D;AAAV,WAAD,CAAR;AACD;AAPH,QAtCJ;AAAA;AADF,IADF;AAqDD,CArND;;AAuNA,IAAMC,QAAQ,gBAAG5F,KAAK,CAAC6F,UAAN,CAA8CzE,gBAA9C,CAAjB;AAMCwE,QAAD,CAAuBE,QAAvB,GAAkCxF,eAAlC;AAEA,eAAesF,QAAf",
|
|
104
104
|
"sourcesContent": [
|
|
105
|
-
"import React, { useEffect, useReducer, useMemo, useRef, useImperativeHandle } from 'react';\nimport MarkdownPreview, { MarkdownPreviewProps, MarkdownPreviewRef } from '@uiw/react-markdown-preview';\nimport TextArea, { ITextAreaProps } from './components/TextArea';\nimport Toolbar from './components/Toolbar';\nimport DragBar from './components/DragBar';\nimport { getCommands, getExtraCommands, ICommand } from './commands';\nimport { reducer, EditorContext, ContextStore, PreviewType } from './Context';\nimport './index.less';\n\nexport interface IProps {\n prefixCls?: string;\n className?: string;\n}\n\nexport interface MDEditorProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'>, IProps {\n /**\n * The Markdown value.\n */\n value?: string;\n /**\n * Event handler for the `onChange` event.\n */\n onChange?: (value?: string) => void;\n /**\n * Can be used to make `Markdown Editor` focus itself on initialization. Defaults to on.\n * it will be set to true when either the source `textarea` is focused,\n * or it has an `autofocus` attribute and no other element is focused.\n */\n autoFocus?: ITextAreaProps['autoFocus'];\n /**\n * The height of the editor.\n */\n height?: number;\n /**\n * Custom toolbar heigth\n * @default 29px\n */\n toolbarHeight?: number;\n /**\n * Show drag and drop tool. Set the height of the editor.\n */\n visiableDragbar?: boolean;\n /**\n * Show markdown preview.\n */\n preview?: PreviewType;\n /**\n * Full screen display editor.\n */\n fullscreen?: boolean;\n /**\n * Disable `fullscreen` setting body styles\n */\n overflow?: boolean;\n /**\n * Maximum drag height. `visiableDragbar=true`\n */\n maxHeight?: number;\n /**\n * Minimum drag height. `visiableDragbar=true`\n */\n minHeight?: number;\n /**\n * This is reset [react-markdown](https://github.com/rexxars/react-markdown) settings.\n */\n previewOptions?: Omit<MarkdownPreviewProps, 'source'>;\n /**\n * Set the `textarea` related props.\n */\n textareaProps?: ITextAreaProps;\n /** Use div to replace TextArea or re-render TextArea */\n renderTextarea?: ITextAreaProps['renderTextarea'];\n /**\n * Disable editing area code highlighting. The value is `false`, which increases the editing speed.\n * @default true\n */\n highlightEnable?: boolean;\n /**\n * The number of characters to insert when pressing tab key.\n * Default `2` spaces.\n */\n tabSize?: number;\n /**\n * If `false`, the `tab` key inserts a tab character into the textarea. If `true`, the `tab` key executes default behavior e.g. focus shifts to next element.\n */\n defaultTabEnable?: boolean;\n /**\n * You can create your own commands or reuse existing commands.\n */\n commands?: ICommand[];\n /**\n * Filter or modify your commands.\n * https://github.com/uiwjs/react-md-editor/issues/296\n */\n commandsFilter?: (command: ICommand, isExtra: boolean) => false | ICommand;\n /**\n * You can create your own commands or reuse existing commands.\n */\n extraCommands?: ICommand[];\n /**\n * Hide the tool bar\n */\n hideToolbar?: boolean;\n /** Whether to enable scrolling */\n enableScroll?: boolean;\n}\n\nfunction setGroupPopFalse(data: Record<string, boolean> = {}) {\n Object.keys(data).forEach((keyname) => {\n data[keyname] = false;\n });\n return data;\n}\n\nconst InternalMDEditor = (\n props: MDEditorProps,\n ref?: ((instance: ContextStore) => void) | React.RefObject<ContextStore> | null,\n) => {\n const {\n prefixCls = 'w-md-editor',\n className,\n value: propsValue,\n commands = getCommands(),\n commandsFilter,\n extraCommands = getExtraCommands(),\n height = 200,\n toolbarHeight = 29,\n enableScroll = true,\n visiableDragbar = true,\n highlightEnable = true,\n preview: previewType = 'live',\n fullscreen = false,\n overflow = true,\n previewOptions = {},\n textareaProps,\n maxHeight = 1200,\n minHeight = 100,\n autoFocus,\n tabSize = 2,\n defaultTabEnable = false,\n onChange,\n hideToolbar,\n renderTextarea,\n ...other\n } = props || {};\n const cmds = commands\n .map((item) => (commandsFilter ? commandsFilter(item, false) : item))\n .filter(Boolean) as ICommand[];\n const extraCmds = extraCommands\n .map((item) => (commandsFilter ? commandsFilter(item, true) : item))\n .filter(Boolean) as ICommand[];\n let [state, dispatch] = useReducer(reducer, {\n markdown: propsValue,\n preview: previewType,\n height,\n highlightEnable,\n tabSize,\n defaultTabEnable,\n scrollTop: 0,\n scrollTopPreview: 0,\n commands: cmds,\n extraCommands: extraCmds,\n fullscreen,\n barPopup: {},\n });\n const container = useRef<HTMLDivElement>(null);\n const previewRef = useRef<MarkdownPreviewRef>(null);\n const enableScrollRef = useRef(enableScroll);\n\n useImperativeHandle(ref, () => ({ ...state }));\n useMemo(() => (enableScrollRef.current = enableScroll), [enableScroll]);\n useEffect(() => {\n const stateInit: ContextStore = {};\n if (container.current) {\n stateInit.container = container.current || undefined;\n }\n stateInit.markdown = propsValue || '';\n stateInit.barPopup = {};\n if (dispatch) {\n dispatch({ ...state, ...stateInit });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const cls = [\n className,\n prefixCls,\n state.preview ? `${prefixCls}-show-${state.preview}` : null,\n state.fullscreen ? `${prefixCls}-fullscreen` : null,\n ]\n .filter(Boolean)\n .join(' ')\n .trim();\n\n useMemo(\n () => propsValue !== state.markdown && dispatch({ markdown: propsValue || '' }),\n [propsValue, state.markdown],\n );\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useMemo(() => previewType !== state.preview && dispatch({ preview: previewType }), [previewType]);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useMemo(() => height !== state.height && dispatch({ height: height }), [height]);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useMemo(() => tabSize !== state.tabSize && dispatch({ tabSize }), [tabSize]);\n useMemo(\n () => highlightEnable !== state.highlightEnable && dispatch({ highlightEnable }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [highlightEnable],\n );\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useMemo(() => autoFocus !== state.autoFocus && dispatch({ autoFocus: autoFocus }), [autoFocus]);\n useMemo(\n () => fullscreen !== state.fullscreen && dispatch({ fullscreen: fullscreen }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [fullscreen],\n );\n\n const textareaDomRef = useRef<HTMLDivElement>();\n const active = useRef<'text' | 'preview'>('preview');\n const initScroll = useRef(false);\n\n useMemo(() => {\n textareaDomRef.current = state.textareaWarp;\n if (state.textareaWarp) {\n state.textareaWarp.addEventListener('mouseover', () => {\n active.current = 'text';\n });\n state.textareaWarp.addEventListener('mouseleave', () => {\n active.current = 'preview';\n });\n }\n }, [state.textareaWarp]);\n\n const handleScroll = (e: React.UIEvent<HTMLDivElement>, type: 'text' | 'preview') => {\n if (!enableScrollRef.current) return;\n const textareaDom = textareaDomRef.current;\n const previewDom = previewRef.current ? previewRef.current.mdp.current : undefined;\n if (!initScroll.current) {\n active.current = type;\n initScroll.current = true;\n }\n if (textareaDom && previewDom) {\n const scale =\n (textareaDom.scrollHeight - textareaDom.offsetHeight) / (previewDom.scrollHeight - previewDom.offsetHeight);\n if (e.target === textareaDom && active.current === 'text') {\n previewDom.scrollTop = textareaDom.scrollTop / scale;\n }\n if (e.target === previewDom && active.current === 'preview') {\n textareaDom.scrollTop = previewDom.scrollTop * scale;\n }\n let scrollTop = 0;\n if (active.current === 'text') {\n scrollTop = textareaDom.scrollTop || 0;\n } else if (active.current === 'preview') {\n scrollTop = previewDom.scrollTop || 0;\n }\n dispatch({ scrollTop });\n }\n };\n\n const mdPreview = useMemo(\n () => (\n <MarkdownPreview\n {...previewOptions}\n onScroll={(e) => handleScroll(e, 'preview')}\n ref={previewRef}\n source={state.markdown || ''}\n className={`${prefixCls}-preview ${previewOptions.className || ''}`}\n />\n ),\n [prefixCls, previewOptions, state.markdown],\n );\n\n return (\n <EditorContext.Provider value={{ ...state, dispatch }}>\n <div\n ref={container}\n className={cls}\n {...other}\n onClick={() => {\n dispatch({ barPopup: { ...setGroupPopFalse(state.barPopup) } });\n }}\n style={{\n ...other.style,\n height: state.fullscreen ? '100%' : hideToolbar ? Number(state.height) - toolbarHeight : state.height,\n }}\n >\n {!hideToolbar && <Toolbar prefixCls={prefixCls} height={toolbarHeight} overflow={overflow} />}\n <div\n className={`${prefixCls}-content`}\n style={{\n height: state.fullscreen ? `calc(100% - ${toolbarHeight}px)` : Number(state.height) - toolbarHeight,\n }}\n >\n {/(edit|live)/.test(state.preview || '') && (\n <TextArea\n className={`${prefixCls}-input`}\n prefixCls={prefixCls}\n autoFocus={autoFocus}\n {...textareaProps}\n onChange={(evn) => {\n onChange && onChange(evn.target.value);\n if (textareaProps && textareaProps.onChange) {\n textareaProps.onChange(evn);\n }\n }}\n renderTextarea={renderTextarea}\n onScroll={(e) => handleScroll(e, 'text')}\n />\n )}\n {/(live|preview)/.test(state.preview || '') && mdPreview}\n </div>\n {visiableDragbar && !state.fullscreen && (\n <DragBar\n prefixCls={prefixCls}\n height={state.height as number}\n maxHeight={maxHeight!}\n minHeight={minHeight!}\n onChange={(newHeight) => {\n dispatch({ height: newHeight });\n }}\n />\n )}\n </div>\n </EditorContext.Provider>\n );\n};\n\nconst mdEditor = React.forwardRef<ContextStore, MDEditorProps>(InternalMDEditor);\n\ntype MDEditor = typeof mdEditor & {\n Markdown: typeof MarkdownPreview;\n};\n\n(mdEditor as MDEditor).Markdown = MarkdownPreview;\n\nexport default mdEditor as MDEditor;\n"
|
|
105
|
+
"import React, { useEffect, useReducer, useMemo, useRef, useImperativeHandle } from 'react';\nimport MarkdownPreview, { MarkdownPreviewProps, MarkdownPreviewRef } from '@uiw/react-markdown-preview';\nimport TextArea, { ITextAreaProps } from './components/TextArea';\nimport Toolbar from './components/Toolbar';\nimport DragBar from './components/DragBar';\nimport { getCommands, getExtraCommands, ICommand } from './commands';\nimport { reducer, EditorContext, ContextStore, PreviewType } from './Context';\nimport './index.less';\n\nexport interface IProps {\n prefixCls?: string;\n className?: string;\n}\n\nexport interface MDEditorProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'>, IProps {\n /**\n * The Markdown value.\n */\n value?: string;\n /**\n * Event handler for the `onChange` event.\n */\n onChange?: (value?: string) => void;\n /**\n * Can be used to make `Markdown Editor` focus itself on initialization. Defaults to on.\n * it will be set to true when either the source `textarea` is focused,\n * or it has an `autofocus` attribute and no other element is focused.\n */\n autoFocus?: ITextAreaProps['autoFocus'];\n /**\n * The height of the editor.\n */\n height?: number;\n /**\n * Custom toolbar heigth\n * @default 29px\n */\n toolbarHeight?: number;\n /**\n * Show drag and drop tool. Set the height of the editor.\n */\n visiableDragbar?: boolean;\n /**\n * Show markdown preview.\n */\n preview?: PreviewType;\n /**\n * Full screen display editor.\n */\n fullscreen?: boolean;\n /**\n * Disable `fullscreen` setting body styles\n */\n overflow?: boolean;\n /**\n * Maximum drag height. `visiableDragbar=true`\n */\n maxHeight?: number;\n /**\n * Minimum drag height. `visiableDragbar=true`\n */\n minHeight?: number;\n /**\n * This is reset [react-markdown](https://github.com/rexxars/react-markdown) settings.\n */\n previewOptions?: Omit<MarkdownPreviewProps, 'source'>;\n /**\n * Set the `textarea` related props.\n */\n textareaProps?: ITextAreaProps;\n /** Use div to replace TextArea or re-render TextArea */\n renderTextarea?: ITextAreaProps['renderTextarea'];\n /**\n * Disable editing area code highlighting. The value is `false`, which increases the editing speed.\n * @default true\n */\n highlightEnable?: boolean;\n /**\n * The number of characters to insert when pressing tab key.\n * Default `2` spaces.\n */\n tabSize?: number;\n /**\n * If `false`, the `tab` key inserts a tab character into the textarea. If `true`, the `tab` key executes default behavior e.g. focus shifts to next element.\n */\n defaultTabEnable?: boolean;\n /**\n * You can create your own commands or reuse existing commands.\n */\n commands?: ICommand[];\n /**\n * Filter or modify your commands.\n * https://github.com/uiwjs/react-md-editor/issues/296\n */\n commandsFilter?: (command: ICommand, isExtra: boolean) => false | ICommand;\n /**\n * You can create your own commands or reuse existing commands.\n */\n extraCommands?: ICommand[];\n /**\n * Hide the tool bar\n */\n hideToolbar?: boolean;\n /** Whether to enable scrolling */\n enableScroll?: boolean;\n}\n\nfunction setGroupPopFalse(data: Record<string, boolean> = {}) {\n Object.keys(data).forEach((keyname) => {\n data[keyname] = false;\n });\n return data;\n}\n\nconst InternalMDEditor = (\n props: MDEditorProps,\n ref?: ((instance: ContextStore) => void) | React.RefObject<ContextStore> | null,\n) => {\n const {\n prefixCls = 'w-md-editor',\n className,\n value: propsValue,\n commands = getCommands(),\n commandsFilter,\n extraCommands = getExtraCommands(),\n height = 200,\n toolbarHeight = 29,\n enableScroll = true,\n visiableDragbar = true,\n highlightEnable = true,\n preview: previewType = 'live',\n fullscreen = false,\n overflow = true,\n previewOptions = {},\n textareaProps,\n maxHeight = 1200,\n minHeight = 100,\n autoFocus,\n tabSize = 2,\n defaultTabEnable = false,\n onChange,\n hideToolbar,\n renderTextarea,\n ...other\n } = props || {};\n const cmds = commands\n .map((item) => (commandsFilter ? commandsFilter(item, false) : item))\n .filter(Boolean) as ICommand[];\n const extraCmds = extraCommands\n .map((item) => (commandsFilter ? commandsFilter(item, true) : item))\n .filter(Boolean) as ICommand[];\n let [state, dispatch] = useReducer(reducer, {\n markdown: propsValue,\n preview: previewType,\n height,\n highlightEnable,\n tabSize,\n defaultTabEnable,\n scrollTop: 0,\n scrollTopPreview: 0,\n commands: cmds,\n extraCommands: extraCmds,\n fullscreen,\n barPopup: {},\n });\n const container = useRef<HTMLDivElement>(null);\n const previewRef = useRef<MarkdownPreviewRef>(null);\n const enableScrollRef = useRef(enableScroll);\n\n useImperativeHandle(ref, () => ({ ...state }));\n useMemo(() => (enableScrollRef.current = enableScroll), [enableScroll]);\n useEffect(() => {\n const stateInit: ContextStore = {};\n if (container.current) {\n stateInit.container = container.current || undefined;\n }\n stateInit.markdown = propsValue || '';\n stateInit.barPopup = {};\n if (dispatch) {\n dispatch({ ...state, ...stateInit });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const cls = [\n className,\n 'wmde-markdown-var',\n prefixCls,\n state.preview ? `${prefixCls}-show-${state.preview}` : null,\n state.fullscreen ? `${prefixCls}-fullscreen` : null,\n ]\n .filter(Boolean)\n .join(' ')\n .trim();\n\n useMemo(\n () => propsValue !== state.markdown && dispatch({ markdown: propsValue || '' }),\n [propsValue, state.markdown],\n );\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useMemo(() => previewType !== state.preview && dispatch({ preview: previewType }), [previewType]);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useMemo(() => height !== state.height && dispatch({ height: height }), [height]);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useMemo(() => tabSize !== state.tabSize && dispatch({ tabSize }), [tabSize]);\n useMemo(\n () => highlightEnable !== state.highlightEnable && dispatch({ highlightEnable }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [highlightEnable],\n );\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useMemo(() => autoFocus !== state.autoFocus && dispatch({ autoFocus: autoFocus }), [autoFocus]);\n useMemo(\n () => fullscreen !== state.fullscreen && dispatch({ fullscreen: fullscreen }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [fullscreen],\n );\n\n const textareaDomRef = useRef<HTMLDivElement>();\n const active = useRef<'text' | 'preview'>('preview');\n const initScroll = useRef(false);\n\n useMemo(() => {\n textareaDomRef.current = state.textareaWarp;\n if (state.textareaWarp) {\n state.textareaWarp.addEventListener('mouseover', () => {\n active.current = 'text';\n });\n state.textareaWarp.addEventListener('mouseleave', () => {\n active.current = 'preview';\n });\n }\n }, [state.textareaWarp]);\n\n const handleScroll = (e: React.UIEvent<HTMLDivElement>, type: 'text' | 'preview') => {\n if (!enableScrollRef.current) return;\n const textareaDom = textareaDomRef.current;\n const previewDom = previewRef.current ? previewRef.current.mdp.current : undefined;\n if (!initScroll.current) {\n active.current = type;\n initScroll.current = true;\n }\n if (textareaDom && previewDom) {\n const scale =\n (textareaDom.scrollHeight - textareaDom.offsetHeight) / (previewDom.scrollHeight - previewDom.offsetHeight);\n if (e.target === textareaDom && active.current === 'text') {\n previewDom.scrollTop = textareaDom.scrollTop / scale;\n }\n if (e.target === previewDom && active.current === 'preview') {\n textareaDom.scrollTop = previewDom.scrollTop * scale;\n }\n let scrollTop = 0;\n if (active.current === 'text') {\n scrollTop = textareaDom.scrollTop || 0;\n } else if (active.current === 'preview') {\n scrollTop = previewDom.scrollTop || 0;\n }\n dispatch({ scrollTop });\n }\n };\n\n const mdPreview = useMemo(\n () => (\n <MarkdownPreview\n {...previewOptions}\n onScroll={(e) => handleScroll(e, 'preview')}\n ref={previewRef}\n source={state.markdown || ''}\n className={`${prefixCls}-preview ${previewOptions.className || ''}`}\n />\n ),\n [prefixCls, previewOptions, state.markdown],\n );\n\n return (\n <EditorContext.Provider value={{ ...state, dispatch }}>\n <div\n ref={container}\n className={cls}\n {...other}\n onClick={() => {\n dispatch({ barPopup: { ...setGroupPopFalse(state.barPopup) } });\n }}\n style={{\n ...other.style,\n height: state.fullscreen ? '100%' : hideToolbar ? Number(state.height) - toolbarHeight : state.height,\n }}\n >\n {!hideToolbar && <Toolbar prefixCls={prefixCls} height={toolbarHeight} overflow={overflow} />}\n <div\n className={`${prefixCls}-content`}\n style={{\n height: state.fullscreen ? `calc(100% - ${toolbarHeight}px)` : Number(state.height) - toolbarHeight,\n }}\n >\n {/(edit|live)/.test(state.preview || '') && (\n <TextArea\n className={`${prefixCls}-input`}\n prefixCls={prefixCls}\n autoFocus={autoFocus}\n {...textareaProps}\n onChange={(evn) => {\n onChange && onChange(evn.target.value);\n if (textareaProps && textareaProps.onChange) {\n textareaProps.onChange(evn);\n }\n }}\n renderTextarea={renderTextarea}\n onScroll={(e) => handleScroll(e, 'text')}\n />\n )}\n {/(live|preview)/.test(state.preview || '') && mdPreview}\n </div>\n {visiableDragbar && !state.fullscreen && (\n <DragBar\n prefixCls={prefixCls}\n height={state.height as number}\n maxHeight={maxHeight!}\n minHeight={minHeight!}\n onChange={(newHeight) => {\n dispatch({ height: newHeight });\n }}\n />\n )}\n </div>\n </EditorContext.Provider>\n );\n};\n\nconst mdEditor = React.forwardRef<ContextStore, MDEditorProps>(InternalMDEditor);\n\ntype MDEditor = typeof mdEditor & {\n Markdown: typeof MarkdownPreview;\n};\n\n(mdEditor as MDEditor).Markdown = MarkdownPreview;\n\nexport default mdEditor as MDEditor;\n"
|
|
106
106
|
]
|
|
107
107
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useContext, useEffect, useMemo } from 'react';
|
|
2
|
-
import { rehype } from 'rehype';
|
|
3
|
-
|
|
4
|
-
import rehypePrism from '@mapbox/rehype-prism';
|
|
2
|
+
import { rehype } from 'rehype';
|
|
3
|
+
import rehypePrism from 'rehype-prism-plus';
|
|
5
4
|
import { EditorContext } from '../../Context';
|
|
6
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
6
|
export default function Markdown(props) {
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"__html",
|
|
37
37
|
"value"
|
|
38
38
|
],
|
|
39
|
-
"mappings": "AAAA,OAAOA,KAAP,IAAgBC,UAAhB,EAA4BC,SAA5B,EAAuCC,OAAvC,QAAsD,OAAtD;AACA,SAASC,MAAT,QAAuB,QAAvB
|
|
39
|
+
"mappings": "AAAA,OAAOA,KAAP,IAAgBC,UAAhB,EAA4BC,SAA5B,EAAuCC,OAAvC,QAAsD,OAAtD;AACA,SAASC,MAAT,QAAuB,QAAvB;AACA,OAAOC,WAAP,MAAwB,mBAAxB;AAEA,SAASC,aAAT,QAA8B,eAA9B;;AAIA,eAAe,SAASC,QAAT,CAAkBC,KAAlB,EAAwC;AACrD,MAAM;AAAEC,IAAAA;AAAF,MAAgBD,KAAtB;AACA,MAAM;AAAEE,IAAAA,QAAQ,GAAG,EAAb;AAAiBC,IAAAA;AAAjB,MAA8BV,UAAU,CAACK,aAAD,CAA9C;AACA,MAAMM,MAAM,gBAAGZ,KAAK,CAACa,SAAN,EAAf;AACAX,EAAAA,SAAS,CAAC,MAAM;AACd,QAAIU,MAAM,CAACE,OAAP,IAAkBH,QAAtB,EAAgC;AA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,GAhBa,EAgBX,CAACpB,QAAD,EAAWE,MAAX,EAAmBH,SAAnB,CAhBW,CAAd;AAiBD",
|
|
40
40
|
"sourcesContent": [
|
|
41
|
-
"import React, { useContext, useEffect, useMemo } from 'react';\nimport { rehype } from 'rehype';\
|
|
41
|
+
"import React, { useContext, useEffect, useMemo } from 'react';\nimport { rehype } from 'rehype';\nimport rehypePrism from 'rehype-prism-plus';\nimport { IProps } from '../../Editor';\nimport { EditorContext } from '../../Context';\n\nexport interface MarkdownProps extends IProps, React.HTMLAttributes<HTMLPreElement> {}\n\nexport default function Markdown(props: MarkdownProps) {\n const { prefixCls } = props;\n const { markdown = '', dispatch } = useContext(EditorContext);\n const preRef = React.createRef<HTMLPreElement>();\n useEffect(() => {\n if (preRef.current && dispatch) {\n dispatch({ textareaPre: preRef.current });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n function html2Escape(sHtml: string) {\n return sHtml\n .replace(/```(tsx?|jsx?|html|xml)(.*)\\s+([\\s\\S]*?)(\\s.+)?```/g, (str: string) => {\n return str.replace(\n /[<&\"]/g,\n (c: string) => (({ '<': '<', '>': '>', '&': '&', '\"': '"' } as Record<string, string>)[c]),\n );\n })\n .replace(\n /[<&\"]/g,\n (c: string) => (({ '<': '<', '>': '>', '&': '&', '\"': '"' } as Record<string, string>)[c]),\n );\n }\n\n return useMemo(() => {\n if (!markdown) {\n return <pre children={markdown || ''} ref={preRef} className={`${prefixCls}-text-pre wmde-markdown-color`} />;\n }\n const str = rehype()\n .data('settings', { fragment: true })\n .use(rehypePrism, { ignoreMissing: true })\n .processSync(\n `<pre class=\"language-markdown ${prefixCls}-text-pre wmde-markdown-color\"><code class=\"language-markdown\">${html2Escape(\n markdown,\n )}\\n</code></pre>`,\n );\n return React.createElement('div', {\n className: 'wmde-markdown-color',\n dangerouslySetInnerHTML: { __html: str.value as string },\n });\n }, [markdown, preRef, prefixCls]);\n}\n"
|
|
42
42
|
]
|
|
43
43
|
}
|
|
@@ -93,39 +93,31 @@
|
|
|
93
93
|
color: transparent !important;
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
.w-md-editor-text-pre {
|
|
97
|
-
color:
|
|
98
|
-
}
|
|
99
|
-
.w-md-editor-text-pre .table .punctuation {
|
|
100
|
-
color: #c3c3c3;
|
|
101
|
-
}
|
|
102
|
-
.w-md-editor-text-pre .table .table-header {
|
|
103
|
-
color: #000;
|
|
96
|
+
.w-md-editor-text-pre .punctuation {
|
|
97
|
+
color: var(--color-prettylights-syntax-comment) !important;
|
|
104
98
|
}
|
|
105
|
-
.w-md-editor-text-pre .url
|
|
106
|
-
|
|
99
|
+
.w-md-editor-text-pre .token.url,
|
|
100
|
+
.w-md-editor-text-pre .token.content {
|
|
101
|
+
color: var(--color-prettylights-syntax-constant) !important;
|
|
107
102
|
}
|
|
108
|
-
.w-md-editor-text-pre .
|
|
109
|
-
color:
|
|
103
|
+
.w-md-editor-text-pre .token.title.important {
|
|
104
|
+
color: var(--color-prettylights-syntax-markup-bold);
|
|
110
105
|
}
|
|
111
|
-
.w-md-editor-text-pre .
|
|
112
|
-
color:
|
|
106
|
+
.w-md-editor-text-pre .token.code-block .function {
|
|
107
|
+
color: var(--color-prettylights-syntax-entity);
|
|
113
108
|
}
|
|
114
|
-
.w-md-editor-text-pre .
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
.w-md-editor-text-pre .title,
|
|
118
|
-
.w-md-editor-text-pre .bold {
|
|
119
|
-
color: #000 !important;
|
|
109
|
+
.w-md-editor-text-pre .token.bold {
|
|
110
|
+
font-weight: unset !important;
|
|
120
111
|
}
|
|
121
|
-
.w-md-editor-text-pre .title {
|
|
112
|
+
.w-md-editor-text-pre .token.title {
|
|
122
113
|
line-height: unset !important;
|
|
123
114
|
font-size: unset !important;
|
|
124
115
|
font-weight: unset !important;
|
|
125
116
|
}
|
|
126
|
-
.w-md-editor-text-pre .code.keyword {
|
|
127
|
-
color:
|
|
117
|
+
.w-md-editor-text-pre .token.code.keyword {
|
|
118
|
+
color: var(--color-prettylights-syntax-constant) !important;
|
|
128
119
|
}
|
|
129
|
-
.w-md-editor-text-pre .strike
|
|
130
|
-
|
|
120
|
+
.w-md-editor-text-pre .token.strike,
|
|
121
|
+
.w-md-editor-text-pre .token.strike .content {
|
|
122
|
+
color: var(--color-prettylights-syntax-markup-deleted-text) !important;
|
|
131
123
|
}
|
|
@@ -95,42 +95,32 @@
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
.@{md-editor}-text-pre {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
.punctuation {
|
|
101
|
-
color: #c3c3c3;
|
|
102
|
-
}
|
|
103
|
-
.table-header {
|
|
104
|
-
color: #000;
|
|
105
|
-
}
|
|
98
|
+
.punctuation {
|
|
99
|
+
color: var(--color-prettylights-syntax-comment) !important;
|
|
106
100
|
}
|
|
107
|
-
|
|
108
|
-
.
|
|
109
|
-
color:
|
|
110
|
-
.content {
|
|
111
|
-
color: #0366d6;
|
|
112
|
-
}
|
|
101
|
+
.token.url,
|
|
102
|
+
.token.content {
|
|
103
|
+
color: var(--color-prettylights-syntax-constant) !important;
|
|
113
104
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
color: #999;
|
|
105
|
+
.token.title.important {
|
|
106
|
+
color: var(--color-prettylights-syntax-markup-bold);
|
|
117
107
|
}
|
|
118
|
-
.
|
|
119
|
-
color:
|
|
108
|
+
.token.code-block .function {
|
|
109
|
+
color: var(--color-prettylights-syntax-entity);
|
|
120
110
|
}
|
|
121
|
-
.
|
|
122
|
-
|
|
123
|
-
color: #000 !important;
|
|
111
|
+
.token.bold {
|
|
112
|
+
font-weight: unset !important;
|
|
124
113
|
}
|
|
125
|
-
.title {
|
|
114
|
+
.token.title {
|
|
126
115
|
line-height: unset !important;
|
|
127
116
|
font-size: unset !important;
|
|
128
117
|
font-weight: unset !important;
|
|
129
118
|
}
|
|
130
|
-
.code.keyword {
|
|
131
|
-
color:
|
|
119
|
+
.token.code.keyword {
|
|
120
|
+
color: var(--color-prettylights-syntax-constant) !important;
|
|
132
121
|
}
|
|
133
|
-
.strike
|
|
134
|
-
|
|
122
|
+
.token.strike,
|
|
123
|
+
.token.strike .content {
|
|
124
|
+
color: var(--color-prettylights-syntax-markup-deleted-text) !important;
|
|
135
125
|
}
|
|
136
126
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
.w-md-editor-toolbar-child {
|
|
2
2
|
position: absolute;
|
|
3
3
|
border-radius: 3px;
|
|
4
|
-
box-shadow: 0 0 0 1px
|
|
5
|
-
background-color:
|
|
4
|
+
box-shadow: 0 0 0 1px var(--color-border-default), 0 0 0 var(--color-border-default), 0 1px 1px var(--color-border-default);
|
|
5
|
+
background-color: var(--color-canvas-default);
|
|
6
6
|
z-index: 1;
|
|
7
7
|
display: none;
|
|
8
8
|
}
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
&-toolbar-child {
|
|
5
5
|
position: absolute;
|
|
6
6
|
border-radius: 3px;
|
|
7
|
-
box-shadow: 0 0 0 1px
|
|
8
|
-
|
|
7
|
+
box-shadow: 0 0 0 1px var(--color-border-default), 0 0 0 var(--color-border-default),
|
|
8
|
+
0 1px 1px var(--color-border-default);
|
|
9
|
+
background-color: var(--color-canvas-default);
|
|
9
10
|
z-index: 1;
|
|
10
11
|
display: none;
|
|
11
12
|
&.active {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
.w-md-editor-toolbar {
|
|
2
|
-
border-bottom: 1px solid
|
|
3
|
-
background-color:
|
|
2
|
+
border-bottom: 1px solid var(--color-border-default);
|
|
3
|
+
background-color: var(--color-canvas-default);
|
|
4
4
|
padding: 0 5px 0 5px;
|
|
5
5
|
display: flex;
|
|
6
6
|
justify-content: space-between;
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
height: 20px;
|
|
25
25
|
line-height: 14px;
|
|
26
26
|
background: none;
|
|
27
|
-
color: #586069;
|
|
28
27
|
padding: 4px;
|
|
29
28
|
margin: 0 1px;
|
|
30
29
|
border-radius: 2px;
|
|
@@ -35,32 +34,33 @@
|
|
|
35
34
|
cursor: pointer;
|
|
36
35
|
transition: all 0.3s;
|
|
37
36
|
white-space: nowrap;
|
|
37
|
+
color: var(--color-fg-default);
|
|
38
38
|
}
|
|
39
39
|
.w-md-editor-toolbar li > button:hover,
|
|
40
40
|
.w-md-editor-toolbar li > button:focus {
|
|
41
|
-
color:
|
|
42
|
-
|
|
41
|
+
background-color: var(--color-neutral-muted);
|
|
42
|
+
color: var(--color-accent-fg);
|
|
43
43
|
}
|
|
44
44
|
.w-md-editor-toolbar li > button:active {
|
|
45
|
-
color:
|
|
46
|
-
|
|
45
|
+
background-color: var(--color-neutral-muted);
|
|
46
|
+
color: var(--color-danger-fg);
|
|
47
47
|
}
|
|
48
48
|
.w-md-editor-toolbar li > button:disabled {
|
|
49
|
-
color:
|
|
49
|
+
color: var(--color-border-default);
|
|
50
50
|
cursor: not-allowed;
|
|
51
51
|
}
|
|
52
52
|
.w-md-editor-toolbar li > button:disabled:hover {
|
|
53
53
|
background-color: transparent;
|
|
54
|
-
color:
|
|
54
|
+
color: var(--color-border-default);
|
|
55
55
|
}
|
|
56
56
|
.w-md-editor-toolbar li.active > button {
|
|
57
|
-
color:
|
|
58
|
-
background-color:
|
|
57
|
+
color: var(--color-accent-fg);
|
|
58
|
+
background-color: var(--color-neutral-muted);
|
|
59
59
|
}
|
|
60
60
|
.w-md-editor-toolbar-divider {
|
|
61
61
|
height: 14px;
|
|
62
62
|
width: 1px;
|
|
63
63
|
margin: -3px 3px 0 3px !important;
|
|
64
64
|
vertical-align: middle;
|
|
65
|
-
background-color:
|
|
65
|
+
background-color: var(--color-border-default);
|
|
66
66
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
.@{md-editor} {
|
|
4
4
|
&-toolbar {
|
|
5
|
-
border-bottom: 1px solid
|
|
6
|
-
background-color:
|
|
5
|
+
border-bottom: 1px solid var(--color-border-default);
|
|
6
|
+
background-color: var(--color-canvas-default);
|
|
7
7
|
padding: 0 5px 0 5px;
|
|
8
8
|
display: flex;
|
|
9
9
|
justify-content: space-between;
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
height: 20px;
|
|
25
25
|
line-height: 14px;
|
|
26
26
|
background: none;
|
|
27
|
-
color: #586069;
|
|
28
27
|
padding: 4px;
|
|
29
28
|
margin: 0 1px;
|
|
30
29
|
border-radius: 2px;
|
|
@@ -35,27 +34,28 @@
|
|
|
35
34
|
cursor: pointer;
|
|
36
35
|
transition: all 0.3s;
|
|
37
36
|
white-space: nowrap;
|
|
37
|
+
color: var(--color-fg-default);
|
|
38
38
|
&:hover,
|
|
39
39
|
&:focus {
|
|
40
|
-
color:
|
|
41
|
-
|
|
40
|
+
background-color: var(--color-neutral-muted);
|
|
41
|
+
color: var(--color-accent-fg);
|
|
42
42
|
}
|
|
43
43
|
&:active {
|
|
44
|
-
color:
|
|
45
|
-
|
|
44
|
+
background-color: var(--color-neutral-muted);
|
|
45
|
+
color: var(--color-danger-fg);
|
|
46
46
|
}
|
|
47
47
|
&:disabled {
|
|
48
|
-
color:
|
|
48
|
+
color: var(--color-border-default);
|
|
49
49
|
cursor: not-allowed;
|
|
50
50
|
&:hover {
|
|
51
51
|
background-color: transparent;
|
|
52
|
-
color:
|
|
52
|
+
color: var(--color-border-default);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
&.active > button {
|
|
57
|
-
color:
|
|
58
|
-
background-color:
|
|
57
|
+
color: var(--color-accent-fg);
|
|
58
|
+
background-color: var(--color-neutral-muted);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
&-divider {
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
width: 1px;
|
|
64
64
|
margin: -3px 3px 0 3px !important;
|
|
65
65
|
vertical-align: middle;
|
|
66
|
-
background-color:
|
|
66
|
+
background-color: var(--color-border-default);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
}
|
package/esm/index.css
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
.w-md-editor {
|
|
2
|
-
color: #24292e;
|
|
3
2
|
text-align: left;
|
|
4
|
-
box-shadow: 0 0 0 1px rgba(16, 22, 26, 0.1), 0 0 0 rgba(16, 22, 26, 0), 0 1px 1px rgba(16, 22, 26, 0.2);
|
|
5
3
|
border-radius: 3px;
|
|
6
4
|
padding-bottom: 1px;
|
|
7
5
|
position: relative;
|
|
8
|
-
|
|
6
|
+
color: var(--color-fg-default);
|
|
7
|
+
box-shadow: 0 0 0 1px var(--color-border-default), 0 0 0 var(--color-border-default), 0 1px 1px var(--color-border-default);
|
|
8
|
+
background-color: var(--color-canvas-default);
|
|
9
9
|
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
|
10
10
|
}
|
|
11
11
|
.w-md-editor-content {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
.w-md-editor-preview {
|
|
21
21
|
width: 50%;
|
|
22
22
|
box-sizing: border-box;
|
|
23
|
-
box-shadow: inset 1px 0 0 0
|
|
23
|
+
box-shadow: inset 1px 0 0 0 var(--color-border-default);
|
|
24
24
|
position: absolute;
|
|
25
25
|
padding: 10px 20px;
|
|
26
26
|
overflow: auto;
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
.w-md-editor-show-preview .w-md-editor-input {
|
|
38
38
|
width: 0%;
|
|
39
39
|
overflow: hidden;
|
|
40
|
-
background-color:
|
|
40
|
+
background-color: var(--color-canvas-default);
|
|
41
41
|
}
|
|
42
42
|
.w-md-editor-show-preview .w-md-editor-preview {
|
|
43
43
|
width: 100%;
|
package/esm/index.less
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
@md-editor:~ "w-md-editor";
|
|
2
2
|
|
|
3
3
|
.@{md-editor} {
|
|
4
|
-
color: #24292e;
|
|
5
4
|
text-align: left;
|
|
6
|
-
box-shadow: 0 0 0 1px rgba(16, 22, 26, 0.1), 0 0 0 rgba(16, 22, 26, 0), 0 1px 1px rgba(16, 22, 26, 0.2);
|
|
7
5
|
border-radius: 3px;
|
|
8
6
|
padding-bottom: 1px;
|
|
9
7
|
position: relative;
|
|
10
|
-
|
|
8
|
+
color: var(--color-fg-default);
|
|
9
|
+
box-shadow: 0 0 0 1px var(--color-border-default), 0 0 0 var(--color-border-default),
|
|
10
|
+
0 1px 1px var(--color-border-default);
|
|
11
|
+
background-color: var(--color-canvas-default);
|
|
11
12
|
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
|
12
13
|
&-content {
|
|
13
14
|
position: relative;
|
|
@@ -21,7 +22,7 @@
|
|
|
21
22
|
&-preview {
|
|
22
23
|
width: 50%;
|
|
23
24
|
box-sizing: border-box;
|
|
24
|
-
box-shadow: inset 1px 0 0 0
|
|
25
|
+
box-shadow: inset 1px 0 0 0 var(--color-border-default);
|
|
25
26
|
position: absolute;
|
|
26
27
|
padding: 10px 20px;
|
|
27
28
|
overflow: auto;
|
|
@@ -38,7 +39,7 @@
|
|
|
38
39
|
&-show-preview &-input {
|
|
39
40
|
width: 0%;
|
|
40
41
|
overflow: hidden;
|
|
41
|
-
background-color:
|
|
42
|
+
background-color: var(--color-canvas-default);
|
|
42
43
|
}
|
|
43
44
|
&-show-preview &-preview {
|
|
44
45
|
width: 100%;
|
package/lib/Editor.js
CHANGED
|
@@ -134,7 +134,7 @@ var InternalMDEditor = function InternalMDEditor(props, ref) {
|
|
|
134
134
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
135
135
|
|
|
136
136
|
}, []);
|
|
137
|
-
var cls = [className, prefixCls, state.preview ? "".concat(prefixCls, "-show-").concat(state.preview) : null, state.fullscreen ? "".concat(prefixCls, "-fullscreen") : null].filter(Boolean).join(' ').trim();
|
|
137
|
+
var cls = [className, 'wmde-markdown-var', prefixCls, state.preview ? "".concat(prefixCls, "-show-").concat(state.preview) : null, state.fullscreen ? "".concat(prefixCls, "-fullscreen") : null].filter(Boolean).join(' ').trim();
|
|
138
138
|
(0, _react.useMemo)(function () {
|
|
139
139
|
return propsValue !== state.markdown && dispatch({
|
|
140
140
|
markdown: propsValue || ''
|
package/lib/Editor.js.map
CHANGED
|
@@ -89,8 +89,8 @@
|
|
|
89
89
|
"Markdown",
|
|
90
90
|
"MarkdownPreview"
|
|
91
91
|
],
|
|
92
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAqGA,SAASA,gBAAT,GAA8D;AAAA,MAApCC,IAAoC,uEAAJ,EAAI;AAC5DC,EAAAA,MAAM,CAACC,IAAP,CAAYF,IAAZ,EAAkBG,OAAlB,CAA0B,UAACC,OAAD,EAAa;AACrCJ,IAAAA,IAAI,CAACI,OAAD,CAAJ,GAAgB,KAAhB;AACD,GAFD;AAGA,SAAOJ,IAAP;AACD;;AAED,IAAMK,gBAAgB,GAAG,SAAnBA,gBAAmB,CACvBC,KADuB,EAEvBC,GAFuB,EAGpB;AACH,aA0BID,KAAK,IAAI,EA1Bb;AAAA,4BACEE,SADF;AAAA,MACEA,SADF,+BACc,aADd;AAAA,MAEEC,SAFF,QAEEA,SAFF;AAAA,MAGSC,UAHT,QAGEC,KAHF;AAAA,2BAIEC,QAJF;AAAA,MAIEA,QAJF,8BAIa,4BAJb;AAAA,MAKEC,cALF,QAKEA,cALF;AAAA,gCAMEC,aANF;AAAA,MAMEA,aANF,mCAMkB,iCANlB;AAAA,yBAOEC,MAPF;AAAA,MAOEA,MAPF,4BAOW,GAPX;AAAA,gCAQEC,aARF;AAAA,MAQEA,aARF,mCAQkB,EARlB;AAAA,+BASEC,YATF;AAAA,MASEA,YATF,kCASiB,IATjB;AAAA,kCAUEC,eAVF;AAAA,MAUEA,eAVF,qCAUoB,IAVpB;AAAA,kCAWEC,eAXF;AAAA,MAWEA,eAXF,qCAWoB,IAXpB;AAAA,0BAYEC,OAZF;AAAA,MAYWC,WAZX,6BAYyB,MAZzB;AAAA,6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AA,QAbF,EAqCGtD,eAAe,IAAI,CAAC4B,KAAK,CAACxB,UAA1B,iBACC,qBAAC,gBAAD;AACE,QAAA,SAAS,EAAEd,SADb;AAEE,QAAA,MAAM,EAAEsC,KAAK,CAAC/B,MAFhB;AAGE,QAAA,SAAS,EAAEW,SAHb;AAIE,QAAA,SAAS,EAAEC,SAJb;AAKE,QAAA,QAAQ,EAAE,kBAACkD,SAAD,EAAe;AACvB9B,UAAAA,QAAQ,CAAC;AAAEhC,YAAAA,MAAM,EAAE8D;AAAV,WAAD,CAAR;AACD;AAPH,QAtCJ;AAAA;AADF,IADF;AAqDD,CArND;;AAuNA,IAAMC,QAAQ,gBAAGC,eAAMC,UAAN,CAA8C3E,gBAA9C,CAAjB;;AAMCyE,QAAD,CAAuBG,QAAvB,GAAkCC,6BAAlC;eAEeJ,Q",
|
|
93
93
|
"sourcesContent": [
|
|
94
|
-
"import React, { useEffect, useReducer, useMemo, useRef, useImperativeHandle } from 'react';\nimport MarkdownPreview, { MarkdownPreviewProps, MarkdownPreviewRef } from '@uiw/react-markdown-preview';\nimport TextArea, { ITextAreaProps } from './components/TextArea';\nimport Toolbar from './components/Toolbar';\nimport DragBar from './components/DragBar';\nimport { getCommands, getExtraCommands, ICommand } from './commands';\nimport { reducer, EditorContext, ContextStore, PreviewType } from './Context';\nimport './index.less';\n\nexport interface IProps {\n prefixCls?: string;\n className?: string;\n}\n\nexport interface MDEditorProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'>, IProps {\n /**\n * The Markdown value.\n */\n value?: string;\n /**\n * Event handler for the `onChange` event.\n */\n onChange?: (value?: string) => void;\n /**\n * Can be used to make `Markdown Editor` focus itself on initialization. Defaults to on.\n * it will be set to true when either the source `textarea` is focused,\n * or it has an `autofocus` attribute and no other element is focused.\n */\n autoFocus?: ITextAreaProps['autoFocus'];\n /**\n * The height of the editor.\n */\n height?: number;\n /**\n * Custom toolbar heigth\n * @default 29px\n */\n toolbarHeight?: number;\n /**\n * Show drag and drop tool. Set the height of the editor.\n */\n visiableDragbar?: boolean;\n /**\n * Show markdown preview.\n */\n preview?: PreviewType;\n /**\n * Full screen display editor.\n */\n fullscreen?: boolean;\n /**\n * Disable `fullscreen` setting body styles\n */\n overflow?: boolean;\n /**\n * Maximum drag height. `visiableDragbar=true`\n */\n maxHeight?: number;\n /**\n * Minimum drag height. `visiableDragbar=true`\n */\n minHeight?: number;\n /**\n * This is reset [react-markdown](https://github.com/rexxars/react-markdown) settings.\n */\n previewOptions?: Omit<MarkdownPreviewProps, 'source'>;\n /**\n * Set the `textarea` related props.\n */\n textareaProps?: ITextAreaProps;\n /** Use div to replace TextArea or re-render TextArea */\n renderTextarea?: ITextAreaProps['renderTextarea'];\n /**\n * Disable editing area code highlighting. The value is `false`, which increases the editing speed.\n * @default true\n */\n highlightEnable?: boolean;\n /**\n * The number of characters to insert when pressing tab key.\n * Default `2` spaces.\n */\n tabSize?: number;\n /**\n * If `false`, the `tab` key inserts a tab character into the textarea. If `true`, the `tab` key executes default behavior e.g. focus shifts to next element.\n */\n defaultTabEnable?: boolean;\n /**\n * You can create your own commands or reuse existing commands.\n */\n commands?: ICommand[];\n /**\n * Filter or modify your commands.\n * https://github.com/uiwjs/react-md-editor/issues/296\n */\n commandsFilter?: (command: ICommand, isExtra: boolean) => false | ICommand;\n /**\n * You can create your own commands or reuse existing commands.\n */\n extraCommands?: ICommand[];\n /**\n * Hide the tool bar\n */\n hideToolbar?: boolean;\n /** Whether to enable scrolling */\n enableScroll?: boolean;\n}\n\nfunction setGroupPopFalse(data: Record<string, boolean> = {}) {\n Object.keys(data).forEach((keyname) => {\n data[keyname] = false;\n });\n return data;\n}\n\nconst InternalMDEditor = (\n props: MDEditorProps,\n ref?: ((instance: ContextStore) => void) | React.RefObject<ContextStore> | null,\n) => {\n const {\n prefixCls = 'w-md-editor',\n className,\n value: propsValue,\n commands = getCommands(),\n commandsFilter,\n extraCommands = getExtraCommands(),\n height = 200,\n toolbarHeight = 29,\n enableScroll = true,\n visiableDragbar = true,\n highlightEnable = true,\n preview: previewType = 'live',\n fullscreen = false,\n overflow = true,\n previewOptions = {},\n textareaProps,\n maxHeight = 1200,\n minHeight = 100,\n autoFocus,\n tabSize = 2,\n defaultTabEnable = false,\n onChange,\n hideToolbar,\n renderTextarea,\n ...other\n } = props || {};\n const cmds = commands\n .map((item) => (commandsFilter ? commandsFilter(item, false) : item))\n .filter(Boolean) as ICommand[];\n const extraCmds = extraCommands\n .map((item) => (commandsFilter ? commandsFilter(item, true) : item))\n .filter(Boolean) as ICommand[];\n let [state, dispatch] = useReducer(reducer, {\n markdown: propsValue,\n preview: previewType,\n height,\n highlightEnable,\n tabSize,\n defaultTabEnable,\n scrollTop: 0,\n scrollTopPreview: 0,\n commands: cmds,\n extraCommands: extraCmds,\n fullscreen,\n barPopup: {},\n });\n const container = useRef<HTMLDivElement>(null);\n const previewRef = useRef<MarkdownPreviewRef>(null);\n const enableScrollRef = useRef(enableScroll);\n\n useImperativeHandle(ref, () => ({ ...state }));\n useMemo(() => (enableScrollRef.current = enableScroll), [enableScroll]);\n useEffect(() => {\n const stateInit: ContextStore = {};\n if (container.current) {\n stateInit.container = container.current || undefined;\n }\n stateInit.markdown = propsValue || '';\n stateInit.barPopup = {};\n if (dispatch) {\n dispatch({ ...state, ...stateInit });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const cls = [\n className,\n prefixCls,\n state.preview ? `${prefixCls}-show-${state.preview}` : null,\n state.fullscreen ? `${prefixCls}-fullscreen` : null,\n ]\n .filter(Boolean)\n .join(' ')\n .trim();\n\n useMemo(\n () => propsValue !== state.markdown && dispatch({ markdown: propsValue || '' }),\n [propsValue, state.markdown],\n );\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useMemo(() => previewType !== state.preview && dispatch({ preview: previewType }), [previewType]);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useMemo(() => height !== state.height && dispatch({ height: height }), [height]);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useMemo(() => tabSize !== state.tabSize && dispatch({ tabSize }), [tabSize]);\n useMemo(\n () => highlightEnable !== state.highlightEnable && dispatch({ highlightEnable }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [highlightEnable],\n );\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useMemo(() => autoFocus !== state.autoFocus && dispatch({ autoFocus: autoFocus }), [autoFocus]);\n useMemo(\n () => fullscreen !== state.fullscreen && dispatch({ fullscreen: fullscreen }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [fullscreen],\n );\n\n const textareaDomRef = useRef<HTMLDivElement>();\n const active = useRef<'text' | 'preview'>('preview');\n const initScroll = useRef(false);\n\n useMemo(() => {\n textareaDomRef.current = state.textareaWarp;\n if (state.textareaWarp) {\n state.textareaWarp.addEventListener('mouseover', () => {\n active.current = 'text';\n });\n state.textareaWarp.addEventListener('mouseleave', () => {\n active.current = 'preview';\n });\n }\n }, [state.textareaWarp]);\n\n const handleScroll = (e: React.UIEvent<HTMLDivElement>, type: 'text' | 'preview') => {\n if (!enableScrollRef.current) return;\n const textareaDom = textareaDomRef.current;\n const previewDom = previewRef.current ? previewRef.current.mdp.current : undefined;\n if (!initScroll.current) {\n active.current = type;\n initScroll.current = true;\n }\n if (textareaDom && previewDom) {\n const scale =\n (textareaDom.scrollHeight - textareaDom.offsetHeight) / (previewDom.scrollHeight - previewDom.offsetHeight);\n if (e.target === textareaDom && active.current === 'text') {\n previewDom.scrollTop = textareaDom.scrollTop / scale;\n }\n if (e.target === previewDom && active.current === 'preview') {\n textareaDom.scrollTop = previewDom.scrollTop * scale;\n }\n let scrollTop = 0;\n if (active.current === 'text') {\n scrollTop = textareaDom.scrollTop || 0;\n } else if (active.current === 'preview') {\n scrollTop = previewDom.scrollTop || 0;\n }\n dispatch({ scrollTop });\n }\n };\n\n const mdPreview = useMemo(\n () => (\n <MarkdownPreview\n {...previewOptions}\n onScroll={(e) => handleScroll(e, 'preview')}\n ref={previewRef}\n source={state.markdown || ''}\n className={`${prefixCls}-preview ${previewOptions.className || ''}`}\n />\n ),\n [prefixCls, previewOptions, state.markdown],\n );\n\n return (\n <EditorContext.Provider value={{ ...state, dispatch }}>\n <div\n ref={container}\n className={cls}\n {...other}\n onClick={() => {\n dispatch({ barPopup: { ...setGroupPopFalse(state.barPopup) } });\n }}\n style={{\n ...other.style,\n height: state.fullscreen ? '100%' : hideToolbar ? Number(state.height) - toolbarHeight : state.height,\n }}\n >\n {!hideToolbar && <Toolbar prefixCls={prefixCls} height={toolbarHeight} overflow={overflow} />}\n <div\n className={`${prefixCls}-content`}\n style={{\n height: state.fullscreen ? `calc(100% - ${toolbarHeight}px)` : Number(state.height) - toolbarHeight,\n }}\n >\n {/(edit|live)/.test(state.preview || '') && (\n <TextArea\n className={`${prefixCls}-input`}\n prefixCls={prefixCls}\n autoFocus={autoFocus}\n {...textareaProps}\n onChange={(evn) => {\n onChange && onChange(evn.target.value);\n if (textareaProps && textareaProps.onChange) {\n textareaProps.onChange(evn);\n }\n }}\n renderTextarea={renderTextarea}\n onScroll={(e) => handleScroll(e, 'text')}\n />\n )}\n {/(live|preview)/.test(state.preview || '') && mdPreview}\n </div>\n {visiableDragbar && !state.fullscreen && (\n <DragBar\n prefixCls={prefixCls}\n height={state.height as number}\n maxHeight={maxHeight!}\n minHeight={minHeight!}\n onChange={(newHeight) => {\n dispatch({ height: newHeight });\n }}\n />\n )}\n </div>\n </EditorContext.Provider>\n );\n};\n\nconst mdEditor = React.forwardRef<ContextStore, MDEditorProps>(InternalMDEditor);\n\ntype MDEditor = typeof mdEditor & {\n Markdown: typeof MarkdownPreview;\n};\n\n(mdEditor as MDEditor).Markdown = MarkdownPreview;\n\nexport default mdEditor as MDEditor;\n"
|
|
94
|
+
"import React, { useEffect, useReducer, useMemo, useRef, useImperativeHandle } from 'react';\nimport MarkdownPreview, { MarkdownPreviewProps, MarkdownPreviewRef } from '@uiw/react-markdown-preview';\nimport TextArea, { ITextAreaProps } from './components/TextArea';\nimport Toolbar from './components/Toolbar';\nimport DragBar from './components/DragBar';\nimport { getCommands, getExtraCommands, ICommand } from './commands';\nimport { reducer, EditorContext, ContextStore, PreviewType } from './Context';\nimport './index.less';\n\nexport interface IProps {\n prefixCls?: string;\n className?: string;\n}\n\nexport interface MDEditorProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'>, IProps {\n /**\n * The Markdown value.\n */\n value?: string;\n /**\n * Event handler for the `onChange` event.\n */\n onChange?: (value?: string) => void;\n /**\n * Can be used to make `Markdown Editor` focus itself on initialization. Defaults to on.\n * it will be set to true when either the source `textarea` is focused,\n * or it has an `autofocus` attribute and no other element is focused.\n */\n autoFocus?: ITextAreaProps['autoFocus'];\n /**\n * The height of the editor.\n */\n height?: number;\n /**\n * Custom toolbar heigth\n * @default 29px\n */\n toolbarHeight?: number;\n /**\n * Show drag and drop tool. Set the height of the editor.\n */\n visiableDragbar?: boolean;\n /**\n * Show markdown preview.\n */\n preview?: PreviewType;\n /**\n * Full screen display editor.\n */\n fullscreen?: boolean;\n /**\n * Disable `fullscreen` setting body styles\n */\n overflow?: boolean;\n /**\n * Maximum drag height. `visiableDragbar=true`\n */\n maxHeight?: number;\n /**\n * Minimum drag height. `visiableDragbar=true`\n */\n minHeight?: number;\n /**\n * This is reset [react-markdown](https://github.com/rexxars/react-markdown) settings.\n */\n previewOptions?: Omit<MarkdownPreviewProps, 'source'>;\n /**\n * Set the `textarea` related props.\n */\n textareaProps?: ITextAreaProps;\n /** Use div to replace TextArea or re-render TextArea */\n renderTextarea?: ITextAreaProps['renderTextarea'];\n /**\n * Disable editing area code highlighting. The value is `false`, which increases the editing speed.\n * @default true\n */\n highlightEnable?: boolean;\n /**\n * The number of characters to insert when pressing tab key.\n * Default `2` spaces.\n */\n tabSize?: number;\n /**\n * If `false`, the `tab` key inserts a tab character into the textarea. If `true`, the `tab` key executes default behavior e.g. focus shifts to next element.\n */\n defaultTabEnable?: boolean;\n /**\n * You can create your own commands or reuse existing commands.\n */\n commands?: ICommand[];\n /**\n * Filter or modify your commands.\n * https://github.com/uiwjs/react-md-editor/issues/296\n */\n commandsFilter?: (command: ICommand, isExtra: boolean) => false | ICommand;\n /**\n * You can create your own commands or reuse existing commands.\n */\n extraCommands?: ICommand[];\n /**\n * Hide the tool bar\n */\n hideToolbar?: boolean;\n /** Whether to enable scrolling */\n enableScroll?: boolean;\n}\n\nfunction setGroupPopFalse(data: Record<string, boolean> = {}) {\n Object.keys(data).forEach((keyname) => {\n data[keyname] = false;\n });\n return data;\n}\n\nconst InternalMDEditor = (\n props: MDEditorProps,\n ref?: ((instance: ContextStore) => void) | React.RefObject<ContextStore> | null,\n) => {\n const {\n prefixCls = 'w-md-editor',\n className,\n value: propsValue,\n commands = getCommands(),\n commandsFilter,\n extraCommands = getExtraCommands(),\n height = 200,\n toolbarHeight = 29,\n enableScroll = true,\n visiableDragbar = true,\n highlightEnable = true,\n preview: previewType = 'live',\n fullscreen = false,\n overflow = true,\n previewOptions = {},\n textareaProps,\n maxHeight = 1200,\n minHeight = 100,\n autoFocus,\n tabSize = 2,\n defaultTabEnable = false,\n onChange,\n hideToolbar,\n renderTextarea,\n ...other\n } = props || {};\n const cmds = commands\n .map((item) => (commandsFilter ? commandsFilter(item, false) : item))\n .filter(Boolean) as ICommand[];\n const extraCmds = extraCommands\n .map((item) => (commandsFilter ? commandsFilter(item, true) : item))\n .filter(Boolean) as ICommand[];\n let [state, dispatch] = useReducer(reducer, {\n markdown: propsValue,\n preview: previewType,\n height,\n highlightEnable,\n tabSize,\n defaultTabEnable,\n scrollTop: 0,\n scrollTopPreview: 0,\n commands: cmds,\n extraCommands: extraCmds,\n fullscreen,\n barPopup: {},\n });\n const container = useRef<HTMLDivElement>(null);\n const previewRef = useRef<MarkdownPreviewRef>(null);\n const enableScrollRef = useRef(enableScroll);\n\n useImperativeHandle(ref, () => ({ ...state }));\n useMemo(() => (enableScrollRef.current = enableScroll), [enableScroll]);\n useEffect(() => {\n const stateInit: ContextStore = {};\n if (container.current) {\n stateInit.container = container.current || undefined;\n }\n stateInit.markdown = propsValue || '';\n stateInit.barPopup = {};\n if (dispatch) {\n dispatch({ ...state, ...stateInit });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const cls = [\n className,\n 'wmde-markdown-var',\n prefixCls,\n state.preview ? `${prefixCls}-show-${state.preview}` : null,\n state.fullscreen ? `${prefixCls}-fullscreen` : null,\n ]\n .filter(Boolean)\n .join(' ')\n .trim();\n\n useMemo(\n () => propsValue !== state.markdown && dispatch({ markdown: propsValue || '' }),\n [propsValue, state.markdown],\n );\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useMemo(() => previewType !== state.preview && dispatch({ preview: previewType }), [previewType]);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useMemo(() => height !== state.height && dispatch({ height: height }), [height]);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useMemo(() => tabSize !== state.tabSize && dispatch({ tabSize }), [tabSize]);\n useMemo(\n () => highlightEnable !== state.highlightEnable && dispatch({ highlightEnable }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [highlightEnable],\n );\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useMemo(() => autoFocus !== state.autoFocus && dispatch({ autoFocus: autoFocus }), [autoFocus]);\n useMemo(\n () => fullscreen !== state.fullscreen && dispatch({ fullscreen: fullscreen }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [fullscreen],\n );\n\n const textareaDomRef = useRef<HTMLDivElement>();\n const active = useRef<'text' | 'preview'>('preview');\n const initScroll = useRef(false);\n\n useMemo(() => {\n textareaDomRef.current = state.textareaWarp;\n if (state.textareaWarp) {\n state.textareaWarp.addEventListener('mouseover', () => {\n active.current = 'text';\n });\n state.textareaWarp.addEventListener('mouseleave', () => {\n active.current = 'preview';\n });\n }\n }, [state.textareaWarp]);\n\n const handleScroll = (e: React.UIEvent<HTMLDivElement>, type: 'text' | 'preview') => {\n if (!enableScrollRef.current) return;\n const textareaDom = textareaDomRef.current;\n const previewDom = previewRef.current ? previewRef.current.mdp.current : undefined;\n if (!initScroll.current) {\n active.current = type;\n initScroll.current = true;\n }\n if (textareaDom && previewDom) {\n const scale =\n (textareaDom.scrollHeight - textareaDom.offsetHeight) / (previewDom.scrollHeight - previewDom.offsetHeight);\n if (e.target === textareaDom && active.current === 'text') {\n previewDom.scrollTop = textareaDom.scrollTop / scale;\n }\n if (e.target === previewDom && active.current === 'preview') {\n textareaDom.scrollTop = previewDom.scrollTop * scale;\n }\n let scrollTop = 0;\n if (active.current === 'text') {\n scrollTop = textareaDom.scrollTop || 0;\n } else if (active.current === 'preview') {\n scrollTop = previewDom.scrollTop || 0;\n }\n dispatch({ scrollTop });\n }\n };\n\n const mdPreview = useMemo(\n () => (\n <MarkdownPreview\n {...previewOptions}\n onScroll={(e) => handleScroll(e, 'preview')}\n ref={previewRef}\n source={state.markdown || ''}\n className={`${prefixCls}-preview ${previewOptions.className || ''}`}\n />\n ),\n [prefixCls, previewOptions, state.markdown],\n );\n\n return (\n <EditorContext.Provider value={{ ...state, dispatch }}>\n <div\n ref={container}\n className={cls}\n {...other}\n onClick={() => {\n dispatch({ barPopup: { ...setGroupPopFalse(state.barPopup) } });\n }}\n style={{\n ...other.style,\n height: state.fullscreen ? '100%' : hideToolbar ? Number(state.height) - toolbarHeight : state.height,\n }}\n >\n {!hideToolbar && <Toolbar prefixCls={prefixCls} height={toolbarHeight} overflow={overflow} />}\n <div\n className={`${prefixCls}-content`}\n style={{\n height: state.fullscreen ? `calc(100% - ${toolbarHeight}px)` : Number(state.height) - toolbarHeight,\n }}\n >\n {/(edit|live)/.test(state.preview || '') && (\n <TextArea\n className={`${prefixCls}-input`}\n prefixCls={prefixCls}\n autoFocus={autoFocus}\n {...textareaProps}\n onChange={(evn) => {\n onChange && onChange(evn.target.value);\n if (textareaProps && textareaProps.onChange) {\n textareaProps.onChange(evn);\n }\n }}\n renderTextarea={renderTextarea}\n onScroll={(e) => handleScroll(e, 'text')}\n />\n )}\n {/(live|preview)/.test(state.preview || '') && mdPreview}\n </div>\n {visiableDragbar && !state.fullscreen && (\n <DragBar\n prefixCls={prefixCls}\n height={state.height as number}\n maxHeight={maxHeight!}\n minHeight={minHeight!}\n onChange={(newHeight) => {\n dispatch({ height: newHeight });\n }}\n />\n )}\n </div>\n </EditorContext.Provider>\n );\n};\n\nconst mdEditor = React.forwardRef<ContextStore, MDEditorProps>(InternalMDEditor);\n\ntype MDEditor = typeof mdEditor & {\n Markdown: typeof MarkdownPreview;\n};\n\n(mdEditor as MDEditor).Markdown = MarkdownPreview;\n\nexport default mdEditor as MDEditor;\n"
|
|
95
95
|
]
|
|
96
96
|
}
|
|
@@ -13,13 +13,12 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
13
13
|
|
|
14
14
|
var _rehype = require("rehype");
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _rehypePrismPlus = _interopRequireDefault(require("rehype-prism-plus"));
|
|
17
17
|
|
|
18
18
|
var _Context = require("../../Context");
|
|
19
19
|
|
|
20
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
21
|
|
|
22
|
-
// @ts-ignore
|
|
23
22
|
function Markdown(props) {
|
|
24
23
|
var prefixCls = props.prefixCls;
|
|
25
24
|
|
|
@@ -70,7 +69,7 @@ function Markdown(props) {
|
|
|
70
69
|
|
|
71
70
|
var str = (0, _rehype.rehype)().data('settings', {
|
|
72
71
|
fragment: true
|
|
73
|
-
}).use(
|
|
72
|
+
}).use(_rehypePrismPlus.default, {
|
|
74
73
|
ignoreMissing: true
|
|
75
74
|
}).processSync("<pre class=\"language-markdown ".concat(prefixCls, "-text-pre wmde-markdown-color\"><code class=\"language-markdown\">").concat(html2Escape(markdown), "\n</code></pre>"));
|
|
76
75
|
return /*#__PURE__*/_react.default.createElement('div', {
|