Skip to content

Commit

Permalink
Merge branch 'development' into dev/build
Browse files Browse the repository at this point in the history
  • Loading branch information
Soare-Robert-Daniel committed Dec 5, 2023
2 parents 2eafeaa + d0c9f9b commit da60053
Show file tree
Hide file tree
Showing 18 changed files with 259 additions and 64 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
##### [Version 3.7.4](https://github.com/Codeinwp/neve/compare/v3.7.3...v3.7.4) (2023-11-29)

### Bug Fixes
**Header Footer Builder Layout Fix:** We updated the builder to work with the latest version of WordPress 6.4.
**Related posts excerpt:** The excerpt from the related post will now correctly show the proper post excerpt.
**Infinite scroll:** Properly load custom post-type posts on the archive page.
**Infinite scroll post order:** The order is now preserved when loading posts for the infinite scroll.
**Improved Gutenberg support:** More default Guttenberg block settings are now supported.
**Blog list alignment:** The alignment now behaves correctly when the thumbnail is missing.

### Improvements
**Update Google Fonts:** Get the newest Google fonts from the public font library.
**E2E testing:** Improved end-to-end testing.
**SDK update:** The latest SDK is now available.

##### [Version 3.7.3](https://github.com/Codeinwp/neve/compare/v3.7.2...v3.7.3) (2023-10-23)

### New Features
Expand Down
1 change: 1 addition & 0 deletions assets/apps/dashboard/src/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { render } from '@wordpress/element';
import actions from './store/actions';
import reducer from './store/reducer';
import selectors from './store/selectors';
import './utils/module-observer';

registerStore('neve-dashboard', {
reducer,
Expand Down
72 changes: 72 additions & 0 deletions assets/apps/dashboard/src/utils/module-observer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import { subscribe, select } from '@wordpress/data';

/**

Check failure on line 3 in assets/apps/dashboard/src/utils/module-observer.js

View workflow job for this annotation

GitHub Actions / npm (18.x)

Expected JSDoc block lines to be aligned

Check failure on line 3 in assets/apps/dashboard/src/utils/module-observer.js

View workflow job for this annotation

GitHub Actions / npm (18.x)

JSDoc @return declaration present but return expression not available in function
* Append New Sub Menu Page.
*
* The page will be added after the parent container of the linkSelector.
*
* @param {string} linkSelector The link selector to determine the position of the added submenu page.
* @param {Object} subMenuData The Sub Menu data to be added.
* @return {HTMLAnchorElement} Custom Layouts menu page.
*/
function appendNewSubMenuPage(linkSelector, subMenuData) {
// Create and configure a new anchor element
const link = document.createElement('a');
link.setAttribute('href', subMenuData?.linkSubMenu);
link.textContent = subMenuData?.labelSubMenu;

const linkToAppendAfter = document.querySelector(linkSelector);
if (!linkToAppendAfter) {
return;
}

// Append the after the Customizer menu item.
const listNode = linkToAppendAfter.parentNode;
const container = document.createElement('li');
container.appendChild(link);
listNode.parentNode.insertBefore(container, listNode.nextSibling);

return link;
}

/**
* Auto Sub Menu Pages on Admin Dashboard for Pro Modules.
*/
function autoHideModuleSubMenuPages() {
let clLinkElem = document.querySelector(
'.toplevel_page_neve-welcome a[href*="edit.php?post_type=neve_custom_layouts"]'
);

subscribe(() => {
/**
* Auto hide Custom Layouts submenu page link based on module status.
*/
const isModuleEnabled =
select('neve-dashboard').getModuleStatus('custom_layouts');

if (isModuleEnabled && !clLinkElem) {
clLinkElem = appendNewSubMenuPage(
'.toplevel_page_neve-welcome .wp-submenu a[href*="customize.php"]',
window?.neveDash?.moduleObserver?.customLayouts
);
} else if (!isModuleEnabled && clLinkElem) {
clLinkElem.parentNode.remove();
clLinkElem = undefined;
}
});
}

function run() {
// Run only on the Neve Pro tab.
if (window.location.hash === '#pro') {
autoHideModuleSubMenuPages();
}
}

if (document.readyState !== 'loading') {
run();
} else {
document.addEventListener('DOMContentLoaded', function () {
run();
});
}
51 changes: 31 additions & 20 deletions assets/js/src/frontend/blog.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { httpGetAsync, isInView } from '../utils';
let masonryContainer = null,
page = 2;
const postWrapSelector = '.nv-index-posts .posts-wrapper';
const triggerSelector = '.infinite-scroll-trigger';

/**
* Initialize blog JS.
Expand Down Expand Up @@ -32,9 +33,10 @@ const masonry = () => {
}

imagesLoaded(masonryContainer, () => {
const selector = `article.layout-${blogLayout}`;
window.nvMasonry = new Masonry(masonryContainer, {
itemSelector: `article.layout-${blogLayout}`,
columnWidth: `article.layout-${blogLayout}`,
itemSelector: selector,
columnWidth: selector,
percentPosition: true,
});
});
Expand All @@ -44,15 +46,14 @@ const masonry = () => {
* Infinite scroll.
*/
const infiniteScroll = () => {
if (NeveProperties.infScroll !== 'enabled') {
if (
NeveProperties.infScroll !== 'enabled' ||
document.querySelector(postWrapSelector) === null
) {
return;
}

if (document.querySelector(postWrapSelector) === null) {
return;
}

isInView(document.querySelector('.infinite-scroll-trigger'), () => {
isInView(document.querySelector(triggerSelector), () => {
if (parent && parent.wp && parent.wp.customize) {
parent.wp.customize.requestChangesetUpdate().then(() => {
requestMorePosts();
Expand All @@ -64,44 +65,54 @@ const infiniteScroll = () => {
};

/**
* Request more posts
* Request more posts.
*
*/
const requestMorePosts = () => {
const trigger = document.querySelector('.infinite-scroll-trigger');
const doc = window.document;
const nP = window.NeveProperties;

const trigger = doc.querySelector(triggerSelector);
if (trigger === null) {
return;
}
document.querySelector('.nv-loader').style.display = 'block';
if (page > NeveProperties.maxPages) {
const loader = doc.querySelector('.nv-loader');
loader.style.display = 'block';

if (page > nP.maxPages) {
trigger.parentNode.removeChild(trigger);
document.querySelector('.nv-loader').style.display = 'none';
loader.style.display = 'none';
return;
}
const blog = document.querySelector(postWrapSelector);
const lang = NeveProperties.lang;
const baseUrl = NeveProperties.endpoint + page;
const blog = doc.querySelector(postWrapSelector);
const lang = nP.lang;
const baseUrl = nP.endpoint + page;
const url = lang ? baseUrl + '/' + lang : baseUrl;
const requestUrl = maybeParseUrlForCustomizer(url);
page++;

// Create an empty div that will be replaced with the new posts. Used to keep the order of the posts.
const postsPlaceholder = doc.createElement('div');
blog.appendChild(postsPlaceholder);

httpGetAsync(
requestUrl,
(response) => {
blog.innerHTML += JSON.parse(response);
if (NeveProperties.masonryStatus !== 'enabled') {
postsPlaceholder.outerHTML = JSON.parse(response);
if (nP.masonryStatus !== 'enabled') {
return false;
}
window.nvMasonry.reloadItems();
window.nvMasonry.layout();
},
NeveProperties.query
nP.query
);
};

/**
* Parse in the customizer context.
*
* @param {string} url
* @param {string} url URL to parse.
* @return {*} Sanitized URL.
*/
const maybeParseUrlForCustomizer = (url) => {
Expand Down
14 changes: 7 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,13 @@
"neve_blog_covers_text_color": "#bada55",
"neve_grid_layout": "{\"desktop\":2,\"tablet\":2,\"mobile\":2}",
"neve_enable_masonry": true
},
"archive4": {
"neve_blog_archive_layout": "default",
"neve_post_excerpt_length": 15,
"neve_post_thumbnail_box_shadow": 4,
"neve_post_content_ordering": "[\"title-meta\", \"excerpt\"]",
"neve_post_meta_ordering": "[\"date\", \"author\", \"category\"]",
"neve_pagination_type": "number"
}
}
19 changes: 19 additions & 0 deletions e2e-tests/specs/customizer/layout/blog-archive-settings.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,3 +256,22 @@ test.describe('Blog/Archive 3 / Covers Layout', () => {
}
});
});

test.describe('Blog/Archive 4 / Default Layout', () => {
test.beforeAll(async ({ request, baseURL }) => {
await setCustomizeSettings('defaultLayout', data.archive4, {
request,
baseURL,
});
});

test('Tests If Post Thumbnail Class Is Removed', async ({ page }) => {
await page.goto('/?test_name=defaultLayout');

await page.waitForSelector('article.post');

expect(
await page.locator('article.post.has-post-thumbnail').count()
).toEqual(0);
});
});
2 changes: 1 addition & 1 deletion functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @package Neve
*/

define( 'NEVE_VERSION', '3.7.3' );
define( 'NEVE_VERSION', '3.7.4' );
define( 'NEVE_INC_DIR', trailingslashit( get_template_directory() ) . 'inc/' );
define( 'NEVE_ASSETS_URL', trailingslashit( get_template_directory_uri() ) . 'assets/' );
define( 'NEVE_MAIN_DIR', get_template_directory() . '/' );
Expand Down
9 changes: 7 additions & 2 deletions globals/google-fonts.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Updated on 23/10/23
* Updated on 27/11/23
*
* @package neve
*/
Expand All @@ -18,6 +18,7 @@
'Actor' => array( '400',),
'Adamina' => array( '400',),
'Advent Pro' => array( '100', '200', '300', '400', '500', '600', '700', '800', '900', '100italic', '200italic', '300italic', '400italic', '500italic', '600italic', '700italic', '800italic', '900italic',),
'Agbalumo' => array( '400',),
'Agdasima' => array( '400', '700',),
'Aguafina Script' => array( '400',),
'Akatab' => array( '400', '500', '600', '700', '800', '900',),
Expand Down Expand Up @@ -207,7 +208,7 @@
'Bigshot One' => array( '400',),
'Bilbo' => array( '400',),
'Bilbo Swash Caps' => array( '400',),
'BioRhyme' => array( '200', '300', '400', '700', '800',),
'BioRhyme' => array( '200', '300', '400', '500', '600', '700', '800',),
'BioRhyme Expanded' => array( '200', '300', '400', '700', '800',),
'Birthstone' => array( '400',),
'Birthstone Bounce' => array( '400', '500',),
Expand Down Expand Up @@ -668,6 +669,7 @@
'Kaushan Script' => array( '400',),
'Kavivanar' => array( '400',),
'Kavoon' => array( '400',),
'Kay Pho Du' => array( '400', '500', '600', '700',),
'Kdam Thmor' => array(),
'Kdam Thmor Pro' => array( '400',),
'Keania One' => array( '400',),
Expand Down Expand Up @@ -747,6 +749,7 @@
'Lily Script One' => array( '400',),
'Limelight' => array( '400',),
'Linden Hill' => array( '400', '400italic',),
'Linefont' => array( '100', '200', '300', '400', '500', '600', '700', '800', '900',),
'Lisu Bosa' => array( '200', '300', '400', '500', '600', '700', '800', '900', '200italic', '300italic', '400italic', '500italic', '600italic', '700italic', '800italic', '900italic',),
'Literata' => array( '200', '300', '400', '500', '600', '700', '800', '900', '200italic', '300italic', '400italic', '500italic', '600italic', '700italic', '800italic', '900italic',),
'Liu Jian Mao Cao' => array( '400',),
Expand Down Expand Up @@ -978,6 +981,7 @@
'Noto Sans KR' => array( '100', '200', '300', '400', '500', '600', '700', '800', '900',),
'Noto Sans Kaithi' => array( '400',),
'Noto Sans Kannada' => array( '100', '200', '300', '400', '500', '600', '700', '800', '900',),
'Noto Sans Kawi' => array( '400', '500', '600', '700',),
'Noto Sans Kayah Li' => array( '400', '500', '600', '700',),
'Noto Sans Kharoshthi' => array( '400',),
'Noto Sans Khmer' => array( '100', '200', '300', '400', '500', '600', '700', '800', '900',),
Expand Down Expand Up @@ -1108,6 +1112,7 @@
'Noto Serif Myanmar' => array( '100', '200', '300', '400', '500', '600', '700', '800', '900',),
'Noto Serif NP Hmong' => array( '400', '500', '600', '700',),
'Noto Serif Nyiakeng Puachue Hmong' => array(),
'Noto Serif Old Uyghur' => array( '400',),
'Noto Serif Oriya' => array( '400', '500', '600', '700',),
'Noto Serif Ottoman Siyaq' => array( '400',),
'Noto Serif SC' => array( '200', '300', '400', '500', '600', '700', '900',),
Expand Down
7 changes: 7 additions & 0 deletions inc/admin/dashboard/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,13 @@ private function get_localization() {
$data['isOtterProInstalled'] = $is_otter_installed;
$data['otterProInstall'] = $is_otter_installed ? esc_url( wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=otter-pro%2Fotter-pro.php&plugin_status=all&paged=1&s' ), 'activate-plugin_otter-pro/otter-pro.php' ) ) : esc_url( wp_nonce_url( admin_url( 'admin-post.php?action=install_otter_pro' ), 'install_otter_pro' ) );
$data['sparksInstallActivateEndpoint'] = $is_sparks_installed ? esc_url( wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=sparks-for-woocommerce%2Fsparks-for-woocommerce.php&plugin_status=all&paged=1&s' ), 'activate-plugin_sparks-for-woocommerce/sparks-for-woocommerce.php' ) ) : esc_url( wp_nonce_url( admin_url( 'admin-post.php?action=install_sparks' ), 'install_sparks' ) );
$data['moduleObserver'] = array(
'customLayouts' => array(
'labelSubMenu' => __( 'Custom Layouts', 'neve' ),
'linkSubMenu' => 'edit.php?post_type=neve_custom_layouts',
),
);

}

if ( isset( $_GET['onboarding'] ) && $_GET['onboarding'] === 'yes' ) {
Expand Down
16 changes: 10 additions & 6 deletions inc/core/front_end.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,27 @@ public function setup_theme() {
'width' => 200,
);

add_theme_support( 'title-tag' );
add_theme_support( 'post-thumbnails' );
add_theme_support( 'align-wide' );
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'border' );
add_theme_support( 'custom-background', [] );
add_theme_support( 'custom-logo', $logo_settings );
add_theme_support( 'html5', array( 'search-form' ) );
add_theme_support( 'custom-spacing' );
add_theme_support( 'custom-units' );
add_theme_support( 'customize-selective-refresh-widgets' );
add_theme_support( 'custom-background', [] );
add_theme_support( 'align-wide' );
add_theme_support( 'editor-color-palette', $this->get_gutenberg_color_palette() );
add_theme_support( 'fl-theme-builder-headers' );
add_theme_support( 'fl-theme-builder-footers' );
add_theme_support( 'fl-theme-builder-headers' );
add_theme_support( 'fl-theme-builder-parts' );
add_theme_support( 'header-footer-elementor' );
add_theme_support( 'html5', array( 'search-form' ) );
add_theme_support( 'lifterlms-sidebars' );
add_theme_support( 'lifterlms' );
add_theme_support( 'link-color' );
add_theme_support( 'post-thumbnails' );
add_theme_support( 'service_worker', true );
add_theme_support( 'starter-content', ( new Starter_Content() )->get() );
add_theme_support( 'title-tag' );
add_filter( 'script_loader_tag', array( $this, 'filter_script_loader_tag' ), 10, 2 );
add_filter( 'embed_oembed_html', array( $this, 'wrap_oembeds' ), 10, 3 );
add_filter( 'video_embed_html', array( $this, 'wrap_jetpack_oembeds' ), 10, 1 );
Expand Down
Loading

0 comments on commit da60053

Please sign in to comment.