Skip to content

Commit

Permalink
remove richtext check onblur
Browse files Browse the repository at this point in the history
  • Loading branch information
ethangardner committed Aug 20, 2024
1 parent 36d15c2 commit 7114045
Showing 1 changed file with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ type PatternEditFormProps = {
editComponent: React.ReactNode;
};

const hasRichText = (data: PatternMap): boolean => {
for (const key in data) {
if (Object.prototype.hasOwnProperty.call(data, key) && data[key].type === "rich-text") {
return true; // If any key type is "rich-text", do not save
}
}
return false;
}
// const hasRichText = (data: PatternMap): boolean => {
// for (const key in data) {
// if (
// Object.prototype.hasOwnProperty.call(data, key) &&
// data[key].type === 'rich-text'
// ) {
// return true; // If any key type is "rich-text", do not save
// }
// }
// return false;
// };

export const PatternEditForm = ({
pattern,
Expand Down Expand Up @@ -48,9 +51,9 @@ export const PatternEditForm = ({
<FormProvider {...methods}>
<form
onBlur={methods.handleSubmit(formData => {
if(!hasRichText(formData)) {
// if (!hasRichText(formData)) {
updateActivePattern(formData);
}
// }
})}
onSubmit={methods.handleSubmit(formData => {
const success = updateActivePattern(formData);
Expand Down

0 comments on commit 7114045

Please sign in to comment.