Skip to content

Commit 3092c8f

Browse files
committed
Merge branch 'master' into improve/update-npm-packages
2 parents ff8152e + 77cf09f commit 3092c8f

26 files changed

+1035
-158
lines changed

lib/client-assets.php

+11-1
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ function novablocks_register_packages_scripts() {
163163

164164
$nova_editor_settings = novablocks_get_block_editor_settings();
165165

166+
if ( class_exists( 'PixCustomifyPlugin' ) ) {
167+
$nova_editor_settings['customify_config'] = PixCustomifyPlugin()->get_options_configs();
168+
}
169+
166170
list( $color_palette, ) = (array) get_theme_support( 'editor-color-palette' );
167171

168172
if ( false !== $color_palette ) {
@@ -182,7 +186,13 @@ function novablocks_register_packages_scripts() {
182186
'novablocks_core_frontend_stylesheet' => novablocks_get_plugin_url() . '/build/core/style.css',
183187
'novablocks_components_frontend_stylesheet' => novablocks_get_plugin_url() . '/build/components/style.css',
184188
'novablocks_opentable_frontend_stylesheet' => novablocks_get_plugin_url() . '/build/block-library/blocks/opentable/style.css',
185-
'novablocks_opentable_editor_stylesheet' => novablocks_get_plugin_url() . '/build/block-library/blocks/opentable/editor-styles.css'
189+
'novablocks_opentable_editor_stylesheet' => novablocks_get_plugin_url() . '/build/block-library/blocks/opentable/editor-styles.css',
190+
'novablocks_customizer_header_link' => novablocks_get_customizer_link(false,
191+
array(
192+
"autofocus[panel]" => "theme_options_panel",
193+
"autofocus[section]" => "rosa2_options[header_section]"
194+
)
195+
)
186196
) );
187197

188198
wp_set_script_translations( 'novablocks-core', '__plugin_txtd', novablocks_get_plugin_path() . 'languages' );

lib/extras.php

+31
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,14 @@ function novablocks_get_header_attributes() {
189189
'type' => 'string',
190190
'default' => 'logo-left',
191191
),
192+
'stickyRow' => array(
193+
'type' => 'string',
194+
'default' => 'primary'
195+
),
196+
'shouldBeSticky' => array(
197+
'type' => 'bool',
198+
'default' => false
199+
)
192200
);
193201
}
194202

@@ -1606,3 +1614,26 @@ function novablocks_get_localize_to_window_script( $object_name, $l10n ) {
16061614

16071615
return $script;
16081616
}
1617+
1618+
function novablocks_get_customizer_link( $return_url = false, $extra_query_args = array() ) {
1619+
global $wp;
1620+
1621+
1622+
if ( empty( $return_url ) ) {
1623+
// Get the current frontend URL.
1624+
$return_url = home_url( add_query_arg( array(), $wp->request ) );
1625+
}
1626+
1627+
// Now get the Customizer URL.
1628+
$link = wp_customize_url();
1629+
1630+
$link = add_query_arg( 'return_url', rawurlencode( $return_url ), $link );
1631+
1632+
if ( ! empty( $extra_query_args ) && is_array( $extra_query_args ) && ! wp_is_numeric_array( $extra_query_args ) ) {
1633+
foreach ( $extra_query_args as $key => $value ) {
1634+
$link = add_query_arg( rawurlencode( $key ), rawurlencode( utf8_uri_encode( $value ) ), $link );
1635+
}
1636+
}
1637+
1638+
return $link;
1639+
}

nova-blocks.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
* Plugin Name: Nova Blocks
44
* Plugin URI: https://github.com/pixelgrade/nova-blocks/
55
* Description: Nova Blocks is a collection of <strong>distinctive Gutenberg blocks</strong>, committed to making your site shine like a newborn star. It is taking a design-driven approach to help you made the right decisions and showcase your content in the best shape.
6-
* Version: 1.8.1
6+
* Version: 1.9.0
77
* Author: Pixelgrade
88
* Author URI: https://www.pixelgrade.com
99
* Text Domain: __plugin_txtd
10-
* Tested up to: 5.5.3
10+
* Tested up to: 5.6.1
1111
* Requires PHP: 5.4.0
1212
* License: GPLv2 or later
1313
*

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nova-blocks",
3-
"version": "1.8.1",
3+
"version": "1.9.0",
44
"main": "blocks/index.js",
55
"license": "GPL-3.0+",
66
"engines": {

packages/block-editor/src/components/notice/editor-styles.scss

+6
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@
22
padding: 16px;
33
color: #191e23;
44
background-color: #e7f5f9;
5+
6+
margin-bottom: 24px;
57

68
.components-button {
79
height: auto;
810
}
11+
12+
p:last-child {
13+
margin-bottom: 0;
14+
}
915
}

packages/block-editor/src/components/notice/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ const Notice = ( props ) => {
2727
return null;
2828
};
2929

30+
console.log(dismissLabel);
31+
3032
return (
3133
<div className={ 'novablocks-notice' }>
3234
{ content }
33-
<Button isPrimary onClick={ onClick }>{ dismissLabel }</Button>
35+
{ dismissLabel !== undefined && <Button isPrimary onClick={ onClick }>{ dismissLabel }</Button> }
3436
</div>
3537
);
3638
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* WordPress dependencies
3+
*/
4+
import classnames from 'classnames';
5+
import { InnerBlocks } from '@wordpress/block-editor';
6+
7+
/**
8+
* Internal dependencies.
9+
*/
10+
const ALLOWED_BLOCKS = [ 'novablocks/logo', 'novablocks/navigation' ];
11+
12+
const HeaderRowEdit = function( props ) {
13+
const {
14+
className,
15+
} = props;
16+
17+
const classNames = classnames(
18+
'site-header__row',
19+
className,
20+
);
21+
22+
return (
23+
<div className={classNames}>
24+
<InnerBlocks
25+
allowedBlocks={ALLOWED_BLOCKS}
26+
renderAppender={false}
27+
templateLock = 'insert'
28+
/>
29+
</div>
30+
31+
);
32+
};
33+
34+
export default HeaderRowEdit;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/**
2+
* Internal dependencies
3+
*/
4+
import iconSvg from '../header/header-block.svg';
5+
import edit from './edit';
6+
7+
/**
8+
* WordPress dependencies
9+
*/
10+
import {__} from '@wordpress/i18n';
11+
import {registerBlockType} from '@wordpress/blocks';
12+
import {getSvg} from "@novablocks/block-editor";
13+
import {InnerBlocks} from "@wordpress/block-editor";
14+
15+
registerBlockType( 'novablocks/header-row', {
16+
title: __( 'Header Row', '__plugin_txtd' ),
17+
description: __( 'Outputs header row markup.', '__plugin_txtd' ),
18+
category: 'nova-blocks',
19+
parent: 'novablocks/header',
20+
attributes: {
21+
name: {
22+
type: 'string',
23+
default: 'Header Row'
24+
},
25+
label: {
26+
type: 'string',
27+
default: 'Header Row Navigation'
28+
},
29+
isSticky: {
30+
type: 'boolean',
31+
default: false,
32+
},
33+
isPrimary: {
34+
type: 'boolean',
35+
default: false
36+
}
37+
},
38+
icon: getSvg( iconSvg ),
39+
edit,
40+
save: function() {
41+
return <InnerBlocks.Content/>
42+
}
43+
} );
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?php // Silence is golden
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
/**
3+
* Handle the Header Row block server logic.
4+
*/
5+
6+
// If this file is called directly, abort.
7+
if ( ! defined( 'ABSPATH' ) ) {
8+
exit;
9+
}
10+
11+
if ( ! function_exists('novablocks_render_header_row_block' ) ) {
12+
13+
/**
14+
* Entry point to render the block with the given attributes, content, and context.
15+
*
16+
* @param array $attributes
17+
* @param string $content
18+
*
19+
* @return string
20+
*/
21+
22+
function novablocks_render_header_row_block( $attributes, $content ) {
23+
24+
ob_start();
25+
26+
$classes = array('wp-block-novablocks-header-row site-header__row');
27+
28+
if ( ! empty( $attributes['className'] ) ) {
29+
$classes[] = $attributes['className'];
30+
}
31+
32+
?>
33+
34+
<div
35+
class="<?php echo esc_attr( join( ' ', $classes ) ); ?>"
36+
<?php if ( $attributes['isSticky'] === true ) { ?>
37+
data-sticky= true
38+
<?php } ?>
39+
>
40+
<?php echo $content; ?>
41+
</div>
42+
43+
<?php return ob_get_clean();
44+
}
45+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import { omit } from 'lodash';
2+
import { createBlock } from '@wordpress/blocks';
3+
import { select } from '@wordpress/data';
4+
5+
const blockAttributes = {
6+
layout: {
7+
type: 'string',
8+
default: 'logo-left'
9+
},
10+
align: {
11+
type: 'string',
12+
default: 'full'
13+
},
14+
15+
}
16+
17+
const deprecated = [
18+
{
19+
20+
isEligible: ( attributes, innerBlocks ) => {
21+
return innerBlocks[0].name !== 'novablocks/header-row';
22+
},
23+
24+
25+
attributes: {
26+
...blockAttributes
27+
},
28+
29+
migrate( attributes, innerBlocks ) {
30+
const { getSettings } = select( 'novablocks' );
31+
const settings = getSettings();
32+
33+
const headerShouldBeSticky = settings.customify_config.header_position.value === 'sticky';
34+
35+
return [
36+
attributes,
37+
[
38+
createBlock( 'novablocks/header-row', {
39+
className: 'site-header__row site-header__row--primary',
40+
name: 'primary',
41+
label: 'Primary Navigation',
42+
isSticky: headerShouldBeSticky
43+
},
44+
innerBlocks
45+
)
46+
]
47+
];
48+
},
49+
50+
save: function() {},
51+
}
52+
];
53+
54+
export default deprecated;

0 commit comments

Comments
 (0)