diff --git a/package.json b/package.json index 5dc3e698f2..f3f184fb65 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "slate": "^0.33.4", "slate-react": "^0.12.4", "slate-html-serializer": "^0.6.1", - "slate-md-serializer": "matrix-org/slate-md-serializer#11fe1b6", + "slate-md-serializer": "matrix-org/slate-md-serializer#1580ed67", "sanitize-html": "^1.14.1", "text-encoding-utf-8": "^1.0.1", "url": "^0.11.0", diff --git a/src/components/views/rooms/MessageComposer.js b/src/components/views/rooms/MessageComposer.js index 28502c348d..686ab3fcb6 100644 --- a/src/components/views/rooms/MessageComposer.js +++ b/src/components/views/rooms/MessageComposer.js @@ -356,7 +356,7 @@ export default class MessageComposer extends React.Component { let formatBar; if (this.state.showFormatting && this.state.inputState.isRichTextEnabled) { const {marks, blockType} = this.state.inputState; - const formatButtons = ["bold", "italic", "deleted", "underlined", "code", "block-quote", "bulleted-list", "numbered-list"].map( + const formatButtons = ["bold", "italic", "deleted", "underlined", "inline-code", "block-quote", "bulleted-list", "numbered-list"].map( (name) => { const active = marks.some(mark => mark.type === name) || blockType === name; const suffix = active ? '-on' : ''; diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 94ef88d04b..50b3422fee 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -103,7 +103,7 @@ const MARK_TAGS = { b: 'bold', // deprecated em: 'italic', i: 'italic', // deprecated - code: 'inline-code', + code: 'code', u: 'underlined', del: 'deleted', strike: 'deleted', // deprecated @@ -853,7 +853,7 @@ export default class MessageComposerInput extends React.Component { case 'inline-code': case 'underlined': case 'deleted': { - change.toggleMark(type); + change.toggleMark(type === 'inline-code' ? 'code' : type); } break; @@ -885,7 +885,7 @@ export default class MessageComposerInput extends React.Component { 'underline': (text) => `${text}`, 'strike': (text) => `${text}`, // ("code" is triggered by ctrl+j by draft-js by default) - 'inline-code': (text) => treatInlineCodeAsBlock ? textMdCodeBlock(text) : `\`${text}\``, + 'code': (text) => treatInlineCodeAsBlock ? textMdCodeBlock(text) : `\`${text}\``, 'code': textMdCodeBlock, 'blockquote': (text) => text.split('\n').map((line) => `> ${line}\n`).join('') + '\n', 'unordered-list-item': (text) => text.split('\n').map((line) => `\n- ${line}`).join(''), @@ -897,7 +897,7 @@ export default class MessageComposerInput extends React.Component { 'italic': -1, 'underline': -4, 'strike': -6, - 'inline-code': treatInlineCodeAsBlock ? -5 : -1, + 'code': treatInlineCodeAsBlock ? -5 : -1, 'code': -5, 'blockquote': -2, }[command]; @@ -1424,7 +1424,7 @@ export default class MessageComposerInput extends React.Component { return {children}; case 'italic': return {children}; - case 'inline-code': + case 'code': return {children}; case 'underlined': return {children};