🐛 (textBubble) Fix variable parsing when starting or finishing by spaces
This commit is contained in:
@ -1,8 +1,9 @@
|
||||
.slate-inline-code {
|
||||
background-color: #805ad5;
|
||||
background-color: #a1a1aa;
|
||||
color: white;
|
||||
padding: 0.125rem 0.25rem;
|
||||
border-radius: 0.35rem;
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
.slate-variable {
|
||||
|
@ -209,6 +209,26 @@ const applyElementStyleToDescendants = (
|
||||
})
|
||||
|
||||
const convertMarkdownToRichText = (text: string): TDescendant[] => {
|
||||
const spacesBefore = text.match(/^[\s]+/)
|
||||
const spacesAfter = text.match(/[\s]+$/)
|
||||
const plugins = [createDeserializeMdPlugin()]
|
||||
return deserializeMd(createPlateEditor({ plugins }) as unknown as any, text)
|
||||
return [
|
||||
...(spacesBefore?.at(0)
|
||||
? [
|
||||
{
|
||||
type: 'p',
|
||||
text: spacesBefore.at(0),
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...deserializeMd(createPlateEditor({ plugins }) as unknown as any, text),
|
||||
...(spacesAfter?.at(0)
|
||||
? [
|
||||
{
|
||||
type: 'p',
|
||||
text: spacesAfter.at(0),
|
||||
},
|
||||
]
|
||||
: []),
|
||||
]
|
||||
}
|
||||
|
Reference in New Issue
Block a user