@uiw/react-md-editor 3.13.0 → 3.14.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.
- package/README.md +31 -34
- package/dist/mdeditor.css +20 -21
- package/dist/mdeditor.js +1076 -986
- package/dist/mdeditor.min.css +1 -1
- package/dist/mdeditor.min.js +1 -1
- package/esm/Editor.d.ts +6 -2
- package/esm/Editor.js +3 -3
- package/esm/Editor.js.map +3 -2
- package/esm/commands/bold.js +1 -1
- package/esm/commands/bold.js.map +2 -2
- package/esm/components/TextArea/Markdown.js +31 -24
- package/esm/components/TextArea/Markdown.js.map +12 -9
- package/esm/components/TextArea/index.js +3 -8
- package/esm/components/TextArea/index.js.map +2 -4
- package/esm/index.css +4 -0
- package/esm/index.less +6 -0
- package/lib/Context.js +3 -3
- package/lib/Context.js.map +1 -1
- package/lib/Editor.d.ts +6 -2
- package/lib/Editor.js +22 -22
- package/lib/Editor.js.map +3 -2
- package/lib/commands/bold.js +2 -2
- package/lib/commands/bold.js.map +1 -1
- package/lib/commands/code.js +1 -1
- package/lib/commands/fullscreen.js +1 -1
- package/lib/commands/group.js +4 -4
- package/lib/commands/group.js.map +1 -1
- package/lib/commands/hr.js +1 -1
- package/lib/commands/image.js +1 -1
- package/lib/commands/index.js +8 -8
- package/lib/commands/italic.js +1 -1
- package/lib/commands/link.js +1 -1
- package/lib/commands/list.js +1 -1
- package/lib/commands/preview.js +1 -1
- package/lib/commands/quote.js +1 -1
- package/lib/commands/strikeThrough.js +1 -1
- package/lib/commands/title.js +2 -2
- package/lib/commands/title.js.map +1 -1
- package/lib/commands/title1.js +1 -1
- package/lib/commands/title2.js +1 -1
- package/lib/commands/title3.js +1 -1
- package/lib/commands/title4.js +1 -1
- package/lib/commands/title5.js +1 -1
- package/lib/commands/title6.js +1 -1
- package/lib/components/DragBar/index.js +3 -3
- package/lib/components/TextArea/Markdown.js +39 -33
- package/lib/components/TextArea/Markdown.js.map +12 -9
- package/lib/components/TextArea/Textarea.js +10 -10
- package/lib/components/TextArea/Textarea.js.map +1 -1
- package/lib/components/TextArea/handleKeyDown.js +1 -1
- package/lib/components/TextArea/index.js +14 -19
- package/lib/components/TextArea/index.js.map +2 -4
- package/lib/components/TextArea/shortcuts.js +3 -3
- package/lib/components/TextArea/shortcuts.js.map +1 -1
- package/lib/components/Toolbar/Child.js +4 -4
- package/lib/components/Toolbar/Child.js.map +1 -1
- package/lib/components/Toolbar/index.js +11 -11
- package/lib/components/Toolbar/index.js.map +1 -1
- package/lib/index.js +4 -4
- package/lib/index.js.map +1 -1
- package/lib/index.less +6 -0
- package/lib/utils/InsertTextAtPosition.js +2 -2
- package/lib/utils/InsertTextAtPosition.js.map +1 -1
- package/markdown-editor.css +4 -0
- package/package.json +3 -61
- package/src/Editor.tsx +8 -4
- package/src/commands/bold.tsx +1 -1
- package/src/components/TextArea/Markdown.tsx +31 -24
- package/src/components/TextArea/index.tsx +4 -4
- package/src/index.less +6 -0
- package/LICENSE +0 -21
- package/src/tsconfig.json +0 -8
package/lib/Editor.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
|
|
5
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")
|
|
5
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports
|
|
10
|
+
exports["default"] = void 0;
|
|
11
11
|
|
|
12
12
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
13
13
|
|
|
@@ -31,7 +31,7 @@ var _Context = require("./Context");
|
|
|
31
31
|
|
|
32
32
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
33
33
|
|
|
34
|
-
var _excluded = ["prefixCls", "className", "value", "commands", "commandsFilter", "extraCommands", "height", "toolbarHeight", "enableScroll", "
|
|
34
|
+
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"];
|
|
35
35
|
|
|
36
36
|
function setGroupPopFalse() {
|
|
37
37
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -58,8 +58,8 @@ var InternalMDEditor = function InternalMDEditor(props, ref) {
|
|
|
58
58
|
toolbarHeight = _ref$toolbarHeight === void 0 ? 29 : _ref$toolbarHeight,
|
|
59
59
|
_ref$enableScroll = _ref.enableScroll,
|
|
60
60
|
enableScroll = _ref$enableScroll === void 0 ? true : _ref$enableScroll,
|
|
61
|
-
_ref$
|
|
62
|
-
|
|
61
|
+
_ref$visibleDragbar = _ref.visibleDragbar,
|
|
62
|
+
visibleDragbar = _ref$visibleDragbar === void 0 ? typeof props.visiableDragbar === 'boolean' ? props.visiableDragbar : true : _ref$visibleDragbar,
|
|
63
63
|
_ref$highlightEnable = _ref.highlightEnable,
|
|
64
64
|
highlightEnable = _ref$highlightEnable === void 0 ? true : _ref$highlightEnable,
|
|
65
65
|
_ref$preview = _ref.preview,
|
|
@@ -86,7 +86,7 @@ var InternalMDEditor = function InternalMDEditor(props, ref) {
|
|
|
86
86
|
_ref$toolbarBottom = _ref.toolbarBottom,
|
|
87
87
|
toolbarBottom = _ref$toolbarBottom === void 0 ? false : _ref$toolbarBottom,
|
|
88
88
|
renderTextarea = _ref.renderTextarea,
|
|
89
|
-
other = (0, _objectWithoutProperties2
|
|
89
|
+
other = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
90
90
|
|
|
91
91
|
var cmds = commands.map(function (item) {
|
|
92
92
|
return commandsFilter ? commandsFilter(item, false) : item;
|
|
@@ -109,7 +109,7 @@ var InternalMDEditor = function InternalMDEditor(props, ref) {
|
|
|
109
109
|
fullscreen: fullscreen,
|
|
110
110
|
barPopup: {}
|
|
111
111
|
}),
|
|
112
|
-
_useReducer2 = (0, _slicedToArray2
|
|
112
|
+
_useReducer2 = (0, _slicedToArray2["default"])(_useReducer, 2),
|
|
113
113
|
state = _useReducer2[0],
|
|
114
114
|
dispatch = _useReducer2[1];
|
|
115
115
|
|
|
@@ -117,7 +117,7 @@ var InternalMDEditor = function InternalMDEditor(props, ref) {
|
|
|
117
117
|
var previewRef = (0, _react.useRef)(null);
|
|
118
118
|
var enableScrollRef = (0, _react.useRef)(enableScroll);
|
|
119
119
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
120
|
-
return (0, _objectSpread2
|
|
120
|
+
return (0, _objectSpread2["default"])({}, state);
|
|
121
121
|
});
|
|
122
122
|
(0, _react.useMemo)(function () {
|
|
123
123
|
return enableScrollRef.current = enableScroll;
|
|
@@ -133,7 +133,7 @@ var InternalMDEditor = function InternalMDEditor(props, ref) {
|
|
|
133
133
|
stateInit.barPopup = {};
|
|
134
134
|
|
|
135
135
|
if (dispatch) {
|
|
136
|
-
dispatch((0, _objectSpread2
|
|
136
|
+
dispatch((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, state), stateInit));
|
|
137
137
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
138
138
|
|
|
139
139
|
}, []);
|
|
@@ -234,7 +234,7 @@ var InternalMDEditor = function InternalMDEditor(props, ref) {
|
|
|
234
234
|
};
|
|
235
235
|
|
|
236
236
|
var mdPreview = (0, _react.useMemo)(function () {
|
|
237
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactMarkdownPreview
|
|
237
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactMarkdownPreview["default"], (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, previewOptions), {}, {
|
|
238
238
|
onScroll: function onScroll(e) {
|
|
239
239
|
return handleScroll(e, 'preview');
|
|
240
240
|
},
|
|
@@ -244,22 +244,22 @@ var InternalMDEditor = function InternalMDEditor(props, ref) {
|
|
|
244
244
|
}));
|
|
245
245
|
}, [prefixCls, previewOptions, state.markdown]);
|
|
246
246
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Context.EditorContext.Provider, {
|
|
247
|
-
value: (0, _objectSpread2
|
|
247
|
+
value: (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, state), {}, {
|
|
248
248
|
dispatch: dispatch
|
|
249
249
|
}),
|
|
250
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _objectSpread2
|
|
250
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _objectSpread2["default"])((0, _objectSpread2["default"])({
|
|
251
251
|
ref: container,
|
|
252
252
|
className: cls
|
|
253
253
|
}, other), {}, {
|
|
254
254
|
onClick: function onClick() {
|
|
255
255
|
dispatch({
|
|
256
|
-
barPopup: (0, _objectSpread2
|
|
256
|
+
barPopup: (0, _objectSpread2["default"])({}, setGroupPopFalse(state.barPopup))
|
|
257
257
|
});
|
|
258
258
|
},
|
|
259
|
-
style: (0, _objectSpread2
|
|
259
|
+
style: (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, other.style), {}, {
|
|
260
260
|
height: state.fullscreen ? '100%' : hideToolbar ? Number(state.height) - toolbarHeight : state.height
|
|
261
261
|
}),
|
|
262
|
-
children: [!hideToolbar && !toolbarBottom && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Toolbar
|
|
262
|
+
children: [!hideToolbar && !toolbarBottom && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Toolbar["default"], {
|
|
263
263
|
prefixCls: prefixCls,
|
|
264
264
|
height: toolbarHeight,
|
|
265
265
|
overflow: overflow,
|
|
@@ -269,7 +269,7 @@ var InternalMDEditor = function InternalMDEditor(props, ref) {
|
|
|
269
269
|
style: {
|
|
270
270
|
height: state.fullscreen ? "calc(100% - ".concat(toolbarHeight, "px)") : Number(state.height) - toolbarHeight
|
|
271
271
|
},
|
|
272
|
-
children: [/(edit|live)/.test(state.preview || '') && /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextArea
|
|
272
|
+
children: [/(edit|live)/.test(state.preview || '') && /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextArea["default"], (0, _objectSpread2["default"])((0, _objectSpread2["default"])({
|
|
273
273
|
className: "".concat(prefixCls, "-input"),
|
|
274
274
|
prefixCls: prefixCls,
|
|
275
275
|
autoFocus: autoFocus
|
|
@@ -286,7 +286,7 @@ var InternalMDEditor = function InternalMDEditor(props, ref) {
|
|
|
286
286
|
return handleScroll(e, 'text');
|
|
287
287
|
}
|
|
288
288
|
})), /(live|preview)/.test(state.preview || '') && mdPreview]
|
|
289
|
-
}),
|
|
289
|
+
}), visibleDragbar && !state.fullscreen && /*#__PURE__*/(0, _jsxRuntime.jsx)(_DragBar["default"], {
|
|
290
290
|
prefixCls: prefixCls,
|
|
291
291
|
height: state.height,
|
|
292
292
|
maxHeight: maxHeight,
|
|
@@ -296,7 +296,7 @@ var InternalMDEditor = function InternalMDEditor(props, ref) {
|
|
|
296
296
|
height: newHeight
|
|
297
297
|
});
|
|
298
298
|
}
|
|
299
|
-
}), !hideToolbar && toolbarBottom && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Toolbar
|
|
299
|
+
}), !hideToolbar && toolbarBottom && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Toolbar["default"], {
|
|
300
300
|
prefixCls: prefixCls,
|
|
301
301
|
height: toolbarHeight,
|
|
302
302
|
overflow: overflow,
|
|
@@ -306,10 +306,10 @@ var InternalMDEditor = function InternalMDEditor(props, ref) {
|
|
|
306
306
|
});
|
|
307
307
|
};
|
|
308
308
|
|
|
309
|
-
var mdEditor = /*#__PURE__*/_react
|
|
309
|
+
var mdEditor = /*#__PURE__*/_react["default"].forwardRef(InternalMDEditor);
|
|
310
310
|
|
|
311
|
-
mdEditor.Markdown = _reactMarkdownPreview
|
|
311
|
+
mdEditor.Markdown = _reactMarkdownPreview["default"];
|
|
312
312
|
var _default = mdEditor;
|
|
313
|
-
exports
|
|
313
|
+
exports["default"] = _default;
|
|
314
314
|
module.exports = exports.default;
|
|
315
315
|
//# sourceMappingURL=Editor.js.map
|
package/lib/Editor.js.map
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"height",
|
|
23
23
|
"toolbarHeight",
|
|
24
24
|
"enableScroll",
|
|
25
|
+
"visibleDragbar",
|
|
25
26
|
"visiableDragbar",
|
|
26
27
|
"highlightEnable",
|
|
27
28
|
"preview",
|
|
@@ -99,7 +100,7 @@
|
|
|
99
100
|
"../src/Editor.tsx"
|
|
100
101
|
],
|
|
101
102
|
"sourcesContent": [
|
|
102
|
-
"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, event?: React.ChangeEvent<HTMLTextAreaElement>, state?: ContextStore) => void;\n /**\n * editor height change listener\n */\n onHeightChange?: (value?: number, oldValue?: number, 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 */\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 /** 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 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\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 && !toolbarBottom && (\n <Toolbar prefixCls={prefixCls} height={toolbarHeight} overflow={overflow} toolbarBottom={toolbarBottom} />\n )}\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, 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 {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 {!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"
|
|
103
|
+
"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, event?: React.ChangeEvent<HTMLTextAreaElement>, state?: ContextStore) => void;\n /**\n * editor height change listener\n */\n onHeightChange?: (value?: number, oldValue?: number, 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 */\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 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\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 && !toolbarBottom && (\n <Toolbar prefixCls={prefixCls} height={toolbarHeight} overflow={overflow} toolbarBottom={toolbarBottom} />\n )}\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, 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 = Markdown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,CAAMC,UAAN,CAA8CrF,gBAA9C,CAAjB;;AAMCmF,QAAD,CAAuBG,QAAvB,GAAkCC,gCAAlC;eAEeJ,Q"
|
|
105
106
|
}
|
package/lib/commands/bold.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.bold = void 0;
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
|
|
12
12
|
var _markdownUtils = require("../utils/markdownUtils");
|
|
13
13
|
|
package/lib/commands/bold.js.map
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"../../src/commands/bold.tsx"
|
|
29
29
|
],
|
|
30
30
|
"sourcesContent": [
|
|
31
|
-
"import
|
|
31
|
+
"import React from 'react';\nimport { ICommand, TextState, TextAreaTextApi } from './';\nimport { selectWord } from '../utils/markdownUtils';\n\nexport const bold: ICommand = {\n name: 'bold',\n keyCommand: 'bold',\n shortcuts: 'ctrlcmd+b',\n buttonProps: { 'aria-label': 'Add bold text', title: 'Add bold text' },\n icon: (\n <svg role=\"img\" width=\"12\" height=\"12\" viewBox=\"0 0 384 512\">\n <path\n fill=\"currentColor\"\n d=\"M304.793 243.891c33.639-18.537 53.657-54.16 53.657-95.693 0-48.236-26.25-87.626-68.626-104.179C265.138 34.01 240.849 32 209.661 32H24c-8.837 0-16 7.163-16 16v33.049c0 8.837 7.163 16 16 16h33.113v318.53H24c-8.837 0-16 7.163-16 16V464c0 8.837 7.163 16 16 16h195.69c24.203 0 44.834-1.289 66.866-7.584C337.52 457.193 376 410.647 376 350.014c0-52.168-26.573-91.684-71.207-106.123zM142.217 100.809h67.444c16.294 0 27.536 2.019 37.525 6.717 15.828 8.479 24.906 26.502 24.906 49.446 0 35.029-20.32 56.79-53.029 56.79h-76.846V100.809zm112.642 305.475c-10.14 4.056-22.677 4.907-31.409 4.907h-81.233V281.943h84.367c39.645 0 63.057 25.38 63.057 63.057.001 28.425-13.66 52.483-34.782 61.284z\"\n />\n </svg>\n ),\n execute: (state: TextState, api: TextAreaTextApi) => {\n // Adjust the selection to encompass the whole word if the caret is inside one\n const newSelectionRange = selectWord({ text: state.text, selection: state.selection });\n const state1 = api.setSelectionRange(newSelectionRange);\n // Replaces the current selection with the bold mark up\n const state2 = api.replaceSelection(`**${state1.selectedText}**`);\n // Adjust the selection to not contain the **\n api.setSelectionRange({\n start: state2.selection.end - 2 - state1.selectedText.length,\n end: state2.selection.end - 2,\n });\n },\n};\n"
|
|
32
32
|
],
|
|
33
33
|
"mappings": ";;;;;;;;;AAAA;;AAEA;;;;AAEO,IAAMA,IAAc,GAAG;EAC5BC,IAAI,EAAE,MADsB;EAE5BC,UAAU,EAAE,MAFgB;EAG5BC,SAAS,EAAE,WAHiB;EAI5BC,WAAW,EAAE;IAAE,cAAc,eAAhB;IAAiCC,KAAK,EAAE;EAAxC,CAJe;EAK5BC,IAAI,eACF;IAAK,IAAI,EAAC,KAAV;IAAgB,KAAK,EAAC,IAAtB;IAA2B,MAAM,EAAC,IAAlC;IAAuC,OAAO,EAAC,aAA/C;IAAA,uBACE;MACE,IAAI,EAAC,cADP;MAEE,CAAC,EAAC;IAFJ;EADF,EAN0B;EAa5BC,OAAO,EAAE,iBAACC,KAAD,EAAmBC,GAAnB,EAA4C;IACnD;IACA,IAAMC,iBAAiB,GAAG,IAAAC,yBAAA,EAAW;MAAEC,IAAI,EAAEJ,KAAK,CAACI,IAAd;MAAoBC,SAAS,EAAEL,KAAK,CAACK;IAArC,CAAX,CAA1B;IACA,IAAMC,MAAM,GAAGL,GAAG,CAACM,iBAAJ,CAAsBL,iBAAtB,CAAf,CAHmD,CAInD;;IACA,IAAMM,MAAM,GAAGP,GAAG,CAACQ,gBAAJ,aAA0BH,MAAM,CAACI,YAAjC,QAAf,CALmD,CAMnD;;IACAT,GAAG,CAACM,iBAAJ,CAAsB;MACpBI,KAAK,EAAEH,MAAM,CAACH,SAAP,CAAiBO,GAAjB,GAAuB,CAAvB,GAA2BN,MAAM,CAACI,YAAP,CAAoBG,MADlC;MAEpBD,GAAG,EAAEJ,MAAM,CAACH,SAAP,CAAiBO,GAAjB,GAAuB;IAFR,CAAtB;EAID;AAxB2B,CAAvB"
|
|
34
34
|
}
|
package/lib/commands/code.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
package/lib/commands/group.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
@@ -16,7 +16,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
17
|
|
|
18
18
|
var group = function group(arr, options) {
|
|
19
|
-
var data = (0, _objectSpread2
|
|
19
|
+
var data = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({
|
|
20
20
|
children: arr,
|
|
21
21
|
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
|
|
22
22
|
width: "12",
|
|
@@ -34,9 +34,9 @@ var group = function group(arr, options) {
|
|
|
34
34
|
|
|
35
35
|
if (Array.isArray(data.children)) {
|
|
36
36
|
data.children = data.children.map(function (_ref) {
|
|
37
|
-
var item = (0, _extends2
|
|
37
|
+
var item = (0, _extends2["default"])({}, _ref);
|
|
38
38
|
item.parent = data;
|
|
39
|
-
return (0, _objectSpread2
|
|
39
|
+
return (0, _objectSpread2["default"])({}, item);
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
"sourcesContent": [
|
|
22
22
|
"import React from 'react';\nimport { ICommand, ICommandChildCommands, ICommandChildHandle } from './';\n\nexport type GroupOptions = Omit<ICommand<string>, 'children'> & {\n children?: ICommandChildHandle['children'];\n};\n\nexport const group = (arr: ICommandChildCommands['children'], options?: GroupOptions): ICommand<string> => {\n let data = {\n children: arr as any,\n icon: (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 520 520\">\n <path\n fill=\"currentColor\"\n d=\"M15.7083333,468 C7.03242448,468 0,462.030833 0,454.666667 L0,421.333333 C0,413.969167 7.03242448,408 15.7083333,408 L361.291667,408 C369.967576,408 377,413.969167 377,421.333333 L377,454.666667 C377,462.030833 369.967576,468 361.291667,468 L15.7083333,468 Z M21.6666667,366 C9.69989583,366 0,359.831861 0,352.222222 L0,317.777778 C0,310.168139 9.69989583,304 21.6666667,304 L498.333333,304 C510.300104,304 520,310.168139 520,317.777778 L520,352.222222 C520,359.831861 510.300104,366 498.333333,366 L21.6666667,366 Z M136.835938,64 L136.835937,126 L107.25,126 L107.25,251 L40.75,251 L40.75,126 L-5.68434189e-14,126 L-5.68434189e-14,64 L136.835938,64 Z M212,64 L212,251 L161.648438,251 L161.648438,64 L212,64 Z M378,64 L378,126 L343.25,126 L343.25,251 L281.75,251 L281.75,126 L238,126 L238,64 L378,64 Z M449.047619,189.550781 L520,189.550781 L520,251 L405,251 L405,64 L449.047619,64 L449.047619,189.550781 Z\"\n />\n </svg>\n ),\n execute: () => {},\n ...options,\n keyCommand: 'group',\n };\n if (Array.isArray(data.children)) {\n data.children = data.children.map(({ ...item }: ICommand) => {\n item.parent = data;\n return { ...item };\n });\n }\n return data;\n};\n"
|
|
23
23
|
],
|
|
24
|
-
"mappings": ";;;;;;;;;;;;;AAAA;;;;AAOO,IAAMA,KAAK,GAAG,SAARA,KAAQ,CAACC,GAAD,EAAyCC,OAAzC,EAAsF;EACzG,IAAIC,IAAI;IACNC,QAAQ,EAAEH,GADJ;IAENI,IAAI,eACF;MAAK,KAAK,EAAC,IAAX;MAAgB,MAAM,EAAC,IAAvB;MAA4B,OAAO,EAAC,aAApC;MAAA,uBACE;QACE,IAAI,EAAC,cADP;QAEE,CAAC,EAAC;MAFJ;IADF,EAHI;IAUNC,OAAO,EAAE,mBAAM,CAAE;EAVX,GAWHJ,OAXG;IAYNK,UAAU,EAAE;EAZN,EAAR;;EAcA,IAAIC,KAAK,CAACC,OAAN,CAAcN,IAAI,CAACC,QAAnB,CAAJ,EAAkC;IAChCD,IAAI,CAACC,QAAL,GAAgBD,IAAI,CAACC,QAAL,CAAcM,GAAd,CAAkB,gBAA2B;MAAA,IAArBC,IAAqB;MAC3DA,IAAI,CAACC,MAAL,GAAcT,IAAd;MACA,
|
|
24
|
+
"mappings": ";;;;;;;;;;;;;AAAA;;;;AAOO,IAAMA,KAAK,GAAG,SAARA,KAAQ,CAACC,GAAD,EAAyCC,OAAzC,EAAsF;EACzG,IAAIC,IAAI;IACNC,QAAQ,EAAEH,GADJ;IAENI,IAAI,eACF;MAAK,KAAK,EAAC,IAAX;MAAgB,MAAM,EAAC,IAAvB;MAA4B,OAAO,EAAC,aAApC;MAAA,uBACE;QACE,IAAI,EAAC,cADP;QAEE,CAAC,EAAC;MAFJ;IADF,EAHI;IAUNC,OAAO,EAAE,mBAAM,CAAE;EAVX,GAWHJ,OAXG;IAYNK,UAAU,EAAE;EAZN,EAAR;;EAcA,IAAIC,KAAK,CAACC,OAAN,CAAcN,IAAI,CAACC,QAAnB,CAAJ,EAAkC;IAChCD,IAAI,CAACC,QAAL,GAAgBD,IAAI,CAACC,QAAL,CAAcM,GAAd,CAAkB,gBAA2B;MAAA,IAArBC,IAAqB;MAC3DA,IAAI,CAACC,MAAL,GAAcT,IAAd;MACA,0CAAYQ,IAAZ;IACD,CAHe,CAAhB;EAID;;EACD,OAAOR,IAAP;AACD,CAtBM"
|
|
25
25
|
}
|
package/lib/commands/hr.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
package/lib/commands/image.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
package/lib/commands/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
@@ -234,8 +234,8 @@ function getStateFromTextArea(textArea) {
|
|
|
234
234
|
|
|
235
235
|
var TextAreaTextApi = /*#__PURE__*/function () {
|
|
236
236
|
function TextAreaTextApi(textArea) {
|
|
237
|
-
(0, _classCallCheck2
|
|
238
|
-
(0, _defineProperty2
|
|
237
|
+
(0, _classCallCheck2["default"])(this, TextAreaTextApi);
|
|
238
|
+
(0, _defineProperty2["default"])(this, "textArea", void 0);
|
|
239
239
|
this.textArea = textArea;
|
|
240
240
|
}
|
|
241
241
|
/**
|
|
@@ -245,7 +245,7 @@ var TextAreaTextApi = /*#__PURE__*/function () {
|
|
|
245
245
|
*/
|
|
246
246
|
|
|
247
247
|
|
|
248
|
-
(0, _createClass2
|
|
248
|
+
(0, _createClass2["default"])(TextAreaTextApi, [{
|
|
249
249
|
key: "replaceSelection",
|
|
250
250
|
value: function replaceSelection(text) {
|
|
251
251
|
(0, _InsertTextAtPosition.insertTextAtPosition)(this.textArea, text);
|
|
@@ -272,14 +272,14 @@ exports.TextAreaTextApi = TextAreaTextApi;
|
|
|
272
272
|
|
|
273
273
|
var TextAreaCommandOrchestrator = /*#__PURE__*/function () {
|
|
274
274
|
function TextAreaCommandOrchestrator(textArea) {
|
|
275
|
-
(0, _classCallCheck2
|
|
276
|
-
(0, _defineProperty2
|
|
277
|
-
(0, _defineProperty2
|
|
275
|
+
(0, _classCallCheck2["default"])(this, TextAreaCommandOrchestrator);
|
|
276
|
+
(0, _defineProperty2["default"])(this, "textArea", void 0);
|
|
277
|
+
(0, _defineProperty2["default"])(this, "textApi", void 0);
|
|
278
278
|
this.textArea = textArea;
|
|
279
279
|
this.textApi = new TextAreaTextApi(textArea);
|
|
280
280
|
}
|
|
281
281
|
|
|
282
|
-
(0, _createClass2
|
|
282
|
+
(0, _createClass2["default"])(TextAreaCommandOrchestrator, [{
|
|
283
283
|
key: "getState",
|
|
284
284
|
value: function getState() {
|
|
285
285
|
if (!this.textArea) return false;
|
package/lib/commands/italic.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
package/lib/commands/link.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
package/lib/commands/list.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
package/lib/commands/preview.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
package/lib/commands/quote.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
package/lib/commands/title.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
@@ -15,7 +15,7 @@ var _title = require("./title2");
|
|
|
15
15
|
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
17
|
|
|
18
|
-
var title = (0, _objectSpread2
|
|
18
|
+
var title = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, _title.title2), {}, {
|
|
19
19
|
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
|
|
20
20
|
width: "12",
|
|
21
21
|
height: "12",
|
|
@@ -11,5 +11,5 @@
|
|
|
11
11
|
"sourcesContent": [
|
|
12
12
|
"import React from 'react';\nimport { ICommand } from './';\nimport { title2 } from './title2';\n\nexport const title: ICommand = {\n ...title2,\n icon: (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 520 520\">\n <path\n fill=\"currentColor\"\n d=\"M15.7083333,468 C7.03242448,468 0,462.030833 0,454.666667 L0,421.333333 C0,413.969167 7.03242448,408 15.7083333,408 L361.291667,408 C369.967576,408 377,413.969167 377,421.333333 L377,454.666667 C377,462.030833 369.967576,468 361.291667,468 L15.7083333,468 Z M21.6666667,366 C9.69989583,366 0,359.831861 0,352.222222 L0,317.777778 C0,310.168139 9.69989583,304 21.6666667,304 L498.333333,304 C510.300104,304 520,310.168139 520,317.777778 L520,352.222222 C520,359.831861 510.300104,366 498.333333,366 L21.6666667,366 Z M136.835938,64 L136.835937,126 L107.25,126 L107.25,251 L40.75,251 L40.75,126 L-5.68434189e-14,126 L-5.68434189e-14,64 L136.835938,64 Z M212,64 L212,251 L161.648438,251 L161.648438,64 L212,64 Z M378,64 L378,126 L343.25,126 L343.25,251 L281.75,251 L281.75,126 L238,126 L238,64 L378,64 Z M449.047619,189.550781 L520,189.550781 L520,251 L405,251 L405,64 L449.047619,64 L449.047619,189.550781 Z\"\n />\n </svg>\n ),\n};\n"
|
|
13
13
|
],
|
|
14
|
-
"mappings": ";;;;;;;;;;;AAAA;;AAEA;;;;AAEO,IAAMA,KAAe
|
|
14
|
+
"mappings": ";;;;;;;;;;;AAAA;;AAEA;;;;AAEO,IAAMA,KAAe,qEACvBC,aADuB;EAE1BC,IAAI,eACF;IAAK,KAAK,EAAC,IAAX;IAAgB,MAAM,EAAC,IAAvB;IAA4B,OAAO,EAAC,aAApC;IAAA,uBACE;MACE,IAAI,EAAC,cADP;MAEE,CAAC,EAAC;IAFJ;EADF;AAHwB,EAArB"
|
|
15
15
|
}
|
package/lib/commands/title1.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
package/lib/commands/title2.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
package/lib/commands/title3.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
package/lib/commands/title4.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
package/lib/commands/title5.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
package/lib/commands/title6.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports
|
|
8
|
+
exports["default"] = void 0;
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
|
|
@@ -70,6 +70,6 @@ var DragBar = function DragBar(props) {
|
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
var _default = DragBar;
|
|
73
|
-
exports
|
|
73
|
+
exports["default"] = _default;
|
|
74
74
|
module.exports = exports.default;
|
|
75
75
|
//# sourceMappingURL=index.js.map
|