Skip to content

Commit

Permalink
Merge branch 'main' into ED-13824-to-main-pt-2
Browse files Browse the repository at this point in the history
  • Loading branch information
davseve committed Jun 7, 2024
2 parents e349293 + f425809 commit 9717f67
Show file tree
Hide file tree
Showing 73 changed files with 2,359 additions and 695 deletions.
32 changes: 32 additions & 0 deletions .github/scripts/get-changelog-from-change-txt.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
'use strict';

const marked = require("marked");
const fs = require('fs');
const { VERSION } = process.env;

if (!VERSION) {
console.error('missing VERSION env var');
process.exit(1);
return;
}

for (let fileName of ['changelog.txt', 'readme.txt'] ) {
try {
const changelogText = fs.readFileSync(`${fileName}`, 'utf-8');
const data = marked.lexer(changelogText);
const headerIndex = data.findIndex((section) => {
const text = section?.text?.match(/\d+\.\d+\.\d+/g)?.[0] || '';
return section.type === 'paragraph' && VERSION == text;
});
if (headerIndex === -1) {
console.error(`Change log for release ${version} not found in ${filename}`);
process.exit(1);
return;
}
const versionLog = data[headerIndex + 1].raw;
fs.writeFileSync(`temp-${fileName}`, versionLog);
} catch (err) {
console.error(err)
process.exit(1);
}
}
17 changes: 17 additions & 0 deletions .github/workflows/get-changelog-from-changelog-txt/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Get change log From changelog and readme text files
description: Get change log From changelog.txt and readme.txt text files - publish in wordpress.org.

inputs:
VERSION:
description: 'Package Version'
required: true

runs:
using: "composite"
steps:
- shell: bash
env:
VERSION: ${{ inputs.VERSION }}
run: |
npm install --no-package-lock --no-save marked@12.0.2
node ./.github/scripts/get-changelog-from-change-txt.js
5 changes: 5 additions & 0 deletions .github/workflows/one-click-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ jobs:
HEAD_BRANCH_NAME: ${{ github.ref }}
BASE_TAG_NAME: ${{ env.PREVIOUS_TAG_SHA }}
GENERATE_EMPTY_CHANGELOG: true
- name: Check that the version contains an updated change log
if: github.event.inputs.channel == 'ga'
uses: ./.github/workflows/get-changelog-from-changelog-txt
with:
VERSION: ${{ env.CLEAN_PACKAGE_VERSION }}
- name: Create GitHub release
uses: softprops/action-gh-release@v1
with:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ jobs:
node-version: 20.x
cache: 'npm'
- name: Install dependencies
run: npm ci
run: |
npm ci
sed -i -e "s/image: 'mariadb:lts'/image: 'mariadb:11.2.4-jammy'/g" node_modules/@wordpress/env/lib/build-docker-compose-config.js
- name: Download build artifact
uses: actions/download-artifact@v4
with:
Expand Down
1 change: 1 addition & 0 deletions .grunt-config/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ const entry = {
'ai-gutenberg': path.resolve( __dirname, '../modules/ai/assets/js/gutenberg/index.js' ),
'element-manager-admin': path.resolve( __dirname, '../modules/element-manager/assets/js/admin.js' ),
'media-hints': path.resolve( __dirname, '../assets/dev/js/admin/hints/media.js' ),
'ai-media-library': path.resolve( __dirname, '../modules/ai/assets/js/media-library/index.js' ),
// Temporary solution for the AI App in the Admin.
'ai-admin': path.resolve( __dirname, '../modules/ai/assets/js/admin/index.js' ),
'styleguide': path.resolve( __dirname, '../modules/styleguide/assets/js/styleguide.js' ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,15 @@ var TemplateLibraryHeaderActionsView = require( 'elementor-templates/views/parts

module.exports = elementorModules.common.views.modal.Layout.extend( {
getModalOptions() {
const allowClosingModal = window?.elementor?.config?.document?.panel?.allow_closing_remote_library ?? true;

return {
id: 'elementor-template-library-modal',
hide: {
onOutsideClick: allowClosingModal,
onBackgroundClick: allowClosingModal,
onEscKeyPress: allowClosingModal,
},
};
},

Expand Down
6 changes: 2 additions & 4 deletions assets/dev/js/editor/elements/views/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -703,8 +703,10 @@ BaseElementView = BaseContainer.extend( {
*
* By adding the following example attributes inside the widget the element innerHTML will be linked to the 'testimonial_content' setting value.
*
*
* Current Limitation:
* Not working with dynamics, will required full re-render.
* UPDATE: Support for dynamics has experimentally been added in v3.23
*/
linkDataBindings() {
/**
Expand Down Expand Up @@ -758,10 +760,6 @@ BaseElementView = BaseContainer.extend( {
const { bindingSetting } = dataBinding.dataset;
let change = settings.changed[ bindingSetting ];

if ( this.isAtomicDynamic( dataBinding ) ) {
change = this.getDynamicValue( settings, bindingSetting );
}

if ( change !== undefined ) {
dataBinding.el.innerHTML = change;
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default class Component extends ComponentBase {
super.activateTab( tab );

elementor.editorEvents.dispatchEvent(
elementor.editorEvents.config.names[ tab ]?.v1,
elementor.editorEvents.config.names.v1[ tab ],
{
location: elementor.editorEvents.config.locations.widgetPanel,
secondaryLocation: elementor.editorEvents.config.secondaryLocations[ tab ],
Expand Down
2 changes: 1 addition & 1 deletion assets/dev/js/frontend/elements-handlers-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ module.exports = function( $ ) {
};

this.runReadyTrigger = function( scope ) {
const isDelayChildHandlers = !! scope.closest( '[data-delay-child-handlers="true"]' );
const isDelayChildHandlers = !! scope.closest( '[data-delay-child-handlers="true"]' ) && 0 !== scope.closest( '[data-delay-child-handlers="true"]' ).length;

if ( elementorFrontend.config.is_static || isDelayChildHandlers ) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ export default class NestedTitleKeyboardHandler extends Base {
this.focusableElementSelector = 'audio, button, canvas, details, iframe, input, select, summary, textarea, video, [accesskey], [contenteditable], [href], [tabindex]:not([tabindex="-1"])';
}

getWidgetNumber() {
return this.$element.find( '> .elementor-widget-container > .e-n-tabs, > .e-n-tabs' ).attr( 'data-widget-number' );
}

getDefaultSettings() {
return {
selectors: {
itemTitle: '.e-n-tab-title',
itemContainer: '.e-n-tabs-content > .e-con',
itemTitle: `[id*="e-n-tab-title-${ this.getWidgetNumber() }"]`,
itemContainer: `[id*="e-n-tab-content-${ this.getWidgetNumber() }"]`,
},
ariaAttributes: {
titleStateAttribute: 'aria-selected',
Expand Down Expand Up @@ -87,8 +91,8 @@ export default class NestedTitleKeyboardHandler extends Base {
}

unbindEvents() {
this.elements.$itemTitles.off();
this.elements.$itemContainers.children().off();
this.elements.$itemTitles.off( this.getTitleEvents() );
this.elements.$focusableContainerElements.children().off( this.getContentElementEvents() );
}

getTitleEvents() {
Expand Down
5 changes: 4 additions & 1 deletion assets/dev/js/frontend/handlers/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ export default class Video extends elementorModules.frontend.handlers.Base {
$videoIframe.attr( 'src', lazyLoad );
}

$videoIframe[ 0 ].src = this.apiProvider.getAutoplayURL( $videoIframe[ 0 ].src );
if ( this.getElementSettings( 'autoplay' ) ) {
$videoIframe.attr( 'allow', 'autoplay' );
$videoIframe[ 0 ].src = this.apiProvider.getAutoplayURL( $videoIframe[ 0 ].src );
}
}

async animateVideo() {
Expand Down
9 changes: 8 additions & 1 deletion assets/dev/js/frontend/utils/lightbox/lightbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,14 @@ module.exports = elementorModules.ViewModule.extend( {
return;
}

$videoElement = $( '<iframe>', { src: apiProvider.getAutoplayURL( options.url ), allowfullscreen: 1 } );
$videoElement = $( '<iframe>', { allowfullscreen: 1 } );

if ( 'yes' === options.autoplay ) {
$videoElement.attr( 'allow', 'autoplay' );
$videoElement.attr( 'src', apiProvider.getAutoplayURL( options.url ) );
} else {
$videoElement.attr( 'src', options.url );
}
}

const classes = this.getSettings( 'classes' ),
Expand Down
26 changes: 9 additions & 17 deletions core/admin/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ private function get_experiments() {
}

private function maybe_enqueue_hints() {
if ( ! Hints::should_display_hint( 'image-optimization-once-media-modal' ) && ! Hints::should_display_hint( 'image-optimization-media-modal' ) ) {
if ( ! Hints::should_display_hint( 'image-optimization' ) ) {
return;
}

Expand All @@ -960,26 +960,18 @@ private function maybe_enqueue_hints() {
true
);

$once_dismissed = Hints::is_dismissed( 'image-optimization-once-media-modal' );
$content = $once_dismissed ?
sprintf("%1\$s <a href='%2\$s' class='e-btn-1' target='_blank'>%3\$s</a> %4\$s",
__( 'This image is large and may slow things down.', 'elementor' ),
Hints::get_plugin_action_url( 'image-optimization' ),
( Hints::is_plugin_installed( 'image-optimization' ) ? __( 'Activate', 'elementor' ) : __( 'Install', 'elementor' ) ) . ' ' . __( 'Image Optimizer', 'elementor' ),
__( 'to reduce size without losing quality.', 'elementor' )
) :
sprintf("%1\$s <a class='e-btn-1' href='%2\$s' target='_blank'>%3\$s</a>!",
__( 'Don’t let unoptimized images be the downfall of your site’s performance.', 'elementor' ),
Hints::get_plugin_action_url( 'image-optimization' ),
( Hints::is_plugin_installed( 'image-optimization' ) ? __( 'Activate', 'elementor' ) : __( 'Install', 'elementor' ) ) . ' ' . __( 'Image Optimizer', 'elementor' )
);
$content = sprintf("%1\$s <a class='e-btn-1' href='%2\$s' target='_blank'>%3\$s</a>!",
__( 'Optimize your images to enhance site performance by using Image Optimizer.', 'elementor' ),
Hints::get_plugin_action_url( 'image-optimization' ),
( Hints::is_plugin_installed( 'image-optimization' ) ? __( 'Activate', 'elementor' ) : __( 'Install', 'elementor' ) ) . ' ' . __( 'Image Optimizer', 'elementor' )
);

$dismissible = $once_dismissed ? 'image-optimization-media-modal' : 'image-optimization-once-media-modal';
$dismissible = 'image_optimizer_hint';

wp_localize_script( 'media-hints', 'elementorAdminHints', [
'mediaHint' => [
'display' => ! $once_dismissed,
'type' => $once_dismissed ? 'warning' : 'info',
'display' => true,
'type' => 'info',
'content' => $content,
'icon' => true,
'dismissible' => $dismissible,
Expand Down
2 changes: 2 additions & 0 deletions core/base/document.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ public static function get_properties() {
'show_copy_and_share' => false,
'library_close_title' => esc_html__( 'Close', 'elementor' ),
'publish_button_title' => esc_html__( 'Publish', 'elementor' ),
'allow_closing_remote_library' => true,
];
}

Expand Down Expand Up @@ -203,6 +204,7 @@ public static function get_editor_panel_config() {
'show_copy_and_share' => static::get_property( 'show_copy_and_share' ),
'library_close_title' => static::get_property( 'library_close_title' ),
'publish_button_title' => static::get_property( 'publish_button_title' ),
'allow_closing_remote_library' => static::get_property( 'allow_closing_remote_library' ),
];
}

Expand Down
7 changes: 5 additions & 2 deletions core/experiments/manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ public function add_feature( array $options ) {
'mutable' => true,
static::TYPE_HIDDEN => false,
'new_site' => [
'default_active' => false,
'always_active' => false,
'default_active' => false,
'default_inactive' => false,
'minimum_installation_version' => null,
],
'on_state_change' => null,
Expand All @@ -92,7 +93,7 @@ public function add_feature( array $options ) {

$new_site = $experimental_data['new_site'];

if ( $new_site['default_active'] || $new_site['always_active'] ) {
if ( $new_site['default_active'] || $new_site['always_active'] || $new_site['default_inactive'] ) {
$is_new_installation = $this->install_compare( $new_site['minimum_installation_version'] );

if ( $is_new_installation ) {
Expand All @@ -102,6 +103,8 @@ public function add_feature( array $options ) {
$experimental_data['mutable'] = false;
} elseif ( $new_site['default_active'] ) {
$experimental_data['default'] = self::STATE_ACTIVE;
} elseif ( $new_site['default_inactive'] ) {
$experimental_data['default'] = self::STATE_INACTIVE;
}
}
}
Expand Down
31 changes: 31 additions & 0 deletions core/utils/hints.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
}

use Elementor\User;
use Elementor\Utils;

class Hints {
const INFO = 'info';
Expand Down Expand Up @@ -223,6 +224,10 @@ public static function should_display_hint( $hint_key ): bool {
return false;
}

if ( static::is_conflict_plugin_installed() ) {
return false;
}

foreach ( $hint as $key => $value ) {
switch ( $key ) {
case self::DISMISSED:
Expand Down Expand Up @@ -255,6 +260,32 @@ public static function should_display_hint( $hint_key ): bool {
return true;
}

private static function is_conflict_plugin_installed(): bool {
if ( ! Utils::has_pro() ) {
return false;
}

$conflicting_plugins = [
'imagify/imagify.php',
'optimole-wp/optimole-wp.php',
'ewww-image-optimizer/ewww-image-optimizer.php',
'ewww-image-optimizer-cloud/ewww-image-optimizer-cloud.php',
'kraken-image-optimizer/kraken.php',
'shortpixel-image-optimiser/wp-shortpixel.php',
'wp-smushit/wp-smush.php',
'wp-smush-pro/wp-smush.php',
'tiny-compress-images/tiny-compress-images.php',
];

foreach ( $conflicting_plugins as $plugin ) {
if ( self::is_plugin_active( $plugin ) ) {
return true;
}
}

return false;
}

/**
* is_plugin_installed
* @param $plugin
Expand Down
2 changes: 1 addition & 1 deletion includes/controls/gallery.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function content_template() {
Hints::get_notice_template( [
'display' => ! Hints::is_dismissed( 'image-optimization' ),
'type' => 'info',
'content' => __( 'Don’t let unoptimized images be the downfall of your site’s performance. Use Image Optimizer!', 'elementor' ),
'content' => __( 'Optimize your images to enhance site performance by using Image Optimizer.', 'elementor' ),
'icon' => true,
'dismissible' => 'image_optimizer_hint',
'button_text' => Hints::is_plugin_installed( 'image-optimization' ) ? __( 'Activate Plugin', 'elementor' ) : __( 'Install Plugin', 'elementor' ),
Expand Down
2 changes: 1 addition & 1 deletion includes/controls/media.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public function content_template() {
Hints::get_notice_template( [
'display' => ! Hints::is_dismissed( 'image-optimization' ),
'type' => 'info',
'content' => __( 'Don’t let unoptimized images be the downfall of your site’s performance. Use Image Optimizer!', 'elementor' ),
'content' => __( 'Optimize your images to enhance site performance by using Image Optimizer.', 'elementor' ),
'icon' => true,
'dismissible' => 'image_optimizer_hint',
'button_text' => Hints::is_plugin_installed( 'image-optimization' ) ? __( 'Activate Plugin', 'elementor' ) : __( 'Install Plugin', 'elementor' ),
Expand Down
4 changes: 4 additions & 0 deletions includes/embed.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ public static function get_embed_html( $video_url, array $embed_url_params = [],
$default_frame_attributes['data-lazy-load'] = $video_embed_url;
}

if ( isset( $embed_url_params['autoplay'] ) ) {
$default_frame_attributes['allow'] = 'autoplay';
}

$frame_attributes = array_merge( $default_frame_attributes, $frame_attributes );

$attributes_for_print = [];
Expand Down
Loading

0 comments on commit 9717f67

Please sign in to comment.