Skip to content

Commit

Permalink
Chore/resolve stage conflict (#3006)
Browse files Browse the repository at this point in the history
Co-authored-by: Andres Galindo <agalin920@gmail.com>
Co-authored-by: Stuart Runyan <shrunyan@gmail.com>
Co-authored-by: Allen Pigar <50983144+allenpigar@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
5 people authored Oct 10, 2024
1 parent a07b40a commit bc4f637
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 9 deletions.
20 changes: 12 additions & 8 deletions src/apps/content-editor/src/app/components/Editor/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import cx from "classnames";
import { AppLink } from "@zesty-io/core/AppLink";
import { ThemeProvider } from "@mui/material";
import { theme } from "@zesty-io/material";
import { unescape } from "lodash";
import { Breadcrumbs } from "shell/components/global-tabs/components/Breadcrumbs";
import { Field } from "./Field";
import { FieldError } from "./FieldError";
Expand Down Expand Up @@ -276,14 +277,17 @@ export default memo(function Editor({

if (firstContentField && firstContentField.name === name) {
// Remove tags and replace MS smart quotes with regular quotes
const cleanedValue = value
?.replace(/<[^>]*>/g, "")
?.replaceAll(/[\u2018\u2019\u201A]/gm, "'")
?.replaceAll("&rsquo;", "'")
?.replaceAll(/[\u201C\u201D\u201E]/gm, '"')
?.replaceAll("&ldquo;", '"')
?.replaceAll("&rdquo;", '"')
?.slice(0, 160);
const cleanedValue = unescape(
value
?.replace(/<[^>]*>/g, "")
?.replaceAll(/[\u2018\u2019\u201A]/gm, "'")
?.replaceAll("&rsquo;", "'")
?.replaceAll(/[\u201C\u201D\u201E]/gm, '"')
?.replaceAll("&ldquo;", '"')
?.replaceAll("&rdquo;", '"')
?.replaceAll("&nbsp;", " ")
?.slice(0, 160) || ""
);

dispatch({
type: "SET_ITEM_WEB",
Expand Down
17 changes: 16 additions & 1 deletion src/apps/content-editor/src/app/views/ItemEdit/Meta/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,24 @@ export const Meta = forwardRef(
if (!isCreateItemPage) return;

if (flowType === FlowType.AIGenerated) {
// Immediately clear out the existing values for the meta title and description
dispatch({
type: "SET_ITEM_WEB",
itemZUID: meta?.ZUID,
key: "metaTitle",
value: "",
});
dispatch({
type: "SET_ITEM_WEB",
itemZUID: meta?.ZUID,
key: "metaDescription",
value: "",
});

// Then trigger the AI assistant popup
metaTitleButtonRef.current?.triggerAIButton?.();
}
}, [flowType, isCreateItemPage]);
}, [flowType, isCreateItemPage, meta?.ZUID]);

if (isCreateItemPage && flowType === null) {
return (
Expand Down

0 comments on commit bc4f637

Please sign in to comment.