You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Permission is hereby granted, free of charge, to any person obtaining a copy
226
+
of this software and associated documentation files (the "Software"), to deal
227
+
in the Software without restriction, including without limitation the rights
228
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
229
+
copies of the Software, and to permit persons to whom the Software is
230
+
furnished to do so, subject to the following conditions:
231
+
232
+
The above copyright notice and this permission notice shall be included in
233
+
all copies or substantial portions of the Software.
234
+
235
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
236
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
237
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
238
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
239
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
240
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
241
+
THE SOFTWARE.
242
+
217
243
---
218
244
This code is part of the Services provided by FullStory, Inc. For license information, please refer to https://www.fullstory.com/legal/terms-and-conditions/
219
245
Portions of this code are licensed under the following license:
Copy file name to clipboardExpand all lines: packages/shared-ux/code_editor/impl/README.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ date: 2022-12-05
9
9
10
10
## Description
11
11
12
-
This component is an abstraction of the [Monaco Code Editor](https://microsoft.github.io/monaco-editor/) (and the [React Monaco Editor component](https://github.com/react-monaco-editor/react-monaco-editor)). This component still allows access to the other Monaco features.
12
+
This component is an abstraction of the [Monaco Code Editor](https://microsoft.github.io/monaco-editor/). This component still allows access to the other Monaco features.
This is a fork of [react-monaco-editor project](https://github.com/react-monaco-editor/react-monaco-editor) that is a Monaco editor wrapper for React.
2
+
This fork is needed to apply a change that fixes the editor behavior in Kibana when running React@18 in Legacy Mode and the bug is described [here](https://github.com/facebook/react/issues/31023)
3
+
The change is to replace the `useEffect` hook with `useLayoutEffect` when the editor is in controlled mode and the value is updated from prop.
4
+
5
+
```diff
6
+
---useEffect(() => {
7
+
+++useLayoutEffect(() => {
8
+
if (editor.current) {
9
+
if (value === editor.current.getValue()) {
10
+
return;
11
+
}
12
+
13
+
const model = editor.current.getModel();
14
+
__prevent_trigger_change_event.current = true;
15
+
editor.current.pushUndoStop();
16
+
// pushEditOperations says it expects a cursorComputer, but doesn't seem to need one.
17
+
model.pushEditOperations(
18
+
[],
19
+
[
20
+
{
21
+
range: model.getFullModelRange(),
22
+
text: value,
23
+
},
24
+
],
25
+
undefined,
26
+
);
27
+
editor.current.pushUndoStop();
28
+
__prevent_trigger_change_event.current = false;
29
+
}
30
+
}, [value]);
31
+
```
32
+
33
+
In addition, the fork only includes functionality that is used in Kibana and removes the rest of the code that is not needed.
0 commit comments