From d4c7992f5a499efff2374c8e26d4fb604a19eee3 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 4 Sep 2019 16:39:56 +0200 Subject: [PATCH] first impl of inline formatting --- src/components/views/rooms/BasicMessageComposer.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/components/views/rooms/BasicMessageComposer.js b/src/components/views/rooms/BasicMessageComposer.js index 9ba3e603b9..b578aa9e0c 100644 --- a/src/components/views/rooms/BasicMessageComposer.js +++ b/src/components/views/rooms/BasicMessageComposer.js @@ -455,22 +455,26 @@ export default class BasicMessageEditor extends React.Component { }); } - _formatBold = () => { + _wrapSelection(prefix, suffix = prefix) { const {partCreator} = this.props.model; this._replaceSelection(range => { const parts = range.parts; - parts.splice(0, 0, partCreator.plain("**")); - parts.push(partCreator.plain("**")); + parts.splice(0, 0, partCreator.plain(prefix)); + parts.push(partCreator.plain(suffix)); return parts; }); } - _formatItalic = () => { + _formatBold = () => { + this._wrapSelection("**"); + } + _formatItalic = () => { + this._wrapSelection("*"); } _formatStrikethrough = () => { - + this._wrapSelection("", ""); } _formatQuote = () => {