-
-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CodeMirrorMerge - Gutter size ingreses when updating #520
Labels
Comments
jaywcjlove
added a commit
that referenced
this issue
Jun 7, 2023
@guillermoamaral Upgrade import React, { useState } from "react";
import CodeMirrorMerge from "react-codemirror-merge";
import { EditorView } from "@codemirror/view";
const Original = CodeMirrorMerge.Original;
const Modified = CodeMirrorMerge.Modified;
function randomText(size) {
let letters = `abcdefghyjklmnopqrstuvwxyz`;
let text = "";
for (let i = 0; i < size; i++) {
text = text + letters[Math.floor(Math.random() * letters.length)];
}
return text;
}
export default function App() {
const [value, setValue] = useState("abc");
const [valueModified, setValueModified] = useState("ab");
return (
<div>
<button
onClick={() => {
setValue(randomText(10));
setValueModified(randomText(10));
}}
>
Update
</button>
<CodeMirrorMerge orientation="a-b" gutter={false}>
<Original
extensions={[EditorView.lineWrapping]}
onChange={(value) => {
setValue(value);
}}
value={value}
/>
<Modified
extensions={[EditorView.lineWrapping]}
onChange={(value) => {
setValueModified(value);
}}
value={valueModified}
/>
</CodeMirrorMerge>
</div>
);
} |
Many thanks sr! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For some reason that I cannot figure out, updating both original and modified values makes gutter margin to increase.
https://codesandbox.io/s/fast-shadow-8v936f?file=/src/App.js
Am I doing someting wrong?
The text was updated successfully, but these errors were encountered: