Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix/v0.63.1 #1733

Merged
merged 3 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "isomercms-frontend",
"version": "0.63.0",
"version": "0.63.1",
"private": true,
"engines": {
"node": ">=16.0.0"
Expand Down
7 changes: 3 additions & 4 deletions src/layouts/EditPage/EditPageLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -37,16 +35,17 @@ import { sanitiseRawHtml, updateHtmlWithMediaData } from "./utils"
interface EditPageLayoutProps {
getEditorContent: () => string
setEditorContent: (content: string) => void
shouldDisableSave?: boolean
variant: PageVariant
}

export const EditPageLayout = ({
getEditorContent,
setEditorContent,
variant = "markdown",
shouldDisableSave = false,
children,
}: PropsWithChildren<EditPageLayoutProps>) => {
const { isAnyDrawerOpen } = useEditorDrawerContext()
const params = useParams<{ siteName: string }>()
const decodedParams = getDecodedParams(params)
const [mediaSrcs, setMediaSrcs] = useState(new Set(""))
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/layouts/EditPage/MarkdownEditPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -119,11 +120,14 @@ export const MarkdownEditPage = ({ togglePreview }: MarkdownPageProps) => {
updateHtmlWithMediaData()
}, [mediaData, editorValue, updateHtmlWithMediaData])

const { isAnyDrawerOpen } = useEditorDrawerContext()

return (
<EditPageLayout
variant="markdown"
getEditorContent={() => editorValue}
setEditorContent={(content: string) => setEditorValue(content)}
shouldDisableSave={isAnyDrawerOpen}
>
<Box w="100%" p="1.25rem">
<Flex flexDir="row" bg="gray.100" p="1.38rem" mb="1.38rem">
Expand Down
3 changes: 3 additions & 0 deletions src/layouts/EditPage/TiptapEditPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,15 @@ export const TiptapEditPage = ({
setHtmlChunk(processedChunk)
}, [mediaData, editorHtmlValue, csp, mediaSrcs])

const { isAnyDrawerOpen } = useEditorDrawerContext()

return (
<EditPageLayout
setEditorContent={(content) => {
editor.commands.setContent(content)
}}
getEditorContent={() => editor.getHTML()}
shouldDisableSave={isAnyDrawerOpen}
variant="tiptap"
>
{/* Editor drawers */}
Expand Down
2 changes: 1 addition & 1 deletion src/layouts/LegacyEditPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const EditPage = ({ match }) => {
setEditorContent={setEditorValue}
>
{/* Editor */}
<Box w="50%" p="1.25rem" maxH="100%" overflowY="scroll">
<Box minW="50%" flexGrow={1} p="1.25rem" maxH="100%" overflowY="scroll">
<MarkdownEditor
siteName={siteName}
onChange={(value) => setEditorValue(value)}
Expand Down
Loading