From 118f0627778880d4f0f44ab22f3baecf35605ab9 Mon Sep 17 00:00:00 2001 From: Rami Yushuvaev <92088692+rami-elementor@users.noreply.github.com> Date: Sun, 17 Mar 2024 12:59:08 -0700 Subject: [PATCH] Replace var with const (#259) --- src/controls/complex-example.md | 4 ++-- src/editor-controls/control-hover-animation.md | 6 +++++- src/editor-controls/control-icons.md | 2 +- src/editor-controls/group-control-image-size.md | 4 ++-- src/widgets/advanced-example.md | 4 ++-- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/controls/complex-example.md b/src/controls/complex-example.md index 6e846901..91310315 100644 --- a/src/controls/complex-example.md +++ b/src/controls/complex-example.md @@ -187,9 +187,9 @@ class Elementor_EmojiOneArea_Control extends \Elementor\Base_Data_Control { ```js window.addEventListener( 'elementor/init', () => { - var emojioneareaItemView = elementor.modules.controls.BaseData.extend({ + const emojioneareaItemView = elementor.modules.controls.BaseData.extend({ onReady() { - var self = this, + const self = this, options = _.extend({ events: { change: () => self.saveValue(), diff --git a/src/editor-controls/control-hover-animation.md b/src/editor-controls/control-hover-animation.md index d43142ff..83421cc6 100644 --- a/src/editor-controls/control-hover-animation.md +++ b/src/editor-controls/control-hover-animation.md @@ -103,9 +103,11 @@ class Elementor_Test_Widget extends \Elementor\Widget_Base { $settings = $this->get_settings_for_display(); $elementClass = 'container'; + if ( $settings['hover_animation'] ) { $elementClass .= ' elementor-animation-' . $settings['hover_animation']; } + $this->add_render_attribute( 'wrapper', 'class', $elementClass ); ?>
get_render_attribute_string( 'wrapper' ); ?>> @@ -117,10 +119,12 @@ class Elementor_Test_Widget extends \Elementor\Widget_Base { protected function content_template() { ?> <# - var elementClass = 'container'; + const elementClass = 'container'; + if ( '' !== settings.hover_animation ) { elementClass += ' elementor-animation-' + settings.hover_animation; } + view.addRenderAttribute( 'wrapper', { 'class': elementClass } ); #>
diff --git a/src/editor-controls/control-icons.md b/src/editor-controls/control-icons.md index 512f314d..9caf1cd1 100644 --- a/src/editor-controls/control-icons.md +++ b/src/editor-controls/control-icons.md @@ -167,7 +167,7 @@ class Icons_Elementor_Test_Control_Widget extends \Elementor\Widget_Base { protected function content_template() { ?> <# - var iconHTML = elementor.helpers.renderIcon( view, settings.selected_icon, { 'aria-hidden': true }, 'i' , 'object' ); + const iconHTML = elementor.helpers.renderIcon( view, settings.selected_icon, { 'aria-hidden': true }, 'i' , 'object' ); #>
{{{ iconHTML.value }}} diff --git a/src/editor-controls/group-control-image-size.md b/src/editor-controls/group-control-image-size.md index 3b0c200c..129c5903 100644 --- a/src/editor-controls/group-control-image-size.md +++ b/src/editor-controls/group-control-image-size.md @@ -116,14 +116,14 @@ class Elementor_Test_Widget extends \Elementor\Widget_Base { protected function content_template() { ?> <# - var image = { + const image = { id: settings.image.id, url: settings.image.url, size: settings.thumbnail_size, dimension: settings.thumbnail_custom_dimension, model: view.getEditModel() }; - var image_url = elementor.imagesManager.getImageUrl( image ); + const image_url = elementor.imagesManager.getImageUrl( image ); #> <{{{ html_tag[ settings.marker_type ] }}} {{{ view.getRenderAttributeString( 'list' ) }}}> <# _.each( settings.list_items, function( item, index ) { - var repeater_setting_key = view.getRepeaterSettingKey( 'text', 'list_items', index ); + const repeater_setting_key = view.getRepeaterSettingKey( 'text', 'list_items', index ); view.addRenderAttribute( repeater_setting_key, 'class', 'elementor-list-widget-text' ); view.addInlineEditingAttributes( repeater_setting_key ); #>
  • - <# var title = item.text; #> + <# const title = item.text; #> <# if ( item.link ) { #> <# view.addRenderAttribute( `link_${index}`, item.link ); #>