@uiw/react-codemirror 3.2.9 → 3.2.10
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/esm/index.js +6 -18
- package/esm/index.js.map +12 -2
- package/lib/index.js +48 -78
- package/lib/index.js.map +51 -5
- package/package.json +1 -1
- package/src/index.js +1 -1
package/esm/index.js
CHANGED
|
@@ -14,12 +14,10 @@ var defaultOptions = {
|
|
|
14
14
|
lineNumbers: true,
|
|
15
15
|
fullScreen: true
|
|
16
16
|
};
|
|
17
|
-
|
|
18
17
|
function ReactCodeMirror(props, ref) {
|
|
19
18
|
if (props === void 0) {
|
|
20
19
|
props = {};
|
|
21
20
|
}
|
|
22
|
-
|
|
23
21
|
var {
|
|
24
22
|
options = {},
|
|
25
23
|
value = '',
|
|
@@ -34,8 +32,9 @@ function ReactCodeMirror(props, ref) {
|
|
|
34
32
|
editor,
|
|
35
33
|
textarea: textareaRef.current
|
|
36
34
|
}), [editor, textareaRef]);
|
|
37
|
-
lastestProps.current = props;
|
|
35
|
+
lastestProps.current = props;
|
|
38
36
|
|
|
37
|
+
// 将props中所有的事件处理函数映射并保存
|
|
39
38
|
function getEventHandleFromProps() {
|
|
40
39
|
var propNames = Object.keys(props);
|
|
41
40
|
var eventHandle = propNames.filter(keyName => {
|
|
@@ -44,36 +43,30 @@ function ReactCodeMirror(props, ref) {
|
|
|
44
43
|
var eventDict = {};
|
|
45
44
|
eventHandle.forEach(ele => {
|
|
46
45
|
var name = ele.slice(2);
|
|
47
|
-
|
|
48
46
|
if (name && name[0]) {
|
|
49
47
|
eventDict[ele] = name.replace(name[0], name[0].toLowerCase());
|
|
50
48
|
}
|
|
51
49
|
});
|
|
52
50
|
return eventDict;
|
|
53
|
-
}
|
|
54
|
-
|
|
51
|
+
}
|
|
55
52
|
|
|
53
|
+
// http://codemirror.net/doc/manual.html#config
|
|
56
54
|
function setOptions(_x, _x2) {
|
|
57
55
|
return _setOptions.apply(this, arguments);
|
|
58
56
|
}
|
|
59
|
-
|
|
60
57
|
function _setOptions() {
|
|
61
58
|
_setOptions = _asyncToGenerator(function* (instance, opt) {
|
|
62
59
|
if (opt === void 0) {
|
|
63
60
|
opt = {};
|
|
64
61
|
}
|
|
65
|
-
|
|
66
62
|
if (typeof opt === 'object' && window) {
|
|
67
63
|
var mode = CodeMirror.findModeByName(opt.mode || '');
|
|
68
|
-
|
|
69
64
|
if (lazyLoadMode && mode && mode.mode) {
|
|
70
65
|
yield import("codemirror/mode/" + mode.mode + "/" + mode.mode + ".js");
|
|
71
66
|
}
|
|
72
|
-
|
|
73
67
|
if (mode) {
|
|
74
68
|
opt.mode = mode.mime;
|
|
75
69
|
}
|
|
76
|
-
|
|
77
70
|
Object.keys(opt).forEach(name => {
|
|
78
71
|
if ((opt[name] || opt[name] === false) && JSON.stringify(opt[name])) {
|
|
79
72
|
instance.setOption(name, opt[name]);
|
|
@@ -83,7 +76,6 @@ function ReactCodeMirror(props, ref) {
|
|
|
83
76
|
});
|
|
84
77
|
return _setOptions.apply(this, arguments);
|
|
85
78
|
}
|
|
86
|
-
|
|
87
79
|
useEffect(() => {
|
|
88
80
|
if (!editor && window) {
|
|
89
81
|
// 生成codemirror实例
|
|
@@ -95,16 +87,13 @@ function ReactCodeMirror(props, ref) {
|
|
|
95
87
|
});
|
|
96
88
|
});
|
|
97
89
|
instance.setValue(value || '');
|
|
98
|
-
|
|
99
90
|
if (width || height) {
|
|
100
91
|
// 设置尺寸
|
|
101
92
|
instance.setSize(width, height);
|
|
102
93
|
}
|
|
103
|
-
|
|
104
94
|
setEditor(instance);
|
|
105
95
|
setOptions(instance, _extends({}, defaultOptions, options));
|
|
106
96
|
}
|
|
107
|
-
|
|
108
97
|
return () => {
|
|
109
98
|
if (editor && window) {
|
|
110
99
|
editor.toTextArea();
|
|
@@ -115,7 +104,6 @@ function ReactCodeMirror(props, ref) {
|
|
|
115
104
|
useMemo(() => {
|
|
116
105
|
if (!editor || !window) return;
|
|
117
106
|
var val = editor.getValue();
|
|
118
|
-
|
|
119
107
|
if (value !== undefined && value !== val) {
|
|
120
108
|
editor.setValue(value);
|
|
121
109
|
}
|
|
@@ -129,9 +117,9 @@ function ReactCodeMirror(props, ref) {
|
|
|
129
117
|
setOptions(editor, _extends({}, defaultOptions, options));
|
|
130
118
|
}, [editor, options]);
|
|
131
119
|
return /*#__PURE__*/_jsx("textarea", {
|
|
132
|
-
ref: textareaRef
|
|
120
|
+
ref: textareaRef,
|
|
121
|
+
children: value
|
|
133
122
|
});
|
|
134
123
|
}
|
|
135
|
-
|
|
136
124
|
export default /*#__PURE__*/React.forwardRef(ReactCodeMirror);
|
|
137
125
|
//# sourceMappingURL=index.js.map
|
package/esm/index.js.map
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
"useState",
|
|
9
9
|
"useMemo",
|
|
10
10
|
"CodeMirror",
|
|
11
|
+
"jsx",
|
|
12
|
+
"_jsx",
|
|
11
13
|
"defaultOptions",
|
|
12
14
|
"tabSize",
|
|
13
15
|
"autoCloseBrackets",
|
|
@@ -45,6 +47,12 @@
|
|
|
45
47
|
"replace",
|
|
46
48
|
"toLowerCase",
|
|
47
49
|
"setOptions",
|
|
50
|
+
"_x",
|
|
51
|
+
"_x2",
|
|
52
|
+
"_setOptions",
|
|
53
|
+
"apply",
|
|
54
|
+
"arguments",
|
|
55
|
+
"_asyncToGenerator",
|
|
48
56
|
"instance",
|
|
49
57
|
"opt",
|
|
50
58
|
"window",
|
|
@@ -55,6 +63,7 @@
|
|
|
55
63
|
"stringify",
|
|
56
64
|
"setOption",
|
|
57
65
|
"fromTextArea",
|
|
66
|
+
"_extends",
|
|
58
67
|
"event",
|
|
59
68
|
"on",
|
|
60
69
|
"setValue",
|
|
@@ -63,13 +72,14 @@
|
|
|
63
72
|
"undefined",
|
|
64
73
|
"val",
|
|
65
74
|
"getValue",
|
|
75
|
+
"children",
|
|
66
76
|
"forwardRef"
|
|
67
77
|
],
|
|
68
78
|
"sources": [
|
|
69
79
|
"../src/index.js"
|
|
70
80
|
],
|
|
71
81
|
"sourcesContent": [
|
|
72
|
-
"import React, { useRef, useEffect, useImperativeHandle, useState, useMemo } from 'react';\nimport CodeMirror from 'codemirror';\nimport 'codemirror/mode/meta';\nimport './codemirror.css';\n\nconst defaultOptions = {\n tabSize: 2,\n autoCloseBrackets: true,\n matchBrackets: true,\n showCursorWhenSelecting: true,\n // 显示行号\n lineNumbers: true,\n fullScreen: true,\n}\n\nfunction ReactCodeMirror(props = {}, ref) {\n const { options = {}, value = '', width = '100%', height = '100%', lazyLoadMode = true } = props;\n const [editor, setEditor] = useState();\n const textareaRef = useRef();\n const lastestProps = useRef(props);\n\n useImperativeHandle(ref, () => ({ editor, textarea: textareaRef.current }), [editor, textareaRef]);\n lastestProps.current = props;\n \n // 将props中所有的事件处理函数映射并保存\n function getEventHandleFromProps() {\n const propNames = Object.keys(props);\n const eventHandle = propNames.filter((keyName) => {\n return /^on+/.test(keyName);\n });\n\n const eventDict = {};\n eventHandle.forEach((ele) => {\n const name = ele.slice(2);\n if (name && name[0]) {\n eventDict[ele] = name.replace(name[0], name[0].toLowerCase());\n }\n });\n\n return eventDict;\n }\n\n // http://codemirror.net/doc/manual.html#config\n async function setOptions(instance, opt = {}) {\n if (typeof opt === 'object' && window) {\n const mode = CodeMirror.findModeByName(opt.mode || '');\n if (lazyLoadMode && mode && mode.mode) {\n await import(`codemirror/mode/${mode.mode}/${mode.mode}.js`);\n }\n if (mode) {\n opt.mode = mode.mime;\n }\n Object.keys(opt).forEach((name) => {\n if ((opt[name] || opt[name] === false) && JSON.stringify(opt[name])) {\n instance.setOption(name, opt[name]);\n }\n });\n }\n }\n\n useEffect(() => {\n if (!editor && window) {\n // 生成codemirror实例\n const instance = CodeMirror.fromTextArea(textareaRef.current, {...defaultOptions, ...options});\n const eventDict = getEventHandleFromProps();\n Object.keys(eventDict).forEach((event) => {\n instance.on(eventDict[event], (...params) => lastestProps.current[event](...params));\n });\n instance.setValue(value || '');\n\n if (width || height) {\n // 设置尺寸\n instance.setSize(width, height);\n }\n setEditor(instance);\n setOptions(instance, {...defaultOptions, ...options});\n }\n return () => {\n if (editor && window) {\n editor.toTextArea();\n setEditor(undefined);\n }\n }\n }, []);\n\n useMemo(() => {\n if (!editor || !window) return;\n const val = editor.getValue();\n if (value !== undefined && value !== val) {\n editor.setValue(value);\n }\n }, [value]);\n\n useMemo(() => {\n if (!editor || !window) return;\n editor.setSize(width, height);\n }, [width, height]);\n\n\n useMemo(() => {\n if (!editor || !window) return;\n setOptions(editor, {...defaultOptions, ...options});\n }, [editor, options]);\n \n return (\n <textarea ref={textareaRef}
|
|
82
|
+
"import React, { useRef, useEffect, useImperativeHandle, useState, useMemo } from 'react';\nimport CodeMirror from 'codemirror';\nimport 'codemirror/mode/meta';\nimport './codemirror.css';\n\nconst defaultOptions = {\n tabSize: 2,\n autoCloseBrackets: true,\n matchBrackets: true,\n showCursorWhenSelecting: true,\n // 显示行号\n lineNumbers: true,\n fullScreen: true,\n}\n\nfunction ReactCodeMirror(props = {}, ref) {\n const { options = {}, value = '', width = '100%', height = '100%', lazyLoadMode = true } = props;\n const [editor, setEditor] = useState();\n const textareaRef = useRef();\n const lastestProps = useRef(props);\n\n useImperativeHandle(ref, () => ({ editor, textarea: textareaRef.current }), [editor, textareaRef]);\n lastestProps.current = props;\n \n // 将props中所有的事件处理函数映射并保存\n function getEventHandleFromProps() {\n const propNames = Object.keys(props);\n const eventHandle = propNames.filter((keyName) => {\n return /^on+/.test(keyName);\n });\n\n const eventDict = {};\n eventHandle.forEach((ele) => {\n const name = ele.slice(2);\n if (name && name[0]) {\n eventDict[ele] = name.replace(name[0], name[0].toLowerCase());\n }\n });\n\n return eventDict;\n }\n\n // http://codemirror.net/doc/manual.html#config\n async function setOptions(instance, opt = {}) {\n if (typeof opt === 'object' && window) {\n const mode = CodeMirror.findModeByName(opt.mode || '');\n if (lazyLoadMode && mode && mode.mode) {\n await import(`codemirror/mode/${mode.mode}/${mode.mode}.js`);\n }\n if (mode) {\n opt.mode = mode.mime;\n }\n Object.keys(opt).forEach((name) => {\n if ((opt[name] || opt[name] === false) && JSON.stringify(opt[name])) {\n instance.setOption(name, opt[name]);\n }\n });\n }\n }\n\n useEffect(() => {\n if (!editor && window) {\n // 生成codemirror实例\n const instance = CodeMirror.fromTextArea(textareaRef.current, {...defaultOptions, ...options});\n const eventDict = getEventHandleFromProps();\n Object.keys(eventDict).forEach((event) => {\n instance.on(eventDict[event], (...params) => lastestProps.current[event](...params));\n });\n instance.setValue(value || '');\n\n if (width || height) {\n // 设置尺寸\n instance.setSize(width, height);\n }\n setEditor(instance);\n setOptions(instance, {...defaultOptions, ...options});\n }\n return () => {\n if (editor && window) {\n editor.toTextArea();\n setEditor(undefined);\n }\n }\n }, []);\n\n useMemo(() => {\n if (!editor || !window) return;\n const val = editor.getValue();\n if (value !== undefined && value !== val) {\n editor.setValue(value);\n }\n }, [value]);\n\n useMemo(() => {\n if (!editor || !window) return;\n editor.setSize(width, height);\n }, [width, height]);\n\n\n useMemo(() => {\n if (!editor || !window) return;\n setOptions(editor, {...defaultOptions, ...options});\n }, [editor, options]);\n \n return (\n <textarea ref={textareaRef}>{value}</textarea>\n );\n}\n\nexport default React.forwardRef(ReactCodeMirror);\n"
|
|
73
83
|
],
|
|
74
|
-
"mappings": ";;AAAA,OAAOA,
|
|
84
|
+
"mappings": ";;AAAA,OAAOA,KAAK,IAAIC,MAAM,EAAEC,SAAS,EAAEC,mBAAmB,EAAEC,QAAQ,EAAEC,OAAO,QAAQ,OAAO;AACxF,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAO,sBAAsB;AAC7B,OAAO,kBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE1B,IAAMC,cAAc,GAAG;EACrBC,OAAO,EAAE,CAAC;EACVC,iBAAiB,EAAE,IAAI;EACvBC,aAAa,EAAE,IAAI;EACnBC,uBAAuB,EAAE,IAAI;EAC7B;EACAC,WAAW,EAAE,IAAI;EACjBC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CAAC,EAAE,CAACD,KAAK,EAAEC,MAAM,CAAC,CAAC;EAGnBjB,OAAO,CAAC,MAAM;IACZ,IAAI,CAACmB,MAAM,IAAI,CAAC8B,MAAM,EAAE;IACxBT,UAAU,CAACrB,MAAM,EAAAsC,QAAA,KAAMrD,cAAc,EAAKU,OAAO,EAAE;EACrD,CAAC,EAAE,CAACK,MAAM,EAAEL,OAAO,CAAC,CAAC;EAErB,oBACEX,IAAA;IAAUU,GAAG,EAAEQ,WAAY;IAAA6C,QAAA,EAAEnD;EAAK,EAAY;AAElD;AAEA,4BAAepB,KAAK,CAACwE,UAAU,CAACxD,eAAe,CAAC"
|
|
75
85
|
}
|
package/lib/index.js
CHANGED
|
@@ -1,34 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireWildcard3 = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
-
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.default = void 0;
|
|
11
|
-
|
|
12
9
|
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
|
|
13
|
-
|
|
14
10
|
var _interopRequireWildcard2 = _interopRequireDefault(require("@babel/runtime/helpers/interopRequireWildcard"));
|
|
15
|
-
|
|
16
11
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
17
|
-
|
|
18
12
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
19
|
-
|
|
20
13
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
21
|
-
|
|
22
14
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
23
|
-
|
|
24
15
|
var _react = _interopRequireWildcard3(require("react"));
|
|
25
|
-
|
|
26
16
|
var _codemirror = _interopRequireDefault(require("codemirror"));
|
|
27
|
-
|
|
28
17
|
require("codemirror/mode/meta");
|
|
29
|
-
|
|
30
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
31
|
-
|
|
32
19
|
var defaultOptions = {
|
|
33
20
|
tabSize: 2,
|
|
34
21
|
autoCloseBrackets: true,
|
|
@@ -38,26 +25,23 @@ var defaultOptions = {
|
|
|
38
25
|
lineNumbers: true,
|
|
39
26
|
fullScreen: true
|
|
40
27
|
};
|
|
41
|
-
|
|
42
28
|
function ReactCodeMirror() {
|
|
43
29
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
44
30
|
var ref = arguments.length > 1 ? arguments[1] : undefined;
|
|
45
31
|
var _props$options = props.options,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
32
|
+
options = _props$options === void 0 ? {} : _props$options,
|
|
33
|
+
_props$value = props.value,
|
|
34
|
+
value = _props$value === void 0 ? '' : _props$value,
|
|
35
|
+
_props$width = props.width,
|
|
36
|
+
width = _props$width === void 0 ? '100%' : _props$width,
|
|
37
|
+
_props$height = props.height,
|
|
38
|
+
height = _props$height === void 0 ? '100%' : _props$height,
|
|
39
|
+
_props$lazyLoadMode = props.lazyLoadMode,
|
|
40
|
+
lazyLoadMode = _props$lazyLoadMode === void 0 ? true : _props$lazyLoadMode;
|
|
56
41
|
var _useState = (0, _react.useState)(),
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
42
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
43
|
+
editor = _useState2[0],
|
|
44
|
+
setEditor = _useState2[1];
|
|
61
45
|
var textareaRef = (0, _react.useRef)();
|
|
62
46
|
var lastestProps = (0, _react.useRef)(props);
|
|
63
47
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
@@ -66,8 +50,9 @@ function ReactCodeMirror() {
|
|
|
66
50
|
textarea: textareaRef.current
|
|
67
51
|
};
|
|
68
52
|
}, [editor, textareaRef]);
|
|
69
|
-
lastestProps.current = props;
|
|
53
|
+
lastestProps.current = props;
|
|
70
54
|
|
|
55
|
+
// 将props中所有的事件处理函数映射并保存
|
|
71
56
|
function getEventHandleFromProps() {
|
|
72
57
|
var propNames = Object.keys(props);
|
|
73
58
|
var eventHandle = propNames.filter(function (keyName) {
|
|
@@ -76,92 +61,79 @@ function ReactCodeMirror() {
|
|
|
76
61
|
var eventDict = {};
|
|
77
62
|
eventHandle.forEach(function (ele) {
|
|
78
63
|
var name = ele.slice(2);
|
|
79
|
-
|
|
80
64
|
if (name && name[0]) {
|
|
81
65
|
eventDict[ele] = name.replace(name[0], name[0].toLowerCase());
|
|
82
66
|
}
|
|
83
67
|
});
|
|
84
68
|
return eventDict;
|
|
85
|
-
}
|
|
86
|
-
|
|
69
|
+
}
|
|
87
70
|
|
|
71
|
+
// http://codemirror.net/doc/manual.html#config
|
|
88
72
|
function setOptions(_x) {
|
|
89
73
|
return _setOptions.apply(this, arguments);
|
|
90
74
|
}
|
|
91
|
-
|
|
92
75
|
function _setOptions() {
|
|
93
76
|
_setOptions = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(instance) {
|
|
94
77
|
var opt,
|
|
95
|
-
|
|
96
|
-
|
|
78
|
+
mode,
|
|
79
|
+
_args = arguments;
|
|
97
80
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
98
|
-
while (1) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
mode = _codemirror.default.findModeByName(opt.mode || '');
|
|
109
|
-
|
|
110
|
-
if (!(lazyLoadMode && mode && mode.mode)) {
|
|
111
|
-
_context.next = 6;
|
|
112
|
-
break;
|
|
113
|
-
}
|
|
114
|
-
|
|
81
|
+
while (1) switch (_context.prev = _context.next) {
|
|
82
|
+
case 0:
|
|
83
|
+
opt = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
|
84
|
+
if (!((0, _typeof2.default)(opt) === 'object' && window)) {
|
|
85
|
+
_context.next = 8;
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
mode = _codemirror.default.findModeByName(opt.mode || '');
|
|
89
|
+
if (!(lazyLoadMode && mode && mode.mode)) {
|
|
115
90
|
_context.next = 6;
|
|
116
|
-
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
_context.next = 6;
|
|
94
|
+
return function (specifier) {
|
|
95
|
+
return new Promise(function (r) {
|
|
96
|
+
return r(specifier);
|
|
97
|
+
}).then(function (s) {
|
|
117
98
|
return (0, _interopRequireWildcard2.default)(require(s));
|
|
118
99
|
});
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
100
|
+
}("codemirror/mode/".concat(mode.mode, "/").concat(mode.mode, ".js"));
|
|
101
|
+
case 6:
|
|
102
|
+
if (mode) {
|
|
103
|
+
opt.mode = mode.mime;
|
|
104
|
+
}
|
|
105
|
+
Object.keys(opt).forEach(function (name) {
|
|
106
|
+
if ((opt[name] || opt[name] === false) && JSON.stringify(opt[name])) {
|
|
107
|
+
instance.setOption(name, opt[name]);
|
|
123
108
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
case 8:
|
|
132
|
-
case "end":
|
|
133
|
-
return _context.stop();
|
|
134
|
-
}
|
|
109
|
+
});
|
|
110
|
+
case 8:
|
|
111
|
+
case "end":
|
|
112
|
+
return _context.stop();
|
|
135
113
|
}
|
|
136
114
|
}, _callee);
|
|
137
115
|
}));
|
|
138
116
|
return _setOptions.apply(this, arguments);
|
|
139
117
|
}
|
|
140
|
-
|
|
141
118
|
(0, _react.useEffect)(function () {
|
|
142
119
|
if (!editor && window) {
|
|
143
120
|
// 生成codemirror实例
|
|
144
121
|
var instance = _codemirror.default.fromTextArea(textareaRef.current, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, defaultOptions), options));
|
|
145
|
-
|
|
146
122
|
var eventDict = getEventHandleFromProps();
|
|
147
123
|
Object.keys(eventDict).forEach(function (event) {
|
|
148
124
|
instance.on(eventDict[event], function () {
|
|
149
125
|
var _lastestProps$current;
|
|
150
|
-
|
|
151
126
|
return (_lastestProps$current = lastestProps.current)[event].apply(_lastestProps$current, arguments);
|
|
152
127
|
});
|
|
153
128
|
});
|
|
154
129
|
instance.setValue(value || '');
|
|
155
|
-
|
|
156
130
|
if (width || height) {
|
|
157
131
|
// 设置尺寸
|
|
158
132
|
instance.setSize(width, height);
|
|
159
133
|
}
|
|
160
|
-
|
|
161
134
|
setEditor(instance);
|
|
162
135
|
setOptions(instance, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, defaultOptions), options));
|
|
163
136
|
}
|
|
164
|
-
|
|
165
137
|
return function () {
|
|
166
138
|
if (editor && window) {
|
|
167
139
|
editor.toTextArea();
|
|
@@ -172,7 +144,6 @@ function ReactCodeMirror() {
|
|
|
172
144
|
(0, _react.useMemo)(function () {
|
|
173
145
|
if (!editor || !window) return;
|
|
174
146
|
var val = editor.getValue();
|
|
175
|
-
|
|
176
147
|
if (value !== undefined && value !== val) {
|
|
177
148
|
editor.setValue(value);
|
|
178
149
|
}
|
|
@@ -186,12 +157,11 @@ function ReactCodeMirror() {
|
|
|
186
157
|
setOptions(editor, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, defaultOptions), options));
|
|
187
158
|
}, [editor, options]);
|
|
188
159
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("textarea", {
|
|
189
|
-
ref: textareaRef
|
|
160
|
+
ref: textareaRef,
|
|
161
|
+
children: value
|
|
190
162
|
});
|
|
191
163
|
}
|
|
192
|
-
|
|
193
164
|
var _default = /*#__PURE__*/_react.default.forwardRef(ReactCodeMirror);
|
|
194
|
-
|
|
195
165
|
exports.default = _default;
|
|
196
166
|
module.exports = exports.default;
|
|
197
167
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"names": [
|
|
4
|
+
"_react",
|
|
5
|
+
"_interopRequireWildcard3",
|
|
6
|
+
"require",
|
|
7
|
+
"_codemirror",
|
|
8
|
+
"_interopRequireDefault",
|
|
9
|
+
"_jsxRuntime",
|
|
4
10
|
"defaultOptions",
|
|
5
11
|
"tabSize",
|
|
6
12
|
"autoCloseBrackets",
|
|
@@ -10,13 +16,25 @@
|
|
|
10
16
|
"fullScreen",
|
|
11
17
|
"ReactCodeMirror",
|
|
12
18
|
"props",
|
|
19
|
+
"arguments",
|
|
20
|
+
"length",
|
|
21
|
+
"undefined",
|
|
13
22
|
"ref",
|
|
23
|
+
"_props$options",
|
|
14
24
|
"options",
|
|
25
|
+
"_props$value",
|
|
15
26
|
"value",
|
|
27
|
+
"_props$width",
|
|
16
28
|
"width",
|
|
29
|
+
"_props$height",
|
|
17
30
|
"height",
|
|
31
|
+
"_props$lazyLoadMode",
|
|
18
32
|
"lazyLoadMode",
|
|
33
|
+
"_useState",
|
|
19
34
|
"useState",
|
|
35
|
+
"_useState2",
|
|
36
|
+
"_slicedToArray2",
|
|
37
|
+
"default",
|
|
20
38
|
"editor",
|
|
21
39
|
"setEditor",
|
|
22
40
|
"textareaRef",
|
|
@@ -41,35 +59,63 @@
|
|
|
41
59
|
"replace",
|
|
42
60
|
"toLowerCase",
|
|
43
61
|
"setOptions",
|
|
62
|
+
"_x",
|
|
63
|
+
"_setOptions",
|
|
64
|
+
"apply",
|
|
65
|
+
"_asyncToGenerator2",
|
|
66
|
+
"_regeneratorRuntime2",
|
|
67
|
+
"mark",
|
|
68
|
+
"_callee",
|
|
44
69
|
"instance",
|
|
45
70
|
"opt",
|
|
46
|
-
"window",
|
|
47
71
|
"mode",
|
|
72
|
+
"_args",
|
|
73
|
+
"wrap",
|
|
74
|
+
"_callee$",
|
|
75
|
+
"_context",
|
|
76
|
+
"prev",
|
|
77
|
+
"next",
|
|
78
|
+
"_typeof2",
|
|
79
|
+
"window",
|
|
48
80
|
"CodeMirror",
|
|
49
81
|
"findModeByName",
|
|
82
|
+
"specifier",
|
|
83
|
+
"Promise",
|
|
84
|
+
"r",
|
|
85
|
+
"then",
|
|
86
|
+
"s",
|
|
87
|
+
"_interopRequireWildcard2",
|
|
88
|
+
"concat",
|
|
50
89
|
"mime",
|
|
51
90
|
"JSON",
|
|
52
91
|
"stringify",
|
|
53
92
|
"setOption",
|
|
93
|
+
"stop",
|
|
54
94
|
"useEffect",
|
|
55
95
|
"fromTextArea",
|
|
96
|
+
"_objectSpread2",
|
|
56
97
|
"event",
|
|
57
98
|
"on",
|
|
99
|
+
"_lastestProps$current",
|
|
58
100
|
"setValue",
|
|
59
101
|
"setSize",
|
|
60
102
|
"toTextArea",
|
|
61
|
-
"undefined",
|
|
62
103
|
"useMemo",
|
|
63
104
|
"val",
|
|
64
105
|
"getValue",
|
|
106
|
+
"jsx",
|
|
107
|
+
"children",
|
|
108
|
+
"_default",
|
|
65
109
|
"React",
|
|
66
|
-
"forwardRef"
|
|
110
|
+
"forwardRef",
|
|
111
|
+
"exports",
|
|
112
|
+
"module"
|
|
67
113
|
],
|
|
68
114
|
"sources": [
|
|
69
115
|
"../src/index.js"
|
|
70
116
|
],
|
|
71
117
|
"sourcesContent": [
|
|
72
|
-
"import React, { useRef, useEffect, useImperativeHandle, useState, useMemo } from 'react';\nimport CodeMirror from 'codemirror';\nimport 'codemirror/mode/meta';\nimport './codemirror.css';\n\nconst defaultOptions = {\n tabSize: 2,\n autoCloseBrackets: true,\n matchBrackets: true,\n showCursorWhenSelecting: true,\n // 显示行号\n lineNumbers: true,\n fullScreen: true,\n}\n\nfunction ReactCodeMirror(props = {}, ref) {\n const { options = {}, value = '', width = '100%', height = '100%', lazyLoadMode = true } = props;\n const [editor, setEditor] = useState();\n const textareaRef = useRef();\n const lastestProps = useRef(props);\n\n useImperativeHandle(ref, () => ({ editor, textarea: textareaRef.current }), [editor, textareaRef]);\n lastestProps.current = props;\n \n // 将props中所有的事件处理函数映射并保存\n function getEventHandleFromProps() {\n const propNames = Object.keys(props);\n const eventHandle = propNames.filter((keyName) => {\n return /^on+/.test(keyName);\n });\n\n const eventDict = {};\n eventHandle.forEach((ele) => {\n const name = ele.slice(2);\n if (name && name[0]) {\n eventDict[ele] = name.replace(name[0], name[0].toLowerCase());\n }\n });\n\n return eventDict;\n }\n\n // http://codemirror.net/doc/manual.html#config\n async function setOptions(instance, opt = {}) {\n if (typeof opt === 'object' && window) {\n const mode = CodeMirror.findModeByName(opt.mode || '');\n if (lazyLoadMode && mode && mode.mode) {\n await import(`codemirror/mode/${mode.mode}/${mode.mode}.js`);\n }\n if (mode) {\n opt.mode = mode.mime;\n }\n Object.keys(opt).forEach((name) => {\n if ((opt[name] || opt[name] === false) && JSON.stringify(opt[name])) {\n instance.setOption(name, opt[name]);\n }\n });\n }\n }\n\n useEffect(() => {\n if (!editor && window) {\n // 生成codemirror实例\n const instance = CodeMirror.fromTextArea(textareaRef.current, {...defaultOptions, ...options});\n const eventDict = getEventHandleFromProps();\n Object.keys(eventDict).forEach((event) => {\n instance.on(eventDict[event], (...params) => lastestProps.current[event](...params));\n });\n instance.setValue(value || '');\n\n if (width || height) {\n // 设置尺寸\n instance.setSize(width, height);\n }\n setEditor(instance);\n setOptions(instance, {...defaultOptions, ...options});\n }\n return () => {\n if (editor && window) {\n editor.toTextArea();\n setEditor(undefined);\n }\n }\n }, []);\n\n useMemo(() => {\n if (!editor || !window) return;\n const val = editor.getValue();\n if (value !== undefined && value !== val) {\n editor.setValue(value);\n }\n }, [value]);\n\n useMemo(() => {\n if (!editor || !window) return;\n editor.setSize(width, height);\n }, [width, height]);\n\n\n useMemo(() => {\n if (!editor || !window) return;\n setOptions(editor, {...defaultOptions, ...options});\n }, [editor, options]);\n \n return (\n <textarea ref={textareaRef}
|
|
118
|
+
"import React, { useRef, useEffect, useImperativeHandle, useState, useMemo } from 'react';\nimport CodeMirror from 'codemirror';\nimport 'codemirror/mode/meta';\nimport './codemirror.css';\n\nconst defaultOptions = {\n tabSize: 2,\n autoCloseBrackets: true,\n matchBrackets: true,\n showCursorWhenSelecting: true,\n // 显示行号\n lineNumbers: true,\n fullScreen: true,\n}\n\nfunction ReactCodeMirror(props = {}, ref) {\n const { options = {}, value = '', width = '100%', height = '100%', lazyLoadMode = true } = props;\n const [editor, setEditor] = useState();\n const textareaRef = useRef();\n const lastestProps = useRef(props);\n\n useImperativeHandle(ref, () => ({ editor, textarea: textareaRef.current }), [editor, textareaRef]);\n lastestProps.current = props;\n \n // 将props中所有的事件处理函数映射并保存\n function getEventHandleFromProps() {\n const propNames = Object.keys(props);\n const eventHandle = propNames.filter((keyName) => {\n return /^on+/.test(keyName);\n });\n\n const eventDict = {};\n eventHandle.forEach((ele) => {\n const name = ele.slice(2);\n if (name && name[0]) {\n eventDict[ele] = name.replace(name[0], name[0].toLowerCase());\n }\n });\n\n return eventDict;\n }\n\n // http://codemirror.net/doc/manual.html#config\n async function setOptions(instance, opt = {}) {\n if (typeof opt === 'object' && window) {\n const mode = CodeMirror.findModeByName(opt.mode || '');\n if (lazyLoadMode && mode && mode.mode) {\n await import(`codemirror/mode/${mode.mode}/${mode.mode}.js`);\n }\n if (mode) {\n opt.mode = mode.mime;\n }\n Object.keys(opt).forEach((name) => {\n if ((opt[name] || opt[name] === false) && JSON.stringify(opt[name])) {\n instance.setOption(name, opt[name]);\n }\n });\n }\n }\n\n useEffect(() => {\n if (!editor && window) {\n // 生成codemirror实例\n const instance = CodeMirror.fromTextArea(textareaRef.current, {...defaultOptions, ...options});\n const eventDict = getEventHandleFromProps();\n Object.keys(eventDict).forEach((event) => {\n instance.on(eventDict[event], (...params) => lastestProps.current[event](...params));\n });\n instance.setValue(value || '');\n\n if (width || height) {\n // 设置尺寸\n instance.setSize(width, height);\n }\n setEditor(instance);\n setOptions(instance, {...defaultOptions, ...options});\n }\n return () => {\n if (editor && window) {\n editor.toTextArea();\n setEditor(undefined);\n }\n }\n }, []);\n\n useMemo(() => {\n if (!editor || !window) return;\n const val = editor.getValue();\n if (value !== undefined && value !== val) {\n editor.setValue(value);\n }\n }, [value]);\n\n useMemo(() => {\n if (!editor || !window) return;\n editor.setSize(width, height);\n }, [width, height]);\n\n\n useMemo(() => {\n if (!editor || !window) return;\n setOptions(editor, {...defaultOptions, ...options});\n }, [editor, options]);\n \n return (\n <textarea ref={textareaRef}>{value}</textarea>\n );\n}\n\nexport default React.forwardRef(ReactCodeMirror);\n"
|
|
73
119
|
],
|
|
74
|
-
"mappings": "
|
|
120
|
+
"mappings": ";;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,wBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACAA,OAAA;AAA8B,IAAAG,WAAA,GAAAH,OAAA;AAG9B,IAAMI,cAAc,GAAG;EACrBC,OAAO,EAAE,CAAC;EACVC,iBAAiB,EAAE,IAAI;EACvBC,aAAa,EAAE,IAAI;EACnBC,uBAAuB,EAAE,IAAI;EAC7B;EACAC,WAAW,EAAE,IAAI;EACjBC,UAAU,EAAE;AACd,CAAC;AAED,SAASC,eAAeA,CAAA,EAAkB;EAAA,IAAjBC,KAAK,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAAA,IAAEG,GAAG,GAAAH,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EACtC,IAAAE,cAAA,GAA2FL,KAAK,CAAxFM,OAAO;IAAPA,OAAO,GAAAD,cAAA,cAAG,CAAC,CAAC,GAAAA,cAAA;IA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