From 2e4c2cab2e758e65e63156edc63fdbb2b2488b87 Mon Sep 17 00:00:00 2001 From: Samantha Holstine Date: Wed, 24 Jun 2026 12:14:59 -0600 Subject: [PATCH 1/2] Update text boxes for 'name' in the branding API to be editable --- .../ApiExplorer/Body/FormBodyItem/index.tsx | 2 +- src/theme/ApiExplorer/FormTextInput/index.tsx | 31 ++++++++++++------- .../ParamFormItems/ParamTextFormItem.tsx | 2 +- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/theme/ApiExplorer/Body/FormBodyItem/index.tsx b/src/theme/ApiExplorer/Body/FormBodyItem/index.tsx index 46f1c32a66990..fe4792c7aeb11 100644 --- a/src/theme/ApiExplorer/Body/FormBodyItem/index.tsx +++ b/src/theme/ApiExplorer/Body/FormBodyItem/index.tsx @@ -102,7 +102,7 @@ export default function FormBodyItem({ // TODO: support all the other types. return ( {paramName ? ( { + registerOnChange?.(e); + onChange?.(e); + }} autoComplete="off" /> ) : ( @@ -61,7 +70,7 @@ function FormTextInput({ type={password ? "password" : "text"} placeholder={placeholder} title={placeholder} - value={value} + {...(value !== undefined ? { value } : {})} onChange={onChange} autoComplete="off" /> diff --git a/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.tsx b/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.tsx index bf4f35e72bc74..d019cf92ade7c 100644 --- a/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.tsx +++ b/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.tsx @@ -13,7 +13,7 @@ export default function ParamTextFormItem({ param }: ParamProps) { return ( ) => dispatch( From 8d78395aac514dd08fe7388c83665fe327c76e2e Mon Sep 17 00:00:00 2001 From: Samantha Holstine Date: Thu, 25 Jun 2026 08:09:18 -0600 Subject: [PATCH 2/2] Always show API explorer server controls Co-authored-by: Cursor --- src/theme/ApiExplorer/Server/index.tsx | 135 +++++++++---------------- 1 file changed, 50 insertions(+), 85 deletions(-) diff --git a/src/theme/ApiExplorer/Server/index.tsx b/src/theme/ApiExplorer/Server/index.tsx index d98d264a06b26..503110b6a19ca 100644 --- a/src/theme/ApiExplorer/Server/index.tsx +++ b/src/theme/ApiExplorer/Server/index.tsx @@ -1,17 +1,13 @@ -import React, { useState } from "react"; +import React from 'react'; -import { translate } from "@docusaurus/Translate"; -import FloatingButton from "@theme/ApiExplorer/FloatingButton"; -import FormItem from "@theme/ApiExplorer/FormItem"; -import FormSelect from "@theme/ApiExplorer/FormSelect"; -import FormTextInput from "@theme/ApiExplorer/FormTextInput"; -import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks"; -import { OPENAPI_SERVER } from "@theme/translationIds"; +import FormItem from '@theme/ApiExplorer/FormItem'; +import FormSelect from '@theme/ApiExplorer/FormSelect'; +import FormTextInput from '@theme/ApiExplorer/FormTextInput'; +import {useTypedDispatch, useTypedSelector} from '@theme/ApiItem/hooks'; -import { setServer, setServerVariable } from "./slice"; +import {setServer, setServerVariable} from './slice'; function Server() { - const [isEditing, setIsEditing] = useState(false); const value = useTypedSelector((state: any) => state.server.value); const options = useTypedSelector((state: any) => state.server.options); const dispatch = useTypedDispatch(); @@ -38,92 +34,61 @@ function Server() { } } - if (!isEditing) { - let url = ""; - if (value) { - url = value.url.replace(/\/$/, ""); - if (value.variables) { - Object.keys(value.variables).forEach((variable) => { - url = url.replace( - `{${variable}}`, - value.variables?.[variable].default ?? "" - ); - }); - } - } - return ( - setIsEditing(true)} - label={translate({ id: OPENAPI_SERVER.EDIT_BUTTON, message: "Edit" })} - > - - - {url} - - - - ); - } return (
- setIsEditing(false)} - label={translate({ id: OPENAPI_SERVER.HIDE_BUTTON, message: "Hide" })} - > - - s.url)} - onChange={(e: React.ChangeEvent) => { - dispatch( - setServer( - JSON.stringify( - options.filter((s: any) => s.url === e.target.value)[0] - ) - ) - ); - }} - value={value?.url} - /> - - {value?.description} - - - {value?.variables && - Object.keys(value.variables).map((key) => { - if (value.variables?.[key].enum !== undefined) { - return ( - - ) => { - dispatch( - setServerVariable( - JSON.stringify({ key, value: e.target.value }) - ) - ); - }} - value={value?.variables[key].default} - /> - - ); - } + + s.url)} + onChange={(e: React.ChangeEvent) => { + dispatch( + setServer( + JSON.stringify( + options.filter((s: any) => s.url === e.target.value)[0], + ), + ), + ); + }} + value={value?.url} + /> + + {value?.description} + + + {value?.variables && + Object.keys(value.variables).map((key) => { + if (value.variables?.[key].enum !== undefined) { return ( - ) => { + ) => { dispatch( setServerVariable( - JSON.stringify({ key, value: e.target.value }) - ) + JSON.stringify({key, value: e.target.value}), + ), ); }} - value={value?.variables?.[key].default} + value={value?.variables[key].default} /> ); - })} - + } + return ( + + ) => { + dispatch( + setServerVariable( + JSON.stringify({key, value: e.target.value}), + ), + ); + }} + value={value?.variables?.[key].default} + /> + + ); + })}
); }