1
0
Fork 0
mirror of synced 2024-07-03 13:30:46 +12:00

Fix regex binding replacement issue due to not being escaped

This commit is contained in:
Andrew Kingston 2021-09-24 16:24:16 +01:00
parent 9d199d6dda
commit 8b35405a85

View file

@ -443,10 +443,9 @@ function bindingReplacement(bindableProperties, textWithBindings, convertTo) {
for (let from of convertFromProps) { for (let from of convertFromProps) {
if (shouldReplaceBinding(newBoundValue, from, convertTo)) { if (shouldReplaceBinding(newBoundValue, from, convertTo)) {
const binding = bindableProperties.find(el => el[convertFrom] === from) const binding = bindableProperties.find(el => el[convertFrom] === from)
newBoundValue = newBoundValue.replace( while (newBoundValue.includes(from)) {
new RegExp(from, "gi"), newBoundValue = newBoundValue.replace(from, binding[convertTo])
binding[convertTo] }
)
} }
} }
result = result.replace(boundValue, newBoundValue) result = result.replace(boundValue, newBoundValue)