Skip to content
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

Can you apply a theme using CodeMirrorMerge? #515

Closed
kimfucious opened this issue Jun 2, 2023 · 18 comments
Closed

Can you apply a theme using CodeMirrorMerge? #515

kimfucious opened this issue Jun 2, 2023 · 18 comments
Labels

Comments

@kimfucious
Copy link

I'm trying to compare two markdown files, using CodeMirrorMerge.

Question: Is there a way to apply a theme in the below?

import { EditorState } from "@codemirror/state";
import { EditorView } from "codemirror";
import { Scene } from "../../../types";
import CodeMirrorMerge from "react-codemirror-merge";

const Original = CodeMirrorMerge.Original;
const Modified = CodeMirrorMerge.Modified;

interface Props {
    changedText: string;
    setChangedText: (s: string) => void;
    originalScene: Scene | undefined;
    original: string | undefined;
    modified: string | undefined;
}
// https://uiwjs.github.io/react-codemirror/#/merge/onchange
export default function MergeEditor({
    original,
    modified,
    changedText,
    setChangedText,
}: Props) {
    function handleChange(str: string) {
        console.log("Changed Text", str);
        setChangedText(str);
    }

    return (
        <div className="container d-flex flex-column align-items-center w-100">
            <CodeMirrorMerge
                className="w-100"
                highlightChanges
                orientation="a-b"
                revertControls="b-to-a"
            >
                <Original
                    value={original}
                    onChange={(str) => handleChange(str)}
                />
                <Modified
                    value={modified}
                    extensions={[
                        EditorView.editable.of(false),
                        EditorState.readOnly.of(true),
                    ]}
                />
            </CodeMirrorMerge>

            <div className="d-flex justify-content-between w-100">
                <small>Current Scene</small>
                <small>Unsaved Changes</small>
            </div>
            {changedText !== modified && (
                <div className="d-flex justify-content-center mt-3 w-100">
                    You can merge the unsaved changes by clicking the little
                    arrow
                </div>
            )}
        </div>
    );
}
@jaywcjlove jaywcjlove added the demo label Jun 2, 2023
@jaywcjlove
Copy link
Member

@kimfucious https://codesandbox.io/embed/react-codemirror-merge-https-github-com-uiwjs-react-codemirror-issues-515-0888v2?fontsize=14&hidenavigation=1&theme=dark

import React from "react";
import CodeMirrorMerge from "react-codemirror-merge";
import { EditorView } from "@codemirror/view";
import { draculaInit } from "@uiw/codemirror-theme-dracula";
import { javascript } from "@codemirror/lang-javascript";

export const defaultThemeOption = EditorView.theme(
  {
    "&": {
      backgroundColor: "#333 !important"
    }
  },
  {
    dark: true
  }
);

const Original = CodeMirrorMerge.Original;
const Modified = CodeMirrorMerge.Modified;
let doc = `function examle() {

}`;

export default function App() {
  return (
    <div>
      <CodeMirrorMerge orientation="a-b">
        <Original
          extensions={[
            defaultLightThemeOption,
            draculaInit({
              theme: "dark"
            }),
            javascript({ jsx: true }),
            EditorView.lineWrapping
          ]}
          value={doc}
        />
        <Modified
          extensions={[EditorView.lineWrapping]}
          value={doc.replace(/e/g, "T")}
        />
      </CodeMirrorMerge>
    </div>
  );
}

@kimfucious
Copy link
Author

Thanks for this @jaywcjlove.

I actually prefer your default "dark" mode. Not sure how to use that. If I can't I'll default to one of the other dark themes.

BTW, I noticed this link seems to lead nowhere: https://uiwjs.github.io/react-codemirror/#/theme/data/vscode/dark

@kimfucious
Copy link
Author

Thanks for your help on this, @jaywcjlove. It's appreciated.

I worked through things and got to the below.

I couldn't find the default "dark" theme settings for defaultThemeOptions so I went with materialDark.

import { useContext, useMemo } from "react";
import { EditorState } from "@codemirror/state";
import { EditorView } from "codemirror";
import { markdown } from "@codemirror/lang-markdown";
import { materialDarkInit } from "@uiw/codemirror-theme-material";
import { Scene } from "../../../types";
import { solarizedLightInit } from "@uiw/codemirror-theme-solarized";
import { ThemeContext } from "../../../contexts/ThemeProvider";
import { vim } from "@replit/codemirror-vim";
import CodeMirrorMerge from "react-codemirror-merge";

const Original = CodeMirrorMerge.Original;
const Modified = CodeMirrorMerge.Modified;

interface Props {
    changedText: string;
    setChangedText: (s: string) => void;
    originalScene: Scene | undefined;
    original: string | undefined;
    modified: string | undefined;
}
// https://uiwjs.github.io/react-codemirror/#/merge/onchange
export default function MergeEditor({
    original,
    modified,
    changedText,
    setChangedText,
}: Props) {
    const { isDark } = useContext(ThemeContext);
    function handleChange(str: string) {
        setChangedText(str);
    }
    const { defaultThemeOptions, theme } = useMemo(() => {
        const defaultThemeOptions = EditorView.theme(
            {
                "&": {
                    background: isDark
                        ? "#2e3235 !important"
                        : "#2e3235 !important",
                    backgroundColor: isDark
                        ? "#2e3235 !important"
                        : "#fdf6e3 !important",
                    foreground: isDark
                        ? "#bdbdbd !important"
                        : "#657b83 !important",
                    caret: isDark ? "#a0a4ae !important" : "#586e75 !important",
                    selection: isDark
                        ? "#d7d4f0 !important"
                        : "#dfd9c8 !important",
                    selectionMatch: isDark
                        ? "#d7d4f0 !important"
                        : "#dfd9c8 !important",
                    gutterBackground: isDark
                        ? "#2e3235 !important"
                        : "#00000010 !important",
                    gutterActiveBackground: isDark
                        ? "#4f5b66 !important"
                        : "#00000010 !important",
                    gutterActiveForeground: isDark
                        ? "#000 !important"
                        : "#657b83 !important",
                    gutterForeground: isDark
                        ? // ? "#999 !important"
                          "#ff69b4 !important"
                        : "#657b83 !important",
                    lineHighlight: isDark
                        ? "#545b61 !important"
                        : "#dfd9c8 !important",
                },
            },
            {
                dark: isDark,
            }
        );
        const theme = isDark
            ? materialDarkInit({ theme: "dark" })
            : solarizedLightInit({ theme: "light" });
        return { defaultThemeOptions, theme };
    }, [isDark]);

    return (
        <div className="container d-flex flex-column align-items-center w-100">
            <CodeMirrorMerge
                className="w-100"
                gutter={false}
                highlightChanges
                orientation="a-b"
                revertControls="b-to-a"
            >
                <Original
                    extensions={[
                        vim({ status: false }),
                        defaultThemeOptions,
                        theme,
                        markdown(),
                        EditorView.lineWrapping,
                        EditorView.contentAttributes.of({ spellcheck: "true" }),
                    ]}
                    value={original}
                    onChange={(str) => handleChange(str)}
                />
                <Modified
                    value={modified}
                    extensions={[
                        vim({ status: false }),
                        defaultThemeOptions,
                        theme,
                        markdown(),
                        EditorView.lineWrapping,
                        EditorView.editable.of(false),
                        EditorState.readOnly.of(true),
                    ]}
                />
            </CodeMirrorMerge>

            <div className="d-flex justify-content-between w-100">
                <small>Current Scene</small>
                <small>Unsaved Changes (read only)</small>
            </div>
            {changedText !== modified && (
                <div className="d-flex justify-content-center mt-3 w-100">
                    You can merge the unsaved changes by clicking the little
                    arrow
                </div>
            )}
        </div>
    );
}

@kimfucious
Copy link
Author

Hi @jaywcjlove,

Before I close this, where can I find these values for the default "dark" theme?

Oddly, I like it better than all of the other packaged dark themes 😄

var defaultSettingsSolarizedLight = {
  background: '#fdf6e3',
  foreground: '#657b83',
  caret: '#586e75',
  selection: '#dfd9c8',
  selectionMatch: '#dfd9c8',
  gutterBackground: '#00000010',
  gutterForeground: '#657b83',
  lineHighlight: '#dfd9c8'
};

@jaywcjlove
Copy link
Member

@kimfucious

import { solarizedLight, solarizedLightInit, solarizedDark, solarizedDarkInit } from '@uiw/codemirror-theme-solarized';

<CodeMirror theme={solarizedLight} />
<CodeMirror
  theme={solarizedLightInit({
    settings: {
      caret: '#c6c6c6',
      fontFamily: 'monospace',
    }
  })}
/>

@kimfucious

export const solarizedDarkInit = (options?: Partial<CreateThemeOptions>) => {
const { theme = 'dark', settings = {}, styles = [] } = options || {};
return createTheme({
theme: theme,
settings: {
...defaultSettingsSolarizedDark,
...settings,
},
styles: [
{ tag: t.keyword, color: '#859900' },
{
tag: [t.name, t.deleted, t.character, t.propertyName, t.macroName],
color: '#2aa198',
},
{ tag: [t.variableName], color: '#93a1a1' },
{ tag: [t.function(t.variableName)], color: '#268bd2' },
{ tag: [t.labelName], color: '#d33682' },
{
tag: [t.color, t.constant(t.name), t.standard(t.name)],
color: '#b58900',
},
{ tag: [t.definition(t.name), t.separator], color: '#2aa198' },
{ tag: [t.brace], color: '#d33682' },
{
tag: [t.annotation],
color: '#d30102',
},
{
tag: [t.number, t.changed, t.annotation, t.modifier, t.self, t.namespace],
color: '#d33682',
},
{
tag: [t.typeName, t.className],
color: '#cb4b16',
},
{
tag: [t.operator, t.operatorKeyword],
color: '#6c71c4',
},
{
tag: [t.tagName],
color: '#268bd2',
},
{
tag: [t.squareBracket],
color: '#dc322f',
},
{
tag: [t.angleBracket],
color: '#586e75',
},
{
tag: [t.attributeName],
color: '#93a1a1',
},
{
tag: [t.regexp],
color: '#d30102',
},
{
tag: [t.quote],
color: '#859900',
},
{ tag: [t.string], color: '#b58900' },
{
tag: t.link,
color: '#2aa198',
textDecoration: 'underline',
textUnderlinePosition: 'under',
},
{
tag: [t.url, t.escape, t.special(t.string)],
color: '#b58900',
},
{ tag: [t.meta], color: '#dc322f' },
{ tag: [t.comment], color: '#586e75', fontStyle: 'italic' },
{ tag: t.strong, fontWeight: 'bold', color: '#eee8d5' },
{ tag: t.emphasis, fontStyle: 'italic', color: '#859900' },
{ tag: t.strikethrough, textDecoration: 'line-through' },
{ tag: t.heading, fontWeight: 'bold', color: '#b58900' },
{ tag: t.heading1, fontWeight: 'bold', color: '#fdf6e3' },
{
tag: [t.heading2, t.heading3, t.heading4],
fontWeight: 'bold',
color: '#eee8d5',
},
{
tag: [t.heading5, t.heading6],
color: '#eee8d5',
},
{ tag: [t.atom, t.bool, t.special(t.variableName)], color: '#d33682' },
{
tag: [t.processingInstruction, t.inserted, t.contentSeparator],
color: '#dc322f',
},
{
tag: [t.contentSeparator],
color: '#b58900',
},
{ tag: t.invalid, color: '#586e75', borderBottom: `1px dotted #dc322f` },
...styles,
],
});
};

@jaywcjlove
Copy link
Member

export const defaultSettingsSolarizedLight: CreateThemeOptions['settings'] = {
background: '#fdf6e3',
foreground: '#657b83',
caret: '#586e75',
selection: '#dfd9c8',
selectionMatch: '#dfd9c8',
gutterBackground: '#00000010',
gutterForeground: '#657b83',
lineHighlight: '#dfd9c8',
};

@kimfucious
Copy link
Author

Hi @jaywcjlove,

Sorry for the confusion.

I'm looking for the values for the DEFAULT dark mode theme, not solarizedLight.

This is the theme that you can get with CodeMirror when you use theme={"dark"}.

Thanks.

@jaywcjlove
Copy link
Member

Oh, the theme is light by default, you don't need to get it, you set it to dark, you should log it.

@kimfucious
Copy link
Author

kimfucious commented Jun 4, 2023

Hi @jaywcjlove,

Sorry again for the confusion.

What I want is for the dark values in defaultThemeOptions to match the default "dark" theme's settings.

const { defaultThemeOptions, theme } = useMemo(() => {
        const defaultThemeOptions = EditorView.theme(
            {
                "&": {
                    background: isDark
                        ? "#2e3235 !important" // value from "dark"
                        : "#2e3235 !important",
                    backgroundColor: isDark
                        ? "#2e3235 !important" // value from "dark"
                        : "#fdf6e3 !important",
                    foreground: isDark
                        ? "#bdbdbd !important" // value from "dark"
                        : "#657b83 !important",
                    //...etc
                },
            },
            {
                dark: isDark,
            }
        );

Then I want

const theme = isDark
    ? materialDarkInit({ theme: "dark" }) // I want this "dark", not materialDark.
    : solarizedLightInit({ theme: "light" });

Thanks.

jaywcjlove added a commit that referenced this issue Jun 5, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
jaywcjlove added a commit that referenced this issue Jun 5, 2023
github-actions bot pushed a commit that referenced this issue Jun 5, 2023
@jaywcjlove
Copy link
Member

@kimfucious https://codesandbox.io/embed/react-codemirror-merge-https-github-com-uiwjs-react-codemirror-issues-515-forked-lm3kgo?fontsize=14&hidenavigation=1&theme=dark

import React, { useState } from "react";
import CodeMirrorMerge from "react-codemirror-merge";
import { EditorView } from "@codemirror/view";
import { javascript } from "@codemirror/lang-javascript";

const Original = CodeMirrorMerge.Original;
const Modified = CodeMirrorMerge.Modified;
let doc = `function examle() {

}`;

export default function App() {
  const [theme, setTheme] = useState("light");
  return (
    <div>
      <CodeMirrorMerge theme={theme} orientation="a-b">
        <Original
          extensions={[javascript({ jsx: true }), EditorView.lineWrapping]}
          value={doc}
        />
        <Modified
          extensions={[EditorView.lineWrapping]}
          value={doc.replace(/e/g, "T")}
        />
      </CodeMirrorMerge>
      <button onClick={() => setTheme(theme === "light" ? "dark" : "light")}>
        Change Theme {theme}
      </button>
    </div>
  );
}
import React, { useState } from "react";
import CodeMirrorMerge from "react-codemirror-merge";
import { EditorView } from "@codemirror/view";
import { javascript } from "@codemirror/lang-javascript";
import { githubLight, githubDark } from "@uiw/codemirror-theme-github";

const Original = CodeMirrorMerge.Original;
const Modified = CodeMirrorMerge.Modified;
let doc = `function examle() {

}`;

function Example() {
  const [theme, setTheme] = useState("light");
  return (
    <div>
      <CodeMirrorMerge
        theme={theme === "light" ? githubLight : githubDark}
        orientation="a-b"
      >
        <Original
          extensions={[javascript({ jsx: true }), EditorView.lineWrapping]}
          value={doc}
        />
        <Modified
          extensions={[EditorView.lineWrapping, javascript({ jsx: true })]}
          value={doc.replace(/e/g, "T")}
        />
      </CodeMirrorMerge>
      <button onClick={() => setTheme(theme === "light" ? "dark" : "light")}>
        Change Theme {theme}
      </button>
    </div>
  );
}

@kimfucious
Copy link
Author

Thanks @jaywcjlove.

Let me try to explain what I want once more.

I want the values for the below from the default dark theme:

settings: {
    background: '#ffffff',
    foreground: '#4D4D4C',
    caret: '#AEAFAD',
    selection: '#D6D6D6',
    selectionMatch: '#D6D6D6',
    gutterBackground: '#FFFFFF',
    gutterForeground: '#4D4D4C',
    gutterBorder: '#ddd',
    gutterActiveForeground: '',
    lineHighlight: '#EFEFEF',
  },

When I say "default dark theme", I mean the one that you get when using CodeMirror, like the below when you use "dark" without a packaged theme, but I want to use it with CodeMirrorMerge.

<CodeMirror
    autoFocus
    basicSetup={{
        foldGutter: false,
        highlightActiveLine: false,
    }}
    value={app.draftActiveSceneText}
    theme={isDark ? "dark" : "light"} // <= I want "dark" here.
    height={"500px"}
    width={`calc(36em + 74px)`}
    extensions={[
        vim({ status: true }),
        markdown(),
        EditorView.lineWrapping,
        EditorView.contentAttributes.of({ spellcheck: "true" }),
    ]}
    onChange={onChange}
/>

jaywcjlove added a commit that referenced this issue Jun 5, 2023
github-actions bot pushed a commit that referenced this issue Jun 5, 2023
@jaywcjlove
Copy link
Member

@kimfucious I tried to help you out, but not sure if it's what you want. https://codesandbox.io/embed/react-codemirror-merge-https-github-com-uiwjs-react-codemirror-issues-515-forked-dqrcgt?fontsize=14&hidenavigation=1&theme=dark

import React, { useState } from "react";
import CodeMirrorMerge from "react-codemirror-merge";
import { EditorView } from "@codemirror/view";
import { javascript } from "@codemirror/lang-javascript";
import {
  githubLight,
  githubDark,
  githubDarkInit
} from "@uiw/codemirror-theme-github";
import { createTheme } from "@uiw/codemirror-themes";
import { tags as t } from "@lezer/highlight";

const myDarkTheme = createTheme({
  theme: "dark",
  settings: {
    background: "#fdf6e3",
    foreground: "#657b83",
    caret: "#586e75",
    selection: "#dfd9c8",
    selectionMatch: "#dfd9c8",
    gutterBackground: "#00000010",
    gutterForeground: "#657b83",
    lineHighlight: "#dfd9c8"
  },
  styles: [
    { tag: t.comment, color: "#787b8099" },
    { tag: t.variableName, color: "#0080ff" },
    { tag: [t.string, t.special(t.brace)], color: "#5c6166" },
    { tag: t.number, color: "#5c6166" },
    { tag: t.bool, color: "#5c6166" },
    { tag: t.null, color: "#5c6166" },
    { tag: t.keyword, color: "#5c6166" },
    { tag: t.operator, color: "#5c6166" },
    { tag: t.className, color: "#5c6166" },
    { tag: t.definition(t.typeName), color: "#5c6166" },
    { tag: t.typeName, color: "#5c6166" },
    { tag: t.angleBracket, color: "#5c6166" },
    { tag: t.tagName, color: "#5c6166" },
    { tag: t.attributeName, color: "#5c6166" }
  ]
});

const Original = CodeMirrorMerge.Original;
const Modified = CodeMirrorMerge.Modified;
let doc = `function examle() {

}`;

export default function Example() {
  const [theme, setTheme] = useState("dark");
  return (
    <div>
      <CodeMirrorMerge
        theme={theme === "dark" ? myDarkTheme : githubLight}
        orientation="a-b"
      >
        <Original
          extensions={[javascript({ jsx: true }), EditorView.lineWrapping]}
          value={doc}
        />
        <Modified
          extensions={[EditorView.lineWrapping, javascript({ jsx: true })]}
          value={doc.replace(/e/g, "T")}
        />
      </CodeMirrorMerge>
      <button onClick={() => setTheme(theme === "light" ? "dark" : "light")}>
        Change Theme {theme}
      </button>
    </div>
  );
}

@kimfucious
Copy link
Author

Hi @jaywcjlove.

I'm sorry for the continued confusion. I am really not communicating clearly, it seems.

I want the theme that looks like the below to use in CodeMergeView so that it will match what I'm using in CodeMirror.

It is NOT any of the themes that are listed here.

It is the theme that is used in CodeMirror with the below. Note that I am not importing any theme. I am only using "dark" (a string) as the value.

<CodeMirror
    autoFocus
    basicSetup={{
        foldGutter: false,
        highlightActiveLine: false,
    }}
    value={app.draftActiveSceneText}
    // themes: https://uiwjs.github.io/react-codemirror/#/theme/home
    theme="dark" // <= No imported theme.  Just "dark"
    height={"500px"}
    width={`calc(36em + 74px)`}
    extensions={[
        vim({ status: true }),
        markdown(),
        EditorView.lineWrapping,
        EditorView.contentAttributes.of({ spellcheck: "true" }),
    ]}
    onChange={onChange}
/>

I don't need a Code Sandbox example. I just need the values that match what looks like below.

I cannot find these values buried anywhere in the code, so I'm asking.

Thanks for your patience.

image

@jaywcjlove
Copy link
Member

@kimfucious If you don't want to use import { createTheme } from "@uiw/codemirror-themes"; to define your theme, you can only use the official method definition.

export const createTheme = ({ theme, settings = {}, styles = [] }: CreateThemeOptions): Extension => {
const themeOptions: Record<string, StyleSpec> = {
'.cm-gutters': {},
};
const baseStyle: StyleSpec = {};
if (settings.background) {
baseStyle.backgroundColor = settings.background;
}
if (settings.foreground) {
baseStyle.color = settings.foreground;
}
if (settings.background || settings.foreground) {
themeOptions['&'] = baseStyle;
}
if (settings.fontFamily) {
themeOptions['&.cm-editor .cm-scroller'] = {
fontFamily: settings.fontFamily,
};
}
if (settings.gutterBackground) {
themeOptions['.cm-gutters'].backgroundColor = settings.gutterBackground;
}
if (settings.gutterForeground) {
themeOptions['.cm-gutters'].color = settings.gutterForeground;
}
if (settings.gutterBorder) {
themeOptions['.cm-gutters'].borderRightColor = settings.gutterBorder;
}
if (settings.caret) {
themeOptions['.cm-content'] = {
caretColor: settings.caret,
};
themeOptions['.cm-cursor, .cm-dropCursor'] = {
borderLeftColor: settings.caret,
};
}
let activeLineGutterStyle: StyleSpec = {};
if (settings.gutterActiveForeground) {
activeLineGutterStyle.color = settings.gutterActiveForeground;
}
if (settings.lineHighlight) {
themeOptions['.cm-activeLine'] = {
backgroundColor: settings.lineHighlight,
};
activeLineGutterStyle.backgroundColor = settings.lineHighlight;
}
themeOptions['.cm-activeLineGutter'] = activeLineGutterStyle;
if (settings.selection) {
themeOptions[
'&.cm-focused .cm-selectionBackground, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection'
] = {
backgroundColor: settings.selection,
};
}
if (settings.selectionMatch) {
themeOptions['& .cm-selectionMatch'] = {
backgroundColor: settings.selectionMatch,
};
}
const themeExtension = EditorView.theme(themeOptions, {
dark: theme === 'dark',
});
const highlightStyle = HighlightStyle.define(styles);
const extension = [themeExtension, syntaxHighlighting(highlightStyle)];
return extension;
};
export default createTheme;

createTheme is the method that simplifies official theme definitions

@jaywcjlove
Copy link
Member

jaywcjlove commented Jun 5, 2023

@kimfucious For custom styles, you must encapsulate an Extension yourself.

@kimfucious
Copy link
Author

Hi @jaywcjlove ,

If I knew the Settings and Styles for the "default dark theme", I'd be happy to create a custom theme from that, but I don't know what they are, which is why I'm asking.

@jaywcjlove
Copy link
Member

import { oneDark } from '@codemirror/theme-one-dark';

This is the built-in official theme, it does not support customization.

switch (theme) {
case 'light':
getExtensions.push(defaultLightThemeOption);
break;
case 'dark':
getExtensions.push(oneDark);
break;
case 'none':
break;
default:
getExtensions.push(theme);
break;
}

@kimfucious If you want to know what styles it defines, you can check here. Currently, the built-in dark theme can only be changed by overriding.

@kimfucious
Copy link
Author

@jaywcjlove, Yay!

I did not know that oneDark was the default dark theme. That helped!

To implement, I used the following.

const { defaultThemeOptions, theme } = useMemo(() => {
    const defaultThemeOptions = EditorView.theme(
        {
            "&": {
                backgroundColor: isDark
                    ? "#282c34 !important"
                    : "#fdf6e3 !important",
            },
        },
        {
            dark: isDark,
        }
    );
    const theme = isDark ? [oneDark] : [solarizedLight];
    return { defaultThemeOptions, theme };
}, [isDark]);
<CodeMirrorMerge
    className="w-100"
    highlightChanges
    orientation="a-b"
    revertControls="b-to-a"
>
    <Original
        extensions={[
            vim({ status: false }),
            defaultThemeOptions,
            theme,
            markdown(),
            EditorView.lineWrapping,
            EditorView.contentAttributes.of({ spellcheck: "true" }),
        ]}
        value={original}
        onChange={(str) => handleChange(str)}
    />
    <Modified
        value={modified}
        extensions={[
            vim({ status: false }),
            defaultThemeOptions,
            theme,
            markdown(),
            EditorView.lineWrapping,
            EditorView.editable.of(false),
            EditorState.readOnly.of(true),
        ]}
    />
</CodeMirrorMerge>

Thank you very much for your patience on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants