mirror of
https://github.com/vxcontrol/pentagi.git
synced 2026-09-23 10:45:42 +00:00
refactor(editor): rename show{Label,Toolbar} -> has{Label,Toolbar}
Boolean presence flags use the has* prefix per the project naming convention. showToolbar (MarkdownEditor) had no external callers; showLabel had one (knowledge-form-layout) — renamed both together to stay consistent. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
52ec6667b6
commit
7a96d9dbd4
@@ -42,10 +42,10 @@ export interface MarkdownEditorProps {
|
||||
className?: string;
|
||||
contentClassName?: string;
|
||||
disabled?: boolean;
|
||||
hasToolbar?: boolean;
|
||||
onBlur?: () => void;
|
||||
onChange: (value: string) => void;
|
||||
placeholder?: string;
|
||||
showToolbar?: boolean;
|
||||
value: string;
|
||||
}
|
||||
|
||||
@@ -94,11 +94,11 @@ function MarkdownEditor({
|
||||
className,
|
||||
contentClassName,
|
||||
disabled,
|
||||
hasToolbar = true,
|
||||
onBlur,
|
||||
onChange,
|
||||
placeholder = 'Write something…',
|
||||
ref,
|
||||
showToolbar = true,
|
||||
value,
|
||||
}: MarkdownEditorProps & { ref?: Ref<MarkdownEditorHandle> }) {
|
||||
// Suppress echoes of our own output: the markdown round-trip re-serializes slightly (whitespace/list
|
||||
@@ -281,7 +281,7 @@ function MarkdownEditor({
|
||||
)}
|
||||
data-slot="markdown-editor"
|
||||
>
|
||||
{showToolbar ? (
|
||||
{hasToolbar ? (
|
||||
<MarkdownEditorToolbar
|
||||
disabled={disabled}
|
||||
editor={editor}
|
||||
|
||||
@@ -74,8 +74,8 @@ interface KnowledgeContentFieldProps {
|
||||
control: Control<FormValues>;
|
||||
/** When `true`, the editor stretches to fill its parent (desktop split view). */
|
||||
fillParent?: boolean;
|
||||
hasLabel?: boolean;
|
||||
isSaving: boolean;
|
||||
showLabel?: boolean;
|
||||
/** 'visual' (default) = rich MarkdownEditor; 'plain' = raw-markdown textarea. */
|
||||
viewMode?: 'plain' | 'visual';
|
||||
}
|
||||
@@ -89,8 +89,8 @@ interface KnowledgeMetaFieldsProps {
|
||||
export function KnowledgeContentField({
|
||||
control,
|
||||
fillParent = false,
|
||||
hasLabel = false,
|
||||
isSaving,
|
||||
showLabel = false,
|
||||
viewMode = 'visual',
|
||||
}: KnowledgeContentFieldProps) {
|
||||
return (
|
||||
@@ -99,7 +99,7 @@ export function KnowledgeContentField({
|
||||
name="content"
|
||||
render={({ field }) => (
|
||||
<FormItem className={fillParent ? 'flex min-h-0 flex-1 flex-col' : undefined}>
|
||||
{showLabel ? <FormLabel>Content</FormLabel> : null}
|
||||
{hasLabel ? <FormLabel>Content</FormLabel> : null}
|
||||
<FormControl>
|
||||
{viewMode === 'plain' ? (
|
||||
<Textarea
|
||||
|
||||
@@ -87,8 +87,8 @@ export function KnowledgeFormLayoutMobile({ control, isNew, isSaving, knowledge,
|
||||
/>
|
||||
<KnowledgeContentField
|
||||
control={control}
|
||||
hasLabel
|
||||
isSaving={isSaving}
|
||||
showLabel
|
||||
viewMode={viewMode}
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user