@uiw/react-codemirror 4.23.13 → 4.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/cjs/timeoutLatch.d.ts +22 -0
- package/cjs/timeoutLatch.js +118 -0
- package/cjs/useCodeMirror.d.ts +1 -0
- package/cjs/useCodeMirror.js +51 -10
- package/dist/codemirror.js +255 -210
- package/dist/codemirror.min.js +1 -1
- package/esm/timeoutLatch.d.ts +22 -0
- package/esm/timeoutLatch.js +88 -0
- package/esm/useCodeMirror.d.ts +1 -0
- package/esm/useCodeMirror.js +46 -10
- package/package.json +2 -2
- package/src/timeoutLatch.ts +98 -0
- package/src/useCodeMirror.ts +40 -6
package/dist/codemirror.js
CHANGED
|
@@ -2471,6 +2471,8 @@ const foldState = /*@__PURE__*/state_.StateField.define({
|
|
|
2471
2471
|
return view_.Decoration.none;
|
|
2472
2472
|
},
|
|
2473
2473
|
update(folded, tr) {
|
|
2474
|
+
if (tr.isUserEvent("delete"))
|
|
2475
|
+
tr.changes.iterChangedRanges((fromA, toA) => folded = clearTouchedFolds(folded, fromA, toA));
|
|
2474
2476
|
folded = folded.map(tr.changes);
|
|
2475
2477
|
for (let e of tr.effects) {
|
|
2476
2478
|
if (e.is(foldEffect) && !foldExists(folded, e.value.from, e.value.to)) {
|
|
@@ -2485,17 +2487,8 @@ const foldState = /*@__PURE__*/state_.StateField.define({
|
|
|
2485
2487
|
}
|
|
2486
2488
|
}
|
|
2487
2489
|
// Clear folded ranges that cover the selection head
|
|
2488
|
-
if (tr.selection)
|
|
2489
|
-
|
|
2490
|
-
folded.between(head, head, (a, b) => { if (a < head && b > head)
|
|
2491
|
-
onSelection = true; });
|
|
2492
|
-
if (onSelection)
|
|
2493
|
-
folded = folded.update({
|
|
2494
|
-
filterFrom: head,
|
|
2495
|
-
filterTo: head,
|
|
2496
|
-
filter: (a, b) => b <= head || a >= head
|
|
2497
|
-
});
|
|
2498
|
-
}
|
|
2490
|
+
if (tr.selection)
|
|
2491
|
+
folded = clearTouchedFolds(folded, tr.selection.main.head);
|
|
2499
2492
|
return folded;
|
|
2500
2493
|
},
|
|
2501
2494
|
provide: f => view_.EditorView.decorations.from(f),
|
|
@@ -2517,6 +2510,16 @@ const foldState = /*@__PURE__*/state_.StateField.define({
|
|
|
2517
2510
|
return view_.Decoration.set(ranges, true);
|
|
2518
2511
|
}
|
|
2519
2512
|
});
|
|
2513
|
+
function clearTouchedFolds(folded, from, to = from) {
|
|
2514
|
+
let touched = false;
|
|
2515
|
+
folded.between(from, to, (a, b) => { if (a < to && b > from)
|
|
2516
|
+
touched = true; });
|
|
2517
|
+
return !touched ? folded : folded.update({
|
|
2518
|
+
filterFrom: from,
|
|
2519
|
+
filterTo: to,
|
|
2520
|
+
filter: (a, b) => a >= to || b <= from
|
|
2521
|
+
});
|
|
2522
|
+
}
|
|
2520
2523
|
/**
|
|
2521
2524
|
Get a [range set](https://codemirror.net/6/docs/ref/#state.RangeSet) containing the folded ranges
|
|
2522
2525
|
in the given state.
|
|
@@ -6008,6 +6011,243 @@ function enterFragments(mounts, ranges) {
|
|
|
6008
6011
|
|
|
6009
6012
|
|
|
6010
6013
|
|
|
6014
|
+
/***/ }),
|
|
6015
|
+
|
|
6016
|
+
/***/ 236:
|
|
6017
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
6018
|
+
|
|
6019
|
+
|
|
6020
|
+
// EXPORTS
|
|
6021
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
6022
|
+
A: () => (/* binding */ toPropertyKey)
|
|
6023
|
+
});
|
|
6024
|
+
|
|
6025
|
+
;// ../node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
6026
|
+
function _typeof(o) {
|
|
6027
|
+
"@babel/helpers - typeof";
|
|
6028
|
+
|
|
6029
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
6030
|
+
return typeof o;
|
|
6031
|
+
} : function (o) {
|
|
6032
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
6033
|
+
}, _typeof(o);
|
|
6034
|
+
}
|
|
6035
|
+
|
|
6036
|
+
;// ../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
|
|
6037
|
+
|
|
6038
|
+
function toPrimitive(t, r) {
|
|
6039
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
6040
|
+
var e = t[Symbol.toPrimitive];
|
|
6041
|
+
if (void 0 !== e) {
|
|
6042
|
+
var i = e.call(t, r || "default");
|
|
6043
|
+
if ("object" != _typeof(i)) return i;
|
|
6044
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
6045
|
+
}
|
|
6046
|
+
return ("string" === r ? String : Number)(t);
|
|
6047
|
+
}
|
|
6048
|
+
|
|
6049
|
+
;// ../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
|
|
6050
|
+
|
|
6051
|
+
|
|
6052
|
+
function toPropertyKey(t) {
|
|
6053
|
+
var i = toPrimitive(t, "string");
|
|
6054
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
6055
|
+
}
|
|
6056
|
+
|
|
6057
|
+
|
|
6058
|
+
/***/ }),
|
|
6059
|
+
|
|
6060
|
+
/***/ 289:
|
|
6061
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
6062
|
+
|
|
6063
|
+
|
|
6064
|
+
// EXPORTS
|
|
6065
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
6066
|
+
A: () => (/* binding */ _objectSpread2)
|
|
6067
|
+
});
|
|
6068
|
+
|
|
6069
|
+
// EXTERNAL MODULE: ../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js + 2 modules
|
|
6070
|
+
var toPropertyKey = __webpack_require__(236);
|
|
6071
|
+
;// ../node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
6072
|
+
|
|
6073
|
+
function _defineProperty(e, r, t) {
|
|
6074
|
+
return (r = (0,toPropertyKey/* default */.A)(r)) in e ? Object.defineProperty(e, r, {
|
|
6075
|
+
value: t,
|
|
6076
|
+
enumerable: !0,
|
|
6077
|
+
configurable: !0,
|
|
6078
|
+
writable: !0
|
|
6079
|
+
}) : e[r] = t, e;
|
|
6080
|
+
}
|
|
6081
|
+
|
|
6082
|
+
;// ../node_modules/@babel/runtime/helpers/esm/objectSpread2.js
|
|
6083
|
+
|
|
6084
|
+
function ownKeys(e, r) {
|
|
6085
|
+
var t = Object.keys(e);
|
|
6086
|
+
if (Object.getOwnPropertySymbols) {
|
|
6087
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
6088
|
+
r && (o = o.filter(function (r) {
|
|
6089
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
6090
|
+
})), t.push.apply(t, o);
|
|
6091
|
+
}
|
|
6092
|
+
return t;
|
|
6093
|
+
}
|
|
6094
|
+
function _objectSpread2(e) {
|
|
6095
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
6096
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
6097
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
|
6098
|
+
_defineProperty(e, r, t[r]);
|
|
6099
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
6100
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
6101
|
+
});
|
|
6102
|
+
}
|
|
6103
|
+
return e;
|
|
6104
|
+
}
|
|
6105
|
+
|
|
6106
|
+
|
|
6107
|
+
/***/ }),
|
|
6108
|
+
|
|
6109
|
+
/***/ 341:
|
|
6110
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
6111
|
+
|
|
6112
|
+
|
|
6113
|
+
// EXPORTS
|
|
6114
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
6115
|
+
Q: () => (/* binding */ ExternalChange),
|
|
6116
|
+
q: () => (/* binding */ useCodeMirror)
|
|
6117
|
+
});
|
|
6118
|
+
|
|
6119
|
+
;// ../node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
|
|
6120
|
+
function _arrayLikeToArray(r, a) {
|
|
6121
|
+
(null == a || a > r.length) && (a = r.length);
|
|
6122
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
6123
|
+
return n;
|
|
6124
|
+
}
|
|
6125
|
+
|
|
6126
|
+
;// ../node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
|
|
6127
|
+
|
|
6128
|
+
function _arrayWithoutHoles(r) {
|
|
6129
|
+
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
6130
|
+
}
|
|
6131
|
+
|
|
6132
|
+
;// ../node_modules/@babel/runtime/helpers/esm/iterableToArray.js
|
|
6133
|
+
function _iterableToArray(r) {
|
|
6134
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
6135
|
+
}
|
|
6136
|
+
|
|
6137
|
+
;// ../node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
|
|
6138
|
+
|
|
6139
|
+
function _unsupportedIterableToArray(r, a) {
|
|
6140
|
+
if (r) {
|
|
6141
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
6142
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
6143
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
6144
|
+
}
|
|
6145
|
+
}
|
|
6146
|
+
|
|
6147
|
+
;// ../node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
|
|
6148
|
+
function _nonIterableSpread() {
|
|
6149
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
6150
|
+
}
|
|
6151
|
+
|
|
6152
|
+
;// ../node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
|
|
6153
|
+
|
|
6154
|
+
|
|
6155
|
+
|
|
6156
|
+
|
|
6157
|
+
function _toConsumableArray(r) {
|
|
6158
|
+
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
6159
|
+
}
|
|
6160
|
+
|
|
6161
|
+
;// ../node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
|
|
6162
|
+
function _arrayWithHoles(r) {
|
|
6163
|
+
if (Array.isArray(r)) return r;
|
|
6164
|
+
}
|
|
6165
|
+
|
|
6166
|
+
;// ../node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
|
|
6167
|
+
function _iterableToArrayLimit(r, l) {
|
|
6168
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
6169
|
+
if (null != t) {
|
|
6170
|
+
var e,
|
|
6171
|
+
n,
|
|
6172
|
+
i,
|
|
6173
|
+
u,
|
|
6174
|
+
a = [],
|
|
6175
|
+
f = !0,
|
|
6176
|
+
o = !1;
|
|
6177
|
+
try {
|
|
6178
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
6179
|
+
if (Object(t) !== t) return;
|
|
6180
|
+
f = !1;
|
|
6181
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
6182
|
+
} catch (r) {
|
|
6183
|
+
o = !0, n = r;
|
|
6184
|
+
} finally {
|
|
6185
|
+
try {
|
|
6186
|
+
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
6187
|
+
} finally {
|
|
6188
|
+
if (o) throw n;
|
|
6189
|
+
}
|
|
6190
|
+
}
|
|
6191
|
+
return a;
|
|
6192
|
+
}
|
|
6193
|
+
}
|
|
6194
|
+
|
|
6195
|
+
;// ../node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
|
|
6196
|
+
function _nonIterableRest() {
|
|
6197
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
6198
|
+
}
|
|
6199
|
+
|
|
6200
|
+
;// ../node_modules/@babel/runtime/helpers/esm/slicedToArray.js
|
|
6201
|
+
|
|
6202
|
+
|
|
6203
|
+
|
|
6204
|
+
|
|
6205
|
+
function _slicedToArray(r, e) {
|
|
6206
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
6207
|
+
}
|
|
6208
|
+
|
|
6209
|
+
// EXTERNAL MODULE: external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"}
|
|
6210
|
+
var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __webpack_require__(442);
|
|
6211
|
+
// EXTERNAL MODULE: external {"root":["CM","@codemirror/state"],"commonjs":"@codemirror/state","commonjs2":"@codemirror/state"}
|
|
6212
|
+
var state_ = __webpack_require__(60);
|
|
6213
|
+
// EXTERNAL MODULE: external {"root":["CM","@codemirror/view"],"commonjs":"@codemirror/view","commonjs2":"@codemirror/view"}
|
|
6214
|
+
var view_ = __webpack_require__(730);
|
|
6215
|
+
// EXTERNAL MODULE: ./src/getDefaultExtensions.ts
|
|
6216
|
+
var getDefaultExtensions = __webpack_require__(89);
|
|
6217
|
+
// EXTERNAL MODULE: ./src/utils.ts
|
|
6218
|
+
var utils = __webpack_require__(369);
|
|
6219
|
+
;// ../node_modules/@babel/runtime/helpers/esm/classCallCheck.js
|
|
6220
|
+
function _classCallCheck(a, n) {
|
|
6221
|
+
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
6222
|
+
}
|
|
6223
|
+
|
|
6224
|
+
// EXTERNAL MODULE: ../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js + 2 modules
|
|
6225
|
+
var toPropertyKey = __webpack_require__(236);
|
|
6226
|
+
;// ../node_modules/@babel/runtime/helpers/esm/createClass.js
|
|
6227
|
+
|
|
6228
|
+
function _defineProperties(e, r) {
|
|
6229
|
+
for (var t = 0; t < r.length; t++) {
|
|
6230
|
+
var o = r[t];
|
|
6231
|
+
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, (0,toPropertyKey/* default */.A)(o.key), o);
|
|
6232
|
+
}
|
|
6233
|
+
}
|
|
6234
|
+
function _createClass(e, r, t) {
|
|
6235
|
+
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
|
|
6236
|
+
writable: !1
|
|
6237
|
+
}), e;
|
|
6238
|
+
}
|
|
6239
|
+
|
|
6240
|
+
;// ./src/timeoutLatch.ts
|
|
6241
|
+
// Setting / Unsetting timeouts for every keystroke was a significant overhead
|
|
6242
|
+
// Inspired from https://github.com/iostreamer-X/timeout-latch
|
|
6243
|
+
var TimeoutLatch=/*#__PURE__*/function(){function TimeoutLatch(callback,timeoutMS){_classCallCheck(this,TimeoutLatch);this.timeLeftMS=void 0;this.timeoutMS=void 0;this.isCancelled=false;this.isTimeExhausted=false;this.callbacks=[];this.timeLeftMS=timeoutMS;this.timeoutMS=timeoutMS;this.callbacks.push(callback);}return _createClass(TimeoutLatch,[{key:"tick",value:function tick(){if(!this.isCancelled&&!this.isTimeExhausted){this.timeLeftMS--;if(this.timeLeftMS<=0){this.isTimeExhausted=true;var callbacks=this.callbacks.slice();this.callbacks.length=0;callbacks.forEach(function(callback){try{callback();}catch(error){console.error('TimeoutLatch callback error:',error);}});}}}},{key:"cancel",value:function cancel(){this.isCancelled=true;this.callbacks.length=0;}},{key:"reset",value:function reset(){this.timeLeftMS=this.timeoutMS;this.isCancelled=false;this.isTimeExhausted=false;}},{key:"isDone",get:function get(){return this.isCancelled||this.isTimeExhausted;}}]);}();var Scheduler=/*#__PURE__*/function(){function Scheduler(){_classCallCheck(this,Scheduler);this.interval=null;this.latches=new Set();}return _createClass(Scheduler,[{key:"add",value:function add(latch){this.latches.add(latch);this.start();}},{key:"remove",value:function remove(latch){this.latches["delete"](latch);if(this.latches.size===0){this.stop();}}},{key:"start",value:function start(){var _this=this;if(this.interval===null){this.interval=setInterval(function(){_this.latches.forEach(function(latch){latch.tick();if(latch.isDone){_this.remove(latch);}});},1);}}},{key:"stop",value:function stop(){if(this.interval!==null){clearInterval(this.interval);this.interval=null;}}}]);}();var globalScheduler=null;var getScheduler=function getScheduler(){if(typeof window==='undefined'){return new Scheduler();}if(!globalScheduler){globalScheduler=new Scheduler();}return globalScheduler;};
|
|
6244
|
+
;// ./src/useCodeMirror.ts
|
|
6245
|
+
var ExternalChange=state_.Annotation.define();var TYPING_TIMOUT=200;// ms
|
|
6246
|
+
var emptyExtensions=[];function useCodeMirror(props){var value=props.value,selection=props.selection,onChange=props.onChange,onStatistics=props.onStatistics,onCreateEditor=props.onCreateEditor,onUpdate=props.onUpdate,_props$extensions=props.extensions,extensions=_props$extensions===void 0?emptyExtensions:_props$extensions,autoFocus=props.autoFocus,_props$theme=props.theme,theme=_props$theme===void 0?'light':_props$theme,_props$height=props.height,height=_props$height===void 0?null:_props$height,_props$minHeight=props.minHeight,minHeight=_props$minHeight===void 0?null:_props$minHeight,_props$maxHeight=props.maxHeight,maxHeight=_props$maxHeight===void 0?null:_props$maxHeight,_props$width=props.width,width=_props$width===void 0?null:_props$width,_props$minWidth=props.minWidth,minWidth=_props$minWidth===void 0?null:_props$minWidth,_props$maxWidth=props.maxWidth,maxWidth=_props$maxWidth===void 0?null:_props$maxWidth,_props$placeholder=props.placeholder,placeholderStr=_props$placeholder===void 0?'':_props$placeholder,_props$editable=props.editable,editable=_props$editable===void 0?true:_props$editable,_props$readOnly=props.readOnly,readOnly=_props$readOnly===void 0?false:_props$readOnly,_props$indentWithTab=props.indentWithTab,defaultIndentWithTab=_props$indentWithTab===void 0?true:_props$indentWithTab,_props$basicSetup=props.basicSetup,defaultBasicSetup=_props$basicSetup===void 0?true:_props$basicSetup,root=props.root,initialState=props.initialState;var _useState=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(),_useState2=_slicedToArray(_useState,2),container=_useState2[0],setContainer=_useState2[1];var _useState3=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(),_useState4=_slicedToArray(_useState3,2),view=_useState4[0],setView=_useState4[1];var _useState5=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(),_useState6=_slicedToArray(_useState5,2),state=_useState6[0],setState=_useState6[1];var typingLatch=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(function(){return{current:null};})[0];var pendingUpdate=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(function(){return{current:null};})[0];var defaultThemeOption=view_.EditorView.theme({'&':{height:height,minHeight:minHeight,maxHeight:maxHeight,width:width,minWidth:minWidth,maxWidth:maxWidth},'& .cm-scroller':{height:'100% !important'}});var updateListener=view_.EditorView.updateListener.of(function(vu){if(vu.docChanged&&typeof onChange==='function'&&// Fix echoing of the remote changes:
|
|
6247
|
+
// If transaction is market as remote we don't have to call `onChange` handler again
|
|
6248
|
+
!vu.transactions.some(function(tr){return tr.annotation(ExternalChange);})){if(typingLatch.current){typingLatch.current.reset();}else{typingLatch.current=new TimeoutLatch(function(){if(pendingUpdate.current){var forceUpdate=pendingUpdate.current;pendingUpdate.current=null;forceUpdate();}typingLatch.current=null;},TYPING_TIMOUT);getScheduler().add(typingLatch.current);}var doc=vu.state.doc;var _value=doc.toString();onChange(_value,vu);}onStatistics&&onStatistics((0,utils/* getStatistics */.m)(vu));});var defaultExtensions=(0,getDefaultExtensions.getDefaultExtensions)({theme:theme,editable:editable,readOnly:readOnly,placeholder:placeholderStr,indentWithTab:defaultIndentWithTab,basicSetup:defaultBasicSetup});var getExtensions=[updateListener,defaultThemeOption].concat(_toConsumableArray(defaultExtensions));if(onUpdate&&typeof onUpdate==='function'){getExtensions.push(view_.EditorView.updateListener.of(onUpdate));}getExtensions=getExtensions.concat(extensions);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useLayoutEffect)(function(){if(container&&!state){var config={doc:value,selection:selection,extensions:getExtensions};var stateCurrent=initialState?state_.EditorState.fromJSON(initialState.json,config,initialState.fields):state_.EditorState.create(config);setState(stateCurrent);if(!view){var viewCurrent=new view_.EditorView({state:stateCurrent,parent:container,root:root});setView(viewCurrent);onCreateEditor&&onCreateEditor(viewCurrent,stateCurrent);}}return function(){if(view){setState(undefined);setView(undefined);}};},[container,state]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(props.container){setContainer(props.container);}},[props.container]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){return function(){if(view){view.destroy();setView(undefined);}if(typingLatch.current){typingLatch.current.cancel();typingLatch.current=null;}};},[view]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(autoFocus&&view){view.focus();}},[autoFocus,view]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(view){view.dispatch({effects:state_.StateEffect.reconfigure.of(getExtensions)});}// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
6249
|
+
},[theme,extensions,height,minHeight,maxHeight,width,minWidth,maxWidth,placeholderStr,editable,readOnly,defaultIndentWithTab,defaultBasicSetup,onChange,onUpdate]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(value===undefined){return;}var currentValue=view?view.state.doc.toString():'';if(view&&value!==currentValue){var isTyping=typingLatch.current&&!typingLatch.current.isDone;var forceUpdate=function forceUpdate(){if(view&&value!==view.state.doc.toString()){view.dispatch({changes:{from:0,to:view.state.doc.toString().length,insert:value||''},annotations:[ExternalChange.of(true)]});}};if(!isTyping){forceUpdate();}else{pendingUpdate.current=forceUpdate;}}},[value,view]);return{state:state,setState:setState,view:view,setView:setView,container:container,setContainer:setContainer};}
|
|
6250
|
+
|
|
6011
6251
|
/***/ }),
|
|
6012
6252
|
|
|
6013
6253
|
/***/ 369:
|
|
@@ -10472,123 +10712,6 @@ var minimalSetup = function minimalSetup(options) {
|
|
|
10472
10712
|
|
|
10473
10713
|
/***/ }),
|
|
10474
10714
|
|
|
10475
|
-
/***/ 695:
|
|
10476
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
10477
|
-
|
|
10478
|
-
|
|
10479
|
-
// EXPORTS
|
|
10480
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
10481
|
-
q: () => (/* binding */ useCodeMirror)
|
|
10482
|
-
});
|
|
10483
|
-
|
|
10484
|
-
;// ../node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
|
|
10485
|
-
function _arrayLikeToArray(r, a) {
|
|
10486
|
-
(null == a || a > r.length) && (a = r.length);
|
|
10487
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
10488
|
-
return n;
|
|
10489
|
-
}
|
|
10490
|
-
|
|
10491
|
-
;// ../node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
|
|
10492
|
-
|
|
10493
|
-
function _arrayWithoutHoles(r) {
|
|
10494
|
-
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
10495
|
-
}
|
|
10496
|
-
|
|
10497
|
-
;// ../node_modules/@babel/runtime/helpers/esm/iterableToArray.js
|
|
10498
|
-
function _iterableToArray(r) {
|
|
10499
|
-
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
10500
|
-
}
|
|
10501
|
-
|
|
10502
|
-
;// ../node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
|
|
10503
|
-
|
|
10504
|
-
function _unsupportedIterableToArray(r, a) {
|
|
10505
|
-
if (r) {
|
|
10506
|
-
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
10507
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
10508
|
-
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
10509
|
-
}
|
|
10510
|
-
}
|
|
10511
|
-
|
|
10512
|
-
;// ../node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
|
|
10513
|
-
function _nonIterableSpread() {
|
|
10514
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
10515
|
-
}
|
|
10516
|
-
|
|
10517
|
-
;// ../node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
|
|
10518
|
-
|
|
10519
|
-
|
|
10520
|
-
|
|
10521
|
-
|
|
10522
|
-
function _toConsumableArray(r) {
|
|
10523
|
-
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
10524
|
-
}
|
|
10525
|
-
|
|
10526
|
-
;// ../node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
|
|
10527
|
-
function _arrayWithHoles(r) {
|
|
10528
|
-
if (Array.isArray(r)) return r;
|
|
10529
|
-
}
|
|
10530
|
-
|
|
10531
|
-
;// ../node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
|
|
10532
|
-
function _iterableToArrayLimit(r, l) {
|
|
10533
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
10534
|
-
if (null != t) {
|
|
10535
|
-
var e,
|
|
10536
|
-
n,
|
|
10537
|
-
i,
|
|
10538
|
-
u,
|
|
10539
|
-
a = [],
|
|
10540
|
-
f = !0,
|
|
10541
|
-
o = !1;
|
|
10542
|
-
try {
|
|
10543
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
10544
|
-
if (Object(t) !== t) return;
|
|
10545
|
-
f = !1;
|
|
10546
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
10547
|
-
} catch (r) {
|
|
10548
|
-
o = !0, n = r;
|
|
10549
|
-
} finally {
|
|
10550
|
-
try {
|
|
10551
|
-
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
10552
|
-
} finally {
|
|
10553
|
-
if (o) throw n;
|
|
10554
|
-
}
|
|
10555
|
-
}
|
|
10556
|
-
return a;
|
|
10557
|
-
}
|
|
10558
|
-
}
|
|
10559
|
-
|
|
10560
|
-
;// ../node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
|
|
10561
|
-
function _nonIterableRest() {
|
|
10562
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
10563
|
-
}
|
|
10564
|
-
|
|
10565
|
-
;// ../node_modules/@babel/runtime/helpers/esm/slicedToArray.js
|
|
10566
|
-
|
|
10567
|
-
|
|
10568
|
-
|
|
10569
|
-
|
|
10570
|
-
function _slicedToArray(r, e) {
|
|
10571
|
-
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
10572
|
-
}
|
|
10573
|
-
|
|
10574
|
-
// EXTERNAL MODULE: external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"}
|
|
10575
|
-
var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __webpack_require__(442);
|
|
10576
|
-
// EXTERNAL MODULE: external {"root":["CM","@codemirror/state"],"commonjs":"@codemirror/state","commonjs2":"@codemirror/state"}
|
|
10577
|
-
var state_ = __webpack_require__(60);
|
|
10578
|
-
// EXTERNAL MODULE: external {"root":["CM","@codemirror/view"],"commonjs":"@codemirror/view","commonjs2":"@codemirror/view"}
|
|
10579
|
-
var view_ = __webpack_require__(730);
|
|
10580
|
-
// EXTERNAL MODULE: ./src/getDefaultExtensions.ts
|
|
10581
|
-
var getDefaultExtensions = __webpack_require__(89);
|
|
10582
|
-
// EXTERNAL MODULE: ./src/utils.ts
|
|
10583
|
-
var utils = __webpack_require__(369);
|
|
10584
|
-
;// ./src/useCodeMirror.ts
|
|
10585
|
-
var External=state_.Annotation.define();var emptyExtensions=[];function useCodeMirror(props){var value=props.value,selection=props.selection,onChange=props.onChange,onStatistics=props.onStatistics,onCreateEditor=props.onCreateEditor,onUpdate=props.onUpdate,_props$extensions=props.extensions,extensions=_props$extensions===void 0?emptyExtensions:_props$extensions,autoFocus=props.autoFocus,_props$theme=props.theme,theme=_props$theme===void 0?'light':_props$theme,_props$height=props.height,height=_props$height===void 0?null:_props$height,_props$minHeight=props.minHeight,minHeight=_props$minHeight===void 0?null:_props$minHeight,_props$maxHeight=props.maxHeight,maxHeight=_props$maxHeight===void 0?null:_props$maxHeight,_props$width=props.width,width=_props$width===void 0?null:_props$width,_props$minWidth=props.minWidth,minWidth=_props$minWidth===void 0?null:_props$minWidth,_props$maxWidth=props.maxWidth,maxWidth=_props$maxWidth===void 0?null:_props$maxWidth,_props$placeholder=props.placeholder,placeholderStr=_props$placeholder===void 0?'':_props$placeholder,_props$editable=props.editable,editable=_props$editable===void 0?true:_props$editable,_props$readOnly=props.readOnly,readOnly=_props$readOnly===void 0?false:_props$readOnly,_props$indentWithTab=props.indentWithTab,defaultIndentWithTab=_props$indentWithTab===void 0?true:_props$indentWithTab,_props$basicSetup=props.basicSetup,defaultBasicSetup=_props$basicSetup===void 0?true:_props$basicSetup,root=props.root,initialState=props.initialState;var _useState=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(),_useState2=_slicedToArray(_useState,2),container=_useState2[0],setContainer=_useState2[1];var _useState3=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(),_useState4=_slicedToArray(_useState3,2),view=_useState4[0],setView=_useState4[1];var _useState5=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(),_useState6=_slicedToArray(_useState5,2),state=_useState6[0],setState=_useState6[1];var defaultThemeOption=view_.EditorView.theme({'&':{height:height,minHeight:minHeight,maxHeight:maxHeight,width:width,minWidth:minWidth,maxWidth:maxWidth},'& .cm-scroller':{height:'100% !important'}});var updateListener=view_.EditorView.updateListener.of(function(vu){if(vu.docChanged&&typeof onChange==='function'&&// Fix echoing of the remote changes:
|
|
10586
|
-
// If transaction is market as remote we don't have to call `onChange` handler again
|
|
10587
|
-
!vu.transactions.some(function(tr){return tr.annotation(External);})){var doc=vu.state.doc;var _value=doc.toString();onChange(_value,vu);}onStatistics&&onStatistics((0,utils/* getStatistics */.m)(vu));});var defaultExtensions=(0,getDefaultExtensions.getDefaultExtensions)({theme:theme,editable:editable,readOnly:readOnly,placeholder:placeholderStr,indentWithTab:defaultIndentWithTab,basicSetup:defaultBasicSetup});var getExtensions=[updateListener,defaultThemeOption].concat(_toConsumableArray(defaultExtensions));if(onUpdate&&typeof onUpdate==='function'){getExtensions.push(view_.EditorView.updateListener.of(onUpdate));}getExtensions=getExtensions.concat(extensions);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useLayoutEffect)(function(){if(container&&!state){var config={doc:value,selection:selection,extensions:getExtensions};var stateCurrent=initialState?state_.EditorState.fromJSON(initialState.json,config,initialState.fields):state_.EditorState.create(config);setState(stateCurrent);if(!view){var viewCurrent=new view_.EditorView({state:stateCurrent,parent:container,root:root});setView(viewCurrent);onCreateEditor&&onCreateEditor(viewCurrent,stateCurrent);}}return function(){if(view){setState(undefined);setView(undefined);}};},[container,state]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(props.container){setContainer(props.container);}},[props.container]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){return function(){if(view){view.destroy();setView(undefined);}};},[view]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(autoFocus&&view){view.focus();}},[autoFocus,view]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(view){view.dispatch({effects:state_.StateEffect.reconfigure.of(getExtensions)});}// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
10588
|
-
},[theme,extensions,height,minHeight,maxHeight,width,minWidth,maxWidth,placeholderStr,editable,readOnly,defaultIndentWithTab,defaultBasicSetup,onChange,onUpdate]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(value===undefined){return;}var currentValue=view?view.state.doc.toString():'';if(view&&value!==currentValue){view.dispatch({changes:{from:0,to:currentValue.length,insert:value||''},annotations:[External.of(true)]});}},[value,view]);return{state:state,setState:setState,view:view,setView:setView,container:container,setContainer:setContainer};}
|
|
10589
|
-
|
|
10590
|
-
/***/ }),
|
|
10591
|
-
|
|
10592
10715
|
/***/ 708:
|
|
10593
10716
|
/***/ ((module) => {
|
|
10594
10717
|
|
|
@@ -12379,85 +12502,6 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__742__;
|
|
|
12379
12502
|
/* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_codemirror_view__WEBPACK_IMPORTED_MODULE_0__);
|
|
12380
12503
|
var defaultLightThemeOption=_codemirror_view__WEBPACK_IMPORTED_MODULE_0__.EditorView.theme({'&':{backgroundColor:'#fff'}},{dark:false});
|
|
12381
12504
|
|
|
12382
|
-
/***/ }),
|
|
12383
|
-
|
|
12384
|
-
/***/ 957:
|
|
12385
|
-
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
12386
|
-
|
|
12387
|
-
|
|
12388
|
-
// EXPORTS
|
|
12389
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
12390
|
-
A: () => (/* binding */ _objectSpread2)
|
|
12391
|
-
});
|
|
12392
|
-
|
|
12393
|
-
;// ../node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
12394
|
-
function _typeof(o) {
|
|
12395
|
-
"@babel/helpers - typeof";
|
|
12396
|
-
|
|
12397
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
12398
|
-
return typeof o;
|
|
12399
|
-
} : function (o) {
|
|
12400
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
12401
|
-
}, _typeof(o);
|
|
12402
|
-
}
|
|
12403
|
-
|
|
12404
|
-
;// ../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
|
|
12405
|
-
|
|
12406
|
-
function toPrimitive(t, r) {
|
|
12407
|
-
if ("object" != _typeof(t) || !t) return t;
|
|
12408
|
-
var e = t[Symbol.toPrimitive];
|
|
12409
|
-
if (void 0 !== e) {
|
|
12410
|
-
var i = e.call(t, r || "default");
|
|
12411
|
-
if ("object" != _typeof(i)) return i;
|
|
12412
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
12413
|
-
}
|
|
12414
|
-
return ("string" === r ? String : Number)(t);
|
|
12415
|
-
}
|
|
12416
|
-
|
|
12417
|
-
;// ../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
|
|
12418
|
-
|
|
12419
|
-
|
|
12420
|
-
function toPropertyKey(t) {
|
|
12421
|
-
var i = toPrimitive(t, "string");
|
|
12422
|
-
return "symbol" == _typeof(i) ? i : i + "";
|
|
12423
|
-
}
|
|
12424
|
-
|
|
12425
|
-
;// ../node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
12426
|
-
|
|
12427
|
-
function _defineProperty(e, r, t) {
|
|
12428
|
-
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
12429
|
-
value: t,
|
|
12430
|
-
enumerable: !0,
|
|
12431
|
-
configurable: !0,
|
|
12432
|
-
writable: !0
|
|
12433
|
-
}) : e[r] = t, e;
|
|
12434
|
-
}
|
|
12435
|
-
|
|
12436
|
-
;// ../node_modules/@babel/runtime/helpers/esm/objectSpread2.js
|
|
12437
|
-
|
|
12438
|
-
function ownKeys(e, r) {
|
|
12439
|
-
var t = Object.keys(e);
|
|
12440
|
-
if (Object.getOwnPropertySymbols) {
|
|
12441
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
12442
|
-
r && (o = o.filter(function (r) {
|
|
12443
|
-
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
12444
|
-
})), t.push.apply(t, o);
|
|
12445
|
-
}
|
|
12446
|
-
return t;
|
|
12447
|
-
}
|
|
12448
|
-
function _objectSpread2(e) {
|
|
12449
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
12450
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
12451
|
-
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
|
12452
|
-
_defineProperty(e, r, t[r]);
|
|
12453
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
12454
|
-
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
12455
|
-
});
|
|
12456
|
-
}
|
|
12457
|
-
return e;
|
|
12458
|
-
}
|
|
12459
|
-
|
|
12460
|
-
|
|
12461
12505
|
/***/ })
|
|
12462
12506
|
|
|
12463
12507
|
/******/ });
|
|
@@ -12531,17 +12575,18 @@ function _objectSpread2(e) {
|
|
|
12531
12575
|
var __webpack_exports__ = {};
|
|
12532
12576
|
__webpack_require__.r(__webpack_exports__);
|
|
12533
12577
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
12578
|
+
/* harmony export */ ExternalChange: () => (/* reexport safe */ _useCodeMirror__WEBPACK_IMPORTED_MODULE_1__.Q),
|
|
12534
12579
|
/* harmony export */ basicSetup: () => (/* reexport safe */ _uiw_codemirror_extensions_basic_setup__WEBPACK_IMPORTED_MODULE_5__.o),
|
|
12535
12580
|
/* harmony export */ "default": () => (src),
|
|
12536
12581
|
/* harmony export */ getStatistics: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_7__.m),
|
|
12537
12582
|
/* harmony export */ minimalSetup: () => (/* reexport safe */ _uiw_codemirror_extensions_basic_setup__WEBPACK_IMPORTED_MODULE_5__.V),
|
|
12538
12583
|
/* harmony export */ useCodeMirror: () => (/* reexport safe */ _useCodeMirror__WEBPACK_IMPORTED_MODULE_1__.q)
|
|
12539
12584
|
/* harmony export */ });
|
|
12540
|
-
/* harmony import */ var _home_runner_work_react_codemirror_react_codemirror_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(
|
|
12585
|
+
/* harmony import */ var _home_runner_work_react_codemirror_react_codemirror_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(289);
|
|
12541
12586
|
/* harmony import */ var _home_runner_work_react_codemirror_react_codemirror_node_modules_babel_runtime_helpers_esm_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(644);
|
|
12542
12587
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(442);
|
|
12543
12588
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
12544
|
-
/* harmony import */ var _useCodeMirror__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
12589
|
+
/* harmony import */ var _useCodeMirror__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(341);
|
|
12545
12590
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(742);
|
|
12546
12591
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__);
|
|
12547
12592
|
/* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(730);
|
|
@@ -12557,7 +12602,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
12557
12602
|
/* harmony import */ var _uiw_codemirror_extensions_basic_setup__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(687);
|
|
12558
12603
|
/* harmony import */ var _getDefaultExtensions__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(89);
|
|
12559
12604
|
/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
12560
|
-
/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _getDefaultExtensions__WEBPACK_IMPORTED_MODULE_6__) if(["default","basicSetup","minimalSetup","useCodeMirror"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _getDefaultExtensions__WEBPACK_IMPORTED_MODULE_6__[__WEBPACK_IMPORT_KEY__]
|
|
12605
|
+
/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _getDefaultExtensions__WEBPACK_IMPORTED_MODULE_6__) if(["default","basicSetup","minimalSetup","ExternalChange","useCodeMirror"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _getDefaultExtensions__WEBPACK_IMPORTED_MODULE_6__[__WEBPACK_IMPORT_KEY__]
|
|
12561
12606
|
/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
12562
12607
|
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(369);
|
|
12563
12608
|
var _excluded=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"];var ReactCodeMirror=/*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(function(props,ref){var className=props.className,_props$value=props.value,value=_props$value===void 0?'':_props$value,selection=props.selection,_props$extensions=props.extensions,extensions=_props$extensions===void 0?[]:_props$extensions,onChange=props.onChange,onStatistics=props.onStatistics,onCreateEditor=props.onCreateEditor,onUpdate=props.onUpdate,autoFocus=props.autoFocus,_props$theme=props.theme,theme=_props$theme===void 0?'light':_props$theme,height=props.height,minHeight=props.minHeight,maxHeight=props.maxHeight,width=props.width,minWidth=props.minWidth,maxWidth=props.maxWidth,basicSetup=props.basicSetup,placeholder=props.placeholder,indentWithTab=props.indentWithTab,editable=props.editable,readOnly=props.readOnly,root=props.root,initialState=props.initialState,other=(0,_home_runner_work_react_codemirror_react_codemirror_node_modules_babel_runtime_helpers_esm_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .A)(props,_excluded);var editor=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);var _useCodeMirror=(0,_useCodeMirror__WEBPACK_IMPORTED_MODULE_1__/* .useCodeMirror */ .q)({root:root,value:value,autoFocus:autoFocus,theme:theme,height:height,minHeight:minHeight,maxHeight:maxHeight,width:width,minWidth:minWidth,maxWidth:maxWidth,basicSetup:basicSetup,placeholder:placeholder,indentWithTab:indentWithTab,editable:editable,readOnly:readOnly,selection:selection,onChange:onChange,onStatistics:onStatistics,onCreateEditor:onCreateEditor,onUpdate:onUpdate,extensions:extensions,initialState:initialState}),state=_useCodeMirror.state,view=_useCodeMirror.view,container=_useCodeMirror.container,setContainer=_useCodeMirror.setContainer;(0,react__WEBPACK_IMPORTED_MODULE_0__.useImperativeHandle)(ref,function(){return{editor:editor.current,state:state,view:view};},[editor,container,state,view]);var setEditorRef=(0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function(el){editor.current=el;setContainer(el);},[setContainer]);// check type of value
|