Skip to content

Commit

Permalink
Merge pull request #290 from publishpress/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
htmgarcia authored Feb 17, 2021
2 parents 29cbb14 + d928501 commit ece7346
Show file tree
Hide file tree
Showing 31 changed files with 585 additions and 293 deletions.
12 changes: 6 additions & 6 deletions src/advanced-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: PublishPress Blocks
* Plugin URI: https://publishpress.com/blocks/
* Description: Enhanced tools for Gutenberg editor
* Version: 2.5.4
* Version: 2.5.5
* Tested up to: 5.6.1
* Author: PublishPress
* Author URI: https://publishpress.com/
Expand All @@ -17,7 +17,7 @@
*
* @copyright 2014-2020 Joomunited
* @copyright 2020 Advanced Gutenberg. help@advancedgutenberg.com
* @copyright 2020 PublishPress. help@publishpress.com
* @copyright 2020-2021 PublishPress. help@publishpress.com
*
* Original development of this plugin was kindly funded by Joomunited
*
Expand Down Expand Up @@ -76,7 +76,7 @@ function advgb_show_error()
}

if (! defined('ADVANCED_GUTENBERG_VERSION')) {
define('ADVANCED_GUTENBERG_VERSION', '2.5.4');
define('ADVANCED_GUTENBERG_VERSION', '2.5.5');
}

if (! defined('ADVANCED_GUTENBERG_PLUGIN')) {
Expand Down Expand Up @@ -117,10 +117,10 @@ function advg_language_domain_init()
plugin_dir_path(__FILE__) . 'languages/' . 'advanced-gutenberg' . '-' . get_locale() . '.mo'
);
}

wp_set_script_translations(
'editor',
'advanced-gutenberg',
'editor',
'advanced-gutenberg',
plugin_dir_path( __FILE__ ) . 'languages'
);
}
Expand Down
54 changes: 52 additions & 2 deletions src/assets/blocks/accordion/block.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@
},
borderWidth: {
type: 'number',
default: 0,
default: 1,
},
borderColor: {
type: 'string',
Expand Down Expand Up @@ -393,6 +393,56 @@
</div>
);
},
deprecated: [
{
attributes: {
...accordionAttrs,
borderWidth: {
type: 'number',
default: 0,
},
},
save: function ( { attributes } ) {
const {
borderWidth,
} = attributes;

return (
<div className="advgb-accordion-block" style={ { marginBottom } } data-collapsed={ collapsedAll ? collapsedAll : undefined }>
<div className="advgb-accordion-header"
style={ {
backgroundColor: headerBgColor,
color: headerTextColor,
borderStyle: borderStyle,
borderWidth: borderWidth + 'px',
borderColor: borderColor,
borderRadius: borderRadius + 'px',
} }
>
<span className="advgb-accordion-header-icon">
<svg fill={ headerIconColor } xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
{ HEADER_ICONS[headerIcon] }
</svg>
</span>
<h4 className="advgb-accordion-header-title">{ header }</h4>
</div>
<div className="advgb-accordion-body"
style={ {
backgroundColor: bodyBgColor,
color: bodyTextColor,
borderStyle: borderStyle,
borderWidth: borderWidth + 'px',
borderColor: borderColor,
borderRadius: borderRadius + 'px',
} }
>
<InnerBlocks.Content />
</div>
</div>
);
}
}
],
transforms: {
to: [
{
Expand All @@ -415,4 +465,4 @@
]
},
} );
})( wp.i18n, wp.blocks, wp.element, wp.blockEditor, wp.components );
})( wp.i18n, wp.blocks, wp.element, wp.blockEditor, wp.components );
57 changes: 53 additions & 4 deletions src/assets/blocks/advaccordion/accordion.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@
className="advgb-accordion-header-title"
placeholder={ __( 'Enter header…', 'advanced-gutenberg' ) }
style={ { color: 'inherit' } }
allowedFormats={ [ 'core/bold', 'core/italic', 'core/image', 'core/strikethrough' ] }
/>
</div>
<div className="advgb-accordion-body"
Expand Down Expand Up @@ -304,7 +305,7 @@
},
borderWidth: {
type: 'number',
default: 0,
default: 1,
},
borderColor: {
type: 'string',
Expand Down Expand Up @@ -379,7 +380,7 @@
backgroundColor: headerBgColor,
color: headerTextColor,
borderStyle: borderStyle,
borderWidth: !!borderWidth ? borderWidth + 'px' : undefined,
borderWidth: borderWidth + 'px',
borderColor: borderColor,
borderRadius: !!borderRadius ? borderRadius + 'px' : undefined,
} }
Expand All @@ -396,7 +397,7 @@
backgroundColor: bodyBgColor,
color: bodyTextColor,
borderStyle: borderStyle + ' !important',
borderWidth: !!borderWidth ? borderWidth + 'px !important' : undefined,
borderWidth: borderWidth + 'px !important',
borderColor: borderColor + ' !important',
borderTop: 'none !important',
borderRadius: !!borderRadius ? borderRadius + 'px !important' : undefined,
Expand Down Expand Up @@ -484,6 +485,54 @@
marginBottom,
} = attributes;

return (
<div className="advgb-accordion-item" style={ { marginBottom } }>
<div className="advgb-accordion-header"
style={ {
backgroundColor: headerBgColor,
color: headerTextColor,
borderStyle: borderStyle,
borderWidth: !!borderWidth ? borderWidth + 'px' : undefined,
borderColor: borderColor,
borderRadius: !!borderRadius ? borderRadius + 'px' : undefined,
} }
>
<span className="advgb-accordion-header-icon">
<svg fill={ headerIconColor } xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
{ HEADER_ICONS[headerIcon] }
</svg>
</span>
<h4 className="advgb-accordion-header-title" style={ { color: 'inherit' } }>{ header }</h4>
</div>
<div className="advgb-accordion-body"
style={ {
backgroundColor: bodyBgColor,
color: bodyTextColor,
borderStyle: borderStyle + ' !important',
borderWidth: !!borderWidth ? borderWidth + 'px !important' : undefined,
borderColor: borderColor + ' !important',
borderTop: 'none !important',
borderRadius: !!borderRadius ? borderRadius + 'px !important' : undefined,
} }
>
<InnerBlocks.Content />
</div>
</div>
);
},
},
{
attributes: {
borderWidth: {
type: 'number',
default: 0,
},
},
save: function ( { attributes } ) {
const {
borderWidth,
} = attributes;

return (
<div className="advgb-accordion-item" style={ { marginBottom } }>
<div className="advgb-accordion-header"
Expand Down Expand Up @@ -521,4 +570,4 @@
}
]
} )
})( wp.i18n, wp.blocks, wp.element, wp.blockEditor, wp.components, wp.compose );
})( wp.i18n, wp.blocks, wp.element, wp.blockEditor, wp.components, wp.compose );
31 changes: 25 additions & 6 deletions src/assets/blocks/advaccordion/block.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
const { Component, Fragment } = wpElement;
const { registerBlockType } = wpBlocks;
const { InspectorControls, BlockControls, PanelColorSettings, InnerBlocks } = wpBlockEditor;
const { RangeControl, PanelBody, BaseControl , SelectControl, ToggleControl, Toolbar, IconButton } = wpComponents;
const { RangeControl, PanelBody, BaseControl , SelectControl, ToggleControl, ToolbarGroup, ToolbarButton } = wpComponents;
const { withDispatch, select, dispatch } = wp.data;
const { compose } = wpCompose;
const { times } = lodash;
Expand Down Expand Up @@ -148,12 +148,13 @@
:
<Fragment>
<BlockControls>
<Toolbar label={ __( 'Options', 'advanced-gutenberg' ) }>
<IconButton
<ToolbarGroup>
<ToolbarButton
icon="update"
onClick={ () => this.resyncAccordions() }
label={__('Refresh', 'advanced-gutenberg')}
/>
</Toolbar>
</ToolbarGroup>
</BlockControls>
<InspectorControls>
<PanelBody title={ __( 'Accordion Settings', 'advanced-gutenberg' ) }>
Expand Down Expand Up @@ -314,7 +315,7 @@
},
borderWidth: {
type: 'number',
default: 0,
default: 1,
},
borderColor: {
type: 'string',
Expand Down Expand Up @@ -392,6 +393,24 @@
);
},
deprecated: [
{
attributes: {
...blockAttrs,
borderWidth: {
type: 'number',
default: 0,
}
},
save: function ( { attributes } ) {
const { collapsedAll } = attributes;

return (
<div className="advgb-accordion-wrapper" data-collapsed={ collapsedAll ? collapsedAll : undefined }>
<InnerBlocks.Content />
</div>
);
},
},
{
attributes: {
...blockAttrs,
Expand All @@ -412,4 +431,4 @@
}
]
} )
})( wp.i18n, wp.blocks, wp.element, wp.blockEditor, wp.components, wp.compose );
})( wp.i18n, wp.blocks, wp.element, wp.blockEditor, wp.components, wp.compose );
Loading

0 comments on commit ece7346

Please sign in to comment.