Skip to content

Commit 0ea2f43

Browse files
author
Reece Browne
committed
UI tweaks and bug fixes
1 parent a9586b8 commit 0ea2f43

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/main/resources/static/js/draggable-utils-form.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ const DraggableUtils = {
180180
window.latestId = input.getAttribute('id');
181181
window.populateEditForm(input.getAttribute('type'), {
182182
'id': input.getAttribute('id'), 'height': input.style.height, 'width': input.style.width,
183-
'backgroundPalette': input.getAttribute('backgroundColor'), 'textPalette': input.getAttribute('textColor'), fontSize: parseInt(input.style.fontSize),
183+
'backgroundPalette': input.getAttribute('backgroundColor'), 'textPalette': input.getAttribute('textColor'), fontSize: parseInt(input.style.fontSize) || "12",
184184
'font': input.style.fontFamily, 'dropdownValues': input.getAttribute("data-value"), 'value': input.value, 'optionListValues': input.getAttribute("data-value")
185185
});
186186
});
@@ -221,7 +221,7 @@ const DraggableUtils = {
221221
window.latestId = element.getAttribute('id');
222222
window.populateEditForm(element.getAttribute('type'), {
223223
'id': element.getAttribute('id'), 'height': element.style.height, 'width': element.style.width,
224-
'backgroundPalette': element.getAttribute('backgroundColor'), 'textPalette': element.getAttribute('textColor'), fontSize: parseInt(element.style.fontSize),
224+
'backgroundPalette': element.getAttribute('backgroundColor'), 'textPalette': element.getAttribute('textColor'), fontSize: parseInt(element.style.fontSize) || "12",
225225
'font': element.style.fontFamily, 'dropdownValues': element.getAttribute("data-value"), 'value': element.value, 'optionListValues': element.getAttribute("data-value")
226226
});
227227
resolve(canvasContainer);
@@ -732,7 +732,7 @@ const DraggableUtils = {
732732
radioGroup.addOptionToPage(buttonValue, page, translatedPositions);
733733
} else if (elementType === 'dropdown') {
734734
// Handle Dropdowns
735-
const fieldValues = input.getAttribute('data-value')?.split(',').map(v => v.trim());
735+
const fieldValues = input.getAttribute('data-value')?.split(',').map(v => v.trim() || []);
736736
const field = form.createDropdown(fieldKey);
737737
field.addOptions(fieldValues);
738738
field.addToPage(page, translatedPositions);

src/main/resources/static/js/pages/forms.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,13 @@ const textBoxConfig = {
6262
{ id: 'value', label: 'Placeholder', type: 'text', placeholder: '' },
6363
{ id: 'fontSize', label: 'Font Size', type: 'number', value: '12' },
6464
{ id: 'backgroundPalette', label: 'Background Color', type: 'color', value: '#ffffff' },
65-
{ id: 'Palette', label: 'Text Color', type: 'color', value: '#000000' }
65+
{ id: 'textPalette', label: 'Text Color', type: 'color', value: '#000000' }
6666
]
6767
};
6868

6969
const configMap = {
7070
radio: radioButtonConfig,
7171
textBox: textBoxConfig,
72-
text: textConfig,
7372
checkbox: checkboxConfig,
7473
dropdown: dropdownConfig,
7574
optionList: optionListConfig
@@ -111,15 +110,15 @@ document.querySelector('input[name=pdf-upload]').addEventListener('change', asyn
111110
await DraggableUtils.renderPage(pdfDoc, 0);
112111

113112
document.querySelectorAll('.show-on-file-selected').forEach((el) => {
114-
el.style.cssText = '';
113+
el.style.display = 'block';
115114
});
116115
}
117116
});
118117
});
119118

120119
document.addEventListener('DOMContentLoaded', () => {
121120
document.querySelectorAll('.show-on-file-selected').forEach((el) => {
122-
el.style.cssText = 'display:none !important';
121+
el.style.display = 'none !important';
123122
});
124123
document.addEventListener('keydown', (e) => {
125124
if (e.key === 'Delete') {

src/main/resources/templates/forms.html

+5-4
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@
4141
th:replace="~{fragments/common :: fileSelector(name='pdf-upload', multipleInputsForSingleRequest=false, disableMultipleFiles=true, accept='application/pdf')}">
4242
</div>
4343
<script type="module" th:src="@{'/pdfjs-legacy/pdf.mjs'}"></script>
44-
<div class="show-on-file-selected">
44+
<div class="show-on-file-selected" style="height:23rem">
4545
<div style="display: flex;">
46-
<div class="margin-auto-parent" style="margin-bottom: 1rem;margin-top: 0.5rem;">
47-
<div style="margin-right: 2rem; width:100%" id="addNewForm"></div>
48-
<button id="save" class="btn btn-outline-success" th:text="#{sign.add}"></button>
46+
<div class="margin-auto-parent" style="margin-bottom: 1rem; margin-top: 0.5rem;">
47+
<div style="margin-right: 2rem; width:100%;" id="addNewForm"></div>
48+
<button id="save" class="btn btn-outline-success" style="height:2.3rem"
49+
th:text="#{sign.add}"></button>
4950
</div>
5051
</div>
5152
<div id="formOptions"></div>

0 commit comments

Comments
 (0)