diff --git a/package.json b/package.json index 84a3463ab..eae902e98 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "@emotion/react": "^11.8.1", "@emotion/server": "^11.4.0", "@emotion/styled": "^11.8.1", - "@mdxeditor/editor": "0.10.0-alpha.2", + "@mdxeditor/editor": "latest", "@mui/icons-material": "^5.11.11", "@mui/lab": "^5.0.0-alpha.69", "@mui/material": "^5.10.14", diff --git a/src/components/client/campaigns/CampaignDetails.tsx b/src/components/client/campaigns/CampaignDetails.tsx index fef9bbe32..4ae4fcac1 100644 --- a/src/components/client/campaigns/CampaignDetails.tsx +++ b/src/components/client/campaigns/CampaignDetails.tsx @@ -26,6 +26,7 @@ import { routes } from 'common/routes' import { useCanEditCampaign } from 'common/hooks/campaigns' import { moneyPublic } from 'common/util/money' import ReceiptLongIcon from '@mui/icons-material/ReceiptLong' +import { QuillStypeWrapper } from 'components/common/QuillStyleWrapper' const ReactQuill = dynamic(() => import('react-quill'), { ssr: false }) const CampaignNewsSection = dynamic(() => import('./CampaignNewsSection'), { ssr: false }) diff --git a/src/components/common/QuillStyleWrapper.tsx b/src/components/common/QuillStyleWrapper.tsx index 289ebdc52..f436f6976 100644 --- a/src/components/common/QuillStyleWrapper.tsx +++ b/src/components/common/QuillStyleWrapper.tsx @@ -15,6 +15,10 @@ export const QuillStypeWrapper = styled(Grid)(({ theme }) => ({ ['.ql-editor, .ql-video']: { maxWidth: '100%', }, + ['.ql-video']: { + maxWidth: '100%', + marginInline: 'auto', + }, ['.ql-editor, blockquote, .ql-editor h1, .ql-editor h2, .ql-editor h3, .ql-editor h4, .ql-editor h5, .ql-editor h6, .ql-editor ol, .ql-editor p, .ql-editor pre, .ql-editor ul']: { diff --git a/src/components/common/form/MDXEditor.tsx b/src/components/common/form/MDXEditor.tsx index cd6d9b5ba..18391ec5c 100644 --- a/src/components/common/form/MDXEditor.tsx +++ b/src/components/common/form/MDXEditor.tsx @@ -1,3 +1,4 @@ +import { markdownShortcutPlugin } from '@mdxeditor/editor' import { MDXEditor } from '@mdxeditor/editor/MDXEditor' import { diffSourcePlugin } from '@mdxeditor/editor/plugins/diff-source' import { @@ -46,7 +47,13 @@ export const YoutubeDirectiveDescriptor: DirectiveDescriptor = { hasChildren: false, Editor: ({ mdastNode, lexicalNode, parentEditor }) => { return ( -