@uiw/react-md-editor 3.16.0 → 3.17.2

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.
Files changed (48) hide show
  1. package/README.md +56 -2
  2. package/dist/mdeditor.css +20 -5
  3. package/dist/mdeditor.js +70 -653
  4. package/dist/mdeditor.min.css +1 -1
  5. package/dist/mdeditor.min.js +1 -1
  6. package/esm/Context.d.ts +15 -0
  7. package/esm/Context.js.map +2 -2
  8. package/esm/Editor.d.ts +19 -1
  9. package/esm/Editor.js +4 -8
  10. package/esm/Editor.js.map +4 -3
  11. package/esm/commands/index.d.ts +1 -1
  12. package/esm/commands/index.js.map +1 -1
  13. package/esm/components/DragBar/index.css +1 -0
  14. package/esm/components/DragBar/index.less +1 -0
  15. package/esm/components/Toolbar/Child.js +0 -1
  16. package/esm/components/Toolbar/Child.js.map +2 -2
  17. package/esm/components/Toolbar/index.css +6 -1
  18. package/esm/components/Toolbar/index.d.ts +0 -2
  19. package/esm/components/Toolbar/index.js +4 -5
  20. package/esm/components/Toolbar/index.js.map +6 -3
  21. package/esm/components/Toolbar/index.less +6 -1
  22. package/esm/index.css +10 -3
  23. package/esm/index.less +9 -3
  24. package/lib/Context.d.ts +15 -0
  25. package/lib/Context.js.map +2 -2
  26. package/lib/Editor.d.ts +19 -1
  27. package/lib/Editor.js +4 -9
  28. package/lib/Editor.js.map +4 -3
  29. package/lib/commands/index.d.ts +1 -1
  30. package/lib/commands/index.js.map +1 -1
  31. package/lib/components/DragBar/index.less +1 -0
  32. package/lib/components/Toolbar/Child.js +0 -1
  33. package/lib/components/Toolbar/Child.js.map +2 -2
  34. package/lib/components/Toolbar/index.d.ts +0 -2
  35. package/lib/components/Toolbar/index.js +4 -6
  36. package/lib/components/Toolbar/index.js.map +7 -4
  37. package/lib/components/Toolbar/index.less +6 -1
  38. package/lib/index.less +9 -3
  39. package/markdown-editor.css +17 -4
  40. package/package.json +2 -2
  41. package/src/Context.tsx +2 -0
  42. package/src/Editor.tsx +25 -11
  43. package/src/commands/index.ts +1 -1
  44. package/src/components/DragBar/index.less +1 -0
  45. package/src/components/Toolbar/Child.tsx +1 -1
  46. package/src/components/Toolbar/index.less +6 -1
  47. package/src/components/Toolbar/index.tsx +10 -7
  48. package/src/index.less +9 -3
package/esm/Context.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
2
  import { ICommand, TextAreaCommandOrchestrator } from './commands';
3
+ import { MDEditorProps } from './Editor';
3
4
  export declare type PreviewType = 'live' | 'edit' | 'preview';
4
5
  export declare type ContextStore = {
6
+ components?: MDEditorProps['components'];
5
7
  commands?: ICommand<string>[];
6
8
  extraCommands?: ICommand<string>[];
7
9
  markdown?: string;
@@ -24,6 +26,19 @@ export declare type ContextStore = {
24
26
  };
25
27
  export declare type ExecuteCommandState = Pick<ContextStore, 'fullscreen' | 'preview' | 'highlightEnable'>;
26
28
  export declare function reducer(state: ContextStore, action: ContextStore): {
29
+ components?: {
30
+ textarea?: ((props: React.HTMLAttributes<HTMLDivElement> | React.TextareaHTMLAttributes<HTMLTextAreaElement>, opts: {
31
+ dispatch: React.Dispatch<ContextStore> | undefined;
32
+ onChange?: React.ChangeEventHandler<HTMLTextAreaElement> | undefined;
33
+ useContext?: {
34
+ commands: ICommand<string>[] | undefined;
35
+ extraCommands: ICommand<string>[] | undefined;
36
+ commandOrchestrator?: TextAreaCommandOrchestrator | undefined;
37
+ } | undefined;
38
+ shortcuts?: ((e: KeyboardEvent | React.KeyboardEvent<HTMLTextAreaElement>, commands: ICommand<string>[], commandOrchestrator?: TextAreaCommandOrchestrator | undefined, dispatch?: React.Dispatch<ContextStore> | undefined, state?: ExecuteCommandState | undefined) => void) | undefined;
39
+ }) => JSX.Element) | undefined;
40
+ toolbar?: ((command: ICommand<string>, disabled: boolean, executeCommand: (command: ICommand<string>, name?: string | undefined) => void, index: number) => void | React.ReactElement<any, string | React.JSXElementConstructor<any>> | null | undefined) | undefined;
41
+ } | undefined;
27
42
  commands?: ICommand<string>[] | undefined;
28
43
  extraCommands?: ICommand<string>[] | undefined;
29
44
  markdown?: string | undefined;
@@ -13,7 +13,7 @@
13
13
  "../src/Context.tsx"
14
14
  ],
15
15
  "sourcesContent": [
16
- "import React from 'react';\nimport { ICommand, TextAreaCommandOrchestrator } from './commands';\n\nexport type PreviewType = 'live' | 'edit' | 'preview';\n\nexport type ContextStore = {\n commands?: ICommand<string>[];\n extraCommands?: ICommand<string>[];\n markdown?: string;\n preview?: PreviewType;\n height?: React.CSSProperties['height'];\n fullscreen?: boolean;\n highlightEnable?: boolean;\n autoFocus?: boolean;\n textarea?: HTMLTextAreaElement;\n commandOrchestrator?: TextAreaCommandOrchestrator;\n textareaWarp?: HTMLDivElement;\n textareaPre?: HTMLPreElement;\n container?: HTMLDivElement | null;\n dispatch?: React.Dispatch<ContextStore>;\n barPopup?: Record<string, boolean>;\n scrollTop?: number;\n scrollTopPreview?: number;\n tabSize?: number;\n defaultTabEnable?: boolean;\n};\n\nexport type ExecuteCommandState = Pick<ContextStore, 'fullscreen' | 'preview' | 'highlightEnable'>;\n\nexport function reducer(state: ContextStore, action: ContextStore) {\n return { ...state, ...action };\n}\n\nexport const EditorContext = React.createContext<ContextStore>({ markdown: '' });\n"
16
+ "import React from 'react';\nimport { ICommand, TextAreaCommandOrchestrator } from './commands';\nimport { MDEditorProps } from './Editor';\n\nexport type PreviewType = 'live' | 'edit' | 'preview';\n\nexport type ContextStore = {\n components?: MDEditorProps['components'];\n commands?: ICommand<string>[];\n extraCommands?: ICommand<string>[];\n markdown?: string;\n preview?: PreviewType;\n height?: React.CSSProperties['height'];\n fullscreen?: boolean;\n highlightEnable?: boolean;\n autoFocus?: boolean;\n textarea?: HTMLTextAreaElement;\n commandOrchestrator?: TextAreaCommandOrchestrator;\n textareaWarp?: HTMLDivElement;\n textareaPre?: HTMLPreElement;\n container?: HTMLDivElement | null;\n dispatch?: React.Dispatch<ContextStore>;\n barPopup?: Record<string, boolean>;\n scrollTop?: number;\n scrollTopPreview?: number;\n tabSize?: number;\n defaultTabEnable?: boolean;\n};\n\nexport type ExecuteCommandState = Pick<ContextStore, 'fullscreen' | 'preview' | 'highlightEnable'>;\n\nexport function reducer(state: ContextStore, action: ContextStore) {\n return { ...state, ...action };\n}\n\nexport const EditorContext = React.createContext<ContextStore>({ markdown: '' });\n"
17
17
  ],
18
- "mappings": ";AAAA,OAAOA,KAAP,MAAkB,OAAlB;AA6BA,OAAO,SAASC,OAAT,CAAiBC,KAAjB,EAAsCC,MAAtC,EAA4D;EACjE,oBAAYD,KAAZ,EAAsBC,MAAtB;AACD;AAED,OAAO,IAAMC,aAAa,gBAAGJ,KAAK,CAACK,aAAN,CAAkC;EAAEC,QAAQ,EAAE;AAAZ,CAAlC,CAAtB"
18
+ "mappings": ";AAAA,OAAOA,KAAP,MAAkB,OAAlB;AA+BA,OAAO,SAASC,OAAT,CAAiBC,KAAjB,EAAsCC,MAAtC,EAA4D;EACjE,oBAAYD,KAAZ,EAAsBC,MAAtB;AACD;AAED,OAAO,IAAMC,aAAa,gBAAGJ,KAAK,CAACK,aAAN,CAAkC;EAAEC,QAAQ,EAAE;AAAZ,CAAlC,CAAtB"
19
19
  }
package/esm/Editor.d.ts CHANGED
@@ -35,6 +35,9 @@ export interface MDEditorProps extends Omit<React.HTMLAttributes<HTMLDivElement>
35
35
  /**
36
36
  * Custom toolbar heigth
37
37
  * @default 29px
38
+ *
39
+ * @deprecated toolbar height adaptive: https://github.com/uiwjs/react-md-editor/issues/427
40
+ *
38
41
  */
39
42
  toolbarHeight?: number;
40
43
  /**
@@ -73,8 +76,23 @@ export interface MDEditorProps extends Omit<React.HTMLAttributes<HTMLDivElement>
73
76
  * Set the `textarea` related props.
74
77
  */
75
78
  textareaProps?: ITextAreaProps;
76
- /** Use div to replace TextArea or re-render TextArea */
79
+ /**
80
+ * Use div to replace TextArea or re-render TextArea
81
+ * @deprecated Please use ~~`renderTextarea`~~ -> `components`
82
+ */
77
83
  renderTextarea?: ITextAreaProps['renderTextarea'];
84
+ /**
85
+ * re-render element
86
+ */
87
+ components?: {
88
+ /** Use div to replace TextArea or re-render TextArea */
89
+ textarea?: ITextAreaProps['renderTextarea'];
90
+ /**
91
+ * Override the default command element
92
+ * _`toolbar`_ < _`command[].render`_
93
+ */
94
+ toolbar?: ICommand['render'];
95
+ };
78
96
  /**
79
97
  * Disable editing area code highlighting. The value is `false`, which increases the editing speed.
80
98
  * @default true
package/esm/Editor.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
- var _excluded = ["prefixCls", "className", "value", "commands", "commandsFilter", "extraCommands", "height", "toolbarHeight", "enableScroll", "visibleDragbar", "highlightEnable", "preview", "fullscreen", "overflow", "previewOptions", "textareaProps", "maxHeight", "minHeight", "autoFocus", "tabSize", "defaultTabEnable", "onChange", "onHeightChange", "hideToolbar", "toolbarBottom", "renderTextarea"];
3
+ var _excluded = ["prefixCls", "className", "value", "commands", "commandsFilter", "extraCommands", "height", "enableScroll", "visibleDragbar", "highlightEnable", "preview", "fullscreen", "overflow", "previewOptions", "textareaProps", "maxHeight", "minHeight", "autoFocus", "tabSize", "defaultTabEnable", "onChange", "onHeightChange", "hideToolbar", "toolbarBottom", "components", "renderTextarea"];
4
4
  import React, { useEffect, useReducer, useMemo, useRef, useImperativeHandle } from 'react';
5
5
  import MarkdownPreview from '@uiw/react-markdown-preview';
6
6
  import TextArea from './components/TextArea';
@@ -33,7 +33,6 @@ var InternalMDEditor = (props, ref) => {
33
33
  commandsFilter,
34
34
  extraCommands = getExtraCommands(),
35
35
  height = 200,
36
- toolbarHeight = 29,
37
36
  enableScroll = true,
38
37
  visibleDragbar = typeof props.visiableDragbar === 'boolean' ? props.visiableDragbar : true,
39
38
  highlightEnable = true,
@@ -51,6 +50,7 @@ var InternalMDEditor = (props, ref) => {
51
50
  onHeightChange,
52
51
  hideToolbar,
53
52
  toolbarBottom = false,
53
+ components,
54
54
  renderTextarea
55
55
  } = _ref,
56
56
  other = _objectWithoutPropertiesLoose(_ref, _excluded);
@@ -60,6 +60,7 @@ var InternalMDEditor = (props, ref) => {
60
60
  var [state, dispatch] = useReducer(reducer, {
61
61
  markdown: propsValue,
62
62
  preview: previewType,
63
+ components,
63
64
  height,
64
65
  highlightEnable,
65
66
  tabSize,
@@ -195,14 +196,10 @@ var InternalMDEditor = (props, ref) => {
195
196
  }),
196
197
  children: [!hideToolbar && !toolbarBottom && /*#__PURE__*/_jsx(Toolbar, {
197
198
  prefixCls: prefixCls,
198
- height: toolbarHeight,
199
199
  overflow: overflow,
200
200
  toolbarBottom: toolbarBottom
201
201
  }), /*#__PURE__*/_jsxs("div", {
202
202
  className: prefixCls + "-content",
203
- style: {
204
- height: "calc(100% - " + toolbarHeight + "px)"
205
- },
206
203
  children: [/(edit|live)/.test(state.preview || '') && /*#__PURE__*/_jsx(TextArea, _extends({
207
204
  className: prefixCls + "-input",
208
205
  prefixCls: prefixCls,
@@ -215,7 +212,7 @@ var InternalMDEditor = (props, ref) => {
215
212
  textareaProps.onChange(evn);
216
213
  }
217
214
  },
218
- renderTextarea: renderTextarea,
215
+ renderTextarea: (components == null ? void 0 : components.textarea) || renderTextarea,
219
216
  onScroll: e => handleScroll(e, 'text')
220
217
  })), /(live|preview)/.test(state.preview || '') && mdPreview]
221
218
  }), visibleDragbar && !state.fullscreen && /*#__PURE__*/_jsx(DragBar, {
@@ -230,7 +227,6 @@ var InternalMDEditor = (props, ref) => {
230
227
  }
231
228
  }), !hideToolbar && toolbarBottom && /*#__PURE__*/_jsx(Toolbar, {
232
229
  prefixCls: prefixCls,
233
- height: toolbarHeight,
234
230
  overflow: overflow,
235
231
  toolbarBottom: toolbarBottom
236
232
  })]
package/esm/Editor.js.map CHANGED
@@ -32,7 +32,6 @@
32
32
  "commandsFilter",
33
33
  "extraCommands",
34
34
  "height",
35
- "toolbarHeight",
36
35
  "enableScroll",
37
36
  "visibleDragbar",
38
37
  "visiableDragbar",
@@ -52,6 +51,7 @@
52
51
  "onHeightChange",
53
52
  "hideToolbar",
54
53
  "toolbarBottom",
54
+ "components",
55
55
  "renderTextarea",
56
56
  "other",
57
57
  "cmds",
@@ -94,6 +94,7 @@
94
94
  "style",
95
95
  "test",
96
96
  "evn",
97
+ "textarea",
97
98
  "newHeight",
98
99
  "mdEditor",
99
100
  "forwardRef",
@@ -103,7 +104,7 @@
103
104
  "../src/Editor.tsx"
104
105
  ],
105
106
  "sourcesContent": [
106
- "import React, { useEffect, useReducer, useMemo, useRef, useImperativeHandle, CSSProperties } 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, event?: React.ChangeEvent<HTMLTextAreaElement>, state?: ContextStore) => void;\n /**\n * editor height change listener\n */\n onHeightChange?: (value?: CSSProperties['height'], oldValue?: CSSProperties['height'], state?: ContextStore) => 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 * ⚠️ `Dragbar` is invalid when **`height`** parameter percentage.\n */\n height?: CSSProperties['height'];\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 visibleDragbar?: boolean;\n /**\n * @deprecated use `visibleDragbar`\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. `visibleDragbar=true`\n */\n maxHeight?: number;\n /**\n * Minimum drag height. `visibleDragbar=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 /** Toolbar on bottom */\n toolbarBottom?: 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 visibleDragbar = typeof props.visiableDragbar === 'boolean' ? props.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 onHeightChange,\n hideToolbar,\n toolbarBottom = false,\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(() => 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 // eslint-disable-next-line react-hooks/exhaustive-deps\n useMemo(() => height !== state.height && dispatch({ height: height }), [height]);\n useMemo(\n () => height !== state.height && onHeightChange && onHeightChange(state.height, height, state),\n [height, onHeightChange, state],\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 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.height || '100%',\n }}\n >\n {!hideToolbar && !toolbarBottom && (\n <Toolbar prefixCls={prefixCls} height={toolbarHeight} overflow={overflow} toolbarBottom={toolbarBottom} />\n )}\n <div\n className={`${prefixCls}-content`}\n style={{\n height: `calc(100% - ${toolbarHeight}px)`,\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, evn, state);\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 {visibleDragbar && !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 {!hideToolbar && toolbarBottom && (\n <Toolbar prefixCls={prefixCls} height={toolbarHeight} overflow={overflow} toolbarBottom={toolbarBottom} />\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"
107
+ "import React, { useEffect, useReducer, useMemo, useRef, useImperativeHandle, CSSProperties } 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, event?: React.ChangeEvent<HTMLTextAreaElement>, state?: ContextStore) => void;\n /**\n * editor height change listener\n */\n onHeightChange?: (value?: CSSProperties['height'], oldValue?: CSSProperties['height'], state?: ContextStore) => 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 * ⚠️ `Dragbar` is invalid when **`height`** parameter percentage.\n */\n height?: CSSProperties['height'];\n /**\n * Custom toolbar heigth\n * @default 29px\n *\n * @deprecated toolbar height adaptive: https://github.com/uiwjs/react-md-editor/issues/427\n *\n */\n toolbarHeight?: number;\n /**\n * Show drag and drop tool. Set the height of the editor.\n */\n visibleDragbar?: boolean;\n /**\n * @deprecated use `visibleDragbar`\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. `visibleDragbar=true`\n */\n maxHeight?: number;\n /**\n * Minimum drag height. `visibleDragbar=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 /**\n * Use div to replace TextArea or re-render TextArea\n * @deprecated Please use ~~`renderTextarea`~~ -> `components`\n */\n renderTextarea?: ITextAreaProps['renderTextarea'];\n /**\n * re-render element\n */\n components?: {\n /** Use div to replace TextArea or re-render TextArea */\n textarea?: ITextAreaProps['renderTextarea'];\n /**\n * Override the default command element\n * _`toolbar`_ < _`command[].render`_\n */\n toolbar?: ICommand['render'];\n };\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 /** Toolbar on bottom */\n toolbarBottom?: 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 enableScroll = true,\n visibleDragbar = typeof props.visiableDragbar === 'boolean' ? props.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 onHeightChange,\n hideToolbar,\n toolbarBottom = false,\n components,\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 components,\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(() => 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 // eslint-disable-next-line react-hooks/exhaustive-deps\n useMemo(() => height !== state.height && dispatch({ height: height }), [height]);\n useMemo(\n () => height !== state.height && onHeightChange && onHeightChange(state.height, height, state),\n [height, onHeightChange, state],\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 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.height || '100%',\n }}\n >\n {!hideToolbar && !toolbarBottom && (\n <Toolbar prefixCls={prefixCls} overflow={overflow} toolbarBottom={toolbarBottom} />\n )}\n <div className={`${prefixCls}-content`}>\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, evn, state);\n if (textareaProps && textareaProps.onChange) {\n textareaProps.onChange(evn);\n }\n }}\n renderTextarea={components?.textarea || renderTextarea}\n onScroll={(e) => handleScroll(e, 'text')}\n />\n )}\n {/(live|preview)/.test(state.preview || '') && mdPreview}\n </div>\n {visibleDragbar && !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 {!hideToolbar && toolbarBottom && (\n <Toolbar prefixCls={prefixCls} overflow={overflow} toolbarBottom={toolbarBottom} />\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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IAAgBC,aAAhB,iBACC,KAAC,OAAD;QAAS,SAAS,EAAE1B,SAApB;QAA+B,QAAQ,EAAEe,QAAzC;QAAmD,aAAa,EAAEW;MAAlE,EA9CJ;IAAA;EADF,EADF;AAqDD,CA3ND;;AA6NA,IAAM8C,QAAQ,gBAAG/F,KAAK,CAACgG,UAAN,CAA8C5E,gBAA9C,CAAjB;AAMC2E,QAAD,CAAuBE,QAAvB,GAAkC3F,eAAlC;AAEA,eAAeyF,QAAf"
109
110
  }
@@ -45,7 +45,7 @@ export interface ICommandBase<T> {
45
45
  position?: 'right';
46
46
  liProps?: React.LiHTMLAttributes<HTMLLIElement>;
47
47
  buttonProps?: React.ButtonHTMLAttributes<HTMLButtonElement> | null;
48
- render?: (command: ICommand<T>, disabled: boolean, executeCommand: (command: ICommand<T>, name?: string) => void, index: number) => React.ReactElement;
48
+ render?: (command: ICommand<T>, disabled: boolean, executeCommand: (command: ICommand<T>, name?: string) => void, index: number) => void | undefined | null | React.ReactElement;
49
49
  execute?: (state: TextState, api: TextAreaTextApi, dispatch?: React.Dispatch<ContextStore>, executeCommandState?: ExecuteCommandState) => void;
50
50
  }
51
51
  export declare type ICommand<T = string> = ICommandChildCommands<T> | ICommandChildHandle<T>;
@@ -59,7 +59,7 @@
59
59
  "../../src/commands/index.ts"
60
60
  ],
61
61
  "sourcesContent": [
62
- "import React from 'react';\nimport { bold } from './bold';\nimport { code, codeBlock } from './code';\nimport { italic } from './italic';\nimport { link } from './link';\nimport { unorderedListCommand, orderedListCommand, checkedListCommand } from './list';\nimport { quote } from './quote';\nimport { hr } from './hr';\nimport { title } from './title';\nimport { title1 } from './title1';\nimport { title2 } from './title2';\nimport { title3 } from './title3';\nimport { title4 } from './title4';\nimport { title5 } from './title5';\nimport { title6 } from './title6';\nimport { comment } from './comment';\nimport { group } from './group';\nimport { divider } from './divider';\nimport { codePreview, codeEdit, codeLive } from './preview';\nimport { fullscreen } from './fullscreen';\nimport { image } from './image';\nimport { strikethrough } from './strikeThrough';\nimport { insertTextAtPosition } from '../utils/InsertTextAtPosition';\nimport { ContextStore, ExecuteCommandState } from '../Context';\n\nexport interface CommandOrchestrator {\n executeCommand(command: ICommand): void;\n}\n\nexport interface ICommandChildHandle<T = string> extends ICommandBase<T> {\n children?: (handle: {\n close: () => void;\n execute: () => void;\n getState?: TextAreaCommandOrchestrator['getState'];\n textApi?: TextAreaTextApi;\n }) => React.ReactElement;\n}\n\nexport interface ICommandChildCommands<T = string> extends ICommandBase<T> {\n children?: Array<ICommand<T>>;\n}\n\nexport interface ICommandBase<T> {\n parent?: ICommand<any>;\n keyCommand?: string;\n name?: string;\n shortcuts?: string;\n groupName?: string;\n icon?: React.ReactElement;\n value?: T;\n position?: 'right';\n liProps?: React.LiHTMLAttributes<HTMLLIElement>;\n buttonProps?: React.ButtonHTMLAttributes<HTMLButtonElement> | null;\n render?: (\n command: ICommand<T>,\n disabled: boolean,\n executeCommand: (command: ICommand<T>, name?: string) => void,\n index: number,\n ) => React.ReactElement;\n execute?: (\n state: TextState,\n api: TextAreaTextApi,\n dispatch?: React.Dispatch<ContextStore>,\n executeCommandState?: ExecuteCommandState,\n ) => void;\n}\n\nexport type ICommand<T = string> = ICommandChildCommands<T> | ICommandChildHandle<T>;\n\nexport interface TextRange {\n start: number;\n end: number;\n}\n\nexport interface TextState {\n text: string;\n selectedText: string;\n selection: TextRange;\n}\n\nconst getCommands: () => ICommand[] = () => [\n comment,\n bold,\n italic,\n strikethrough,\n hr,\n title,\n divider,\n link,\n quote,\n code,\n codeBlock,\n image,\n divider,\n unorderedListCommand,\n orderedListCommand,\n checkedListCommand,\n];\n\nconst getExtraCommands: () => ICommand[] = () => [codeEdit, codeLive, codePreview, divider, fullscreen];\n\nfunction getStateFromTextArea(textArea: HTMLTextAreaElement): TextState {\n return {\n selection: {\n start: textArea.selectionStart,\n end: textArea.selectionEnd,\n },\n text: textArea.value,\n selectedText: textArea.value.slice(textArea.selectionStart, textArea.selectionEnd),\n };\n}\n\nclass TextAreaTextApi {\n textArea: HTMLTextAreaElement;\n\n constructor(textArea: HTMLTextAreaElement) {\n this.textArea = textArea;\n }\n\n /**\n * Replaces the current selection with the new text. This will make the new selectedText to be empty, the\n * selection start and selection end will be the same and will both point to the end\n * @param text Text that should replace the current selection\n */\n replaceSelection(text: string): TextState {\n insertTextAtPosition(this.textArea, text);\n return getStateFromTextArea(this.textArea);\n }\n\n /**\n * Selects the specified text range\n * @param selection\n */\n setSelectionRange(selection: TextRange): TextState {\n this.textArea.focus();\n this.textArea.selectionStart = selection.start;\n this.textArea.selectionEnd = selection.end;\n return getStateFromTextArea(this.textArea);\n }\n}\n\nclass TextAreaCommandOrchestrator implements CommandOrchestrator {\n textArea: HTMLTextAreaElement;\n textApi: TextAreaTextApi;\n\n constructor(textArea: HTMLTextAreaElement) {\n this.textArea = textArea;\n this.textApi = new TextAreaTextApi(textArea);\n }\n\n getState() {\n if (!this.textArea) return false;\n return getStateFromTextArea(this.textArea);\n }\n\n executeCommand(\n command: ICommand<string>,\n dispatch?: React.Dispatch<ContextStore>,\n state?: ExecuteCommandState,\n ): void {\n command.execute && command.execute(getStateFromTextArea(this.textArea), this.textApi, dispatch, state);\n }\n}\n\nexport {\n // Toolbars.\n title,\n title1,\n title2,\n title3,\n title4,\n title5,\n title6,\n bold,\n codeBlock,\n italic,\n strikethrough,\n hr,\n group,\n divider,\n link,\n quote,\n code,\n image,\n unorderedListCommand,\n orderedListCommand,\n checkedListCommand,\n codeEdit,\n codeLive,\n codePreview,\n fullscreen,\n // Tool method.\n getCommands,\n getExtraCommands,\n getStateFromTextArea,\n TextAreaCommandOrchestrator,\n TextAreaTextApi,\n};\n"
62
+ "import React from 'react';\nimport { bold } from './bold';\nimport { code, codeBlock } from './code';\nimport { italic } from './italic';\nimport { link } from './link';\nimport { unorderedListCommand, orderedListCommand, checkedListCommand } from './list';\nimport { quote } from './quote';\nimport { hr } from './hr';\nimport { title } from './title';\nimport { title1 } from './title1';\nimport { title2 } from './title2';\nimport { title3 } from './title3';\nimport { title4 } from './title4';\nimport { title5 } from './title5';\nimport { title6 } from './title6';\nimport { comment } from './comment';\nimport { group } from './group';\nimport { divider } from './divider';\nimport { codePreview, codeEdit, codeLive } from './preview';\nimport { fullscreen } from './fullscreen';\nimport { image } from './image';\nimport { strikethrough } from './strikeThrough';\nimport { insertTextAtPosition } from '../utils/InsertTextAtPosition';\nimport { ContextStore, ExecuteCommandState } from '../Context';\n\nexport interface CommandOrchestrator {\n executeCommand(command: ICommand): void;\n}\n\nexport interface ICommandChildHandle<T = string> extends ICommandBase<T> {\n children?: (handle: {\n close: () => void;\n execute: () => void;\n getState?: TextAreaCommandOrchestrator['getState'];\n textApi?: TextAreaTextApi;\n }) => React.ReactElement;\n}\n\nexport interface ICommandChildCommands<T = string> extends ICommandBase<T> {\n children?: Array<ICommand<T>>;\n}\n\nexport interface ICommandBase<T> {\n parent?: ICommand<any>;\n keyCommand?: string;\n name?: string;\n shortcuts?: string;\n groupName?: string;\n icon?: React.ReactElement;\n value?: T;\n position?: 'right';\n liProps?: React.LiHTMLAttributes<HTMLLIElement>;\n buttonProps?: React.ButtonHTMLAttributes<HTMLButtonElement> | null;\n render?: (\n command: ICommand<T>,\n disabled: boolean,\n executeCommand: (command: ICommand<T>, name?: string) => void,\n index: number,\n ) => void | undefined | null | React.ReactElement;\n execute?: (\n state: TextState,\n api: TextAreaTextApi,\n dispatch?: React.Dispatch<ContextStore>,\n executeCommandState?: ExecuteCommandState,\n ) => void;\n}\n\nexport type ICommand<T = string> = ICommandChildCommands<T> | ICommandChildHandle<T>;\n\nexport interface TextRange {\n start: number;\n end: number;\n}\n\nexport interface TextState {\n text: string;\n selectedText: string;\n selection: TextRange;\n}\n\nconst getCommands: () => ICommand[] = () => [\n comment,\n bold,\n italic,\n strikethrough,\n hr,\n title,\n divider,\n link,\n quote,\n code,\n codeBlock,\n image,\n divider,\n unorderedListCommand,\n orderedListCommand,\n checkedListCommand,\n];\n\nconst getExtraCommands: () => ICommand[] = () => [codeEdit, codeLive, codePreview, divider, fullscreen];\n\nfunction getStateFromTextArea(textArea: HTMLTextAreaElement): TextState {\n return {\n selection: {\n start: textArea.selectionStart,\n end: textArea.selectionEnd,\n },\n text: textArea.value,\n selectedText: textArea.value.slice(textArea.selectionStart, textArea.selectionEnd),\n };\n}\n\nclass TextAreaTextApi {\n textArea: HTMLTextAreaElement;\n\n constructor(textArea: HTMLTextAreaElement) {\n this.textArea = textArea;\n }\n\n /**\n * Replaces the current selection with the new text. This will make the new selectedText to be empty, the\n * selection start and selection end will be the same and will both point to the end\n * @param text Text that should replace the current selection\n */\n replaceSelection(text: string): TextState {\n insertTextAtPosition(this.textArea, text);\n return getStateFromTextArea(this.textArea);\n }\n\n /**\n * Selects the specified text range\n * @param selection\n */\n setSelectionRange(selection: TextRange): TextState {\n this.textArea.focus();\n this.textArea.selectionStart = selection.start;\n this.textArea.selectionEnd = selection.end;\n return getStateFromTextArea(this.textArea);\n }\n}\n\nclass TextAreaCommandOrchestrator implements CommandOrchestrator {\n textArea: HTMLTextAreaElement;\n textApi: TextAreaTextApi;\n\n constructor(textArea: HTMLTextAreaElement) {\n this.textArea = textArea;\n this.textApi = new TextAreaTextApi(textArea);\n }\n\n getState() {\n if (!this.textArea) return false;\n return getStateFromTextArea(this.textArea);\n }\n\n executeCommand(\n command: ICommand<string>,\n dispatch?: React.Dispatch<ContextStore>,\n state?: ExecuteCommandState,\n ): void {\n command.execute && command.execute(getStateFromTextArea(this.textArea), this.textApi, dispatch, state);\n }\n}\n\nexport {\n // Toolbars.\n title,\n title1,\n title2,\n title3,\n title4,\n title5,\n title6,\n bold,\n codeBlock,\n italic,\n strikethrough,\n hr,\n group,\n divider,\n link,\n quote,\n code,\n image,\n unorderedListCommand,\n orderedListCommand,\n checkedListCommand,\n codeEdit,\n codeLive,\n codePreview,\n fullscreen,\n // Tool method.\n getCommands,\n getExtraCommands,\n getStateFromTextArea,\n TextAreaCommandOrchestrator,\n TextAreaTextApi,\n};\n"
63
63
  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,EAGZC,KAHY,EAIN;IACNF,OAAO,CAACG,OAAR,IAAmBH,OAAO,CAACG,OAAR,CAAgBvB,oBAAoB,CAAC,KAAKC,QAAN,CAApC,EAAqD,KAAKgB,OAA1D,EAAmEI,QAAnE,EAA6EC,KAA7E,CAAnB;EACD;;AApB8D;;AAuBjE,SACE;AACAzC,KAFF,EAGEC,MAHF,EAIEC,MAJF,EAKEC,MALF,EAMEC,MANF,EAOEC,MAPF,EAQEC,MARF,EASEhB,IATF,EAUEE,SAVF,EAWEC,MAXF,EAYEsB,aAZF,EAaEhB,EAbF,EAcES,KAdF,EAeEC,OAfF,EAgBEf,IAhBF,EAiBEI,KAjBF,EAkBEP,IAlBF,EAmBEuB,KAnBF,EAoBEnB,oBApBF,EAqBEC,kBArBF,EAsBEC,kBAtBF,EAuBEc,QAvBF,EAwBEC,QAxBF,EAyBEF,WAzBF,EA0BEG,UA1BF,EA2BE;AACAI,WA5BF,EA6BEC,gBA7BF,EA8BEC,oBA9BF,EA+BEgB,2BA/BF,EAgCEL,eAhCF"
65
65
  }
@@ -2,6 +2,7 @@
2
2
  position: absolute;
3
3
  cursor: s-resize;
4
4
  right: 0;
5
+ bottom: 0;
5
6
  margin-top: -11px;
6
7
  margin-right: 0;
7
8
  width: 14px;
@@ -5,6 +5,7 @@
5
5
  position: absolute;
6
6
  cursor: s-resize;
7
7
  right: 0;
8
+ bottom: 0;
8
9
  margin-top: -11px;
9
10
  margin-right: 0;
10
11
  width: 14px;
@@ -20,7 +20,6 @@ export default function Child(props) {
20
20
  children: Array.isArray(commands) ? /*#__PURE__*/_jsx(Toolbar, _extends({
21
21
  commands: commands
22
22
  }, props, {
23
- height: "",
24
23
  isChild: true
25
24
  })) : children
26
25
  }), // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -22,7 +22,7 @@
22
22
  "../../../src/components/Toolbar/Child.tsx"
23
23
  ],
24
24
  "sourcesContent": [
25
- "import React, { useContext, useMemo } from 'react';\nimport './Child.less';\nimport Toolbar, { IToolbarProps } from './';\nimport { EditorContext } from '../../Context';\n\nexport type ChildProps = IToolbarProps & {\n children?: JSX.Element;\n groupName?: string;\n};\n\nexport default function Child(props: ChildProps) {\n const { prefixCls, groupName, commands, children } = props || {};\n const { barPopup = {} } = useContext(EditorContext);\n return useMemo(\n () => (\n <div\n className={`${prefixCls}-toolbar-child ${groupName && barPopup[groupName] ? 'active' : ''}`}\n onClick={(e) => e.stopPropagation()}\n >\n {Array.isArray(commands) ? <Toolbar commands={commands} {...props} height=\"\" isChild /> : children}\n </div>\n ),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [commands, barPopup, groupName, prefixCls],\n );\n}\n"
25
+ "import React, { useContext, useMemo } from 'react';\nimport './Child.less';\nimport Toolbar, { IToolbarProps } from './';\nimport { EditorContext } from '../../Context';\n\nexport type ChildProps = IToolbarProps & {\n children?: JSX.Element;\n groupName?: string;\n};\n\nexport default function Child(props: ChildProps) {\n const { prefixCls, groupName, commands, children } = props || {};\n const { barPopup = {} } = useContext(EditorContext);\n return useMemo(\n () => (\n <div\n className={`${prefixCls}-toolbar-child ${groupName && barPopup[groupName] ? 'active' : ''}`}\n onClick={(e) => e.stopPropagation()}\n >\n {Array.isArray(commands) ? <Toolbar commands={commands} {...props} isChild /> : children}\n </div>\n ),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [commands, barPopup, groupName, prefixCls],\n );\n}\n"
26
26
  ],
27
- "mappings": ";AAAA,OAAOA,KAAP,IAAgBC,UAAhB,EAA4BC,OAA5B,QAA2C,OAA3C;AACA;AACA,OAAOC,OAAP,MAAuC,IAAvC;AACA,SAASC,aAAT,QAA8B,eAA9B;;AAOA,eAAe,SAASC,KAAT,CAAeC,KAAf,EAAkC;EAC/C,IAAM;IAAEC,SAAF;IAAaC,SAAb;IAAwBC,QAAxB;IAAkCC;EAAlC,IAA+CJ,KAAK,IAAI,EAA9D;EACA,IAAM;IAAEK,QAAQ,GAAG;EAAb,IAAoBV,UAAU,CAACG,aAAD,CA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EAAgCD,SAAhC,CAVY,CAAd;AAYD"
28
28
  }
@@ -1,13 +1,14 @@
1
1
  .w-md-editor-toolbar {
2
2
  border-bottom: 1px solid var(--color-border-default);
3
3
  background-color: var(--color-canvas-default);
4
- padding: 0 5px 0 5px;
4
+ padding: 5px 5px;
5
5
  display: flex;
6
6
  justify-content: space-between;
7
7
  align-items: center;
8
8
  border-radius: 3px 3px 0 0;
9
9
  -webkit-user-select: none;
10
10
  user-select: none;
11
+ flex-wrap: wrap;
11
12
  }
12
13
  .w-md-editor-toolbar.bottom {
13
14
  border-bottom: 0px;
@@ -19,11 +20,15 @@
19
20
  margin: 0;
20
21
  padding: 0;
21
22
  list-style: none;
23
+ line-height: initial;
22
24
  }
23
25
  .w-md-editor-toolbar li {
24
26
  display: inline-block;
25
27
  font-size: 14px;
26
28
  }
29
+ .w-md-editor-toolbar li + li {
30
+ margin: 0;
31
+ }
27
32
  .w-md-editor-toolbar li > button {
28
33
  border: none;
29
34
  height: 20px;
@@ -1,10 +1,8 @@
1
- import React from 'react';
2
1
  import { IProps } from '../../Editor';
3
2
  import { ICommand } from '../../commands';
4
3
  import './index.less';
5
4
  export interface IToolbarProps extends IProps {
6
5
  overflow?: boolean;
7
- height?: React.CSSProperties['height'];
8
6
  toolbarBottom?: boolean;
9
7
  onCommand?: (command: ICommand<string>, groupName?: string) => void;
10
8
  commands?: ICommand<string>[];
@@ -14,6 +14,7 @@ export function ToolbarItems(props) {
14
14
  fullscreen,
15
15
  preview,
16
16
  barPopup = {},
17
+ components,
17
18
  commandOrchestrator,
18
19
  dispatch
19
20
  } = useContext(EditorContext);
@@ -89,9 +90,11 @@ export function ToolbarItems(props) {
89
90
  })
90
91
  }) : undefined;
91
92
  var disabled = barPopup && preview && preview === 'preview' && !/(preview|fullscreen)/.test(item.keyCommand);
93
+ var render = (components == null ? void 0 : components.toolbar) || item.render;
94
+ var com = render && typeof render === 'function' ? render(item, !!disabled, handleClick, idx) : null;
92
95
  return /*#__PURE__*/_jsxs("li", _extends({}, item.liProps, {
93
96
  className: activeBtn ? "active" : '',
94
- children: [item.render && typeof item.render === 'function' && item.render(item, !!disabled, handleClick, idx), !item.render && !item.buttonProps && item.icon, !item.render && item.buttonProps && /*#__PURE__*/React.createElement('button', _extends({
97
+ children: [com && /*#__PURE__*/React.isValidElement(com) && com, !com && !item.buttonProps && item.icon, !com && item.buttonProps && /*#__PURE__*/React.createElement('button', _extends({
95
98
  type: 'button',
96
99
  key: idx,
97
100
  disabled,
@@ -119,7 +122,6 @@ export default function Toolbar(props) {
119
122
 
120
123
  var {
121
124
  prefixCls,
122
- height = 29,
123
125
  toolbarBottom,
124
126
  isChild
125
127
  } = props;
@@ -130,9 +132,6 @@ export default function Toolbar(props) {
130
132
  var bottomClassName = toolbarBottom ? 'bottom' : '';
131
133
  return /*#__PURE__*/_jsxs("div", {
132
134
  className: prefixCls + "-toolbar " + bottomClassName,
133
- style: {
134
- height
135
- },
136
135
  children: [/*#__PURE__*/_jsx(ToolbarItems, _extends({}, props, {
137
136
  commands: props.commands || commands || []
138
137
  })), !isChild && /*#__PURE__*/_jsx(ToolbarItems, _extends({}, props, {
@@ -15,6 +15,7 @@
15
15
  "fullscreen",
16
16
  "preview",
17
17
  "barPopup",
18
+ "components",
18
19
  "commandOrchestrator",
19
20
  "dispatch",
20
21
  "originalOverflow",
@@ -54,6 +55,9 @@
54
55
  "disabled",
55
56
  "test",
56
57
  "render",
58
+ "toolbar",
59
+ "com",
60
+ "isValidElement",
57
61
  "buttonProps",
58
62
  "icon",
59
63
  "createElement",
@@ -65,7 +69,6 @@
65
69
  "Array",
66
70
  "isArray",
67
71
  "Toolbar",
68
- "height",
69
72
  "toolbarBottom",
70
73
  "isChild",
71
74
  "extraCommands",
@@ -75,7 +78,7 @@
75
78
  "../../../src/components/Toolbar/index.tsx"
76
79
  ],
77
80
  "sourcesContent": [
78
- "import React, { Fragment, useContext, useEffect, useRef } from 'react';\nimport { IProps } from '../../Editor';\nimport { EditorContext, PreviewType, ContextStore } from '../../Context';\nimport { ICommand } from '../../commands';\nimport Child from './Child';\nimport './index.less';\n\nexport interface IToolbarProps extends IProps {\n overflow?: boolean;\n height?: React.CSSProperties['height'];\n toolbarBottom?: boolean;\n onCommand?: (command: ICommand<string>, groupName?: string) => void;\n commands?: ICommand<string>[];\n isChild?: boolean;\n}\n\nexport function ToolbarItems(props: IToolbarProps) {\n const { prefixCls, overflow } = props;\n const { fullscreen, preview, barPopup = {}, commandOrchestrator, dispatch } = useContext(EditorContext);\n const originalOverflow = useRef('');\n\n function handleClick(command: ICommand<string>, name?: string) {\n if (!dispatch) return;\n const state: ContextStore = { barPopup: { ...barPopup } };\n if (command.keyCommand === 'preview') {\n state.preview = command.value as PreviewType;\n }\n if (command.keyCommand === 'fullscreen') {\n state.fullscreen = !fullscreen;\n }\n if (props.commands && command.keyCommand === 'group') {\n props.commands.forEach((item) => {\n if (name === item.groupName) {\n state.barPopup![name!] = true;\n } else if (item.keyCommand) {\n state.barPopup![item.groupName!] = false;\n }\n });\n } else if (name || command.parent) {\n Object.keys(state.barPopup || {}).forEach((keyName) => {\n state.barPopup![keyName] = false;\n });\n }\n\n if (Object.keys(state).length) {\n dispatch({ ...state });\n }\n commandOrchestrator && commandOrchestrator.executeCommand(command);\n }\n\n useEffect(() => {\n if (document && overflow) {\n if (fullscreen) {\n // prevent scroll on fullscreen\n document.body.style.overflow = 'hidden';\n } else {\n // get the original overflow only the first time\n if (!originalOverflow.current) {\n originalOverflow.current = window.getComputedStyle(document.body, null).overflow;\n }\n // reset to the original overflow\n document.body.style.overflow = originalOverflow.current;\n }\n }\n }, [fullscreen, originalOverflow, overflow]);\n\n return (\n <ul>\n {(props.commands || []).map((item, idx) => {\n if (item.keyCommand === 'divider') {\n return <li key={idx} {...item.liProps} className={`${prefixCls}-toolbar-divider`} />;\n }\n if (!item.keyCommand) return <Fragment key={idx} />;\n const activeBtn =\n (fullscreen && item.keyCommand === 'fullscreen') || (item.keyCommand === 'preview' && preview === item.value);\n const childNode =\n item.children && typeof item.children === 'function'\n ? item.children({\n getState: () => commandOrchestrator!.getState(),\n textApi: commandOrchestrator ? commandOrchestrator!.textApi : undefined,\n close: () => handleClick({}, item.groupName),\n execute: () => handleClick({ execute: item.execute }),\n })\n : undefined;\n const disabled = barPopup && preview && preview === 'preview' && !/(preview|fullscreen)/.test(item.keyCommand);\n return (\n <li key={idx} {...item.liProps} className={activeBtn ? `active` : ''}>\n {item.render && typeof item.render === 'function' && item.render(item, !!disabled, handleClick, idx)}\n {!item.render && !item.buttonProps && item.icon}\n {!item.render &&\n item.buttonProps &&\n React.createElement(\n 'button',\n {\n type: 'button',\n key: idx,\n disabled,\n 'data-name': item.name,\n ...item.buttonProps,\n onClick: (evn: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n evn.stopPropagation();\n handleClick(item, item.groupName);\n },\n },\n item.icon,\n )}\n {item.children && (\n <Child\n overflow={overflow}\n groupName={item.groupName}\n prefixCls={prefixCls}\n children={childNode}\n commands={Array.isArray(item.children) ? item.children : undefined}\n />\n )}\n </li>\n );\n })}\n </ul>\n );\n}\n\nexport default function Toolbar(props: IToolbarProps = {}) {\n const { prefixCls, height = 29, toolbarBottom, isChild } = props;\n const { commands, extraCommands } = useContext(EditorContext);\n const bottomClassName = toolbarBottom ? 'bottom' : '';\n return (\n <div className={`${prefixCls}-toolbar ${bottomClassName}`} style={{ height }}>\n <ToolbarItems {...props} commands={props.commands || commands || []} />\n {!isChild && <ToolbarItems {...props} commands={extraCommands || []} />}\n </div>\n );\n}\n"
81
+ "import React, { Fragment, useContext, useEffect, useRef } from 'react';\nimport { IProps } from '../../Editor';\nimport { EditorContext, PreviewType, ContextStore } from '../../Context';\nimport { ICommand } from '../../commands';\nimport Child from './Child';\nimport './index.less';\n\nexport interface IToolbarProps extends IProps {\n overflow?: boolean;\n toolbarBottom?: boolean;\n onCommand?: (command: ICommand<string>, groupName?: string) => void;\n commands?: ICommand<string>[];\n isChild?: boolean;\n}\n\nexport function ToolbarItems(props: IToolbarProps) {\n const { prefixCls, overflow } = props;\n const { fullscreen, preview, barPopup = {}, components, commandOrchestrator, dispatch } = useContext(EditorContext);\n const originalOverflow = useRef('');\n\n function handleClick(command: ICommand<string>, name?: string) {\n if (!dispatch) return;\n const state: ContextStore = { barPopup: { ...barPopup } };\n if (command.keyCommand === 'preview') {\n state.preview = command.value as PreviewType;\n }\n if (command.keyCommand === 'fullscreen') {\n state.fullscreen = !fullscreen;\n }\n if (props.commands && command.keyCommand === 'group') {\n props.commands.forEach((item) => {\n if (name === item.groupName) {\n state.barPopup![name!] = true;\n } else if (item.keyCommand) {\n state.barPopup![item.groupName!] = false;\n }\n });\n } else if (name || command.parent) {\n Object.keys(state.barPopup || {}).forEach((keyName) => {\n state.barPopup![keyName] = false;\n });\n }\n\n if (Object.keys(state).length) {\n dispatch({ ...state });\n }\n commandOrchestrator && commandOrchestrator.executeCommand(command);\n }\n\n useEffect(() => {\n if (document && overflow) {\n if (fullscreen) {\n // prevent scroll on fullscreen\n document.body.style.overflow = 'hidden';\n } else {\n // get the original overflow only the first time\n if (!originalOverflow.current) {\n originalOverflow.current = window.getComputedStyle(document.body, null).overflow;\n }\n // reset to the original overflow\n document.body.style.overflow = originalOverflow.current;\n }\n }\n }, [fullscreen, originalOverflow, overflow]);\n\n return (\n <ul>\n {(props.commands || []).map((item, idx) => {\n if (item.keyCommand === 'divider') {\n return <li key={idx} {...item.liProps} className={`${prefixCls}-toolbar-divider`} />;\n }\n if (!item.keyCommand) return <Fragment key={idx} />;\n const activeBtn =\n (fullscreen && item.keyCommand === 'fullscreen') || (item.keyCommand === 'preview' && preview === item.value);\n const childNode =\n item.children && typeof item.children === 'function'\n ? item.children({\n getState: () => commandOrchestrator!.getState(),\n textApi: commandOrchestrator ? commandOrchestrator!.textApi : undefined,\n close: () => handleClick({}, item.groupName),\n execute: () => handleClick({ execute: item.execute }),\n })\n : undefined;\n const disabled = barPopup && preview && preview === 'preview' && !/(preview|fullscreen)/.test(item.keyCommand);\n const render = components?.toolbar || item.render;\n const com = (\n render && typeof render === 'function' ? render(item, !!disabled, handleClick, idx) : null\n ) as React.ReactElement;\n return (\n <li key={idx} {...item.liProps} className={activeBtn ? `active` : ''}>\n {com && React.isValidElement(com) && com}\n {!com && !item.buttonProps && item.icon}\n {!com &&\n item.buttonProps &&\n React.createElement(\n 'button',\n {\n type: 'button',\n key: idx,\n disabled,\n 'data-name': item.name,\n ...item.buttonProps,\n onClick: (evn: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n evn.stopPropagation();\n handleClick(item, item.groupName);\n },\n },\n item.icon,\n )}\n {item.children && (\n <Child\n overflow={overflow}\n groupName={item.groupName}\n prefixCls={prefixCls}\n children={childNode}\n commands={Array.isArray(item.children) ? item.children : undefined}\n />\n )}\n </li>\n );\n })}\n </ul>\n );\n}\n\nexport default function Toolbar(props: IToolbarProps = {}) {\n const { prefixCls, toolbarBottom, isChild } = props;\n const { commands, extraCommands } = useContext(EditorContext);\n const bottomClassName = toolbarBottom ? 'bottom' : '';\n return (\n <div className={`${prefixCls}-toolbar ${bottomClassName}`}>\n <ToolbarItems {...props} commands={props.commands || commands || []} />\n {!isChild && <ToolbarItems {...props} commands={extraCommands || []} />}\n </div>\n );\n}\n"
79
82
  ],
80
- "mappings": ";AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,UAA1B,EAAsCC,SAAtC,EAAiDC,MAAjD,QAA+D,OAA/D;AAEA,SAASC,aAAT,QAAyD,eAAzD;AAEA,OAAOC,KAAP,MAAkB,SAAlB;AACA;;;AAWA,OAAO,SAASC,YAAT,CAAsBC,KAAtB,EAA4C;EACjD,IAAM;IAAEC,SAAF;IAAaC;EAAb,IAA0BF,KAAhC;EACA,IAAM;IAAEG,UAAF;IAAcC,OAAd;IAAuBC,QAAQ,GAAG,EAAlC;IAAsCC,mBAAtC;IAA2DC;EAA3D,IAAwEb,UAAU,CAACG,aAAD,CAAxF;EACA,IAAMW,gBAAgB,GAAGZ,MAAM,C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(--color-border-default);
6
6
  background-color: var(--color-canvas-default);
7
- padding: 0 5px 0 5px;
7
+ padding: 5px 5px;
8
8
  display: flex;
9
9
  justify-content: space-between;
10
10
  align-items: center;
11
11
  border-radius: 3px 3px 0 0;
12
12
  user-select: none;
13
+ flex-wrap: wrap;
13
14
  &.bottom {
14
15
  border-bottom: 0px;
15
16
  border-top: 1px solid var(--color-border-default);
@@ -20,10 +21,14 @@
20
21
  margin: 0;
21
22
  padding: 0;
22
23
  list-style: none;
24
+ line-height: initial;
23
25
  }
24
26
  li {
25
27
  display: inline-block;
26
28
  font-size: 14px;
29
+ & + li {
30
+ margin: 0;
31
+ }
27
32
  > button {
28
33
  border: none;
29
34
  height: 20px;
package/esm/index.css CHANGED
@@ -7,14 +7,21 @@
7
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
8
  background-color: var(--color-canvas-default);
9
9
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
10
+ display: flex;
11
+ flex-direction: column;
10
12
  }
11
- .w-md-editor .copied {
12
- display: none !important;
13
+ .w-md-editor-toolbar {
14
+ height: -webkit-fit-content;
15
+ height: fit-content;
13
16
  }
14
17
  .w-md-editor-content {
18
+ height: 100%;
19
+ overflow: auto;
15
20
  position: relative;
16
21
  border-radius: 0 0 3px 0;
17
- height: calc(100% - 39.1px);
22
+ }
23
+ .w-md-editor .copied {
24
+ display: none !important;
18
25
  }
19
26
  .w-md-editor-input {
20
27
  width: 50%;
package/esm/index.less CHANGED
@@ -10,13 +10,19 @@
10
10
  0 1px 1px var(--color-border-default);
11
11
  background-color: var(--color-canvas-default);
12
12
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
13
- .copied {
14
- display: none !important;
13
+ display: flex;
14
+ flex-direction: column;
15
+ &-toolbar {
16
+ height: fit-content;
15
17
  }
16
18
  &-content {
19
+ height: 100%;
20
+ overflow: auto;
17
21
  position: relative;
18
22
  border-radius: 0 0 3px 0;
19
- height: calc(100% - 39.1px);
23
+ }
24
+ .copied {
25
+ display: none !important;
20
26
  }
21
27
  &-input {
22
28
  width: 50%;