From c95b2ab7e4909d0b9852e8603bc5995a716dc743 Mon Sep 17 00:00:00 2001 From: seaerchin Date: Wed, 6 Dec 2023 14:28:54 +0800 Subject: [PATCH 1/3] fix(editpagelayout): shift context call elsewhere --- src/layouts/EditPage/EditPageLayout.tsx | 7 +++---- src/layouts/EditPage/MarkdownEditPage.tsx | 4 ++++ src/layouts/EditPage/TiptapEditPage.tsx | 3 +++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/layouts/EditPage/EditPageLayout.tsx b/src/layouts/EditPage/EditPageLayout.tsx index 045a12061..92dcf0129 100644 --- a/src/layouts/EditPage/EditPageLayout.tsx +++ b/src/layouts/EditPage/EditPageLayout.tsx @@ -20,8 +20,6 @@ import Header from "components/Header" import { OverwriteChangesModal } from "components/OverwriteChangesModal" import { WarningModal } from "components/WarningModal" -import { useEditorDrawerContext } from "contexts/EditorDrawerContext" - import { useGetMultipleMediaHook } from "hooks/mediaHooks" import { useGetPageHook, useUpdatePageHook } from "hooks/pageHooks" import { useCspHook, useGetSiteColorsHook } from "hooks/settingsHooks" @@ -37,6 +35,7 @@ import { sanitiseRawHtml, updateHtmlWithMediaData } from "./utils" interface EditPageLayoutProps { getEditorContent: () => string setEditorContent: (content: string) => void + shouldDisableSave?: boolean variant: PageVariant } @@ -44,9 +43,9 @@ export const EditPageLayout = ({ getEditorContent, setEditorContent, variant = "markdown", + shouldDisableSave = false, children, }: PropsWithChildren) => { - const { isAnyDrawerOpen } = useEditorDrawerContext() const params = useParams<{ siteName: string }>() const decodedParams = getDecodedParams(params) const [mediaSrcs, setMediaSrcs] = useState(new Set("")) @@ -223,7 +222,7 @@ export const EditPageLayout = ({ // TODO: Add an alert/modal // to warn the user when they violate our csp // so they know why + can take action to remedy - isDisabled={isContentViolation || isAnyDrawerOpen} + isDisabled={isContentViolation || shouldDisableSave} isLoading={isSavingPage} > Save diff --git a/src/layouts/EditPage/MarkdownEditPage.tsx b/src/layouts/EditPage/MarkdownEditPage.tsx index 18ad2651a..da1f5242e 100644 --- a/src/layouts/EditPage/MarkdownEditPage.tsx +++ b/src/layouts/EditPage/MarkdownEditPage.tsx @@ -24,6 +24,7 @@ import MarkdownEditor from "components/pages/MarkdownEditor" import PagePreview from "components/pages/PagePreview" import { useEditorContext } from "contexts/EditorContext" +import { useEditorDrawerContext } from "contexts/EditorDrawerContext" import { useGetMultipleMediaHook } from "hooks/mediaHooks" import { useGetPageHook } from "hooks/pageHooks" @@ -119,11 +120,14 @@ export const MarkdownEditPage = ({ togglePreview }: MarkdownPageProps) => { updateHtmlWithMediaData() }, [mediaData, editorValue, updateHtmlWithMediaData]) + const { isAnyDrawerOpen } = useEditorDrawerContext() + return ( editorValue} setEditorContent={(content: string) => setEditorValue(content)} + shouldDisableSave={isAnyDrawerOpen} > diff --git a/src/layouts/EditPage/TiptapEditPage.tsx b/src/layouts/EditPage/TiptapEditPage.tsx index a36ef85e7..593247112 100644 --- a/src/layouts/EditPage/TiptapEditPage.tsx +++ b/src/layouts/EditPage/TiptapEditPage.tsx @@ -98,12 +98,15 @@ export const TiptapEditPage = ({ setHtmlChunk(processedChunk) }, [mediaData, editorHtmlValue, csp, mediaSrcs]) + const { isAnyDrawerOpen } = useEditorDrawerContext() + return ( { editor.commands.setContent(content) }} getEditorContent={() => editor.getHTML()} + shouldDisableSave={isAnyDrawerOpen} variant="tiptap" > {/* Editor drawers */} From ad8b36cfa09c2bafb4e1c44d65343d2621e2d1c8 Mon Sep 17 00:00:00 2001 From: seaerchin Date: Wed, 6 Dec 2023 14:33:06 +0800 Subject: [PATCH 2/3] fix(legacyeditpage): minor style fix so the editor grows --- src/layouts/LegacyEditPage.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layouts/LegacyEditPage.jsx b/src/layouts/LegacyEditPage.jsx index 4ab67ddb1..2e32afab0 100644 --- a/src/layouts/LegacyEditPage.jsx +++ b/src/layouts/LegacyEditPage.jsx @@ -97,7 +97,7 @@ const EditPage = ({ match }) => { setEditorContent={setEditorValue} > {/* Editor */} - + setEditorValue(value)} From d47f5a9a28ca5d6d18172e5d43498bacfeb55778 Mon Sep 17 00:00:00 2001 From: seaerchin Date: Wed, 6 Dec 2023 14:57:47 +0800 Subject: [PATCH 3/3] 0.63.1 --- CHANGELOG.md | 7 +++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eed238b93..194e8a88d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,15 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [v0.63.1](https://github.com/isomerpages/isomercms-frontend/compare/v0.63.0...v0.63.1) + +- fix(editpagelayout): shift context call elsewhere [`c95b2ab`](https://github.com/isomerpages/isomercms-frontend/commit/c95b2ab7e4909d0b9852e8603bc5995a716dc743) +- fix(legacyeditpage): minor style fix so the editor grows [`ad8b36c`](https://github.com/isomerpages/isomercms-frontend/commit/ad8b36cfa09c2bafb4e1c44d65343d2621e2d1c8) + #### [v0.63.0](https://github.com/isomerpages/isomercms-frontend/compare/v0.62.0...v0.63.0) +> 6 December 2023 + - fix(embed-views): add a max width [`#1729`](https://github.com/isomerpages/isomercms-frontend/pull/1729) - fix(blockwrapper): remove padding [`#1728`](https://github.com/isomerpages/isomercms-frontend/pull/1728) - feat(editor): enhance image bubble menu with more functions [`#1721`](https://github.com/isomerpages/isomercms-frontend/pull/1721) diff --git a/package-lock.json b/package-lock.json index 5e76a4327..130ba7229 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "isomercms-frontend", - "version": "0.63.0", + "version": "0.63.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "isomercms-frontend", - "version": "0.63.0", + "version": "0.63.1", "hasInstallScript": true, "dependencies": { "@braintree/sanitize-url": "^6.0.1", diff --git a/package.json b/package.json index 64a375eb9..4b7bb88d9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "isomercms-frontend", - "version": "0.63.0", + "version": "0.63.1", "private": true, "engines": { "node": ">=16.0.0"