From 90751d7923d5c69260d9703e24c25f6202dc3c6a Mon Sep 17 00:00:00 2001 From: "geodem.dev" <74890703+geodem127@users.noreply.github.com> Date: Tue, 18 Feb 2025 17:49:36 +0800 Subject: [PATCH 1/5] =?UTF-8?q?Added=20min=20width/height=20to=20image=20t?= =?UTF-8?q?humbnail=20icon=20|=20set=20getImage=20height=20=E2=80=A6=20(#3?= =?UTF-8?q?199)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/app/views/ItemList/DialogContentItem.tsx | 2 ++ .../content-editor/src/app/views/ItemList/index.tsx | 2 +- .../components/AddFieldModal/views/FieldSelection.tsx | 10 ++++++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/apps/content-editor/src/app/views/ItemList/DialogContentItem.tsx b/src/apps/content-editor/src/app/views/ItemList/DialogContentItem.tsx index 4fafb2948b..023a34f05d 100644 --- a/src/apps/content-editor/src/app/views/ItemList/DialogContentItem.tsx +++ b/src/apps/content-editor/src/app/views/ItemList/DialogContentItem.tsx @@ -79,6 +79,8 @@ export const DialogContentItem = ({ item }: DialogContentItemProps) => { backgroundColor: "grey.100", width: 40, height: 40, + minWidth: 40, + minHeight: 40, alignItems: "center", justifyContent: "center", overflow: "hidden", diff --git a/src/apps/content-editor/src/app/views/ItemList/index.tsx b/src/apps/content-editor/src/app/views/ItemList/index.tsx index 55edf5abbd..57cbc77248 100644 --- a/src/apps/content-editor/src/app/views/ItemList/index.tsx +++ b/src/apps/content-editor/src/app/views/ItemList/index.tsx @@ -266,7 +266,7 @@ export const ItemList = () => { CONFIG.SERVICE_MEDIA_RESOLVER }/resolve/${ value?.split(",")[0] - }/getimage/?w=${68}&h=${58}&type=fit` + }/getimage/?w=${68}&h=auto&type=fit` : value?.split(",")?.[0]; break; case "internal_link": diff --git a/src/apps/schema/src/app/components/AddFieldModal/views/FieldSelection.tsx b/src/apps/schema/src/app/components/AddFieldModal/views/FieldSelection.tsx index c86619cd02..053a7482e4 100644 --- a/src/apps/schema/src/app/components/AddFieldModal/views/FieldSelection.tsx +++ b/src/apps/schema/src/app/components/AddFieldModal/views/FieldSelection.tsx @@ -1,4 +1,4 @@ -import { useState } from "react"; +import { useEffect, useState } from "react"; import { DialogContent, DialogTitle, @@ -23,6 +23,12 @@ interface Props { onFieldClick: (fieldType: string, fieldName: string) => void; onModalClose: () => void; } + +const FIELD_CATEGORIES: Record = { + dateandtime: "Date & Time", + options: "Advanced", +}; + export const FieldSelection = ({ onFieldClick, onModalClose }: Props) => { const user: User = useSelector((state: AppState) => state.user); const [fieldTypes, setFieldTypes] = useState(FIELD_COPY_CONFIG); @@ -137,7 +143,7 @@ export const FieldSelection = ({ onFieldClick, onModalClose }: Props) => { mb={1.5} color="text.secondary" > - {fieldKey === "dateandtime" ? "Date & Time" : fieldKey} + {FIELD_CATEGORIES?.[fieldKey] || fieldKey} Date: Wed, 19 Feb 2025 05:56:11 +0800 Subject: [PATCH 2/5] =?UTF-8?q?[#3189]=20-=20Blocks=20App:=20Deleting=20a?= =?UTF-8?q?=20Block=20in=20Blocks=20App,=20should=20redirect=E2=80=A6=20(#?= =?UTF-8?q?3200)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/app/components/DeleteModelDialogue.tsx | 5 +++-- .../schema/src/app/components/ModelMenu.tsx | 7 ++++++- .../NavTree/components/NavTreeItem.tsx | 18 ++---------------- src/shell/components/NavTree/index.tsx | 3 --- 4 files changed, 11 insertions(+), 22 deletions(-) diff --git a/src/apps/schema/src/app/components/DeleteModelDialogue.tsx b/src/apps/schema/src/app/components/DeleteModelDialogue.tsx index 79ac05e052..5bdf9aa727 100644 --- a/src/apps/schema/src/app/components/DeleteModelDialogue.tsx +++ b/src/apps/schema/src/app/components/DeleteModelDialogue.tsx @@ -41,9 +41,10 @@ export const DeleteModelDialogue = ({ onClose, model }: Props) => { useEffect(() => { if (isSuccess) { onClose(); - history.push("/schema"); + const targetPath = `/${history?.location?.pathname.split("/")[1]}`; + history.push(targetPath); } - }, [isSuccess]); + }, [isSuccess, history]); useEffect(() => { // @ts-ignore diff --git a/src/apps/schema/src/app/components/ModelMenu.tsx b/src/apps/schema/src/app/components/ModelMenu.tsx index 6e7a5452d9..6c80f213f4 100644 --- a/src/apps/schema/src/app/components/ModelMenu.tsx +++ b/src/apps/schema/src/app/components/ModelMenu.tsx @@ -47,7 +47,12 @@ export const ModelMenu: FC = ({ anchorEl, onClose, modelZUID }) => { return ( - + document.getElementById(modelZUID)!} + > { setShowDialogue("rename"); diff --git a/src/shell/components/NavTree/components/NavTreeItem.tsx b/src/shell/components/NavTree/components/NavTreeItem.tsx index 8ac926bfe9..a186c96aab 100644 --- a/src/shell/components/NavTree/components/NavTreeItem.tsx +++ b/src/shell/components/NavTree/components/NavTreeItem.tsx @@ -1,4 +1,4 @@ -import React, { FC, HTMLAttributes } from "react"; +import React, { FC } from "react"; import { TreeItem } from "@mui/x-tree-view"; import { Stack, Box, Typography, Tooltip, alpha } from "@mui/material"; @@ -15,8 +15,6 @@ interface Props { nodeData?: any; onItemDrop?: (draggedItem: any, targetItem: any) => void; dragAndDrop?: boolean; - hoveredItemId?: string; - setHoveredItemId?: (id: string) => void; } export const NavTreeItem: FC = React.memo( ({ @@ -30,12 +28,9 @@ export const NavTreeItem: FC = React.memo( nodeData, onItemDrop, dragAndDrop = false, - hoveredItemId = "", - setHoveredItemId = () => {}, }) => { const currentDepth = depth + 1; const depthPadding = currentDepth * 1; - const itemId = `${nodeId}-${currentDepth}`; return ( = React.memo( py: 0.5, pl: 1, borderRadius: 0, - "&.is-hovered": { - backgroundColor: (theme) => - alpha(theme.palette.primary.main, 0.07), - }, ".MuiTreeItem-iconContainer": { width: 20, height: 20, @@ -144,10 +135,7 @@ export const NavTreeItem: FC = React.memo( }, }} ContentProps={{ - className: itemId === hoveredItemId ? "is-hovered" : "", - onMouseEnter: (event: any) => { - setHoveredItemId(itemId); - }, + id: nodeId.split("/").pop(), onDragOver: (event: any) => { if (dragAndDrop) { event.preventDefault(); @@ -189,8 +177,6 @@ export const NavTreeItem: FC = React.memo( actions={item.actions ?? []} onItemDrop={onItemDrop} dragAndDrop={dragAndDrop} - hoveredItemId={hoveredItemId} - setHoveredItemId={setHoveredItemId} /> ); })} diff --git a/src/shell/components/NavTree/index.tsx b/src/shell/components/NavTree/index.tsx index 8465d8297c..3e84860682 100644 --- a/src/shell/components/NavTree/index.tsx +++ b/src/shell/components/NavTree/index.tsx @@ -45,7 +45,6 @@ export const NavTree: FC> = ({ dragAndDrop = false, }) => { const history = useHistory(); - const [hoveredItemId, setHoveredItemId] = React.useState(""); return ( <> @@ -89,8 +88,6 @@ export const NavTree: FC> = ({ nodeData={item.nodeData} onItemDrop={onItemDrop} dragAndDrop={dragAndDrop} - hoveredItemId={hoveredItemId} - setHoveredItemId={setHoveredItemId} /> ); })} From 2299cffbbce2b23f9e228fe3f70753adb3bc0966 Mon Sep 17 00:00:00 2001 From: Nar -- <28705606+finnar-bin@users.noreply.github.com> Date: Wed, 19 Feb 2025 06:38:48 +0800 Subject: [PATCH 3/5] [Content] Filter out deleted fields in FieldForm dropdown options (#3227) Filter out deleted fields in FieldForm dropdown options Resolves #3212 --- .../app/components/AddFieldModal/views/FieldForm.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/apps/schema/src/app/components/AddFieldModal/views/FieldForm.tsx b/src/apps/schema/src/app/components/AddFieldModal/views/FieldForm.tsx index 1357f409c9..54340b8b1e 100644 --- a/src/apps/schema/src/app/components/AddFieldModal/views/FieldForm.tsx +++ b/src/apps/schema/src/app/components/AddFieldModal/views/FieldForm.tsx @@ -165,10 +165,12 @@ export const FieldForm = ({ ?.sort((a, b) => a.label.localeCompare(b.label)); }, [allModels]); const fieldsOptions: DropdownOptions[] = useMemo(() => { - return selectedModelFields?.map((field) => ({ - label: field.label, - value: field.ZUID, - })); + return selectedModelFields + ?.filter((field) => !field.deletedAt) + ?.map((field) => ({ + label: field.label, + value: field.ZUID, + })); }, [selectedModelFields]); const [ deleteContentModelField, From ed23dbe07533911bb54d158ace64be506554bea4 Mon Sep 17 00:00:00 2001 From: "geodem.dev" <74890703+geodem127@users.noreply.github.com> Date: Wed, 19 Feb 2025 07:03:24 +0800 Subject: [PATCH 4/5] Content: WYSIWYG - Command P or Ctrl P does not trigger the Save and Publish and the Publish Button (#3225) --- src/shell/components/FieldTypeTinyMCE/index.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/shell/components/FieldTypeTinyMCE/index.tsx b/src/shell/components/FieldTypeTinyMCE/index.tsx index c6c88828c2..62dbd337fe 100644 --- a/src/shell/components/FieldTypeTinyMCE/index.tsx +++ b/src/shell/components/FieldTypeTinyMCE/index.tsx @@ -339,6 +339,13 @@ export const FieldTypeTinyMCE = React.memo(function FieldTypeTinyMCE({ // Customize editor buttons and actions setup: (editor: any) => { + editor.on("init", function () { + editor.addShortcut("meta+p", "", () => { + window.dispatchEvent( + new KeyboardEvent("keydown", { key: "p", metaKey: true }) + ); + }); + }); editor.on("SkinLoaded", () => { setIsSkinLoaded(true); }); From 1edccf48bb65821f435be3ae4f7722f610d65949 Mon Sep 17 00:00:00 2001 From: Nar -- <28705606+finnar-bin@users.noreply.github.com> Date: Wed, 19 Feb 2025 08:25:14 +0800 Subject: [PATCH 5/5] [Schema] Auto-populate relational field name & label (#3221) Auto-populate field name and label based on the selected related model Resolves #3186 [Schema---hello-world-test-123---Zesty-io---zesty-pw---Manager.webm](https://github.com/user-attachments/assets/f8ecb82a-cd4c-4cd1-8b64-46cc8074de1f) --- cypress/e2e/schema/field.spec.js | 10 ++---- .../AddFieldModal/views/FieldForm.tsx | 35 +++++++++++-------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/cypress/e2e/schema/field.spec.js b/cypress/e2e/schema/field.spec.js index cfd1c4a8db..f5b0b8809c 100644 --- a/cypress/e2e/schema/field.spec.js +++ b/cypress/e2e/schema/field.spec.js @@ -308,9 +308,6 @@ describe("Schema: Fields", () => { it("Creates a One-to-one relationship field", () => { cy.intercept("**/fields?showDeleted=true").as("getFields"); - const fieldLabel = `One to One ${timestamp}`; - const fieldName = `one_to_one_${timestamp}`; - // Open the add field modal cy.getBySelector(SELECTORS.ADD_FIELD_BTN) .should("exist") @@ -320,9 +317,6 @@ describe("Schema: Fields", () => { // Select one-to-one relationship field cy.getBySelector(SELECTORS.FIELD_SELECT_ONE_TO_ONE).should("exist").click(); - // Fill up fields - cy.getBySelector(SELECTORS.INPUT_LABEL).should("exist").type(fieldLabel); - // Select a related model cy.getBySelector(SELECTORS.AUTOCOMPLETE_MODEL_ZUID) .should("exist") @@ -359,7 +353,9 @@ describe("Schema: Fields", () => { cy.wait("@getFields"); // Check if field exists - cy.getBySelector(`Field_${fieldName}`).should("exist"); + cy.getBySelector( + "Field_cypress_test__group_with_visible_fields_in_list_" + ).should("exist"); }); it("Creates a currency field", () => { diff --git a/src/apps/schema/src/app/components/AddFieldModal/views/FieldForm.tsx b/src/apps/schema/src/app/components/AddFieldModal/views/FieldForm.tsx index 54340b8b1e..5ef4f100f9 100644 --- a/src/apps/schema/src/app/components/AddFieldModal/views/FieldForm.tsx +++ b/src/apps/schema/src/app/components/AddFieldModal/views/FieldForm.tsx @@ -700,30 +700,35 @@ export const FieldForm = ({ inputName: string; value: FormValue; }) => { - const isAutoPopulateName = inputName === "label" && !isUpdateField; + const modelName = + inputName === "relatedModelZUID" && !!value + ? allModels?.find((model) => model.ZUID === value)?.label + : ""; // Form data update setFormData((prevData) => ({ ...prevData, [inputName]: inputName === "name" ? convertLabelValue(value as string) : value, - })); - // Auto populate "name" when "label" field changes - if (isAutoPopulateName) { - setFormData((prevData) => ({ - ...prevData, - name: convertLabelValue(value as string), - })); - } + // Auto populate "name" when "label" field changes + ...(inputName === "label" && + !isUpdateField && { + name: convertLabelValue(value as string), + }), - // Reset relatedFieldZUID when model zuid changes - if (inputName === "relatedModelZUID") { - setFormData((prevData) => ({ - ...prevData, + // Reset relatedFieldZUID when model zuid changes + ...(inputName === "relatedModelZUID" && { relatedFieldZUID: "", - })); - } + }), + + // Auto populate "name" and "label" when relatedModelZUID changes + ...(inputName === "relatedModelZUID" && + !isUpdateField && { + name: convertLabelValue(modelName), + label: modelName, + }), + })); }; const handleAddAnotherField = () => {