Page Builder by SiteOrigin - Version 2.9.6

Version Description

  • 10 December 2018 =
  • Default to Page Builder interface for post types set to use Page Builder in Settings.
  • Add check for WooCommerce 'product' type to prevent output of 'Add New' dropdown.
Download this release

Release Info

Developer gpriday
Plugin Icon 128x128 Page Builder by SiteOrigin
Version 2.9.6
Comparing to
See all releases

Code changes from version 2.9.5 to 2.9.6

compat/js/siteorigin-panels-layout-block.js CHANGED
@@ -9,7 +9,7 @@
9
  var __ = i18n.__;
10
 
11
  blocks.registerBlockType( 'siteorigin-panels/layout-block', {
12
- title: __( 'SiteOrigin Layout (in beta)', 'siteorigin-panels' ),
13
 
14
  description: __( "Build a layout using SiteOrigin's Page Builder.", 'siteorigin-panels' ),
15
 
9
  var __ = i18n.__;
10
 
11
  blocks.registerBlockType( 'siteorigin-panels/layout-block', {
12
+ title: __( 'SiteOrigin Layout', 'siteorigin-panels' ),
13
 
14
  description: __( "Build a layout using SiteOrigin's Page Builder.", 'siteorigin-panels' ),
15
 
compat/js/siteorigin-panels-layout-block.min.js CHANGED
@@ -1 +1 @@
1
- !function(e,t,n,i,o,a){var l=i.createElement,r=e.BlockControls,s=a.withState,d=o.Toolbar,p=o.IconButton,u=o.Spinner,c=n.__;t.registerBlockType("siteorigin-panels/layout-block",{title:c("SiteOrigin Layout (in beta)","siteorigin-panels"),description:c("Build a layout using SiteOrigin's Page Builder.","siteorigin-panels"),icon:function(){return l("span",{className:"siteorigin-panels-block-icon"})},category:"layout",supports:{html:!1},attributes:{panelsData:{type:"object"}},edit:s({editing:!1,panelsInitialized:!1,loadingPreview:!1,previewInitialized:!1,previewHtml:""})(function(s){if(s.editing||!s.attributes.panelsData)return[l(r,{key:"controls"},l(d,null,l(p,{className:"components-icon-button components-toolbar__control",label:c("Preview layout.","siteorigin-panels"),onClick:function(){s.attributes.panelsData&&s.setState({editing:!1,previewInitialized:!1})},icon:"visibility"}))),l("div",{key:"pageBuilder",className:"siteorigin-panels-layout-block-container",ref:function(e){if(!s.panelsInitialized){var t=jQuery(e),n=new panels.model.builder,i=new panels.view.builder({model:n,config:{editorType:"standalone"}}),o=JSON.parse(JSON.stringify($.extend({},s.attributes.panelsData)));function a(){s.toggleSelection(!1),$(document).on("mouseup",function e(){s.toggleSelection(!0),$(document).off("mouseup",e)})}i.on("row_added",function(){i.$(".so-row-move").off("mousedown",a),i.$(".so-row-move").on("mousedown",a),i.$(".so-widget").off("mousedown",a),i.$(".so-widget").on("mousedown",a)}),i.on("widget_added",function(){i.$(".so-widget").off("mousedown",a),i.$(".so-widget").on("mousedown",a)}),i.render().attach({container:t}).setData(o),i.trigger("builder_resize"),i.on("content_change",function(){s.setAttributes({panelsData:i.getData()}),s.setState({previewInitialized:!1,previewHtml:""})}),$(document).trigger("panels_setup",i),s.setState({editing:!0,panelsInitialized:!0})}}})];var e=!s.editing&&!s.previewHtml&&s.attributes.panelsData;e&&$.post({url:soPanelsBlockEditorAdmin.previewUrl,data:{action:"so_panels_block_editor_preview",panelsData:JSON.stringify(s.attributes.panelsData)}}).then(function(e){s.setState({previewHtml:e,loadingPreview:!1})});var t=s.previewHtml?s.previewHtml:"";return[l(r,{key:"controls"},l(d,null,l(p,{className:"components-icon-button components-toolbar__control",label:c("Edit layout.","siteorigin-panels"),onClick:function(){s.setState({editing:!0,panelsInitialized:!1})},icon:"edit"}))),l("div",{key:"preview",className:"so-panels-block-layout-preview-container"},e?l("div",{className:"so-panels-spinner-container"},l("span",null,l(u))):l("div",{dangerouslySetInnerHTML:{__html:t},ref:function(){s.editing||($(document).trigger("panels_setup_preview"),window.sowb&&$(window.sowb).trigger("setup_widgets"))}}))]}),save:function(){return null}})}(window.wp.editor,window.wp.blocks,window.wp.i18n,window.wp.element,window.wp.components,window.wp.compose);
1
+ !function(e,t,n,i,o,a){var l=i.createElement,r=e.BlockControls,s=a.withState,d=o.Toolbar,p=o.IconButton,u=o.Spinner,c=n.__;t.registerBlockType("siteorigin-panels/layout-block",{title:c("SiteOrigin Layout","siteorigin-panels"),description:c("Build a layout using SiteOrigin's Page Builder.","siteorigin-panels"),icon:function(){return l("span",{className:"siteorigin-panels-block-icon"})},category:"layout",supports:{html:!1},attributes:{panelsData:{type:"object"}},edit:s({editing:!1,panelsInitialized:!1,loadingPreview:!1,previewInitialized:!1,previewHtml:""})(function(s){if(s.editing||!s.attributes.panelsData)return[l(r,{key:"controls"},l(d,null,l(p,{className:"components-icon-button components-toolbar__control",label:c("Preview layout.","siteorigin-panels"),onClick:function(){s.attributes.panelsData&&s.setState({editing:!1,previewInitialized:!1})},icon:"visibility"}))),l("div",{key:"pageBuilder",className:"siteorigin-panels-layout-block-container",ref:function(e){if(!s.panelsInitialized){var t=jQuery(e),n=new panels.model.builder,i=new panels.view.builder({model:n,config:{editorType:"standalone"}}),o=JSON.parse(JSON.stringify($.extend({},s.attributes.panelsData)));function a(){s.toggleSelection(!1),$(document).on("mouseup",function e(){s.toggleSelection(!0),$(document).off("mouseup",e)})}i.on("row_added",function(){i.$(".so-row-move").off("mousedown",a),i.$(".so-row-move").on("mousedown",a),i.$(".so-widget").off("mousedown",a),i.$(".so-widget").on("mousedown",a)}),i.on("widget_added",function(){i.$(".so-widget").off("mousedown",a),i.$(".so-widget").on("mousedown",a)}),i.render().attach({container:t}).setData(o),i.trigger("builder_resize"),i.on("content_change",function(){s.setAttributes({panelsData:i.getData()}),s.setState({previewInitialized:!1,previewHtml:""})}),$(document).trigger("panels_setup",i),s.setState({editing:!0,panelsInitialized:!0})}}})];var e=!s.editing&&!s.previewHtml&&s.attributes.panelsData;e&&$.post({url:soPanelsBlockEditorAdmin.previewUrl,data:{action:"so_panels_block_editor_preview",panelsData:JSON.stringify(s.attributes.panelsData)}}).then(function(e){s.setState({previewHtml:e,loadingPreview:!1})});var t=s.previewHtml?s.previewHtml:"";return[l(r,{key:"controls"},l(d,null,l(p,{className:"components-icon-button components-toolbar__control",label:c("Edit layout.","siteorigin-panels"),onClick:function(){s.setState({editing:!0,panelsInitialized:!1})},icon:"edit"}))),l("div",{key:"preview",className:"so-panels-block-layout-preview-container"},e?l("div",{className:"so-panels-spinner-container"},l("span",null,l(u))):l("div",{dangerouslySetInnerHTML:{__html:t},ref:function(){s.editing||($(document).trigger("panels_setup_preview"),window.sowb&&$(window.sowb).trigger("setup_widgets"))}}))]}),save:function(){return null}})}(window.wp.editor,window.wp.blocks,window.wp.i18n,window.wp.element,window.wp.components,window.wp.compose);
inc/admin.php CHANGED
@@ -1242,22 +1242,34 @@ class SiteOrigin_Panels_Admin {
1242
  */
1243
  public function show_classic_editor_for_panels( $use_block_editor, $post_type ) {
1244
 
1245
- if ( isset( $_GET['siteorigin-page-builder'] ) ) {
 
 
 
1246
  return false;
1247
  }
1248
 
1249
- if ( function_exists( 'get_current_screen' ) ) {
1250
- $screen = get_current_screen();
1251
- $panels_data = $screen->base == 'post' ? $this->get_current_admin_panels_data() : array();
 
 
 
 
 
 
 
 
 
 
 
1252
  } else {
1253
- // Fall back to just checking the global $post for 'panels_data' metadata.
1254
- global $post;
1255
- $panels_data = empty( $post ) ? array() : get_post_meta( $post->ID, 'panels_data', true );
1256
  }
1257
- $post_types = siteorigin_panels_setting( 'post-types' );
1258
- $is_panels_page = in_array( $post_type, $post_types ) && ! empty( $panels_data );
1259
 
1260
- return empty( $is_panels_page ) && $use_block_editor;
1261
  }
1262
 
1263
  /**
@@ -1279,7 +1291,9 @@ class SiteOrigin_Panels_Admin {
1279
  <?php
1280
  }
1281
 
1282
- if ( ! in_array( $typenow, siteorigin_panels_setting( 'post-types' ) ) ) {
 
 
1283
  return;
1284
  }
1285
 
@@ -1377,12 +1391,13 @@ class SiteOrigin_Panels_Admin {
1377
  var url = button.href;
1378
  var urlHasParams = ( -1 !== url.indexOf( '?' ) );
1379
  var panelsUrl = url + ( urlHasParams ? '&' : '?' ) + 'siteorigin-page-builder';
 
1380
 
1381
  var newbutton = '<span id="split-page-title-action" class="split-page-title-action">';
1382
  newbutton += '<a href="' + url + '">' + button.innerText + '</a>';
1383
  newbutton += '<span class="expander" tabindex="0" role="button" aria-haspopup="true" aria-label="<?php echo esc_attr( __( 'Toggle editor selection menu', 'siteorigin-panels' ) ); ?>"></span>';
1384
  newbutton += '<span class="dropdown"><a href="' + panelsUrl + '"><?php echo esc_html( __( 'SiteOrigin Page Builder', 'siteorigin-panels' ) ); ?></a>';
1385
- newbutton += '<a href="' + url + '"><?php echo esc_html( __( 'Block Editor', 'siteorigin-panels' ) ); ?></a></span></span><span class="page-title-action" style="display:none;"></span>';
1386
 
1387
  button.insertAdjacentHTML( 'afterend', newbutton );
1388
  button.parentNode.removeChild( button );
1242
  */
1243
  public function show_classic_editor_for_panels( $use_block_editor, $post_type ) {
1244
 
1245
+ // For new pages.
1246
+ if ( isset( $_GET['block-editor'] ) ) {
1247
+ return $use_block_editor;
1248
+ } else if ( isset( $_GET['siteorigin-page-builder'] ) ) {
1249
  return false;
1250
  }
1251
 
1252
+ // If the `$post_type` is set to be used by Page Builder.
1253
+ $post_types = siteorigin_panels_setting( 'post-types' );
1254
+ $is_panels_type = in_array( $post_type, $post_types );
1255
+
1256
+ // For existing posts.
1257
+ global $post;
1258
+ if ( ! empty( $post ) ) {
1259
+ // If the post has blocks just allow `$use_block_editor` to decide.
1260
+ if ( ! has_blocks( $post ) ) {
1261
+ $panels_data = get_post_meta( $post->ID, 'panels_data', true );
1262
+ if ( ! empty( $panels_data ) || $is_panels_type ) {
1263
+ $use_block_editor = false;
1264
+ }
1265
+ }
1266
  } else {
1267
+ if ( $is_panels_type ){
1268
+ $use_block_editor = false;
1269
+ }
1270
  }
 
 
1271
 
1272
+ return $use_block_editor;
1273
  }
1274
 
1275
  /**
1291
  <?php
1292
  }
1293
 
1294
+ if ( ! in_array( $typenow, siteorigin_panels_setting( 'post-types' ) ) ||
1295
+ // WooCommerce product type doesn't support block editor...
1296
+ ( class_exists( 'WooCommerce' ) && $typenow == 'product' ) ) {
1297
  return;
1298
  }
1299
 
1391
  var url = button.href;
1392
  var urlHasParams = ( -1 !== url.indexOf( '?' ) );
1393
  var panelsUrl = url + ( urlHasParams ? '&' : '?' ) + 'siteorigin-page-builder';
1394
+ var blockEditorUrl = url + ( urlHasParams ? '&' : '?' ) + 'block-editor';
1395
 
1396
  var newbutton = '<span id="split-page-title-action" class="split-page-title-action">';
1397
  newbutton += '<a href="' + url + '">' + button.innerText + '</a>';
1398
  newbutton += '<span class="expander" tabindex="0" role="button" aria-haspopup="true" aria-label="<?php echo esc_attr( __( 'Toggle editor selection menu', 'siteorigin-panels' ) ); ?>"></span>';
1399
  newbutton += '<span class="dropdown"><a href="' + panelsUrl + '"><?php echo esc_html( __( 'SiteOrigin Page Builder', 'siteorigin-panels' ) ); ?></a>';
1400
+ newbutton += '<a href="' + blockEditorUrl + '"><?php echo esc_html( __( 'Block Editor', 'siteorigin-panels' ) ); ?></a></span></span><span class="page-title-action" style="display:none;"></span>';
1401
 
1402
  button.insertAdjacentHTML( 'afterend', newbutton );
1403
  button.parentNode.removeChild( button );
js/{siteorigin-panels-295.js → siteorigin-panels-296.js} RENAMED
File without changes
js/{siteorigin-panels-295.min.js → siteorigin-panels-296.min.js} RENAMED
File without changes
js/{styling-295.js → styling-296.js} RENAMED
File without changes
js/{styling-295.min.js → styling-296.min.js} RENAMED
File without changes
lang/siteorigin-panels.pot CHANGED
@@ -475,15 +475,15 @@ msgstr ""
475
  msgid "Get premium email support for SiteOrigin Page Builder"
476
  msgstr ""
477
 
478
- #: inc/admin.php:1383
479
  msgid "Toggle editor selection menu"
480
  msgstr ""
481
 
482
- #: inc/admin.php:1384, inc/admin.php:1414, inc/settings.php:196, settings/tpl/settings.php:9
483
  msgid "SiteOrigin Page Builder"
484
  msgstr ""
485
 
486
- #: inc/admin.php:1385
487
  msgid "Block Editor"
488
  msgstr ""
489
 
475
  msgid "Get premium email support for SiteOrigin Page Builder"
476
  msgstr ""
477
 
478
+ #: inc/admin.php:1398
479
  msgid "Toggle editor selection menu"
480
  msgstr ""
481
 
482
+ #: inc/admin.php:1399, inc/admin.php:1429, inc/settings.php:196, settings/tpl/settings.php:9
483
  msgid "SiteOrigin Page Builder"
484
  msgstr ""
485
 
486
+ #: inc/admin.php:1400
487
  msgid "Block Editor"
488
  msgstr ""
489
 
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Page Builder by SiteOrigin ===
2
  Tags: page builder, responsive, widget, widgets, builder, page, admin, gallery, content, cms, pages, post, css, layout, grid
3
  Requires at least: 4.4
4
- Tested up to: 4.9
5
- Stable tag: 2.9.5
6
- Build time: 2018-12-06T23:34:37-08:00
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl.html
9
  Donate link: https://siteorigin.com/downloads/contribution/
@@ -96,6 +96,10 @@ We've tried to ensure that Page Builder is compatible with most plugin widgets.
96
 
97
  == Changelog ==
98
 
 
 
 
 
99
  = 2.9.5 - 6 December 2018 =
100
  * Layout block: Default to preview state if block has panels data.
101
  * Dropdown for 'Add New' with SiteOrigin Page Builder as an option.
1
  === Page Builder by SiteOrigin ===
2
  Tags: page builder, responsive, widget, widgets, builder, page, admin, gallery, content, cms, pages, post, css, layout, grid
3
  Requires at least: 4.4
4
+ Tested up to: 5.0
5
+ Stable tag: 2.9.6
6
+ Build time: 2018-12-10T13:39:14-08:00
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl.html
9
  Donate link: https://siteorigin.com/downloads/contribution/
96
 
97
  == Changelog ==
98
 
99
+ = 2.9.6 - 10 December 2018 =
100
+ * Default to Page Builder interface for post types set to use Page Builder in Settings.
101
+ * Add check for WooCommerce 'product' type to prevent output of 'Add New' dropdown.
102
+
103
  = 2.9.5 - 6 December 2018 =
104
  * Layout block: Default to preview state if block has panels data.
105
  * Dropdown for 'Add New' with SiteOrigin Page Builder as an option.
siteorigin-panels.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Page Builder by SiteOrigin
4
  Plugin URI: https://siteorigin.com/page-builder/
5
  Description: A drag and drop, responsive page builder that simplifies building your website.
6
- Version: 2.9.5
7
  Author: SiteOrigin
8
  Author URI: https://siteorigin.com
9
  License: GPL3
@@ -11,12 +11,12 @@ License URI: http://www.gnu.org/licenses/gpl.html
11
  Donate link: http://siteorigin.com/page-builder/#donate
12
  */
13
 
14
- define( 'SITEORIGIN_PANELS_VERSION', '2.9.5' );
15
  if ( ! defined( 'SITEORIGIN_PANELS_JS_SUFFIX' ) ) {
16
  define( 'SITEORIGIN_PANELS_JS_SUFFIX', '.min' );
17
  }
18
  define( 'SITEORIGIN_PANELS_CSS_SUFFIX', '.min' );
19
- define( 'SITEORIGIN_PANELS_VERSION_SUFFIX', '-295' );
20
 
21
  require_once plugin_dir_path( __FILE__ ) . 'inc/functions.php';
22
 
3
  Plugin Name: Page Builder by SiteOrigin
4
  Plugin URI: https://siteorigin.com/page-builder/
5
  Description: A drag and drop, responsive page builder that simplifies building your website.
6
+ Version: 2.9.6
7
  Author: SiteOrigin
8
  Author URI: https://siteorigin.com
9
  License: GPL3
11
  Donate link: http://siteorigin.com/page-builder/#donate
12
  */
13
 
14
+ define( 'SITEORIGIN_PANELS_VERSION', '2.9.6' );
15
  if ( ! defined( 'SITEORIGIN_PANELS_JS_SUFFIX' ) ) {
16
  define( 'SITEORIGIN_PANELS_JS_SUFFIX', '.min' );
17
  }
18
  define( 'SITEORIGIN_PANELS_CSS_SUFFIX', '.min' );
19
+ define( 'SITEORIGIN_PANELS_VERSION_SUFFIX', '-296' );
20
 
21
  require_once plugin_dir_path( __FILE__ ) . 'inc/functions.php';
22