Make onChange in CodeEditor optional (#107128)

* Make onChang in CodeEditor optional

* Update api docs
This commit is contained in:
Tim Roes 2021-07-29 15:37:43 +02:00 committed by GitHub
parent c98ffa5339
commit ff3029f1b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 5 additions and 44 deletions

View file

@ -3719,48 +3719,15 @@
"label": "onChange",
"description": [],
"signature": [
"(value: string, event: ",
"((value: string, event: ",
"editor",
".IModelContentChangedEvent) => void"
".IModelContentChangedEvent) => void) | undefined"
],
"source": {
"path": "src/plugins/kibana_react/public/url_template_editor/url_template_editor.tsx",
"lineNumber": 27
},
"deprecated": false,
"returnComment": [],
"children": [
{
"parentPluginId": "kibanaReact",
"id": "def-public.value",
"type": "string",
"tags": [],
"label": "value",
"description": [],
"source": {
"path": "src/plugins/kibana_react/public/code_editor/code_editor.tsx",
"lineNumber": 37
},
"deprecated": false
},
{
"parentPluginId": "kibanaReact",
"id": "def-public.event",
"type": "Object",
"tags": [],
"label": "event",
"description": [],
"signature": [
"editor",
".IModelContentChangedEvent"
],
"source": {
"path": "src/plugins/kibana_react/public/code_editor/code_editor.tsx",
"lineNumber": 37
},
"deprecated": false
}
]
"deprecated": false
},
{
"parentPluginId": "kibanaReact",

View file

@ -18,7 +18,7 @@ import kibanaReactObj from './kibana_react.json';
| Public API count | Any count | Items lacking comments | Missing exports |
|-------------------|-----------|------------------------|-----------------|
| 260 | 5 | 230 | 4 |
| 258 | 5 | 228 | 4 |
## Client

View file

@ -56,7 +56,6 @@ export const JsonCodeEditorCommon = ({
languageId={XJsonLang.ID}
width={width}
value={jsonValue || ''}
onChange={() => {}}
editorDidMount={onEditorDidMount}
aria-label={codeEditorAriaLabel}
options={{

View file

@ -546,7 +546,6 @@ exports[`Source Viewer component renders json code editor 1`] = `
aria-label="Read only JSON view of an elasticsearch document"
editorDidMount={[Function]}
languageId="xjson"
onChange={[Function]}
options={
Object {
"automaticLayout": true,

View file

@ -54,7 +54,6 @@ export const RequestCodeViewer = ({ json }: RequestCodeViewerProps) => (
<CodeEditor
languageId={XJsonLang.ID}
value={json}
onChange={() => {}}
options={{
readOnly: true,
lineNumbers: 'off',

View file

@ -34,7 +34,7 @@ export interface Props {
value: string;
/** Function invoked when text in editor is changed */
onChange: (value: string, event: monaco.editor.IModelContentChangedEvent) => void;
onChange?: (value: string, event: monaco.editor.IModelContentChangedEvent) => void;
/**
* Options for the Monaco Code Editor

View file

@ -74,7 +74,6 @@ export const SpecViewer = ({ vegaAdapter, ...rest }: SpecViewerProps) => {
<CodeEditor
languageId={XJsonLang.ID}
value={spec}
onChange={() => {}}
options={{
readOnly: true,
lineNumbers: 'off',

View file

@ -35,7 +35,6 @@ const InspectFlyout = ({ uiSettings, searchSession }: InspectFlyoutProps) => {
<CodeEditor
languageId="json"
value={JSON.stringify(searchSession.initialState, null, 2)}
onChange={() => {}}
options={{
readOnly: true,
lineNumbers: 'off',

View file

@ -75,7 +75,6 @@ export class ImportCompleteView extends Component<Props, {}> {
<CodeEditor
languageId="json"
value={jsonAsString}
onChange={() => {}}
options={{
readOnly: true,
lineNumbers: 'off',