Fix markdown preview breaks and statics image count
This commit is contained in:
@@ -457,8 +457,7 @@ def get_statics():
|
|||||||
try:
|
try:
|
||||||
post_count = Submission.query.count()
|
post_count = Submission.query.count()
|
||||||
comment_count = Comment.query.count()
|
comment_count = Comment.query.count()
|
||||||
# TODO:目前暂未实现图片上传逻辑,先返回114514!!!
|
image_count = ImgFile.query.count()
|
||||||
image_count = 114514
|
|
||||||
return jsonify({
|
return jsonify({
|
||||||
"code": 1000,
|
"code": 1000,
|
||||||
"data": {
|
"data": {
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
"react-dom": "^19.2.0",
|
"react-dom": "^19.2.0",
|
||||||
"react-markdown": "^10.1.0",
|
"react-markdown": "^10.1.0",
|
||||||
"react-router-dom": "^7.12.0",
|
"react-router-dom": "^7.12.0",
|
||||||
|
"remark-breaks": "^4.0.0",
|
||||||
"remark-gfm": "^4.0.1",
|
"remark-gfm": "^4.0.1",
|
||||||
"remark-ins": "^1.1.0"
|
"remark-ins": "^1.1.0"
|
||||||
},
|
},
|
||||||
|
|||||||
20
front/pnpm-lock.yaml
generated
20
front/pnpm-lock.yaml
generated
@@ -32,6 +32,9 @@ importers:
|
|||||||
react-router-dom:
|
react-router-dom:
|
||||||
specifier: ^7.12.0
|
specifier: ^7.12.0
|
||||||
version: 7.12.0(react-dom@19.2.3(react@19.2.3))(react@19.2.3)
|
version: 7.12.0(react-dom@19.2.3(react@19.2.3))(react@19.2.3)
|
||||||
|
remark-breaks:
|
||||||
|
specifier: ^4.0.0
|
||||||
|
version: 4.0.0
|
||||||
remark-gfm:
|
remark-gfm:
|
||||||
specifier: ^4.0.1
|
specifier: ^4.0.1
|
||||||
version: 4.0.1
|
version: 4.0.1
|
||||||
@@ -1779,6 +1782,9 @@ packages:
|
|||||||
mdast-util-mdxjs-esm@2.0.1:
|
mdast-util-mdxjs-esm@2.0.1:
|
||||||
resolution: {integrity: sha512-EcmOpxsZ96CvlP03NghtH1EsLtr0n9Tm4lPUJUBccV9RwUOneqSycg19n5HGzCf+10LozMRSObtVr3ee1WoHtg==}
|
resolution: {integrity: sha512-EcmOpxsZ96CvlP03NghtH1EsLtr0n9Tm4lPUJUBccV9RwUOneqSycg19n5HGzCf+10LozMRSObtVr3ee1WoHtg==}
|
||||||
|
|
||||||
|
mdast-util-newline-to-break@2.0.0:
|
||||||
|
resolution: {integrity: sha512-MbgeFca0hLYIEx/2zGsszCSEJJ1JSCdiY5xQxRcLDDGa8EPvlLPupJ4DSajbMPAnC0je8jfb9TiUATnxxrHUog==}
|
||||||
|
|
||||||
mdast-util-phrasing@4.1.0:
|
mdast-util-phrasing@4.1.0:
|
||||||
resolution: {integrity: sha512-TqICwyvJJpBwvGAMZjj4J2n0X8QWp21b9l0o7eXyVJ25YNWYbJDVIyD1bZXE6WtV6RmKJVYmQAKWa0zWOABz2w==}
|
resolution: {integrity: sha512-TqICwyvJJpBwvGAMZjj4J2n0X8QWp21b9l0o7eXyVJ25YNWYbJDVIyD1bZXE6WtV6RmKJVYmQAKWa0zWOABz2w==}
|
||||||
|
|
||||||
@@ -2041,6 +2047,9 @@ packages:
|
|||||||
rehype@13.0.2:
|
rehype@13.0.2:
|
||||||
resolution: {integrity: sha512-j31mdaRFrwFRUIlxGeuPXXKWQxet52RBQRvCmzl5eCefn/KGbomK5GMHNMsOJf55fgo3qw5tST5neDuarDYR2A==}
|
resolution: {integrity: sha512-j31mdaRFrwFRUIlxGeuPXXKWQxet52RBQRvCmzl5eCefn/KGbomK5GMHNMsOJf55fgo3qw5tST5neDuarDYR2A==}
|
||||||
|
|
||||||
|
remark-breaks@4.0.0:
|
||||||
|
resolution: {integrity: sha512-IjEjJOkH4FuJvHZVIW0QCDWxcG96kCq7An/KVH2NfJe6rKZU2AsHeB3OEjPNRxi4QC34Xdx7I2KGYn6IpT7gxQ==}
|
||||||
|
|
||||||
remark-gfm@4.0.1:
|
remark-gfm@4.0.1:
|
||||||
resolution: {integrity: sha512-1quofZ2RQ9EWdeN34S79+KExV1764+wCUGop5CPL1WGdD0ocPpu91lzPGbwWMECpEpd42kJGQwzRfyov9j4yNg==}
|
resolution: {integrity: sha512-1quofZ2RQ9EWdeN34S79+KExV1764+wCUGop5CPL1WGdD0ocPpu91lzPGbwWMECpEpd42kJGQwzRfyov9j4yNg==}
|
||||||
|
|
||||||
@@ -4801,6 +4810,11 @@ snapshots:
|
|||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
|
mdast-util-newline-to-break@2.0.0:
|
||||||
|
dependencies:
|
||||||
|
'@types/mdast': 4.0.4
|
||||||
|
mdast-util-find-and-replace: 3.0.2
|
||||||
|
|
||||||
mdast-util-phrasing@4.1.0:
|
mdast-util-phrasing@4.1.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/mdast': 4.0.4
|
'@types/mdast': 4.0.4
|
||||||
@@ -5248,6 +5262,12 @@ snapshots:
|
|||||||
rehype-stringify: 10.0.1
|
rehype-stringify: 10.0.1
|
||||||
unified: 11.0.5
|
unified: 11.0.5
|
||||||
|
|
||||||
|
remark-breaks@4.0.0:
|
||||||
|
dependencies:
|
||||||
|
'@types/mdast': 4.0.4
|
||||||
|
mdast-util-newline-to-break: 2.0.0
|
||||||
|
unified: 11.0.5
|
||||||
|
|
||||||
remark-gfm@4.0.1:
|
remark-gfm@4.0.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/mdast': 4.0.4
|
'@types/mdast': 4.0.4
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import React, { useState, useEffect, useRef, useCallback } from 'react';
|
|||||||
import MDEditor from '@uiw/react-md-editor';
|
import MDEditor from '@uiw/react-md-editor';
|
||||||
// 引入中文指令集
|
// 引入中文指令集
|
||||||
import { getCommands, getExtraCommands } from '@uiw/react-md-editor/commands-cn';
|
import { getCommands, getExtraCommands } from '@uiw/react-md-editor/commands-cn';
|
||||||
|
import remarkBreaks from 'remark-breaks';
|
||||||
// 导入编辑器样式
|
// 导入编辑器样式
|
||||||
import '@uiw/react-md-editor/markdown-editor.css';
|
import '@uiw/react-md-editor/markdown-editor.css';
|
||||||
import {
|
import {
|
||||||
@@ -415,7 +416,7 @@ const CreatePost: React.FC = () => {
|
|||||||
commands={commands}
|
commands={commands}
|
||||||
extraCommands={getExtraCommands()}
|
extraCommands={getExtraCommands()}
|
||||||
previewOptions={{
|
previewOptions={{
|
||||||
remarkPlugins: [remarkTagPlugin],
|
remarkPlugins: [remarkTagPlugin, remarkBreaks],
|
||||||
components: {
|
components: {
|
||||||
a: ({ node, ...props }) => {
|
a: ({ node, ...props }) => {
|
||||||
if (props.href && props.href.startsWith('tag:')) {
|
if (props.href && props.href.startsWith('tag:')) {
|
||||||
|
|||||||
Reference in New Issue
Block a user