Fixed issue with emoji placement in composer

• Fixed:
- issue with emoji placement in composer
This commit is contained in:
mgabdev 2021-01-13 18:37:07 -05:00
parent 2fe5162aa8
commit 625cfab1b4

View File

@ -180,7 +180,8 @@ class Composer extends React.PureComponent {
const currentBlockIndex = blocks.findIndex((k) => k.key === currentBlockKey) const currentBlockIndex = blocks.findIndex((k) => k.key === currentBlockKey)
const priorBlockTextLength = blocks.splice(0, currentBlockIndex).map(block => (!block.text.trim() && '') || block.text).join('\n').length const priorBlockTextLength = blocks.splice(0, currentBlockIndex).map(block => (!block.text.trim() && '') || block.text).join('\n').length
const selectionStart = selectionState.getStartOffset() const selectionStart = selectionState.getStartOffset()
const cursorPosition = priorBlockTextLength + selectionStart const toAdd = currentBlockIndex === 0 ? 0 : 1
const cursorPosition = priorBlockTextLength + selectionStart + toAdd
const rawObject = convertToRaw(content) const rawObject = convertToRaw(content)
const markdownString = this.props.isPro ? draftToMarkdown(rawObject,markdownOptions) : null const markdownString = this.props.isPro ? draftToMarkdown(rawObject,markdownOptions) : null