first impl of inline formatting

This commit is contained in:
Bruno Windels 2019-09-04 16:39:56 +02:00
parent e7db660820
commit d4c7992f5a

View file

@ -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("<del>", "</del>");
}
_formatQuote = () => {