Skip to content
This repository was archived by the owner on Jan 30, 2026. It is now read-only.

Commit bb9323c

Browse files
committed
refactor: improve code readability and formatting in template builder and field components
1 parent d46ab5d commit bb9323c

File tree

3 files changed

+36
-20
lines changed

3 files changed

+36
-20
lines changed

src/defaults/FieldList.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ export const FieldList: React.FC<FieldListProps> = ({
136136
fontSize: "10px",
137137
padding: "2px 6px",
138138
borderRadius: "4px",
139-
background: field.mode === "block" ? "#dbeafe" : "#f3f4f6",
139+
background:
140+
field.mode === "block" ? "#dbeafe" : "#f3f4f6",
140141
color: field.mode === "block" ? "#1e40af" : "#4b5563",
141142
fontWeight: "500",
142143
}}

src/defaults/FieldMenu.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,14 @@ export const FieldMenu: React.FC<FieldMenuProps> = ({
189189
fontSize: "13px",
190190
}}
191191
>
192-
<label style={{ display: "flex", alignItems: "center", gap: "4px", cursor: "pointer" }}>
192+
<label
193+
style={{
194+
display: "flex",
195+
alignItems: "center",
196+
gap: "4px",
197+
cursor: "pointer",
198+
}}
199+
>
193200
<input
194201
type="radio"
195202
value="inline"
@@ -198,7 +205,14 @@ export const FieldMenu: React.FC<FieldMenuProps> = ({
198205
/>
199206
Inline
200207
</label>
201-
<label style={{ display: "flex", alignItems: "center", gap: "4px", cursor: "pointer" }}>
208+
<label
209+
style={{
210+
display: "flex",
211+
alignItems: "center",
212+
gap: "4px",
213+
cursor: "pointer",
214+
}}
215+
>
202216
<input
203217
type="radio"
204218
value="block"

src/index.tsx

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -209,23 +209,23 @@ const SuperDocTemplateBuilder = forwardRef<
209209
const success =
210210
mode === "inline"
211211
? editor.commands.insertStructuredContentInline?.({
212-
attrs: {
213-
alias: field.alias,
214-
tag: field.metadata
215-
? JSON.stringify(field.metadata)
216-
: field.category,
217-
},
218-
text: field.defaultValue || field.alias,
219-
})
212+
attrs: {
213+
alias: field.alias,
214+
tag: field.metadata
215+
? JSON.stringify(field.metadata)
216+
: field.category,
217+
},
218+
text: field.defaultValue || field.alias,
219+
})
220220
: editor.commands.insertStructuredContentBlock?.({
221-
attrs: {
222-
alias: field.alias,
223-
tag: field.metadata
224-
? JSON.stringify(field.metadata)
225-
: field.category,
226-
},
227-
text: field.defaultValue || field.alias,
228-
});
221+
attrs: {
222+
alias: field.alias,
223+
tag: field.metadata
224+
? JSON.stringify(field.metadata)
225+
: field.category,
226+
},
227+
text: field.defaultValue || field.alias,
228+
});
229229

230230
if (success) {
231231
const updatedFields = getTemplateFieldsFromEditor(editor);
@@ -533,7 +533,8 @@ const SuperDocTemplateBuilder = forwardRef<
533533
const createdField = await onFieldCreate(field);
534534

535535
if (createdField) {
536-
const createdMode = (createdField.metadata?.mode as "inline" | "block") || mode;
536+
const createdMode =
537+
(createdField.metadata?.mode as "inline" | "block") || mode;
537538
insertFieldInternal(createdMode, {
538539
alias: createdField.label,
539540
category: createdField.category,

0 commit comments

Comments
 (0)