Skip to content

Commit

Permalink
add an example for getting the values of DiffEditor
Browse files Browse the repository at this point in the history
  • Loading branch information
suren-atoyan committed Apr 2, 2021
1 parent 537b224 commit a41c3e7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
### Versions

## 4.1.1
###### *Apr 2, 2021*

- DiffEditor: update `DiffEditor`'s `modified` value by `executeEdits`
- README: add an example for getting the values of `DiffEditor`

## 4.1.0
###### *Mar 15, 2021*

Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,13 @@ ReactDOM.render(<App />, rootElement);

[codesandbox](https://codesandbox.io/s/onchange-4nf6g?file=/src/App.js)

3) get the diffEditor value via `onMount` prop
<details><summary>(get the `DiffEditor` values via `editor` instance)</summary>

```javascript
import React, { useRef } from 'react';
import ReactDOM from 'react-dom';
import React, { useRef } from "react";
import ReactDOM from "react-dom";

import { DiffEditor } from '@monaco-editor/react';
import { DiffEditor } from "@monaco-editor/react";

function App() {
const diffEditorRef = useRef(null);
Expand Down Expand Up @@ -257,12 +257,13 @@ function App() {
);
}

const rootElement = document.getElementById('root');
const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);
```
- [codesandbox](https://codesandbox.io/s/simple-usage-forked-z31tj)
- [getmodifiededitor](https://microsoft.github.io/monaco-editor/api/interfaces/monaco.editor.idiffeditor.html#getmodifiededitor)
- [getoriginaleditor](https://microsoft.github.io/monaco-editor/api/interfaces/monaco.editor.idiffeditor.html#getoriginaleditor)

[codesandbox](https://codesandbox.io/s/get-values-diffeditor-c6xrg?file=/src/App.js)

</details>

#### `editor instance`

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@monaco-editor/react",
"version": "4.1.0",
"version": "4.1.1",
"description": "Monaco Editor for React - use the monaco-editor in any React application without needing to use webpack (or rollup/parcel/etc) configuration files / plugins",
"author": "Suren Atoyan <[email protected]>",
"main": "lib/cjs/index.js",
Expand Down

0 comments on commit a41c3e7

Please sign in to comment.