Fix Android-like format triggers offset calc (#1333)

This commit is contained in:
Viktor Oreshkin 2017-01-30 12:55:25 +04:00 committed by Igor Zhukov
parent f0eee9f963
commit 594bbe4496

View File

@ -1442,14 +1442,14 @@ angular.module('izhukov.utils', [])
length: text.length length: text.length
}) })
rawOffset -= match[2].length + match[4].length rawOffset -= match[2].length + match[4].length
} else if (match[7]) { // code } else if (match[7]) { // code|italic|bold
newText.push(match[6] + text + match[9]) newText.push(match[6] + text + match[9])
entities.push({ entities.push({
_: markdownEntities[match[7]], _: markdownEntities[match[7]],
offset: matchIndex + match[6].length, offset: matchIndex + match[6].length,
length: text.length length: text.length
}) })
rawOffset -= 2 rawOffset -= match[7].length * 2
} else if (match[11]) { // custom mention } else if (match[11]) { // custom mention
newText.push(text) newText.push(text)
entities.push({ entities.push({