File tree 2 files changed +25
-11
lines changed
components/ui/markdown/parsers
2 files changed +25
-11
lines changed Original file line number Diff line number Diff line change @@ -4,9 +4,21 @@ import type { MarkdownToJSX } from 'markdown-to-jsx'
4
4
5
5
import { Banner } from '../../banner/Banner'
6
6
import { Gallery } from '../../gallery/Gallery'
7
+ import { Markdown } from '../Markdown'
7
8
import { pickImagesFromMarkdown } from '../utils/image'
8
9
9
- const shouldCatchContainerName = [ 'gallery' , 'banner' , 'carousel' ] . join ( '|' )
10
+ const shouldCatchContainerName = [
11
+ 'gallery' ,
12
+ 'banner' ,
13
+ 'carousel' ,
14
+
15
+ 'warn' ,
16
+ 'error' ,
17
+ 'danger' ,
18
+ 'info' ,
19
+ 'success' ,
20
+ 'warning' ,
21
+ ] . join ( '|' )
10
22
export const ContainerRule : MarkdownToJSX . Rule = {
11
23
match : blockRegex (
12
24
new RegExp (
@@ -45,9 +57,14 @@ export const ContainerRule: MarkdownToJSX.Rule = {
45
57
< Banner
46
58
type = { name || ( transformMap as any ) [ name ] || 'info' }
47
59
className = "my-4"
48
- message = { content }
49
60
key = { state ?. key }
50
- />
61
+ >
62
+ < Markdown
63
+ value = { content }
64
+ allowsScript
65
+ className = "[&>p:first-child]:mt-0"
66
+ />
67
+ </ Banner >
51
68
)
52
69
}
53
70
case 'banner' : {
@@ -56,12 +73,9 @@ export const ContainerRule: MarkdownToJSX.Rule = {
56
73
}
57
74
58
75
return (
59
- < Banner
60
- type = { params }
61
- className = "my-4"
62
- message = { content }
63
- key = { state ?. key }
64
- />
76
+ < Banner type = { params } className = "my-4" key = { state ?. key } >
77
+ < Markdown value = { content } allowsScript />
78
+ </ Banner >
65
79
)
66
80
}
67
81
}
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ export const eventHandler = (
57
57
case EventTypes . POST_DELETE : {
58
58
const post = data as PostModel
59
59
if ( getCurrentPostData ( ) ?. id === post . id ) {
60
- router . push ( routeBuilder ( Routes . PageDeletd , { } ) )
60
+ router . replace ( routeBuilder ( Routes . PageDeletd , { } ) )
61
61
toast . error ( '文章已删除' )
62
62
}
63
63
break
@@ -77,7 +77,7 @@ export const eventHandler = (
77
77
case 'NOTE_DELETE' : {
78
78
const note = data as NoteModel
79
79
if ( getCurrentNoteData ( ) ?. data . id === note . id ) {
80
- router . push ( routeBuilder ( Routes . PageDeletd , { } ) )
80
+ router . replace ( routeBuilder ( Routes . PageDeletd , { } ) )
81
81
toast . error ( '手记已删除' )
82
82
}
83
83
break
You can’t perform that action at this time.
0 commit comments