fix image insert issue

This commit is contained in:
feruz 2022-06-22 22:41:36 +03:00
parent bd98ee843f
commit c98da9143f

View File

@ -7,7 +7,7 @@ export default async ({ text, selection, setTextAndSelection, items }) => {
let newSelection = selection; let newSelection = selection;
items.forEach(item => { items.forEach(item => {
if(item.url && item.text){ if(item.url){
const formatedText = `\n${imagePrefix}[${item.text}](${item.url})\n` const formatedText = `\n${imagePrefix}[${item.text}](${item.url})\n`
newText = replaceBetween(newText, newSelection, formatedText); newText = replaceBetween(newText, newSelection, formatedText);
const newIndex = newText && newText.indexOf(item.url, newSelection.start) + item.url.length + 2; const newIndex = newText && newText.indexOf(item.url, newSelection.start) + item.url.length + 2;