From c331ceae997a49e3c7125853c2225964dc17749b Mon Sep 17 00:00:00 2001 From: Stephen Kraus <8003332+stephenmk@users.noreply.github.com> Date: Sun, 14 Aug 2022 12:30:25 -0500 Subject: Add new structured content styling options (#2203) Allow for arbitrary string assignment to the font-size property. https://developer.mozilla.org/en-US/docs/Web/CSS/font-size Add support for the text-align property. https://developer.mozilla.org/en-US/docs/Web/CSS/text-align Co-authored-by: stephenmk --- ext/data/schemas/dictionary-term-bank-v3-schema.json | 6 +++++- ext/js/display/sandbox/structured-content-generator.js | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'ext') diff --git a/ext/data/schemas/dictionary-term-bank-v3-schema.json b/ext/data/schemas/dictionary-term-bank-v3-schema.json index a7c861d5..a52c18e0 100644 --- a/ext/data/schemas/dictionary-term-bank-v3-schema.json +++ b/ext/data/schemas/dictionary-term-bank-v3-schema.json @@ -252,7 +252,6 @@ }, "fontSize": { "type": "string", - "enum": ["xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "xxx-large"], "default": "medium" }, "textDecorationLine": { @@ -277,6 +276,11 @@ "enum": ["baseline", "sub", "super", "text-top", "text-bottom", "middle", "top", "bottom"], "default": "baseline" }, + "textAlign": { + "type": "string", + "enum": ["start", "end", "left", "right", "center", "justify", "justify-all", "match-parent"], + "default": "start" + }, "marginTop": { "type": "number", "default": 0 diff --git a/ext/js/display/sandbox/structured-content-generator.js b/ext/js/display/sandbox/structured-content-generator.js index 0e287dc2..bf9c1fb2 100644 --- a/ext/js/display/sandbox/structured-content-generator.js +++ b/ext/js/display/sandbox/structured-content-generator.js @@ -265,6 +265,7 @@ class StructuredContentGenerator { fontSize, textDecorationLine, verticalAlign, + textAlign, marginTop, marginLeft, marginRight, @@ -275,6 +276,7 @@ class StructuredContentGenerator { if (typeof fontWeight === 'string') { style.fontWeight = fontWeight; } if (typeof fontSize === 'string') { style.fontSize = fontSize; } if (typeof verticalAlign === 'string') { style.verticalAlign = verticalAlign; } + if (typeof textAlign === 'string') { style.textAlign = textAlign; } if (typeof textDecorationLine === 'string') { style.textDecoration = textDecorationLine; } else if (Array.isArray(textDecorationLine)) { -- cgit v1.2.3