Skip to content

Commit

Permalink
fix FE send font style to BE and save
Browse files Browse the repository at this point in the history
  • Loading branch information
yennanliu committed Nov 22, 2023
1 parent ff4e8fe commit b863ea2
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,14 @@ <h1 align="center">Create A New Post</h1>
<option value="Times New Roman, serif">Times New Roman</option>
<option value="Courier New, monospace">Courier New</option>
</select>

<label for="font-color">Font Color:</label>
<input type="color" id="font-color" onchange="changeStyle()">
</div>

<input type="hidden" th:value="20px" name="selectedFontSize" id="selectedFontSize" th:field="*{FontSize}" />
<input type="hidden" th:value="Ariel" name="selectedFontStyle" id="selectedFontStyle" th:field="*{FontStyle}" />
<input type="hidden" th:value="red" name="selectedFontColor" id="selectedFontColor" th:field="*{FontColor}" />

<textarea id="content" name="courseMemo" th:field="*{content}" oninput="changeStyle()">blog content</textarea>
<p><input type="submit" value="Submit" /> <input type="reset" value="Reset" /></p>
</form>
Expand All @@ -53,9 +57,17 @@ <h1 align="center">Create A New Post</h1>
var fontStyle = document.getElementById('font-style').value;
var fontColor = document.getElementById('font-color').value;

console.log(">>> fontSize = " + fontSize);

content.style.fontSize = fontSize;
content.style.fontFamily = fontStyle;
content.style.color = fontColor;

document.getElementById('selectedFontSize').value = fontSize;
document.getElementById('selectedFontStyle').value = fontStyle;
document.getElementById('selectedFontColor').value = fontColor;

//console.log(">>> content = " + JSON.stringify(content));
}
</script>
</body>
Expand Down

0 comments on commit b863ea2

Please sign in to comment.