slate-md-serializer 3.1.0 now escapes correctly

pull/21833/head
Matthew Hodgson 2018-05-23 02:15:34 +01:00
parent 6fba8311f9
commit fc1c4996fc
2 changed files with 2 additions and 10 deletions

View File

@ -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",

View File

@ -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') })`;