mirror of https://github.com/vector-im/riot-web
switch to using 'code' for both blocks & marks to match md-serializer
parent
294565c47e
commit
864a33f978
|
@ -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",
|
||||
|
|
|
@ -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' : '';
|
||||
|
|
|
@ -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) => `<u>${text}</u>`,
|
||||
'strike': (text) => `<del>${text}</del>`,
|
||||
// ("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 <strong {...attributes}>{children}</strong>;
|
||||
case 'italic':
|
||||
return <em {...attributes}>{children}</em>;
|
||||
case 'inline-code':
|
||||
case 'code':
|
||||
return <code {...attributes}>{children}</code>;
|
||||
case 'underlined':
|
||||
return <u {...attributes}>{children}</u>;
|
||||
|
|
Loading…
Reference in New Issue