UX: Set selected scale to 100% if scale is undefined

This commit is contained in:
romanrizzi 2019-11-22 18:19:02 -03:00
parent f9fa9b45d0
commit 01e2d5a670
1 changed files with 4 additions and 1 deletions

View File

@ -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}%`;