diff --git a/app/assets/javascripts/pretty-text/engines/discourse-markdown/resize-controls.js.es6 b/app/assets/javascripts/pretty-text/engines/discourse-markdown/resize-controls.js.es6 index 6231a265446..bb8e381d335 100644 --- a/app/assets/javascripts/pretty-text/engines/discourse-markdown/resize-controls.js.es6 +++ b/app/assets/javascripts/pretty-text/engines/discourse-markdown/resize-controls.js.es6 @@ -15,7 +15,7 @@ function buildToken(state, type, tag, klass, nesting) { function wrapImage(tokens, index, state, imgNumber) { const imgToken = tokens[index]; - const selectedScale = imgToken.content + let selectedScale = imgToken.content .split(",") .pop() .trim(); @@ -38,6 +38,9 @@ function wrapImage(tokens, index, state, imgNumber) { const minimumScale = 50; const scales = [100, 75, minimumScale]; + const overwriteScale = !scales.find(scale => `${scale}%` === selectedScale); + if (overwriteScale) selectedScale = "100%"; + scales.forEach(scale => { const scaleText = `${scale}%`;