diff --git a/.gitattributes b/.gitattributes index 511d902c43..e36130d7e8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -16,6 +16,8 @@ /.eslintrc.js export-ignore /.gitattributes export-ignore /.gitignore export-ignore +/.nvmrc export-ignore +/.npmrc export-ignore /.husky export-ignore /.lintstagedrc.json export-ignore /.stylelintrc export-ignore diff --git a/.github/workflows/build-and-tag.yml b/.github/workflows/build-and-tag.yml index 397faedea0..63026eb80e 100644 --- a/.github/workflows/build-and-tag.yml +++ b/.github/workflows/build-and-tag.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set PHP version uses: shivammathur/setup-php@v2 @@ -22,10 +22,10 @@ jobs: - name: composer install run: composer install - - name: install node v18 - uses: actions/setup-node@v3 + - name: install node v20 + uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 - name: Build run: | diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index d2cab33acd..5d950dc416 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: path: 'wp-content/plugins/elasticpress' @@ -54,10 +54,10 @@ jobs: wp package install felipeelia/cli-command-docs:dev-trunk wp cli-command-docs elasticpress --custom-order=sync,activate-feature,deactivate-feature,list-features,get-algorithm-version,set-algorithm-version --remove=delete_transient_on_int,custom_get_transient,stop_on_failed_mapping,call_ep_cli_put_mapping,should_interrupt_sync,index_output,get-indexes,get-cluster-indexes,index,clear-index,get-indexing-status,get-last-cli-index,stop-indexing --custom-intro='The following WP-CLI commands are supported by ElasticPress:' > wp-content/plugins/elasticpress/docs/wp-cli.md - - name: Use Node.js 18 - uses: actions/setup-node@v3 + - name: Use Node.js 20 + uses: actions/setup-node@v4 with: - node-version: '18' + node-version: '20' - name: npm ci, and build docs run: | @@ -69,7 +69,7 @@ jobs: CI: true - name: Deploy to GH Pages - uses: peaceiris/actions-gh-pages@v3 + uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: './wp-content/plugins/elasticpress/docs-built' diff --git a/.github/workflows/build-with-vendor-prefixed.yml b/.github/workflows/build-with-vendor-prefixed.yml index dd9aaeddae..53cb0a3a32 100644 --- a/.github/workflows/build-with-vendor-prefixed.yml +++ b/.github/workflows/build-with-vendor-prefixed.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set PHP version uses: shivammathur/setup-php@v2 @@ -24,10 +24,10 @@ jobs: - name: composer install run: composer install - - name: install node v18 - uses: actions/setup-node@v3 + - name: install node v20 + uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 - name: Build run: | diff --git a/.github/workflows/cypress-tests.yml b/.github/workflows/cypress-tests.yml index 11741654e4..9ec2943e7b 100644 --- a/.github/workflows/cypress-tests.yml +++ b/.github/workflows/cypress-tests.yml @@ -3,7 +3,7 @@ name: E2E Test env: COMPOSER_VERSION: "2" COMPOSER_CACHE: "${{ github.workspace }}/.composer-cache" - NODE_VERSION: "18" + NODE_VERSION: "20" NODE_CACHE: "${{ github.workspace }}/node_modules_cache" on: @@ -33,18 +33,17 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Prepare npm cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ env.NODE_CACHE }} key: npm-${{ env.NODE_VERSION }}-${{ hashFiles('**/package-lock.json') }} restore-keys: | npm-${{ env.NODE_VERSION }}- - - name: Prepare composer cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ env.COMPOSER_CACHE }} key: composer-${{ env.COMPOSER_VERSION }}-${{ hashFiles('**/composer.lock') }} @@ -63,7 +62,7 @@ jobs: run: composer install - name: "Install node v${{ env.NODE_VERSION }}" - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} @@ -89,7 +88,7 @@ jobs: uses: actions/upload-artifact@v4 if: failure() with: - name: cypress-artifact-${{ matrix.core.name }}-${{ matrix.testGroup }} + name: cypress-artifact-${{ matrix.esVersion }}-${{ matrix.core.name }}-${{ matrix.testGroup }} retention-days: 2 path: | ${{ github.workspace }}/tests/cypress/screenshots/ @@ -98,7 +97,7 @@ jobs: - name: Stop Elasticsearch if: always() - run: cd bin/es-docker/ && docker-compose down + run: cd bin/es-docker/ && docker compose down - name: Test plugin uninstall if: always() @@ -122,18 +121,17 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Prepare npm cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ env.NODE_CACHE }} key: npm-${{ env.NODE_VERSION }}-${{ hashFiles('**/package-lock.json') }} restore-keys: | npm-${{ env.NODE_VERSION }}- - - name: Prepare composer cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ env.COMPOSER_CACHE }} key: composer-${{ env.COMPOSER_VERSION }}-${{ hashFiles('**/composer.lock') }} @@ -152,7 +150,7 @@ jobs: run: composer install - name: "Install node v${{ env.NODE_VERSION }}" - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ae94179cf0..a823974afa 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -3,7 +3,7 @@ name: Linting env: COMPOSER_VERSION: "2" COMPOSER_CACHE: "${{ github.workspace }}/.composer-cache" - NODE_VERSION: "18" + NODE_VERSION: "20" NODE_CACHE: "${{ github.workspace }}/node_modules_cache" on: @@ -22,14 +22,14 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set standard 10up cache directories run: | sudo npm config set cache "${{ env.NODE_CACHE }}" --global - name: Prepare npm cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ env.NODE_CACHE }} key: npm-${{ env.NODE_VERSION }}-${{ hashFiles('**/package-lock.json') }} @@ -37,7 +37,7 @@ jobs: npm-${{ env.NODE_VERSION }}- - name: "install node v${{ env.NODE_VERSION }}" - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} @@ -56,14 +56,14 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set standard 10up cache directories run: | composer config -g cache-dir "${{ env.COMPOSER_CACHE }}" - name: Prepare composer cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ env.COMPOSER_CACHE }} key: composer-${{ env.COMPOSER_VERSION }}-${{ hashFiles('**/composer.lock') }} @@ -82,4 +82,4 @@ jobs: run: composer install - name: PHPCS check - run: './vendor/bin/phpcs . -q --report=checkstyle --runtime-set testVersion 7.4- | cs2pr' + run: './vendor/bin/phpcs . -q --report=checkstyle --warning-severity=6 --runtime-set testVersion 7.4- | cs2pr' diff --git a/.github/workflows/push-asset-readme-update.yml b/.github/workflows/push-asset-readme-update.yml index 4098203a80..1e0cf6430a 100644 --- a/.github/workflows/push-asset-readme-update.yml +++ b/.github/workflows/push-asset-readme-update.yml @@ -8,7 +8,7 @@ jobs: name: Push to trunk runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: WordPress.org plugin asset/readme update uses: 10up/action-wordpress-plugin-asset-update@stable env: diff --git a/.github/workflows/push-deploy.yml b/.github/workflows/push-deploy.yml index a4d98ff6c3..c3e137e029 100644 --- a/.github/workflows/push-deploy.yml +++ b/.github/workflows/push-deploy.yml @@ -13,10 +13,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: WordPress Plugin Deploy - if: "! github.event.release.prerelease" + if: ! github.event.release.prerelease id: deploy uses: 10up/action-wordpress-plugin-deploy@stable env: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 17d4b04ebc..69d5e1b93a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,13 +30,13 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Start MySQL run: sudo systemctl start mysql.service - name: Setup Elasticsearch - run: cd bin/es-docker/ && docker-compose build --build-arg ES_VERSION=${{ matrix.esVersion }} && docker-compose up -d + run: cd bin/es-docker/ && docker compose build --build-arg ES_VERSION=${{ matrix.esVersion }} && docker compose up -d - name: Check ES response run: curl --connect-timeout 5 --max-time 10 --retry 5 --retry-max-time 40 --retry-all-errors http://127.0.0.1:8890 @@ -46,7 +46,7 @@ jobs: composer config -g cache-dir "${{ env.COMPOSER_CACHE }}" - name: Prepare composer cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ env.COMPOSER_CACHE }} key: composer-${{ env.COMPOSER_VERSION }}-${{ hashFiles('**/composer.lock') }} diff --git a/.github/workflows/wordpress-latest.yml b/.github/workflows/wordpress-latest.yml index b134ea59da..d773a7eacd 100644 --- a/.github/workflows/wordpress-latest.yml +++ b/.github/workflows/wordpress-latest.yml @@ -15,6 +15,6 @@ jobs: runs-on: ubuntu-latest steps: - name: WordPress version checker - uses: skaut/wordpress-version-checker@v1.2.0 + uses: skaut/wordpress-version-checker@v2.2.2 with: repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000000..b6f27f1359 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +engine-strict=true diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000000..9a2a0e219c --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v20 diff --git a/.stylelintrc b/.stylelintrc index 002cd64fe7..f7007ae70b 100644 --- a/.stylelintrc +++ b/.stylelintrc @@ -11,7 +11,8 @@ } ], "font-family-no-missing-generic-family-keyword": null, - "declaration-property-unit-allowed-list": null + "declaration-property-unit-allowed-list": null, + "at-rule-disallowed-list": null } } diff --git a/.wp-env.json b/.wp-env.json index fad3bc4ab2..c102b17dd2 100644 --- a/.wp-env.json +++ b/.wp-env.json @@ -13,7 +13,6 @@ ".", "https://downloads.wordpress.org/plugin/classic-widgets.zip", "https://downloads.wordpress.org/plugin/debug-bar.zip", - "https://downloads.wordpress.org/plugin/debug-bar-elasticpress.zip", "https://downloads.wordpress.org/plugin/wordpress-importer.zip", "10up/elasticpress-proxy#develop" ], diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d366a4b51..0ae4c9f4b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,8 +11,57 @@ All notable changes to this project will be documented in this file, per [the Ke ### Removed ### Fixed ### Security +### Developer --> +## [5.1.4] - 2024-12-12 + +### Added +* New filter `ep_facet_selected_filters`. Props [@burhandodhy](https://github.com/burhandodhy) via [#3953](https://github.com/10up/ElasticPress/pull/3953). +* New filter `ep_disable_query_logging` to disable query logging. Props [@davidsword](https://github.com/davidsword) and [@rebeccahum](https://github.com/rebeccahum) via [#4019](https://github.com/10up/ElasticPress/pull/4019). +* New setting to Protect Content to use WP default order in admin. Props [@felipeelia](https://github.com/felipeelia) and [@realrellek](https://github.com/realrellek) via [#4028](https://github.com/10up/ElasticPress/pull/4028). + +### Changed +* Apply ElasticPress filters to the requests in status and stats CLI commands. Props [@edpittol](https://github.com/edpittol) via [#4000](https://github.com/10up/ElasticPress/pull/4000). +* Autosuggest Endpoint field explanation. Props [@burhandodhy](https://github.com/burhandodhy) and [@felipeelia](https://github.com/felipeelia) via [#4009](https://github.com/10up/ElasticPress/pull/4009). +* Alignment of custom search results action icons. Props [@felipeelia](https://github.com/felipeelia) and [@anjulahettige](https://github.com/anjulahettige) via [#4020](https://github.com/10up/ElasticPress/pull/4020). +* Update all of our blocks apiVersion from 2 to 3, to indicate support for working in an iframed editor. Props [@dkotter](https://github.com/dkotter) and [@JakePT](https://github.com/JakePT) via [#4029](https://github.com/10up/ElasticPress/pull/4029). +* If using the new way to index meta, avoid querying distinct meta fields in the sync page. Props [@felipeelia](https://github.com/felipeelia) and [@majiix](https://github.com/majiix) via [#4033](https://github.com/10up/ElasticPress/pull/4033). +* Updated several composer and node packages. Node 20 is now the default version. Props [@felipeelia](https://github.com/felipeelia) via [#4039](https://github.com/10up/ElasticPress/pull/4039) and [#4043](https://github.com/10up/ElasticPress/pull/4043). +* Improve readability of sync output (MB/GB) and number formatting on the Health Status page. Props [@columbian-chris](https://github.com/columbian-chris) via [#4042](https://github.com/10up/ElasticPress/pull/4042). + +### Fixed +* Hardcoded `tmp` path replaced with a dynamic value. Props [@burhandodhy](https://github.com/burhandodhy) via [#3962](https://github.com/10up/ElasticPress/pull/3962). +* Variable names and descriptions in the docblocks for `ep_formatted_args` and `ep_post_formatted_args`. Props [@barryceelen](https://github.com/barryceelen) via [#3977](https://github.com/10up/ElasticPress/pull/3977). +* Remove 'None' from Highlight tag list. Props [@burhandodhy](https://github.com/burhandodhy) via [#3979](https://github.com/10up/ElasticPress/pull/3979). +* [Facets] Incorrect link on description when not using a block theme. Props [@felipeelia](https://github.com/felipeelia) and [@burhandodhy](https://github.com/burhandodhy) via [#3997](https://github.com/10up/ElasticPress/pull/3997). +* Deprecation warning in `strtotime()` call. Props [@felipeelia](https://github.com/felipeelia) and [@barryceelen](https://github.com/barryceelen) via [#3998](https://github.com/10up/ElasticPress/pull/3998). +* Special characters like `\` in search terms for both Autosuggest and Instant Results. Props [@felipeelia](https://github.com/felipeelia) and [@burhandodhy](https://github.com/burhandodhy) via [#3999](https://github.com/10up/ElasticPress/pull/3999). +* [WooCommerce] Incompatibility when "Enable table usage" was enabled to filter the product catalog. Props [@felipeelia](https://github.com/felipeelia) and [@burhandodhy](https://github.com/burhandodhy) via [#4002](https://github.com/10up/ElasticPress/pull/4002). +* Deprecation warning related to PluginPostStatusInfo. Props [@burhandodhy](https://github.com/burhandodhy) and [@felipeelia](https://github.com/felipeelia) via [#4008](https://github.com/10up/ElasticPress/pull/4008). +* [Custom Results] Inconsistent Reordering Issue. Props [@felipeelia](https://github.com/felipeelia), [@anjulahettige](https://github.com/anjulahettige), [@burhandodhy](https://github.com/burhandodhy) via [#4018](https://github.com/10up/ElasticPress/pull/4018) and [#4045](https://github.com/10up/ElasticPress/pull/4045). +* Update supported document file types in Documents feature summary. Props [@burhandodhy](https://github.com/burhandodhy) via [#4024](https://github.com/10up/ElasticPress/pull/4024). +* "Exclude from search results" to work in AJAX contexts. Props [@felipeelia](https://github.com/felipeelia) and [@burhandodhy](https://github.com/burhandodhy) via [#4025](https://github.com/10up/ElasticPress/pull/4025). +* Retain CR & RD Labels Upon Saving Custom Search Result Posts. Props [@felipeelia](https://github.com/felipeelia) and [@anjulahettige](https://github.com/anjulahettige) via [#4020](https://github.com/10up/ElasticPress/pull/4020). +* Typo in "All filters" text domain. Props [@felipeelia](https://github.com/felipeelia) and [@arturomonge](https://github.com/arturomonge) via [#4031](https://github.com/10up/ElasticPress/pull/4031). +* Autosuggest GA tracking to work when ad blocks are enabled. The dataLayer.push() call now pushes a custom event called ep_autosuggest_click with ep_autosuggest_search_term and ep_autosuggest_clicked_url as custom parameters. Props [@felipeelia](https://github.com/felipeelia) and [@anjulahettige](https://github.com/anjulahettige) via [#4032](https://github.com/10up/ElasticPress/pull/4032). +* Delay `load_plugin_textdomain` to `init` and set a Domain Path. Props [@felipeelia](https://github.com/felipeelia) via [#4036](https://github.com/10up/ElasticPress/pull/4036). +* Only display the Exclude From Search checkbox if the post type supports `custom-fields`. Props [@felipeelia](https://github.com/felipeelia) and [@maartenhunink](https://github.com/maartenhunink) via [#4040](https://github.com/10up/ElasticPress/pull/4040). +* JS error when submit button is clicked without selecting a date. Props [@burhandodhy](https://github.com/burhandodhy) via [#4044](https://github.com/10up/ElasticPress/pull/4044). +* Deprecated warnings for margin style. Props [@burhandodhy](https://github.com/burhandodhy) via [#4046](https://github.com/10up/ElasticPress/pull/4046). + +### Security +* Bumped `composer/composer` from 2.7.0 to 2.7.8. Props [@dependabot](https://github.com/dependabot) via [#3972](https://github.com/10up/ElasticPress/pull/3972). +* Bumped `symfony/process` from 6.4.8 to 6.4.14. Props [@dependabot](https://github.com/dependabot) via [#3996](https://github.com/10up/ElasticPress/pull/3996). + +### Developer +* Tests use ES 8 by default. Props [@felipeelia](https://github.com/felipeelia) via [#4017](https://github.com/10up/ElasticPress/pull/4017). +* Update E2E tests to work properly with the iframed block editor. Props [@dkotter](https://github.com/dkotter) via [#4029](https://github.com/10up/ElasticPress/pull/4029). +* E2e tests for WP 6.6. Props [@felipeelia](https://github.com/felipeelia) via [#3959](https://github.com/10up/ElasticPress/pull/3959). +* E2e tests for WP 6.7. Props [@felipeelia](https://github.com/felipeelia) via [#4010](https://github.com/10up/ElasticPress/pull/4010). +* Unit Tests: Fail faster on requests we know will fail. Props [@felipeelia](https://github.com/felipeelia) via [#4047](https://github.com/10up/ElasticPress/pull/4047). +* E2e tests: Fix the debug-bar-elasticpress dependency of ElasticPress. Props [@felipeelia](https://github.com/felipeelia) via [#4048](https://github.com/10up/ElasticPress/pull/4048). + ## [5.1.3] - 2024-06-11 ### Fixed @@ -2128,6 +2177,7 @@ This is a bug fix release with some filter additions. - Initial plugin release [Unreleased]: https://github.com/10up/ElasticPress/compare/trunk...develop +[5.1.4]: https://github.com/10up/ElasticPress/compare/5.1.3...5.1.4 [5.1.3]: https://github.com/10up/ElasticPress/compare/5.1.2...5.1.3 [5.1.2]: https://github.com/10up/ElasticPress/compare/5.1.1...5.1.2 [5.1.1]: https://github.com/10up/ElasticPress/compare/5.1.0...5.1.1 diff --git a/CREDITS.md b/CREDITS.md index e9ea18d65a..8f4b48791e 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -239,6 +239,12 @@ Thank you to all the people who have already contributed to this repository via [Dharmesh Patel (@iamdharmesh)](https://github.com/iamdharmesh), [Lucas Grzegorczyk (@furai)](https://github.com/furai), [Ananda Dhakal (@dhakalananda)](https://github.com/dhakalananda), +[Eduardo Pittol (@edpittol)](https://github.com/edpittol), +[David Sword (@davidsword)](https://github.com/davidsword), +[@realrellek](https://github.com/realrellek), +[Arturo Monge (@arturomonge)](https://github.com/arturomonge), +[Majix (@majiix)](https://github.com/majiix), +[Maarten Hunink (@maartenhunink)](https://github.com/maartenhunink), and [@qazaqstan2025](https://github.com/qazaqstan2025). diff --git a/README.md b/README.md index ea485b3268..3c8a6ee3aa 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Simply downloading the repository files is not enough to have the plugin working `npm install && npm run build` -[Node.js](https://nodejs.org/en/) (v18) and [npm](https://www.npmjs.com/) (v8) are required. +[Node.js](https://nodejs.org/en/) (v20) and [npm](https://www.npmjs.com/) (v9) are required. ## React Components diff --git a/assets/css/ordering.css b/assets/css/ordering.css index ef15981707..db0814af3a 100644 --- a/assets/css/ordering.css +++ b/assets/css/ordering.css @@ -57,6 +57,10 @@ color: #0073aa; } + & .removed .title { + color: #999; + } + & .pointer-actions { float: right; @@ -65,7 +69,7 @@ } & .delete-pointer { - margin-left: 10px; + margin-right: 10px; } } diff --git a/assets/js/autosuggest/index.js b/assets/js/autosuggest/index.js index cd035ac25b..308ebd74e7 100644 --- a/assets/js/autosuggest/index.js +++ b/assets/js/autosuggest/index.js @@ -83,26 +83,42 @@ function triggerAutosuggestEvent(detail) { const event = new CustomEvent('ep-autosuggest-click', { detail }); window.dispatchEvent(event); - /** - * Check if window.gtag was already defined, otherwise - * try to use window.dataLayer.push, available by default - * for Tag Manager users. - */ - let epGtag = null; - if (typeof window?.gtag === 'function') { - epGtag = window.gtag; - } else if (typeof window?.dataLayer?.push === 'function') { - epGtag = window.dataLayer.push; + if (parseInt(epas.triggerAnalytics, 10) !== 1) { + return; } - if (detail.searchTerm && parseInt(epas.triggerAnalytics, 10) === 1 && epGtag) { - const action = `click - ${detail.searchTerm}`; - // eslint-disable-next-line no-undef - epGtag('event', action, { - event_category: 'EP :: Autosuggest', - event_label: detail.url, - transport_type: 'beacon', - }); + if (!detail.searchTerm) { + return; + } + + const action = `click - ${detail.searchTerm}`; + try { + /** + * Check if window.gtag was already defined, otherwise + * try to use window.dataLayer.push, available by default + * for Tag Manager users. + */ + if (typeof window?.gtag === 'function') { + window.gtag('event', action, { + ep_autosuggest_search_term: detail.searchTerm, + ep_autosuggest_clicked_url: detail.url, + event_category: 'EP :: Autosuggest', + event_label: detail.url, + transport_type: 'beacon', + }); + return; + } + if (typeof window?.dataLayer?.push === 'function') { + window.dataLayer.push({ + event: 'ep_autosuggest_click', + ep_autosuggest_search_term: detail.searchTerm, + ep_autosuggest_clicked_url: detail.url, + event_category: 'EP :: Autosuggest', + event_label: detail.url, + }); + } + } catch (error) { + // When Ad blocks are enabled, the call above will fail } } diff --git a/assets/js/blocks/comments/block.json b/assets/js/blocks/comments/block.json index c0e61999f4..b55efa0670 100644 --- a/assets/js/blocks/comments/block.json +++ b/assets/js/blocks/comments/block.json @@ -1,6 +1,6 @@ { "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, + "apiVersion": 3, "name": "elasticpress/comments", "title": "Search Comments", "category": "elasticpress", diff --git a/assets/js/blocks/facets/common/components/empty-response-placeholder.js b/assets/js/blocks/facets/common/components/empty-response-placeholder.js index bf9da36335..9ab7665d1a 100644 --- a/assets/js/blocks/facets/common/components/empty-response-placeholder.js +++ b/assets/js/blocks/facets/common/components/empty-response-placeholder.js @@ -21,11 +21,11 @@ export default ({ attributes }) => { ? __( 'Preview unavailable. The selected taxonomy has no terms assigned to searchable content.', 'elasticpress', - ) + ) : __( 'Preview unavailable. There is no searchable content available with the selected metadata.', 'elasticpress', - )} + )} ); }; diff --git a/assets/js/blocks/facets/common/components/facet-display-count-control.js b/assets/js/blocks/facets/common/components/facet-display-count-control.js index d21f635d0d..aca22778b5 100644 --- a/assets/js/blocks/facets/common/components/facet-display-count-control.js +++ b/assets/js/blocks/facets/common/components/facet-display-count-control.js @@ -19,6 +19,7 @@ export default ({ onChange, checked }) => { checked={checked} label={__('Display count', 'elasticpress')} onChange={onChange} + __nextHasNoMarginBottom /> ); }; diff --git a/assets/js/blocks/facets/common/components/facet-meta-control.js b/assets/js/blocks/facets/common/components/facet-meta-control.js index 670605cff3..7850c82c2b 100644 --- a/assets/js/blocks/facets/common/components/facet-meta-control.js +++ b/assets/js/blocks/facets/common/components/facet-meta-control.js @@ -50,6 +50,7 @@ export default ({ onChange, value }) => { onChange={onChange} options={options} value={value} + __nextHasNoMarginBottom /> ); }; diff --git a/assets/js/blocks/facets/common/components/facet-order-control.js b/assets/js/blocks/facets/common/components/facet-order-control.js index 11aef3bcfe..d8a19ff093 100644 --- a/assets/js/blocks/facets/common/components/facet-order-control.js +++ b/assets/js/blocks/facets/common/components/facet-order-control.js @@ -52,6 +52,7 @@ export default ({ onChange, orderby, order }) => { }} options={options} value={`${orderby}/${order}`} + __nextHasNoMarginBottom /> ); }; diff --git a/assets/js/blocks/facets/common/components/facet-search-placeholder-control.js b/assets/js/blocks/facets/common/components/facet-search-placeholder-control.js index 5626f09a0c..07a0f3e6e8 100644 --- a/assets/js/blocks/facets/common/components/facet-search-placeholder-control.js +++ b/assets/js/blocks/facets/common/components/facet-search-placeholder-control.js @@ -19,6 +19,7 @@ export default ({ onChange, value }) => { label={__('Search field placeholder', 'elasticpress')} value={value} onChange={onChange} + __nextHasNoMarginBottom /> ); }; diff --git a/assets/js/blocks/facets/common/components/facet-taxonomy-control.js b/assets/js/blocks/facets/common/components/facet-taxonomy-control.js index fb3f41ae20..cecc370640 100644 --- a/assets/js/blocks/facets/common/components/facet-taxonomy-control.js +++ b/assets/js/blocks/facets/common/components/facet-taxonomy-control.js @@ -44,6 +44,7 @@ export default ({ onChange, value }) => { onChange={onChange} options={options} value={value} + __nextHasNoMarginBottom /> ); }; diff --git a/assets/js/blocks/facets/date/block.json b/assets/js/blocks/facets/date/block.json index 3a00f831c8..670e92b20b 100644 --- a/assets/js/blocks/facets/date/block.json +++ b/assets/js/blocks/facets/date/block.json @@ -1,6 +1,6 @@ { "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, + "apiVersion": 3, "name": "elasticpress/facet-date", "title": "Filter by Post Date", "category": "elasticpress", diff --git a/assets/js/blocks/facets/date/edit.js b/assets/js/blocks/facets/date/edit.js index e71da66bd1..f71aae3c85 100644 --- a/assets/js/blocks/facets/date/edit.js +++ b/assets/js/blocks/facets/date/edit.js @@ -25,6 +25,7 @@ const FacetDate = (props) => { label={__('Display custom date option', 'elasticpress')} checked={displayCustomDate} onChange={(displayCustomDate) => setAttributes({ displayCustomDate })} + __nextHasNoMarginBottom /> diff --git a/assets/js/blocks/facets/date/view.js b/assets/js/blocks/facets/date/view.js index c646626e42..71ac294dc1 100644 --- a/assets/js/blocks/facets/date/view.js +++ b/assets/js/blocks/facets/date/view.js @@ -16,7 +16,11 @@ const initFacet = () => { form.addEventListener('submit', function (event) { event.preventDefault(); - const { value } = this.querySelector(`[name="${filterName}"]:checked`); + const { value } = this.querySelector(`[name="${filterName}"]:checked`) || ''; + if (!value) { + return; + } + const { value: startDateValue } = this.querySelector('.ep-date-range-picker')?.querySelector( `[name="${filterName}_from"]`, diff --git a/assets/js/blocks/facets/meta-range/block.json b/assets/js/blocks/facets/meta-range/block.json index 41d0930367..b759958156 100644 --- a/assets/js/blocks/facets/meta-range/block.json +++ b/assets/js/blocks/facets/meta-range/block.json @@ -1,6 +1,6 @@ { "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, + "apiVersion": 3, "name": "elasticpress/facet-meta-range", "title": "Filter by Metadata Range - Beta", "category": "elasticpress", diff --git a/assets/js/blocks/facets/meta-range/edit.js b/assets/js/blocks/facets/meta-range/edit.js index 5f28ecdc76..f0952c2713 100644 --- a/assets/js/blocks/facets/meta-range/edit.js +++ b/assets/js/blocks/facets/meta-range/edit.js @@ -94,6 +94,7 @@ export default ({ attributes, name, setAttributes }) => { label={__('Value prefix', 'elasticpress')} onChange={onChangePrefix} value={prefix} + __nextHasNoMarginBottom /> @@ -101,6 +102,7 @@ export default ({ attributes, name, setAttributes }) => { label={__('Value suffix', 'elasticpress')} onChange={onChangeSuffix} value={suffix} + __nextHasNoMarginBottom /> diff --git a/assets/js/blocks/facets/meta/block.json b/assets/js/blocks/facets/meta/block.json index 45700ae5ab..1a09da18f0 100644 --- a/assets/js/blocks/facets/meta/block.json +++ b/assets/js/blocks/facets/meta/block.json @@ -1,6 +1,6 @@ { "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, + "apiVersion": 3, "name": "elasticpress/facet-meta", "title": "Filter by Metadata", "category": "elasticpress", diff --git a/assets/js/blocks/facets/post-type/block.json b/assets/js/blocks/facets/post-type/block.json index 98b4c7549b..37688ab6af 100644 --- a/assets/js/blocks/facets/post-type/block.json +++ b/assets/js/blocks/facets/post-type/block.json @@ -1,6 +1,6 @@ { "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, + "apiVersion": 3, "title": "Filter by Post Type", "description": "Let visitors filter your content by post type.", "textdomain": "elasticpress", diff --git a/assets/js/blocks/facets/taxonomy/block.json b/assets/js/blocks/facets/taxonomy/block.json index e4e7c23c14..70e21628a1 100644 --- a/assets/js/blocks/facets/taxonomy/block.json +++ b/assets/js/blocks/facets/taxonomy/block.json @@ -1,6 +1,6 @@ { "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, + "apiVersion": 3, "name": "elasticpress/facet", "title": "Filter by Taxonomy", "category": "elasticpress", diff --git a/assets/js/blocks/related-posts/block.json b/assets/js/blocks/related-posts/block.json index 86ee8a2297..6c641b1ac3 100644 --- a/assets/js/blocks/related-posts/block.json +++ b/assets/js/blocks/related-posts/block.json @@ -1,6 +1,6 @@ { "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, + "apiVersion": 3, "name": "elasticpress/related-posts", "title": "Related Posts", "category": "elasticpress", diff --git a/assets/js/features/components/control.js b/assets/js/features/components/control.js index 5fec8841e1..bbf97b405e 100644 --- a/assets/js/features/components/control.js +++ b/assets/js/features/components/control.js @@ -68,7 +68,7 @@ export default ({ value: o.value, label: , // eslint-disable-line react/no-danger }; - }) + }) : []; /** @@ -85,9 +85,9 @@ export default ({ const requiredFeatureNotice = name === 'active' ? /* translators: Feature name */ - __('The %s feature must be enabled to use this feature.', 'elasticpress') + __('The %s feature must be enabled to use this feature.', 'elasticpress') : /* translators: Feature name */ - __('The %s feature must be enabled to use the following setting.', 'elasticpress'); + __('The %s feature must be enabled to use the following setting.', 'elasticpress'); /** * The notice to display if a sync is required. @@ -159,6 +159,7 @@ export default ({ label={label} onChange={onChangeCheckbox} disabled={isDisabled} + __nextHasNoMarginBottom /> ); } @@ -184,6 +185,7 @@ export default ({ disabled={isDisabled} suggestions={suggestions} value={values} + __nextHasNoMarginBottom /> ); } @@ -208,6 +210,7 @@ export default ({ options={options} disabled={isDisabled} value={value} + __nextHasNoMarginBottom /> ); } @@ -219,6 +222,7 @@ export default ({ label={label} onChange={onChange} disabled={isDisabled} + __nextHasNoMarginBottom /> ); } @@ -242,6 +246,7 @@ export default ({ disabled={isDisabled} value={value} type={type} + __nextHasNoMarginBottom /> ); } diff --git a/assets/js/instant-results/components/common/checkbox-list.js b/assets/js/instant-results/components/common/checkbox-list.js index 05d1e87581..a0cbe39438 100644 --- a/assets/js/instant-results/components/common/checkbox-list.js +++ b/assets/js/instant-results/components/common/checkbox-list.js @@ -238,7 +238,7 @@ export default ({ disabled, label, locale, options, onChange, selected, sortBy } 'elasticpress', ), options.length - optionsLimit, - )} + )} )} diff --git a/assets/js/instant-results/components/common/result.js b/assets/js/instant-results/components/common/result.js index 7d7abab2b9..9e814fa35c 100644 --- a/assets/js/instant-results/components/common/result.js +++ b/assets/js/instant-results/components/common/result.js @@ -1,7 +1,7 @@ /** * WordPress dependencies. */ -import { React, WPElement } from '@wordpress/element'; +import { Component, FunctionComponent, WPElement } from '@wordpress/element'; import { applyFilters } from '@wordpress/hooks'; /** @@ -80,7 +80,7 @@ const Result = ({ averageRating = 0, date, excerpt, priceHtml, thumbnail, title, * @filter ep.InstantResults.Result * @since 4.4.0 * - * @param {React.Component|React.FunctionComponent} Result Result component. - * @returns {React.Component|React.FunctionComponent} Result component. + * @param {Component|FunctionComponent} Result Result component. + * @returns {Component|FunctionComponent} Result component. */ export default applyFilters('ep.InstantResults.Result', Result); diff --git a/assets/js/instant-results/components/facets/taxonomy-terms-facet.js b/assets/js/instant-results/components/facets/taxonomy-terms-facet.js index 9bdab5b965..7fad81b2fe 100644 --- a/assets/js/instant-results/components/facets/taxonomy-terms-facet.js +++ b/assets/js/instant-results/components/facets/taxonomy-terms-facet.js @@ -47,7 +47,7 @@ export default ({ defaultIsOpen, label, postTypes, name }) => { __('%1$s (%2$s)', 'elasticpress'), label, typeLabels.join(typeSeparator), - ) + ) : label; }, [label, postTypes, name]); diff --git a/assets/js/instant-results/components/results/result.js b/assets/js/instant-results/components/results/result.js index 47806c591d..2bc7dbc031 100644 --- a/assets/js/instant-results/components/results/result.js +++ b/assets/js/instant-results/components/results/result.js @@ -8,6 +8,7 @@ import { WPElement } from '@wordpress/element'; */ import { postTypeLabels } from '../../config'; import { formatDate } from '../../utilities'; +import { escapeRegExp } from '../../../utils/helpers'; import Result from '../common/result'; /** @@ -36,7 +37,7 @@ export default ({ hit, searchTerm, highlightTag }) => { /** * Note: highlighting is redone here because the unified highlight type is not supported in ES5 */ - const regex = new RegExp(`\\b(${searchTerm})`, 'gi'); + const regex = new RegExp(`\\b(${escapeRegExp(searchTerm)})`, 'gi'); let title; if (highlightTag === '' || highlightTag === undefined) { diff --git a/assets/js/instant-results/components/tools/sidebar-toggle.js b/assets/js/instant-results/components/tools/sidebar-toggle.js index a8e66c9174..3df59838f4 100644 --- a/assets/js/instant-results/components/tools/sidebar-toggle.js +++ b/assets/js/instant-results/components/tools/sidebar-toggle.js @@ -21,7 +21,7 @@ export default ({ isOpen, onClick }) => { onClick={onClick} type="button" > - {isOpen ? __('Close filters', 'elasticpress') : __('All filters', 'elasticoress')} + {isOpen ? __('Close filters', 'elasticpress') : __('All filters', 'elasticpress')} ); diff --git a/assets/js/ordering/pointers.js b/assets/js/ordering/pointers.js index 94836d34d4..5338244f21 100644 --- a/assets/js/ordering/pointers.js +++ b/assets/js/ordering/pointers.js @@ -1,7 +1,7 @@ /** * External dependencies. */ -import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd'; +import { DragDropContext, Droppable, Draggable } from '@hello-pangea/dnd'; /** * WordPress dependencies. @@ -63,6 +63,7 @@ export class Pointers extends Component { defaultResults: {}, searchText: '', searchResults: {}, + removedPointers: [], }; } @@ -101,9 +102,11 @@ export class Pointers extends Component { removePointer = (pointer) => { let { pointers } = this.state; + const { removedPointers } = this.state; delete pointers[pointers.indexOf(pointer)]; pointers = pointers.filter((item) => item !== null); + removedPointers.push(pointer.ID); this.setState({ pointers }); }; @@ -113,23 +116,16 @@ export class Pointers extends Component { const { title, defaultResults } = this.state; let merged = defaultResults[title].slice(); - const setIds = {}; - merged.forEach((item) => { - setIds[item.ID] = item; - }); - pointers = pointers.sort((a, b) => { return a.order > b.order ? 1 : -1; }); + const pointersIds = pluck(pointers, 'ID'); - pointers.forEach((pointer) => { - // Remove the original if a duplicate - if (setIds[pointer.ID]) { - delete merged[merged.indexOf(setIds[pointer.ID])]; - merged = merged.filter((item) => item); - } + // Remove all custom pointers from the default results + merged = merged.filter((item) => pointersIds.indexOf(item.ID) === -1); - // Insert into proper location + // Insert pointers into their proper location + pointers.forEach((pointer) => { merged.splice(parseInt(pointer.order, 10) - 1, 0, pointer); }); @@ -190,6 +186,7 @@ export class Pointers extends Component { pointers.push({ ID: id, order: position, + type: 'custom-result', }); this.setState({ pointers }); @@ -227,17 +224,12 @@ export class Pointers extends Component { const pointers = []; items.forEach((item, index) => { - if (item.order) { - // Reordering an existing pointer - pointers.push({ - ID: item.ID, - order: index + 1, - }); - } else if (item.ID === result.draggableId) { - // Adding a default post to the pointers array + // Reordering an existing pointer or adding a default post to the pointers array + if (item.order || Number(item.ID) === Number(result.draggableId)) { pointers.push({ ID: item.ID, order: index + 1, + type: item?.type || 'reordered', }); } }); @@ -300,6 +292,7 @@ export class Pointers extends Component { defaultResults, title, pointers, + removedPointers, searchText, searchResults: searchResultsFromState, } = this.state; @@ -338,7 +331,7 @@ export class Pointers extends Component { const searchResults = searchResultsFromState[searchText] ? searchResultsFromState[searchText].filter( (item) => renderedIds.indexOf(item.ID) === -1, - ) + ) : false; return ( @@ -359,6 +352,8 @@ export class Pointers extends Component { ? index + 1 : index; + const isRemoved = removedPointers.includes(item.ID); + let { title } = item; if (undefined === title) { title = @@ -368,15 +363,14 @@ export class Pointers extends Component { } // Determine if this result is part of default search results or not - const isDefaultResult = - undefined !== defaultResultsById[item.ID]; + const itemType = item?.type || 'reordered'; const tooltipText = - isDefaultResult === true + itemType === 'reordered' ? __('Return to original position', 'elasticpress') : __( 'Remove custom result from results list', 'elasticpress', - ); + ); return ( @@ -408,34 +402,25 @@ export class Pointers extends Component { {(provided2) => (
- {item.order && isDefaultResult === true && ( + {item.order && itemType === 'reordered' && ( RD )} - {item.order && - isDefaultResult === false && ( - - CR - - )} + {item.order && itemType !== 'reordered' && ( + CR + )} {title}
- {item.order && ( )} +
)} diff --git a/assets/js/search/editor/plugins/exclude-from-search.js b/assets/js/search/editor/plugins/exclude-from-search.js index d4e7b8ef12..f588b5484a 100644 --- a/assets/js/search/editor/plugins/exclude-from-search.js +++ b/assets/js/search/editor/plugins/exclude-from-search.js @@ -3,7 +3,8 @@ */ import { CheckboxControl } from '@wordpress/components'; import { useDispatch, useSelect } from '@wordpress/data'; -import { PluginPostStatusInfo } from '@wordpress/edit-post'; +import { PluginPostStatusInfo as PluginPostStatusInfoLegacy } from '@wordpress/edit-post'; +import { PluginPostStatusInfo } from '@wordpress/editor'; import { __ } from '@wordpress/i18n'; export default () => { @@ -17,8 +18,13 @@ export default () => { editPost({ meta: { ...meta, ep_exclude_from_search } }); }; + const WrapperElement = + typeof PluginPostStatusInfo !== 'undefined' + ? PluginPostStatusInfo + : PluginPostStatusInfoLegacy; + return ( - + { )} checked={ep_exclude_from_search} onChange={onChange} + __nextHasNoMarginBottom /> - + ); }; diff --git a/assets/js/sites-admin.js b/assets/js/sites-admin.js index d6c4a3e91e..5269e30e72 100644 --- a/assets/js/sites-admin.js +++ b/assets/js/sites-admin.js @@ -57,6 +57,7 @@ const ElasticPressToggleControl = ({ blogId, isDefaultChecked }) => { disabled={isLoading} label={isChecked ? __('On', 'elasticpress') : __('Off', 'elasticpress')} onChange={onChange} + __nextHasNoMarginBottom /> ); }; diff --git a/assets/js/sync-ui/apps/sync.js b/assets/js/sync-ui/apps/sync.js index afa03faf6a..d9628974ab 100644 --- a/assets/js/sync-ui/apps/sync.js +++ b/assets/js/sync-ui/apps/sync.js @@ -111,7 +111,7 @@ export default () => { ? __( 'If you are missing data in your search results or have recently added custom content types to your site, you should run a sync to reflect these changes.', 'elasticpress', - ) + ) : sprintf( /* translators: %s: Index type. ElasticPress.io or Elasticsearch. */ __( @@ -121,7 +121,7 @@ export default () => { isEpio ? __('on ElasticPress.io', 'elasticpress') : __('in Elasticsearch', 'elasticpress'), - )} + )}

diff --git a/assets/js/sync-ui/components/include.js b/assets/js/sync-ui/components/include.js index 2c6ef6a0eb..0c5f7800a7 100644 --- a/assets/js/sync-ui/components/include.js +++ b/assets/js/sync-ui/components/include.js @@ -53,6 +53,7 @@ export default () => { onChange={onChange} saveTransform={saveTransform} value={args.include} + __nextHasNoMarginBottom /> ); diff --git a/assets/js/sync-ui/components/indexables.js b/assets/js/sync-ui/components/indexables.js index 7fc721129a..eceddc3368 100644 --- a/assets/js/sync-ui/components/indexables.js +++ b/assets/js/sync-ui/components/indexables.js @@ -57,6 +57,7 @@ export default () => { key={indexable} label={label} onChange={(checked) => onChange(indexable, checked)} + __nextHasNoMarginBottom /> ))} diff --git a/assets/js/sync-ui/components/limits.js b/assets/js/sync-ui/components/limits.js index b280246bb0..7922b4c005 100644 --- a/assets/js/sync-ui/components/limits.js +++ b/assets/js/sync-ui/components/limits.js @@ -56,6 +56,7 @@ export default () => { onChange={onChangeLower} type="number" value={args.lower_limit_object_id} + __nextHasNoMarginBottom /> @@ -67,6 +68,7 @@ export default () => { onChange={onChangeUpper} type="number" value={args.upper_limit_object_id} + __nextHasNoMarginBottom /> diff --git a/assets/js/sync-ui/components/offset.js b/assets/js/sync-ui/components/offset.js index c40e02d8f4..f63c64bc32 100644 --- a/assets/js/sync-ui/components/offset.js +++ b/assets/js/sync-ui/components/offset.js @@ -29,6 +29,7 @@ export default () => { onChange={(offset) => setArgs({ ...args, offset })} type="number" value={args.offset} + __nextHasNoMarginBottom /> ); }; diff --git a/assets/js/sync-ui/components/post-types.js b/assets/js/sync-ui/components/post-types.js index f41014cf28..d89197d757 100644 --- a/assets/js/sync-ui/components/post-types.js +++ b/assets/js/sync-ui/components/post-types.js @@ -52,6 +52,7 @@ export default () => { key={postType} label={label} onChange={(checked) => onChange(postType, checked)} + __nextHasNoMarginBottom /> ))} diff --git a/assets/js/sync-ui/components/previous-sync.js b/assets/js/sync-ui/components/previous-sync.js index f85a9e927e..c8e0e214f7 100644 --- a/assets/js/sync-ui/components/previous-sync.js +++ b/assets/js/sync-ui/components/previous-sync.js @@ -52,7 +52,7 @@ export default ({ failures, method, stateDatetime, status, trigger }) => { 'elasticpress', ), failures, - ) + ) : __('Completed with errors.', 'elasticpress'); case 'aborted': return __('Stopped.', 'elasticpress'); @@ -119,7 +119,7 @@ export default ({ failures, method, stateDatetime, status, trigger }) => { ), when, why, - ) + ) : when}
{how}
diff --git a/assets/js/sync-ui/components/progress.js b/assets/js/sync-ui/components/progress.js index 2b7fba80b2..fc4ec4e29c 100644 --- a/assets/js/sync-ui/components/progress.js +++ b/assets/js/sync-ui/components/progress.js @@ -117,7 +117,7 @@ export default () => { })} > -
+
{label} {syncStartDateTime ? createInterpolateElement( @@ -125,11 +125,12 @@ export default () => { { time:
{ indeterminate={isSyncing && isDeleting && !args.put_mapping} label={__('Delete all data and start fresh sync', 'elasticpress')} onChange={(checked) => setArgs({ ...args, put_mapping: checked })} + __nextHasNoMarginBottom /> ); diff --git a/assets/js/sync-ui/css/advanced-control.css b/assets/js/sync-ui/css/advanced-control.css index 4c36813d8f..4757c3abf9 100644 --- a/assets/js/sync-ui/css/advanced-control.css +++ b/assets/js/sync-ui/css/advanced-control.css @@ -8,6 +8,10 @@ &.components-flex .components-flex-item { flex-grow: 2; } + + & .components-checkbox-control { + margin-bottom: 1em; + } } .ep-sync-advanced-control__label { diff --git a/assets/js/sync-ui/css/controls.css b/assets/js/sync-ui/css/controls.css index 1a38d306b5..165eafab9a 100644 --- a/assets/js/sync-ui/css/controls.css +++ b/assets/js/sync-ui/css/controls.css @@ -9,3 +9,7 @@ justify-self: end; } } + +.ep-sync-delete { + margin-bottom: 1em; +} diff --git a/assets/js/sync/index.js b/assets/js/sync/index.js index 074158512f..6a7d190d26 100644 --- a/assets/js/sync/index.js +++ b/assets/js/sync/index.js @@ -268,7 +268,7 @@ export const SyncProvider = ({ isEpio ? __('ElasticPress.io', 'elasticpress') : __('Elasticsearch', 'elasticpress'), - ) + ) : __('Sync interrupted by WP-CLI command.', 'elasticpress'); logMessage(message, 'info'); diff --git a/assets/js/synonyms/components/common/edit-panel.js b/assets/js/synonyms/components/common/edit-panel.js index ba712daa74..0377902f40 100644 --- a/assets/js/synonyms/components/common/edit-panel.js +++ b/assets/js/synonyms/components/common/edit-panel.js @@ -69,6 +69,7 @@ const EditPanel = ( label={labels.primary} onChange={onChangePrimary} value={primaryValue.map((p) => p.value).join('')} + __nextHasNoMarginBottom /> ) : null} {mode === 'replacements' ? ( @@ -77,6 +78,7 @@ const EditPanel = ( label={labels.primary} onChange={onChangePrimary} value={primaryValue.map((p) => p.value)} + __nextHasNoMarginBottom /> ) : null} h.value)} + __nextHasNoMarginBottom /> diff --git a/assets/js/synonyms/components/common/list-table.js b/assets/js/synonyms/components/common/list-table.js index d19ae3836d..95f67d9a09 100644 --- a/assets/js/synonyms/components/common/list-table.js +++ b/assets/js/synonyms/components/common/list-table.js @@ -130,6 +130,7 @@ export default ({ children, Colgroup, Head, onDelete, ...props }) => { checked={isAllChecked} indeterminate={checked.length && !isAllChecked} onChange={onCheckAll} + __nextHasNoMarginBottom /> ), [checked, isAllChecked, onCheckAll], diff --git a/assets/js/synonyms/components/editors/solr-editor.js b/assets/js/synonyms/components/editors/solr-editor.js index 41496565c9..71331b5608 100644 --- a/assets/js/synonyms/components/editors/solr-editor.js +++ b/assets/js/synonyms/components/editors/solr-editor.js @@ -35,6 +35,7 @@ const SolrEditor = () => { rows="20" value={solr} onChange={onChange} + __nextHasNoMarginBottom /> ); }; diff --git a/assets/js/synonyms/components/editors/visual-editor.js b/assets/js/synonyms/components/editors/visual-editor.js index b767a0b1e5..b4ed044ae1 100644 --- a/assets/js/synonyms/components/editors/visual-editor.js +++ b/assets/js/synonyms/components/editors/visual-editor.js @@ -300,6 +300,7 @@ export default ({ labels, messages, mode, rules }) => { check(i, isChecked)} + __nextHasNoMarginBottom /> {labels.primary ? ( diff --git a/assets/js/synonyms/css/edit-panel.css b/assets/js/synonyms/css/edit-panel.css index 4973fc7909..978e8727a0 100644 --- a/assets/js/synonyms/css/edit-panel.css +++ b/assets/js/synonyms/css/edit-panel.css @@ -11,5 +11,14 @@ padding-bottom: 4px; padding-top: 4px; } + + & .components-form-token-field__help { + margin-bottom: 1em; + margin-top: 1em; + } + } + + & .components-text-control__input { + margin-bottom: 1em; } } diff --git a/assets/js/utils/helpers.js b/assets/js/utils/helpers.js index 294947df7a..fec7b39942 100644 --- a/assets/js/utils/helpers.js +++ b/assets/js/utils/helpers.js @@ -47,7 +47,10 @@ export const escapeRegExp = (string) => string.replace(/[.*+?^${}()|[\]\\]/g, '\ * @returns {string} replaced string */ export const replaceGlobally = (string, term, replacement) => { - return string.replace(new RegExp(escapeRegExp(term), 'g'), replacement); + return string.replace( + new RegExp(escapeRegExp(term), 'g'), + JSON.stringify(replacement).slice(1, -1), // Escapes especial chars and remove quotes added by JSON.stringify + ); }; /** diff --git a/assets/js/weighting/components/field.js b/assets/js/weighting/components/field.js index 814542eb53..576d6fdbdf 100644 --- a/assets/js/weighting/components/field.js +++ b/assets/js/weighting/components/field.js @@ -60,6 +60,7 @@ export default ({ label, onChange, onDelete, value, showTooltip }) => { checked={enabled} label={__('Searchable', 'elasticpress')} onChange={onChangeSearchable} + __nextHasNoMarginBottom />
@@ -70,6 +71,7 @@ export default ({ label, onChange, onDelete, value, showTooltip }) => { min={1} onChange={onChangeWeight} value={weight} + __nextHasNoMarginBottom />
diff --git a/assets/js/weighting/components/group.js b/assets/js/weighting/components/group.js index faf9d38c80..effc260369 100644 --- a/assets/js/weighting/components/group.js +++ b/assets/js/weighting/components/group.js @@ -184,6 +184,7 @@ export default ({ group, postType }) => { onKeyDown={onKeyDown} placeholder={__('Metadata key', 'elasticpress')} value={toAdd} + __nextHasNoMarginBottom />