Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release: 3.6.0-alpha.1 #669

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c8232ae
3.5.2
tomusborne Oct 23, 2024
ab71087
3.5.2
tomusborne Oct 23, 2024
9f89b12
Fix: Broken Font Manager when adding multiple fonts
tomusborne Oct 23, 2024
5129b49
Merge pull request #646 from tomusborne/fix/broken-font-manager
tomusborne Oct 25, 2024
af2c902
Merge 5129b49ca64f0267462d6c5589dbb5d39448b364 into 8598ca648c3d34c24…
tomusborne Oct 25, 2024
774307b
Update dist files
github-actions[bot] Oct 25, 2024
e9997a5
Fix: Inconsistent editor width
tomusborne Nov 30, 2024
5cb338f
Require WP 6.5
tomusborne Nov 30, 2024
95b8914
Update readme.txt
tomusborne Nov 30, 2024
48f25e4
Update requires at least
tomusborne Dec 1, 2024
34c51c1
3.5.2-beta.1
tomusborne Dec 16, 2024
8a87512
Update version
tomusborne Dec 16, 2024
b879698
Update version
tomusborne Dec 16, 2024
fe2d74d
Merge b87969882f3fe8062d10eca005f9f80b73a49d58 into 8598ca648c3d34c24…
tomusborne Dec 16, 2024
5b0f7a8
Update dist files
github-actions[bot] Dec 16, 2024
7d89ed6
Improve iframe check
tomusborne Dec 17, 2024
16c25a9
Merge pull request #652 from tomusborne/fix/inconsistent-editor-width
tomusborne Jan 24, 2025
57a38dc
Merge 16c25a9b318b2eecea58ef0b012223d5a0b1634d into 8598ca648c3d34c24…
tomusborne Jan 24, 2025
89a6e57
Update dist files
github-actions[bot] Jan 24, 2025
92b5b90
Tweak: Use `wp_print_inline_script_tag` for a11y script
tomusborne Feb 25, 2025
f573dc0
Tweak: Use `wp_add_inline_script()` for all frontend inline scripts
tomusborne Feb 25, 2025
1c0be37
Update ci.yml
tomusborne Mar 17, 2025
bdd6318
Merge 1c0be37aad0068805d78ad2404f6223274aa09da into 8598ca648c3d34c24…
tomusborne Mar 17, 2025
1bd2648
Update dist files
github-actions[bot] Mar 17, 2025
f4205fc
3.6.0-alpha.1
tomusborne Mar 19, 2025
f0560a5
Merge pull request #665 from tomusborne/tweak/use-print-inline-script…
tomusborne Mar 20, 2025
c434375
Update style.css
tomusborne Mar 21, 2025
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
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:

- name: Check changed files
id: 'js-files'
uses: tj-actions/changed-files@v35.4.3
uses: tj-actions/changed-files@v46
with:
files: |
src/**/*.js
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:

- name: Check changed files
id: 'js-files'
uses: tj-actions/changed-files@v35.4.3
uses: tj-actions/changed-files@v46
with:
files: |
src/**/*.js
Expand Down Expand Up @@ -102,7 +102,7 @@ jobs:

- name: Check changed files
id: 'js-files'
uses: tj-actions/changed-files@v35.4.3
uses: tj-actions/changed-files@v46
with:
files: |
src/**/*.js
Expand Down Expand Up @@ -147,7 +147,7 @@ jobs:

- name: Check changed files
id: 'php-files'
uses: tj-actions/changed-files@v35.4.3
uses: tj-actions/changed-files@v46
with:
files: |
**/*.php
Expand Down Expand Up @@ -180,7 +180,7 @@ jobs:

- name: Check changed files
id: 'php-files'
uses: tj-actions/changed-files@v35.4.3
uses: tj-actions/changed-files@v46
with:
files: |
**/*.php
Expand Down
2 changes: 1 addition & 1 deletion assets/dist/block-editor.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-dom-ready', 'wp-element', 'wp-plugins'), 'version' => '53a6a5a937a68e460003');
<?php return array('dependencies' => array('wp-data', 'wp-dom-ready', 'wp-editor', 'wp-element', 'wp-plugins'), 'version' => '24bb9110ccf231b1e49f');
2 changes: 1 addition & 1 deletion assets/dist/block-editor.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/dist/customizer.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-components', 'wp-element', 'wp-hooks', 'wp-i18n'), 'version' => '731b220042b06e3421fb');
<?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-components', 'wp-element', 'wp-hooks', 'wp-i18n'), 'version' => '79795830803e662a540e');
4 changes: 2 additions & 2 deletions assets/dist/customizer.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/dist/modal.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => '8b4cabf5d14f1f64f94a');
<?php return array('dependencies' => array(), 'version' => 'b9041bb3f75d06782df7');
2 changes: 1 addition & 1 deletion assets/dist/modal.js

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

2 changes: 1 addition & 1 deletion functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}

// Set our theme version.
define( 'GENERATE_VERSION', '3.5.1' );
define( 'GENERATE_VERSION', '3.6.0-alpha.1' );

if ( ! function_exists( 'generate_setup' ) ) {
add_action( 'after_setup_theme', 'generate_setup' );
Expand Down
77 changes: 43 additions & 34 deletions inc/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,31 +74,35 @@ function generate_scripts() {

if ( generate_has_active_menu() ) {
wp_enqueue_script( 'generate-menu', $dir_uri . "/assets/js/menu{$suffix}.js", array(), GENERATE_VERSION, true );
}

wp_localize_script(
'generate-menu',
'generatepressMenu',
apply_filters(
$menu_script_args = apply_filters(
'generate_localize_js_args',
array(
'toggleOpenedSubMenus' => true,
'openSubMenuLabel' => esc_attr__( 'Open Sub-Menu', 'generatepress' ),
'closeSubMenuLabel' => esc_attr__( 'Close Sub-Menu', 'generatepress' ),
'openSubMenuLabel' => esc_attr__( 'Open Sub-Menu', 'generatepress' ),
'closeSubMenuLabel' => esc_attr__( 'Close Sub-Menu', 'generatepress' ),
)
)
);
);

generate_add_inline_script(
'generate-menu',
$menu_script_args,
'generatepressMenu'
);
}

if ( 'click' === generate_get_option( 'nav_dropdown_type' ) || 'click-arrow' === generate_get_option( 'nav_dropdown_type' ) ) {
wp_enqueue_script( 'generate-dropdown-click', $dir_uri . "/assets/js/dropdown-click{$suffix}.js", array(), GENERATE_VERSION, true );

wp_localize_script(
$dropdown_click_args = array(
'openSubMenuLabel' => esc_attr__( 'Open Sub-Menu', 'generatepress' ),
'closeSubMenuLabel' => esc_attr__( 'Close Sub-Menu', 'generatepress' ),
);

generate_add_inline_script(
'generate-dropdown-click',
'generatepressDropdownClick',
array(
'openSubMenuLabel' => esc_attr__( 'Open Sub-Menu', 'generatepress' ),
'closeSubMenuLabel' => esc_attr__( 'Close Sub-Menu', 'generatepress' ),
)
$dropdown_click_args,
'generatepressDropdownClick'
);
}

Expand All @@ -109,29 +113,33 @@ function generate_scripts() {
if ( 'enable' === generate_get_option( 'nav_search' ) ) {
wp_enqueue_script( 'generate-navigation-search', $dir_uri . "/assets/js/navigation-search{$suffix}.js", array(), GENERATE_VERSION, true );

wp_localize_script(
$nav_search_args = array(
'open' => esc_attr__( 'Open Search Bar', 'generatepress' ),
'close' => esc_attr__( 'Close Search Bar', 'generatepress' ),
);

generate_add_inline_script(
'generate-navigation-search',
'generatepressNavSearch',
array(
'open' => esc_attr__( 'Open Search Bar', 'generatepress' ),
'close' => esc_attr__( 'Close Search Bar', 'generatepress' ),
)
$nav_search_args,
'generatepressNavSearch'
);
}

if ( 'enable' === generate_get_option( 'back_to_top' ) ) {
wp_enqueue_script( 'generate-back-to-top', $dir_uri . "/assets/js/back-to-top{$suffix}.js", array(), GENERATE_VERSION, true );

wp_localize_script(
'generate-back-to-top',
'generatepressBackToTop',
apply_filters(
'generate_back_to_top_js_args',
array(
'smooth' => true,
)
$back_to_top_args = apply_filters(
'generate_back_to_top_js_args',
array(
'smooth' => true,
)
);

generate_add_inline_script(
'generate-back-to-top',
$back_to_top_args,
'generatepressBackToTop'
);
}

if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
Expand Down Expand Up @@ -482,11 +490,12 @@ function generate_set_microdata_markup( $output, $context ) {
* @since 3.1.0
*/
function generate_do_a11y_scripts() {
if ( apply_filters( 'generate_print_a11y_script', true ) ) {
// Add our small a11y script inline.
printf(
'<script id="generate-a11y">%s</script>',
'!function(){"use strict";if("querySelector"in document&&"addEventListener"in window){var e=document.body;e.addEventListener("mousedown",function(){e.classList.add("using-mouse")}),e.addEventListener("keydown",function(){e.classList.remove("using-mouse")})}}();'
if ( apply_filters( 'generate_print_a11y_script', true ) && function_exists( 'wp_print_inline_script_tag' ) ) {
wp_print_inline_script_tag(
'!function(){"use strict";if("querySelector"in document&&"addEventListener"in window){var e=document.body;e.addEventListener("mousedown",function(){e.classList.add("using-mouse")}),e.addEventListener("keydown",function(){e.classList.remove("using-mouse")})}}();',
array(
'id' => 'generate-a11y',
)
);
}
}
16 changes: 16 additions & 0 deletions inc/theme-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -826,3 +826,19 @@ function generate_has_active_menu() {
function generate_is_using_dynamic_typography() {
return generate_get_option( 'use_dynamic_typography' );
}

/**
* Add inline script.
*
* @param string $handle The script handle to attach the inline script to.
* @param array $data The data to be passed to the script.
* @param string $var The JavaScript variable name to assign the data to.
* @param string $position The position to add the inline script.
*/
function generate_add_inline_script( $handle, $data, $var, $position = 'before' ) {
if ( ! empty( $data ) ) {
$json_data = wp_json_encode( $data );
$inline_script = "var $var = $json_data;";
wp_add_inline_script( $handle, $inline_script, $position );
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "generatepress",
"version": "3.5.1",
"version": "3.6.0-alpha.1",
"description": "A super lightweight WordPress theme.",
"main": "Gruntfile.js",
"scripts": {
Expand Down
7 changes: 5 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ Donate link: https://generatepress.com/ongoing-development/
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Tags: two-columns, three-columns, one-column, right-sidebar, left-sidebar, footer-widgets, blog, e-commerce, flexible-header, full-width-template, buddypress, custom-header, custom-background, custom-menu, custom-colors, sticky-post, threaded-comments, translation-ready, rtl-language-support, featured-images, theme-options
Requires at least: 6.1
Requires at least: 6.5
Requires PHP: 7.4
Tested up to: 6.6
Tested up to: 6.7
Stable tag: 3.5.1

GeneratePress is a lightweight WordPress theme built with a focus on speed and usability.
Expand Down Expand Up @@ -100,6 +100,9 @@ MIT License: https://github.com/JedWatson/react-select/blob/master/LICENSE

== Changelog ==

= 3.6.0 =
* Fix: Inability to add more than one font in the Font Manager

= 3.5.1 =
* Tweak: Revert addition of appearance-tools theme support
* Fix: Dropdown click conflict with off-canvas panel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ const GeneratePressFontManagerControlForm = ( props ) => {
<Button
isPrimary
onClick={ () => {
const fontValues = [ ...props.value ];
const fontValues = [ ...fonts ];

fontValues.push( {
fontFamily: '',
Expand All @@ -345,8 +345,7 @@ const GeneratePressFontManagerControlForm = ( props ) => {

handleChangeComplete( fontValues );

const itemCount = wp.customize.control( props.customizerSetting.id ).setting.get().length;
setOpen( itemCount );
setOpen( fontValues.length );
} }
>
{ __( 'Add Font', 'generatepress' ) }
Expand Down
53 changes: 46 additions & 7 deletions src/extend/content-width/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { registerPlugin } from '@wordpress/plugins';
import { useEffect, useState } from '@wordpress/element';
import domReady from '@wordpress/dom-ready';
import { store as editorStore } from '@wordpress/editor';
import { useSelect } from '@wordpress/data';

function getContentWidth( layout, contentContainer = '' ) {
let contentWidth = '';
Expand Down Expand Up @@ -40,22 +42,59 @@ function getContentWidth( layout, contentContainer = '' ) {
const ContentWidth = () => {
const [ sidebarLayout, setSidebarLayout ] = useState( generatepressBlockEditor.sidebarLayout );
const [ fullWidth, setFullWidth ] = useState( generatepressBlockEditor.contentAreaType );
const editorWrapperStyles = document.querySelector( '.editor-styles-wrapper' )?.style;

// We use editorWrapperStyles to update the content width when changing devices or code editor to visual editor.
// See https://github.com/tomusborne/generatepress/issues/493.
const editorMode = useSelect( ( select ) => (
select( editorStore ).getEditorMode()
), [] );

const deviceType = useSelect( ( select ) => {
const { getDeviceType } = select( 'core/editor' ) || {};

if ( 'function' === typeof getDeviceType ) {
return getDeviceType();
}

const {
__experimentalGetPreviewDeviceType: experimentalGetPreviewDeviceType,
} = select( 'core/edit-post' );

if ( 'function' === typeof experimentalGetPreviewDeviceType ) {
return experimentalGetPreviewDeviceType();
}

return 'Desktop';
}, [] );

useEffect( () => {
const body = document.querySelector( '.editor-styles-wrapper' );
body?.style?.setProperty( '--content-width', getContentWidth( sidebarLayout, fullWidth ) );
}, [ sidebarLayout, fullWidth, JSON.stringify( editorWrapperStyles ) ] );
const iframe = document.querySelector( 'iframe[name="editor-canvas"]' );
const queryDocument = iframe?.contentDocument || document;
const body = queryDocument.querySelector( '.editor-styles-wrapper' );

if ( body ) {
const contentWidth = getContentWidth( sidebarLayout, fullWidth );
body.style.setProperty( '--content-width', contentWidth );
}

if ( iframe && 'loading' === iframe.contentDocument.readyState ) {
const handleLoad = () => {
if ( body ) {
const contentWidth = getContentWidth( sidebarLayout, fullWidth );
body.style.setProperty( '--content-width', contentWidth );
}
};

iframe.addEventListener( 'load', handleLoad, { once: true } );
return () => iframe.removeEventListener( 'load', handleLoad );
}
}, [ sidebarLayout, fullWidth, editorMode, deviceType ] );

domReady( () => {
const sidebarSelect = document.getElementById( 'generate-sidebar-layout' );
const contentWidthSelect = document.getElementById( '_generate-full-width-content' );

if ( sidebarSelect ) {
sidebarSelect.onchange = ( event ) => {
setSidebarLayout( event.target.value || generatepressBlockEditor.globalSidebarLayout );
setSidebarLayout( event.target.value || generatepressBlockEditor.sidebarLayout );
};
}

Expand Down
Loading