|
120 | 120 | }); |
121 | 121 |
|
122 | 122 | const select = $("#node-select-font"); |
| 123 | + |
| 124 | + // add font options |
123 | 125 | fonts.forEach((font) => { |
124 | 126 | var name = font.name; |
125 | 127 | var val = font.value; |
126 | 128 | $("<option/>", { |
127 | 129 | value: val, |
128 | 130 | }).text(name).appendTo(select); |
129 | 131 | }); |
| 132 | + |
| 133 | + // when a font is selected |
130 | 134 | $(select).change(() => { |
131 | 135 | const val = $("#node-select-font").val(); |
| 136 | + // update hidden input |
132 | 137 | $("#node-input-font").val(val); |
| 138 | + // update test text |
133 | 139 | $("#node-test-text").css({ |
134 | 140 | "font-family": val, |
135 | 141 | }); |
136 | 142 | }); |
137 | 143 | $(select).val(this.font); |
138 | 144 | $(select).change(); |
139 | 145 |
|
| 146 | + // make the fontsize a numeric spinner |
140 | 147 | $("#node-input-fontSize").spinner({ |
141 | 148 | min: 1, |
142 | 149 | max: 100, |
143 | 150 | spin: () => { |
| 151 | + // update the test text when value is changed |
144 | 152 | const val = $("#node-input-fontSize").val(); |
145 | 153 | $("#node-test-text").css({ |
146 | 154 | "font-size": val +"px", |
147 | 155 | }); |
148 | 156 | } |
149 | 157 | }); |
150 | | - if (this.fontSize) { |
151 | | - $("#node-test-text").css({ |
152 | | - "font-size": this.fontSize +"px", |
153 | | - }); |
154 | | - } |
155 | 158 |
|
| 159 | + // add change handler to color picker to update test text |
156 | 160 | $("#node-input-color").change(() => { |
157 | 161 | const val = $("#node-input-color").val(); |
158 | 162 | $("#node-test-text").css({ |
159 | 163 | "color": val, |
160 | 164 | }); |
161 | 165 | }); |
162 | | - if (this.color) { |
163 | | - $("#node-test-text").css({ |
164 | | - "color": this.color |
165 | | - }); |
166 | | - } |
167 | 166 |
|
| 167 | + // add change handler to show/hide style config options |
168 | 168 | $("#node-input-style").change(() => { |
169 | 169 | const val = $("#node-input-style").prop("checked"); |
170 | 170 | if (val) { |
|
176 | 176 | }); |
177 | 177 | $("#node-input-style").change(); |
178 | 178 |
|
| 179 | + // when opening the config, make sure the test text is updated |
| 180 | + if (this.fontSize) { |
| 181 | + $("#node-test-text").css({ |
| 182 | + "font-size": this.fontSize +"px", |
| 183 | + }); |
| 184 | + } |
| 185 | + if (this.color) { |
| 186 | + $("#node-test-text").css({ |
| 187 | + "color": this.color |
| 188 | + }); |
| 189 | + } |
179 | 190 | } |
180 | 191 | }); |
181 | 192 | </script> |
182 | 193 |
|
183 | 194 | <script type="text/html" data-template-name="ui-text"> |
| 195 | + <div class="form-row"> |
| 196 | + <label for="node-input-name"><i class="fa fa-tag"></i> Name</label> |
| 197 | + <input type="text" id="node-input-name"> |
| 198 | + </div> |
184 | 199 | <div class="form-row"> |
185 | 200 | <label for="node-input-group"><i class="fa fa-table"></i> Group</label> |
186 | 201 | <input type="text" id="node-input-group"> |
|
195 | 210 | <label for="node-input-label"><i class="fa fa-i-cursor"></i> Label</label> |
196 | 211 | <input type="text" id="node-input-label"> |
197 | 212 | </div> |
198 | | - <div class="form-row"> |
| 213 | + <!--<div class="form-row"> |
199 | 214 | <label for="node-input-format"><i class="fa fa-i-cursor"></i> Value format</label> |
200 | 215 | <input type="text" id="node-input-format" placeholder="{{msg.payload}}"> |
201 | | - </div> |
| 216 | + </div>--> |
202 | 217 | <div class="form-row"> |
203 | 218 | <label style="vertical-align: top"><i class="fa fa-th-large"></i> Layout</label> |
204 | 219 | <div style="display:inline-block"> |
|
236 | 251 | </div> |
237 | 252 | </div> |
238 | 253 |
|
239 | | - <!--<div class="form-row"> |
| 254 | + <div class="form-row"> |
240 | 255 | <label><i class="fa fa-cog"></i> Style</label> |
241 | | - <input type="checkbox" id="node-input-style" style="display: inline-block; width: auto; vertical-align: top;"/> |
| 256 | + <input type="checkbox" id="node-input-style" style="display: inline-block; width: auto; vertical-align: top; margin: 0 3px 0 0;"/> |
242 | 257 | <label for="node-input-style" style="width: 70%;"> Apply Style</label> |
243 | | - </div>--> |
| 258 | + </div> |
244 | 259 |
|
245 | 260 | <div id="node-styles"> |
246 | 261 | <div class="form-row"> |
|
262 | 277 | <input id="node-test-text" value="Enter Sample Here"/ style="width: 280px;"> |
263 | 278 | </div> |
264 | 279 | </div> |
265 | | - |
266 | | - <div class="form-row"> |
267 | | - <label for="node-input-className"><i class="fa fa-code"></i> Class</label> |
268 | | - <input type="text" id="node-input-className" placeholder="Optional CSS class name(s) for widget"/> |
269 | | - </div> |
270 | | - <div class="form-row"> |
271 | | - <label for="node-input-name"><i class="fa fa-tag"></i> Name</label> |
272 | | - <input type="text" id="node-input-name"> |
273 | | - </div> |
274 | | - |
275 | | - |
276 | 280 | </script> |
| 281 | + |
277 | 282 | <style> |
278 | 283 | .nr-db-text-layout { |
279 | 284 | position:relative; |
|
0 commit comments