Skip to content

Commit 8c675ca

Browse files
Merge pull request #881 from gadget-inc/mill/removeAutoFormRichTextDiffAndCodeView
Removed diff and code view from the AutoForm richText inputs
2 parents e29e0ef + e0be6af commit 8c675ca

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

packages/react/src/auto/shared/AutoRichTextInput.tsx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import * as mdxModule from "@mdxeditor/editor";
22
import "@mdxeditor/editor/style.css";
33
import React, { useEffect, useRef } from "react";
44
import { GadgetFieldType } from "../../internal/gql/graphql.js";
5-
import { useFormContext } from "../../useActionForm.js";
6-
import { get } from "../../utils.js";
75
import { autoInput } from "../AutoInput.js";
86
import { useStringInputController } from "../hooks/useStringInputController.js";
97
import { assertFieldType, multiref } from "../hooks/utils.js";
@@ -21,16 +19,13 @@ const {
2119
thematicBreakPlugin,
2220
markdownShortcutPlugin,
2321
linkDialogPlugin,
24-
diffSourcePlugin,
2522
toolbarPlugin,
26-
DiffSourceToggleWrapper,
2723
UndoRedo,
2824
BlockTypeSelect,
2925
Separator,
3026
} = mdxModule;
3127

3228
const AutoRichTextInput = autoInput<AutoRichTextInputProps>((props) => {
33-
const { formState } = useFormContext();
3429
const { field, control, editorRef, ...rest } = props;
3530
const controller = useStringInputController({ field, control });
3631
assertFieldType({
@@ -56,22 +51,17 @@ const AutoRichTextInput = autoInput<AutoRichTextInputProps>((props) => {
5651
thematicBreakPlugin(),
5752
markdownShortcutPlugin(),
5853
linkDialogPlugin(),
59-
diffSourcePlugin({
60-
diffMarkdown: get(formState.defaultValues, field)?.markdown ?? "",
61-
viewMode: "rich-text",
62-
readOnlyDiff: true,
63-
}),
6454
toolbarPlugin({
6555
toolbarContents: () => (
66-
<DiffSourceToggleWrapper>
56+
<>
6757
<UndoRedo />
6858
<BlockTypeSelect />
6959
<Separator />
7060
<BoldItalicUnderlineToggles />
7161
<ListsToggle />
7262
<CodeToggle />
7363
<CreateLink />
74-
</DiffSourceToggleWrapper>
64+
</>
7565
),
7666
}),
7767
]}

0 commit comments

Comments
 (0)