escape blockquotes correctly
and fix NPE
This commit is contained in:
parent
6ac2324874
commit
6fba8311f9
1 changed files with 5 additions and 2 deletions
|
@ -184,7 +184,7 @@ export default class MessageComposerInput extends React.Component {
|
||||||
// TODO: this can probably be more robust - it doesn't consider
|
// TODO: this can probably be more robust - it doesn't consider
|
||||||
// indenting or lists for instance.
|
// indenting or lists for instance.
|
||||||
return children.replace(/([*_~`+])/g, '\\$1')
|
return children.replace(/([*_~`+])/g, '\\$1')
|
||||||
.replace(/^([>#\|])/g, '\\$1');
|
.replace(/^([>#\|])/mg, '\\$1');
|
||||||
}
|
}
|
||||||
else if (obj.object === 'inline') {
|
else if (obj.object === 'inline') {
|
||||||
switch (obj.type) {
|
switch (obj.type) {
|
||||||
|
@ -369,6 +369,7 @@ export default class MessageComposerInput extends React.Component {
|
||||||
let fragmentChange = fragment.change();
|
let fragmentChange = fragment.change();
|
||||||
fragmentChange.moveToRangeOf(fragment.document)
|
fragmentChange.moveToRangeOf(fragment.document)
|
||||||
.wrapBlock(quote);
|
.wrapBlock(quote);
|
||||||
|
//.setBlocks('block-quote');
|
||||||
|
|
||||||
// FIXME: handle pills and use commonmark rather than md-serialize
|
// FIXME: handle pills and use commonmark rather than md-serialize
|
||||||
const md = this.md.serialize(fragmentChange.value);
|
const md = this.md.serialize(fragmentChange.value);
|
||||||
|
@ -536,7 +537,9 @@ export default class MessageComposerInput extends React.Component {
|
||||||
// emoji picker can leave the selection stuck in the emoji's
|
// emoji picker can leave the selection stuck in the emoji's
|
||||||
// child text. This seems to happen due to selection getting
|
// child text. This seems to happen due to selection getting
|
||||||
// moved in the normalisation phase after calculating these changes
|
// moved in the normalisation phase after calculating these changes
|
||||||
if (editorState.document.getParent(editorState.anchorKey).type === 'emoji') {
|
if (editorState.anchorKey &&
|
||||||
|
editorState.document.getParent(editorState.anchorKey).type === 'emoji')
|
||||||
|
{
|
||||||
change = change.collapseToStartOfNextText();
|
change = change.collapseToStartOfNextText();
|
||||||
editorState = change.value;
|
editorState = change.value;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue