mirror of https://github.com/vector-im/riot-web
slate-md-serializer 3.1.0 now escapes correctly
parent
6fba8311f9
commit
fc1c4996fc
|
@ -86,7 +86,7 @@
|
|||
"slate": "^0.33.4",
|
||||
"slate-react": "^0.12.4",
|
||||
"slate-html-serializer": "^0.6.1",
|
||||
"slate-md-serializer": "^3.0.3",
|
||||
"slate-md-serializer": "^3.1.0",
|
||||
"sanitize-html": "^1.14.1",
|
||||
"text-encoding-utf-8": "^1.0.1",
|
||||
"url": "^0.11.0",
|
||||
|
|
|
@ -178,15 +178,7 @@ export default class MessageComposerInput extends React.Component {
|
|||
rules: [
|
||||
{
|
||||
serialize: (obj, children) => {
|
||||
if (obj.object === 'string') {
|
||||
// escape any MD in it. i have no idea why the serializer doesn't
|
||||
// do this already.
|
||||
// TODO: this can probably be more robust - it doesn't consider
|
||||
// indenting or lists for instance.
|
||||
return children.replace(/([*_~`+])/g, '\\$1')
|
||||
.replace(/^([>#\|])/mg, '\\$1');
|
||||
}
|
||||
else if (obj.object === 'inline') {
|
||||
if (obj.object === 'inline') {
|
||||
switch (obj.type) {
|
||||
case 'pill':
|
||||
return `[${ obj.data.get('completion') }](${ obj.data.get('href') })`;
|
||||
|
|
Loading…
Reference in New Issue