Merge pull request #619 from esteemapp/bugfix/#580

Fixed image upload error
This commit is contained in:
uğur erdal 2019-02-21 22:13:51 +03:00 committed by GitHub
commit 50767e2191
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,10 +30,17 @@ export default ({
}
} else {
newText = replaceBetween(text, selection, `${imagePrefix}[${itemText}](${itemUrl})`);
newSelection = {
start: selection.start + 1,
end: selection.start + 1 + itemText && itemText.length,
};
if (isImage) {
newSelection = {
start: newText && newText.length,
end: newText && newText.length,
};
} else {
newSelection = {
start: selection.start + 1,
end: selection.start + 1 + (itemText && itemText.length),
};
}
}
setState({ text: newText }, () => {
setState({ newSelection });