Skip to content

Support project documentation with direct Markdown input #3478

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

Merged
merged 14 commits into from
Mar 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions client/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
"apiversion",
"ascii",
"asciimath",
"autoformat",
"autosave",
"autosaved",
"autosaves",
Expand All @@ -106,6 +107,7 @@
"bool",
"booleans",
"borderless",
"bulleted",
"calc",
"cancellable",
"cancelled",
Expand Down Expand Up @@ -257,13 +259,15 @@
"stdout",
"stockimages",
"storages",
"strikethrough",
"swiper",
"tada",
"telepresence",
"textarea",
"thead",
"toastify",
"toggler",
"tokenizer",
"tolerations",
"toml",
"tooltip",
Expand Down
21 changes: 12 additions & 9 deletions client/src/components/form-field/TextAreaInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

// TODO: Upgrade to ckeditor5 v6.0.0 to get TS support
import cx from "classnames";
import React from "react";
import { Controller } from "react-hook-form";
import type {
Expand All @@ -42,9 +43,9 @@ function EditMarkdownSwitch(props: EditMarkdownSwitchProps) {
const outputType = "markdown";
const switchLabel = outputType === "markdown" ? "Raw Markdown" : "Raw HTML";
return (
<div className="form-check form-switch float-end">
<div className={cx("form-check", "form-switch", "float-end")}>
<Input
className="form-check-input rounded-pill"
className={cx("form-check-input", "rounded-pill")}
type="switch"
id="CKEditorSwitch"
name="customSwitch"
Expand Down Expand Up @@ -107,7 +108,7 @@ interface TextAreaInputProps<T extends FieldValues> {
error?: FieldError;
getValue: () => string;
help?: string | React.ReactNode;
label: string;
label?: string;
name: string;
register: UseFormRegisterReturn;
required?: boolean;
Expand All @@ -119,12 +120,14 @@ function TextAreaInput<T extends FieldValues>(props: TextAreaInputProps<T>) {
return (
<div>
<FormGroup className="field-group">
<div className="pb-2">
<FormLabel
name={props.name}
label={props.label}
required={props.required ?? false}
/>
<div className={cx("pb-2", props.label == null && "mb-4")}>
{props.label && (
<FormLabel
name={props.name}
label={props.label}
required={props.required ?? false}
/>
)}
<EditMarkdownSwitch codeView={codeView} setCodeView={setCodeView} />
</div>
<div data-cy={`ckeditor-${props.name}`}>
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/formlabels/FormLabels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ interface InputLabelProps extends LabelProps {
}

const InputLabel = ({ text, isRequired = false }: InputLabelProps) => {
return (
return text ? (
<Label>
{text} <RequiredLabel isRequired={isRequired} />
</Label>
);
) : null;
};

const LoadingLabel = ({ className, text }: LabelProps) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export default function ProjectPageContainer() {
useGetNamespacesByNamespaceProjectsAndSlugQuery({
namespace: namespace ?? "",
slug: slug ?? "",
withDocumentation: true,
});

const navigate = useNavigate();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.modalBody {
max-height: 75vh;
}
Loading
Loading