| @@ -49,9 +49,8 @@ | ||
| 49 | 49 | */ |
| 50 | 50 | function initPreview() { |
| 51 | 51 | initFloatingLabels(); |
| 52 | 52 | fillMissingSignatureValidationFunction(); |
| 53 | - setSelectPlaceholderColor(); | |
| 54 | 53 | |
| 55 | 54 | // Remove .wp-core-ui from the body so the preview can avoid it. |
| 56 | 55 | // Then add it back where we want to use admin styles (the sidebar, otherwise inputs appear short). |
| 57 | 56 | document.body.classList.remove( 'wp-core-ui' ); |
| @@ -1159,12 +1158,9 @@ | ||
| 1159 | 1158 | action: 'frm_change_styling', |
| 1160 | 1159 | nonce: frmGlobal.nonce, |
| 1161 | 1160 | frm_style_setting: locStr |
| 1162 | 1161 | }, |
| 1163 | - success: ( css ) => { | |
| 1164 | - handleChangeStylingSuccess( css ); | |
| 1165 | - setSelectPlaceholderColor(); | |
| 1166 | - } | |
| 1162 | + success: handleChangeStylingSuccess | |
| 1167 | 1163 | }); |
| 1168 | 1164 | } |
| 1169 | 1165 | |
| 1170 | 1166 | /** |
| @@ -1356,42 +1352,8 @@ | ||
| 1356 | 1352 | const $sample = jQuery( '#datepicker_sample' ); |
| 1357 | 1353 | if ( $sample.length && 'function' === typeof $sample.datepicker ) { |
| 1358 | 1354 | $sample.datepicker({ changeMonth: true, changeYear: true }); |
| 1359 | 1355 | } |
| 1360 | - } | |
| 1361 | - | |
| 1362 | - /** | |
| 1363 | - * Set color for select placeholders. | |
| 1364 | - * | |
| 1365 | - * @since 6.5.1 | |
| 1366 | - */ | |
| 1367 | - function setSelectPlaceholderColor() { | |
| 1368 | - const selects = document.querySelectorAll( '.form-field select' ); | |
| 1369 | - const styleElement = document.querySelector( '.with_frm_style' ); | |
| 1370 | - const textColorDisabled = styleElement ? getComputedStyle( styleElement ).getPropertyValue( '--text-color-disabled' ).trim() : ''; | |
| 1371 | - | |
| 1372 | - // Exit if there are no select elements or the textColorDisabled property is missing | |
| 1373 | - if ( ! selects.length || ! textColorDisabled ) { | |
| 1374 | - return; | |
| 1375 | - } | |
| 1376 | - | |
| 1377 | - // Function to change the color of a select element | |
| 1378 | - const changeSelectColor = ( select ) => { | |
| 1379 | - if ( select.options[select.selectedIndex].classList.contains( 'frm-select-placeholder' ) ) { | |
| 1380 | - select.style.setProperty( 'color', textColorDisabled, 'important' ); | |
| 1381 | - } else { | |
| 1382 | - select.style.color = ''; | |
| 1383 | - } | |
| 1384 | - }; | |
| 1385 | - | |
| 1386 | - // Use a loop to iterate through each select element | |
| 1387 | - selects.forEach( ( select ) => { | |
| 1388 | - // Apply the color change to each select element | |
| 1389 | - changeSelectColor( select ); | |
| 1390 | - | |
| 1391 | - // Add an event listener for future changes | |
| 1392 | - select.addEventListener( 'change', () => changeSelectColor( select ) ); | |
| 1393 | - }); | |
| 1394 | 1356 | } |
| 1395 | 1357 | |
| 1396 | 1358 | // Hook into the styleInit function in formidable_admin.js |
| 1397 | 1359 | wp.hooks.addAction( 'frm_style_editor_init', 'formidable', initEditPage ); |