Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions classes/helpers/FrmAppHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1404,7 +1404,7 @@ public static function icon_by_class( $class, $atts = array() ) {
$icon = reset( $icon );
}

$icon = '<svg class="frmsvg' . esc_attr( $class ) . '"' . $html_atts . '><use xlink:href="#' . esc_attr( $icon ) . '" /></svg>';
$icon = '<svg class="frmsvg' . esc_attr( $class ) . '"' . $html_atts . '><use href="#' . esc_attr( $icon ) . '" /></svg>';
}

if ( $echo ) {
Expand Down Expand Up @@ -3775,7 +3775,7 @@ public static function maybe_utf8_encode( $value ) {
*
* @since 4.02.03
*
* @param array $form
* @param array $form
*
* @return void
*/
Expand Down
6 changes: 3 additions & 3 deletions classes/views/frm-forms/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@
</div>
<div class="frm_hidden">
<svg id="frm_break_field_group_svg" class="frmsvg">
<use xlink:href="#frm_break_field_group_icon"></use>
<use href="#frm_break_field_group_icon"></use>
</svg>
<svg id="frm_gear_svg" class="frmsvg">
<use xlink:href="#frm_settings_icon"></use>
<use href="#frm_settings_icon"></use>
</svg>
<svg id="frm_trash_svg" class="frmsvg">
<use xlink:href="#frm_delete_icon"></use>
<use href="#frm_delete_icon"></use>
</svg>
</div>
4 changes: 2 additions & 2 deletions classes/views/styles/_style-options.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
tabindex="0" role="button"
title="<?php esc_attr_e( 'Back', 'formidable' ); ?>">
<svg class="frmsvg">
<use xlink:href="#frm_back"></use>
<use href="#frm_back"></use>
</svg>
</a>
<span id="frm_style_name"><?php echo esc_html( $back_button_args['title'] ); ?></span>
Expand All @@ -23,4 +23,4 @@

<div class="frm-quick-settings frm_grid_container <?php echo esc_attr( FrmStylesHelper::style_editor_get_wrapper_classname( 'quick-settings' ) ); ?>">
<?php require_once FrmAppHelper::plugin_path() . '/classes/views/styles/_quick-settings.php'; ?>
</div>
</div>
8 changes: 4 additions & 4 deletions images/sales/anniversary.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion images/sales/no-brainer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 1 addition & 4 deletions js/admin/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -843,10 +843,7 @@
};
const use = node.querySelector( 'use' );
if ( use ) {
svgArgs.href = use.getAttribute( 'xlink:href' );
if ( ! svgArgs.href ) {
svgArgs.href = use.getAttribute( 'href' );
}
svgArgs.href = use.getAttribute( 'href' ) || use.getAttribute( 'xlink:href' );
}
return svg( svgArgs );
}
Expand Down
2 changes: 1 addition & 1 deletion js/form-templates.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/formidable_admin.js

Large diffs are not rendered by default.

32 changes: 19 additions & 13 deletions js/src/admin/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -1395,13 +1395,13 @@ window.frmAdminBuildJS = function() {
let layoutOption, moveOption;

layoutOption = document.createElement( 'span' );
layoutOption.innerHTML = '<svg class="frmsvg"><use xlink:href="#frm_field_group_layout_icon"></use></svg>';
layoutOption.innerHTML = '<svg class="frmsvg"><use href="#frm_field_group_layout_icon"></use></svg>';
const layoutOptionLabel = __( 'Set Row Layout', 'formidable' );
addTooltip( layoutOption, layoutOptionLabel );
makeTabbable( layoutOption, layoutOptionLabel );

moveOption = document.createElement( 'span' );
moveOption.innerHTML = '<svg class="frmsvg"><use xlink:href="#frm_thick_move_icon"></use></svg>';
moveOption.innerHTML = '<svg class="frmsvg"><use href="#frm_thick_move_icon"></use></svg>';
moveOption.classList.add( 'frm-move' );
const moveOptionLabel = __( 'Move Field Group', 'formidable' );
addTooltip( moveOption, moveOptionLabel );
Expand Down Expand Up @@ -2647,7 +2647,7 @@ window.frmAdminBuildJS = function() {

span = document.createElement( 'span' );
span.textContent = option.label;
anchor.innerHTML = '<svg class="frmsvg"><use xlink:href="#' + option.icon + '"></use></svg>';
anchor.innerHTML = '<svg class="frmsvg"><use href="#' + option.icon + '"></use></svg>';
anchor.appendChild( document.createTextNode( ' ' ) );
anchor.appendChild( span );

Expand Down Expand Up @@ -7290,7 +7290,7 @@ window.frmAdminBuildJS = function() {
parentClass = '';
}
maybeAddFieldSelection( parentClass );
jQuery( parentClass + ' .frm_has_shortcodes:not(.frm-with-right-icon) input,' + parentClass + ' .frm_has_shortcodes:not(.frm-with-right-icon) textarea' ).wrap( '<span class="frm-with-right-icon"></span>' ).before( '<svg class="frmsvg frm-show-box"><use xlink:href="#frm_more_horiz_solid_icon"/></svg>' );
jQuery( parentClass + ' .frm_has_shortcodes:not(.frm-with-right-icon) input,' + parentClass + ' .frm_has_shortcodes:not(.frm-with-right-icon) textarea' ).wrap( '<span class="frm-with-right-icon"></span>' ).before( '<svg class="frmsvg frm-show-box"><use href="#frm_more_horiz_solid_icon"/></svg>' );
}

/**
Expand Down Expand Up @@ -8397,6 +8397,17 @@ window.frmAdminBuildJS = function() {
result.innerHTML = '[' + code + '[/if ' + field + ']';
}

/**
* Gets data from href or xlink:href of the given element.
*
* @param {HTMLElement} element HTML element.
*
* @return {String}
*/
function getSVGHref( element ) {
return element.getAttribute( 'href' ) || element.getAttributeNS( 'http://www.w3.org/1999/xlink', 'href' );
}

function maybeShowModal( input ) {
let moreIcon;
if ( input.parentNode.parentNode.classList.contains( 'frm_has_shortcodes' ) ) {
Expand All @@ -8405,7 +8416,7 @@ window.frmAdminBuildJS = function() {
if ( moreIcon.tagName === 'use' ) {
moreIcon = moreIcon.firstElementChild;

if ( moreIcon.getAttributeNS( 'http://www.w3.org/1999/xlink', 'href' ).indexOf( 'frm_close_icon' ) === -1 ) {
if ( getSVGHref( moreIcon ).indexOf( 'frm_close_icon' ) === -1 ) {
showShortcodeBox( moreIcon, 'nofocus' );
}
} else if ( ! moreIcon.classList.contains( 'frm_close_icon' ) ) {
Expand Down Expand Up @@ -8535,12 +8546,7 @@ window.frmAdminBuildJS = function() {
moreIcon = moreIcon.firstElementChild;
}
if ( moreIcon.tagName === 'use' ) {
classes = moreIcon.getAttributeNS( 'http://www.w3.org/1999/xlink', 'href' );

if ( null === classes ) {
// If the deprecated xlink:href is not defined, check for href.
classes = moreIcon.getAttribute( 'href' );
}
classes = getSVGHref( moreIcon );
}

if ( classes.indexOf( 'frm_close_icon' ) !== -1 ) {
Expand Down Expand Up @@ -8801,7 +8807,7 @@ window.frmAdminBuildJS = function() {

closeSvg = document.querySelectorAll( '.frm_has_shortcodes use' );
for ( u = 0; u < closeSvg.length; u++ ) {
if ( closeSvg[ u ].getAttributeNS( 'http://www.w3.org/1999/xlink', 'href' ) === '#frm_close_icon' ) {
if ( getSVGHref( closeSvg[ u ] ) === '#frm_close_icon' ) {
if ( closeSvg[ u ].closest( '.frm_remove_field' ) ) {
// Don't change the icon for the email fields remove button.
continue;
Expand Down Expand Up @@ -9856,7 +9862,7 @@ window.frmAdminBuildJS = function() {
if ( ! useTag ) {
return;
}
useTagHref = useTag.getAttributeNS( 'http://www.w3.org/1999/xlink', 'href' ) || useTag.getAttribute( 'href' );
useTagHref = getSVGHref( useTag );

if ( useTagHref === '#frm_drag_icon' ) {
hasDragIcon = true;
Expand Down
8 changes: 4 additions & 4 deletions js/src/form-templates/events/favoriteButtonListener.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ const onFavoriteButtonClick = event => {
++favoritesCount.total;
isTemplateCustom ? ++favoritesCount.custom : ++favoritesCount.default; // eslint-disable-line no-unused-expressions
// Set heart icon to filled
heartIcon.setAttribute( 'xlink:href', FILLED_HEART_ICON );
twinTemplateHeartIcon?.setAttribute( 'xlink:href', FILLED_HEART_ICON );
heartIcon.setAttribute( 'href', FILLED_HEART_ICON );
twinTemplateHeartIcon?.setAttribute( 'href', FILLED_HEART_ICON );
} else {
// Decrement favorite counts
--favoritesCount.total;
isTemplateCustom ? --favoritesCount.custom : --favoritesCount.default; // eslint-disable-line no-unused-expressions
// Set heart icon to outline
heartIcon.setAttribute( 'xlink:href', LINEAR_HEART_ICON );
twinTemplateHeartIcon?.setAttribute( 'xlink:href', LINEAR_HEART_ICON );
heartIcon.setAttribute( 'href', LINEAR_HEART_ICON );
twinTemplateHeartIcon?.setAttribute( 'href', LINEAR_HEART_ICON );
}

// Update UI and state to reflect new favorite counts
Expand Down
2 changes: 1 addition & 1 deletion js/src/form-templates/ui/showModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export const showUpgradeModal = showModal( ( plan, template ) => {

// Update SVG icon
const svg = icon.querySelector( 'svg > use' );
svg.setAttribute( 'xlink:href', shouldDisplayCheck ? '#frm_checkmark_icon' : '#frm_close_icon' );
svg.setAttribute( 'href', shouldDisplayCheck ? '#frm_checkmark_icon' : '#frm_close_icon' );
} );

// Append template slug to the upgrade modal link URL
Expand Down
Loading