This repository was archived by the owner on Jul 30, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
plugins/plugin-client-common/src/components/Client/StatusStripe Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,25 @@ export default class StatusStripe extends React.PureComponent<Props, State> {
85
85
return < div style = { { flex : 1 } } />
86
86
}
87
87
88
+ /** Simplistic Markdown, to help with performance. Our full Markdown.tsx is pretty heavy-weight. */
89
+ private simpleMarkdown ( str : string ) {
90
+ const msg = decode ( str )
91
+ const pat = / \* \* [ ^ * ] + \* \* / g
92
+ const bolds = msg . match ( pat )
93
+
94
+ return msg . split ( pat ) . reduce (
95
+ ( M , _ ) => {
96
+ if ( _ === '' ) {
97
+ M . A . push ( < strong > { bolds [ M . idx ++ ] . replace ( / \* \* / g, '' ) } </ strong > )
98
+ } else {
99
+ M . A . push ( _ )
100
+ }
101
+ return M
102
+ } ,
103
+ { A : [ ] , idx : 0 }
104
+ ) . A
105
+ }
106
+
88
107
/**
89
108
* Render the current State.message, if any
90
109
*
@@ -93,7 +112,7 @@ export default class StatusStripe extends React.PureComponent<Props, State> {
93
112
if ( this . state . type !== 'default' && this . state . message ) {
94
113
return (
95
114
< div className = "kui--status-stripe-element left-pad kui--status-stripe-message-element" >
96
- { decode ( this . state . message ) }
115
+ { this . simpleMarkdown ( this . state . message ) }
97
116
</ div >
98
117
)
99
118
}
You can’t perform that action at this time.
0 commit comments