react-monaco-editor
Advanced tools
Comparing version
@@ -26,3 +26,3 @@ var __assign = (this && this.__assign) || function () { | ||
import { useEffect, useMemo, useRef } from "react"; | ||
import { noop, processSize } from "./utils"; | ||
import { noop, processSize, propCallbacks } from "./utils"; | ||
function MonacoEditor(_a) { | ||
@@ -36,2 +36,3 @@ var width = _a.width, height = _a.height, value = _a.value, defaultValue = _a.defaultValue, language = _a.language, theme = _a.theme, options = _a.options, overrideServices = _a.overrideServices, editorWillMount = _a.editorWillMount, editorDidMount = _a.editorDidMount, editorWillUnmount = _a.editorWillUnmount, onChange = _a.onChange, className = _a.className, uri = _a.uri; | ||
var fixedHeight = processSize(height); | ||
propCallbacks.onChange = onChange; | ||
var style = useMemo(function () { return ({ | ||
@@ -48,4 +49,5 @@ width: fixedWidth, | ||
_subscription.current = editor.current.onDidChangeModelContent(function (event) { | ||
var _a; | ||
if (!__prevent_trigger_change_event.current) { | ||
onChange(editor.current.getValue(), event); | ||
(_a = propCallbacks.onChange) === null || _a === void 0 ? void 0 : _a.call(propCallbacks, editor.current.getValue(), event); | ||
} | ||
@@ -52,0 +54,0 @@ }); |
@@ -0,2 +1,4 @@ | ||
import { MonacoEditorProps } from "./types"; | ||
export declare function processSize(size: number | string): string | number; | ||
export declare function noop(): void; | ||
export declare const propCallbacks: Pick<MonacoEditorProps, "onChange">; |
@@ -5,2 +5,5 @@ export function processSize(size) { | ||
export function noop() { } | ||
export var propCallbacks = { | ||
onChange: null, | ||
}; | ||
//# sourceMappingURL=utils.js.map |
{ | ||
"name": "react-monaco-editor", | ||
"version": "0.56.0", | ||
"version": "0.56.1", | ||
"description": "Monaco Editor for React", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -0,1 +1,3 @@ | ||
import { MonacoEditorProps } from "./types"; | ||
export function processSize(size: number | string) { | ||
@@ -6,1 +8,5 @@ return !/^\d+$/.test(size as string) ? size : `${size}px`; | ||
export function noop() {} | ||
export const propCallbacks: Pick<MonacoEditorProps, "onChange"> = { | ||
onChange: null, | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
59760
1.11%1044
1.16%