Skip to content

Commit 9673ffa

Browse files
committed
Update MDXEditor to latest version
- mdxeditor to 2.12.1 - don't set default frontmatter template, causes bugs when the modal is cancelled with an empty page.
1 parent f801050 commit 9673ffa

File tree

4 files changed

+9
-37
lines changed

4 files changed

+9
-37
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"*.css"
1717
],
1818
"dependencies": {
19-
"@mdxeditor/editor": "^2.3.2",
19+
"@mdxeditor/editor": "^2.12.1",
2020
"@mdxeditor/gurx": "^1.1.1",
2121
"@trussworks/react-uswds": "^6.2.0",
2222
"@uswds/uswds": "^3.7.1",

src/mdxcomponents/frontmatterUtils.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export const getYamlBlogHeaderNew = (fields: BlogFrontMatterFields): string => {
7474
return `# Page template info (DO NOT EDIT)
7575
layout: default
7676
blog_page: true
77+
7778
# Carousel (Edit this)
7879
carousel_title: "${fields.carousel_title}"
7980
carousel_summary: "${fields.carousel_summary}"
@@ -350,8 +351,9 @@ export const saveDataToZip = async (markdownstr: string) => {
350351
};
351352

352353
export const getDefaultMarkdown = (): string => {
353-
const yamlHeader = getYamlBlogHeader(BLANK_BLOG_FRONTMATTER_FIELDS);
354-
return `---\n${yamlHeader}\n---\n\n \n`;
354+
// it causes issue to auto-insert the frontmatter 100% of the time. (when cancelling edit dialog)
355+
//const yamlHeader = getYamlBlogHeader(BLANK_BLOG_FRONTMATTER_FIELDS);
356+
return `\n`;
355357
}
356358

357359
export const getBlogTemplateMarkdown = (): string => {

src/types/commontypes.ts

-30
Original file line numberDiff line numberDiff line change
@@ -43,36 +43,6 @@ export const BLANK_BLOG_FRONTMATTER_FIELDS: BlogFrontMatterFields = {
4343
tags: [],
4444
};
4545

46-
/*
47-
---
48-
# Page template info (DO NOT EDIT)
49-
layout: default
50-
blog_page: true
51-
52-
# Carousel (Edit this)
53-
carousel_title: "Test page"
54-
carousel_summary: "This is a test page template, it include problematic markdown to make checking it easier"
55-
# partial path to image e.g /news-and-blog/2024-03-01-test-page-img/
56-
# images should be 800x600 jpg
57-
carousel_image: /news-and-blog/2024-03-01-test-page-img/icon-512x512.png
58-
# accessibility text for image
59-
carousel_image_alt_text: "Test image"
60-
# should show on news and blog page. ordered by date prefix in filename
61-
carousel_show: true
62-
63-
# Blog detail page (Edit this)
64-
title: "Test page"
65-
dateline_str: "Feb 30, 2024"
66-
readtime_str: "1"
67-
author: "U.S. Digital Service"
68-
permalink: /news-and-blog/test-page-slpm7
69-
basename: "test-page"
70-
tags: [[]]
71-
72-
---
73-
74-
Image found in a Projects posting.
75-
* */
7646
export const STARTER_BLOG_FRONTMATTER_FIELDS: BlogFrontMatterFields = {
7747
title: "New news and blog page",
7848
date: getShortDate(new Date().toDateString()),

yarn.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -830,10 +830,10 @@
830830
"@lezer/common" "^1.0.0"
831831
"@lezer/highlight" "^1.0.0"
832832

833-
"@mdxeditor/editor@^2.3.2":
834-
version "2.9.1"
835-
resolved "https://registry.yarnpkg.com/@mdxeditor/editor/-/editor-2.9.1.tgz#e6922d475fe37cc6b7810f60844b35bafab59ebd"
836-
integrity sha512-YrKFmB/6gJid4CgssCy+TU1YyFfOOGv71WB2JYzi+41ZNAnMtSiEuXGv6jzQNtyp8t3i/Z5KfZl4KtHp9/14Lg==
833+
"@mdxeditor/editor@^2.12.1":
834+
version "2.12.1"
835+
resolved "https://registry.yarnpkg.com/@mdxeditor/editor/-/editor-2.12.1.tgz#fea16bfbd7a9de553ce0f9f86d995d9c8166cc72"
836+
integrity sha512-8+QDABGA1pCYQUioyDIsOMum2W8riqVoolZfbiFI1nSeE1afNLk8FOALaVyAvzeoobGnSYnqD2nEUUMdHT6HtQ==
837837
dependencies:
838838
"@codemirror/lang-markdown" "^6.2.3"
839839
"@codemirror/merge" "^6.4.0"

0 commit comments

Comments
 (0)