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", "label": "onChange",
"description": [], "description": [],
"signature": [ "signature": [
"(value: string, event: ", "((value: string, event: ",
"editor", "editor",
".IModelContentChangedEvent) => void" ".IModelContentChangedEvent) => void) | undefined"
], ],
"source": { "source": {
"path": "src/plugins/kibana_react/public/url_template_editor/url_template_editor.tsx", "path": "src/plugins/kibana_react/public/url_template_editor/url_template_editor.tsx",
"lineNumber": 27 "lineNumber": 27
}, },
"deprecated": false, "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
}
]
}, },
{ {
"parentPluginId": "kibanaReact", "parentPluginId": "kibanaReact",

View file

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

View file

@ -56,7 +56,6 @@ export const JsonCodeEditorCommon = ({
languageId={XJsonLang.ID} languageId={XJsonLang.ID}
width={width} width={width}
value={jsonValue || ''} value={jsonValue || ''}
onChange={() => {}}
editorDidMount={onEditorDidMount} editorDidMount={onEditorDidMount}
aria-label={codeEditorAriaLabel} aria-label={codeEditorAriaLabel}
options={{ 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" aria-label="Read only JSON view of an elasticsearch document"
editorDidMount={[Function]} editorDidMount={[Function]}
languageId="xjson" languageId="xjson"
onChange={[Function]}
options={ options={
Object { Object {
"automaticLayout": true, "automaticLayout": true,

View file

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

View file

@ -34,7 +34,7 @@ export interface Props {
value: string; value: string;
/** Function invoked when text in editor is changed */ /** 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 * Options for the Monaco Code Editor

View file

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

View file

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

View file

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