Page Builder: PageLayer – Drag and Drop website builder - Version 0.9.6

Version Description

(June 25, 2019) = * [Bug Fix] Undo History small fix

Download this release

Release Info

Developer pagelayer
Plugin Icon 128x128 Page Builder: PageLayer – Drag and Drop website builder
Version 0.9.6
Comparing to
See all releases

Code changes from version 0.9.5 to 0.9.6

Files changed (4) hide show
  1. init.php +1 -1
  2. js/pagelayer-editor.js +53 -16
  3. pagelayer.php +1 -1
  4. readme.txt +4 -1
init.php CHANGED
@@ -5,7 +5,7 @@ if (!defined('ABSPATH')) exit;
5
 
6
  define('PAGELAYER_BASE', plugin_basename(__FILE__));
7
  define('PAGELAYER_FILE', __FILE__);
8
- define('PAGELAYER_VERSION', '0.9.5');
9
  define('PAGELAYER_DIR', WP_PLUGIN_DIR.'/'.basename(dirname(PAGELAYER_FILE)));
10
  define('PAGELAYER_SLUG', 'pagelayer');
11
  define('PAGELAYER_URL', plugins_url('', PAGELAYER_FILE));
5
 
6
  define('PAGELAYER_BASE', plugin_basename(__FILE__));
7
  define('PAGELAYER_FILE', __FILE__);
8
+ define('PAGELAYER_VERSION', '0.9.6');
9
  define('PAGELAYER_DIR', WP_PLUGIN_DIR.'/'.basename(dirname(PAGELAYER_FILE)));
10
  define('PAGELAYER_SLUG', 'pagelayer');
11
  define('PAGELAYER_URL', plugins_url('', PAGELAYER_FILE));
js/pagelayer-editor.js CHANGED
@@ -229,11 +229,11 @@ function pagelayer_setup_drag(){
229
  if(ele_wrap.length == 1){
230
  onWrap = jQuery(ele).closest('.pagelayer-wrap-ele,.pagelayer-wrap-col');
231
  }else{
232
- onWrap = jQuery(ele).closest('.pagelayer-wrap-ele,.pagelayer-wrap-inner-row');
233
  }
234
  // For every other element, we can be over a col or ele
235
  }else{
236
- onWrap = jQuery(ele).closest('.pagelayer-wrap-ele,.pagelayer-wrap-col');
237
  }
238
  //console.log(onWrap);
239
 
@@ -2427,7 +2427,7 @@ function pagelayer_history_action_push(args){
2427
  }
2428
 
2429
  // Get current active history action id
2430
- var action_id = parseInt(pagelayer_history_obj['current_active_item_id']) || '';
2431
 
2432
  // Remove the all array element after the active array element
2433
  var del_ele = history_obj_len - action_id - 1;
@@ -2445,8 +2445,9 @@ function pagelayer_history_action_push(args){
2445
  }
2446
 
2447
  pagelayer_history_obj['action_data'].push(args);
2448
- pagelayer_history_obj['current_active_item_id'] ++;
2449
  pagelayer_history_setup();
 
2450
  }
2451
 
2452
  // Setup pagelayer history
@@ -2459,6 +2460,9 @@ function pagelayer_history_setup(force){
2459
  return;
2460
  }
2461
 
 
 
 
2462
  // pagelayer-HISTORY - Element Properties Dialog
2463
  var pagelayer_history_html = '<div class="pagelayer-history-tabs">'+
2464
  '<div class="pagelayer-history-tab" pagelayer-history-tab="actions" pagelayer-history-active-tab="1">Actions</div>'+
@@ -2470,8 +2474,6 @@ function pagelayer_history_setup(force){
2470
  // Any actions
2471
  if(pagelayer_history_obj['action_data'].length > 0){
2472
 
2473
- var current_active = pagelayer_history_obj['action_data'].length - 1 || '';
2474
-
2475
  for(var x in pagelayer_history_obj['action_data']){
2476
 
2477
  if(pagelayer_empty(pagelayer_history_obj['action_data'][x])){continue;}
@@ -2486,7 +2488,7 @@ function pagelayer_history_setup(force){
2486
  eAttr = "pagelayer-history-hidden";
2487
  }
2488
 
2489
- pagelayer_history_html += '<div class="pagelayer-history-holder '+((current_active == x) ? 'current_active_item' : '' )+' '+eAttr+'" history-action-id="'+x+'" >'+
2490
  '<div class="pagelayer-history-detail-holder">'+
2491
  '<span class="pagelayer-history-title"><b> '+title+' </b></span>'+
2492
  '<span class="pagelayer-history-subtitle"> '+subTitle+' </span>'+
@@ -2545,8 +2547,8 @@ function pagelayer_history_setup(force){
2545
  var prev_item_id = pagelayer_history_obj['current_active_item_id'];
2546
  hEle.parent().children().removeClass('current_active_item');
2547
  hEle.addClass('current_active_item');
2548
- pagelayer_history_obj['current_active_item_id'] = hEle.attr('history-action-id');
2549
- pagelayer_history_action_setup(hEle, prev_item_id);
2550
  });
2551
 
2552
  // Apply revision
@@ -2654,22 +2656,57 @@ function pagelayer_get_revision(){
2654
  // Do the history action - use for ctrl-z and ctrl-y
2655
  function pagelayer_do_history(action){
2656
 
2657
- var actions_section = pagelayer.$$('#pagelayer-history [pagelayer-show-tab="actions"]');
2658
- var current_item = actions_section.find('.pagelayer-history-holder.current_active_item');
 
 
2659
 
2660
  if(action == 'undo'){
2661
- current_item = jQuery(current_item).prevAll(":not(.pagelayer-history-hidden)").first();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2662
  }else if(action == 'redo'){
2663
- current_item = jQuery(current_item).nextAll(":not(.pagelayer-history-hidden)").first();
 
 
 
 
 
 
 
 
 
 
 
2664
  }
2665
 
2666
- current_item.click();
 
 
2667
 
2668
  };
2669
 
2670
  // Action setup handle on ctrl-z and ctrl-y
2671
- function pagelayer_history_action_setup(now_active, prev_item_id){
2672
- var current_item_id = parseInt(now_active.attr('history-action-id'));
 
 
2673
 
2674
  // Delete the element
2675
  var delete_ele = function(id){
229
  if(ele_wrap.length == 1){
230
  onWrap = jQuery(ele).closest('.pagelayer-wrap-ele,.pagelayer-wrap-col');
231
  }else{
232
+ onWrap = jQuery(ele).closest('.pagelayer-wrap-inner-row');
233
  }
234
  // For every other element, we can be over a col or ele
235
  }else{
236
+ onWrap = jQuery(ele).closest('.pagelayer-wrap-ele,.pagelayer-wrap-col,.pagelayer-wrap-inner-row');
237
  }
238
  //console.log(onWrap);
239
 
2427
  }
2428
 
2429
  // Get current active history action id
2430
+ var action_id = parseInt(pagelayer_history_obj['current_active_item_id']) || 0;
2431
 
2432
  // Remove the all array element after the active array element
2433
  var del_ele = history_obj_len - action_id - 1;
2445
  }
2446
 
2447
  pagelayer_history_obj['action_data'].push(args);
2448
+ pagelayer_history_obj['current_active_item_id'] = pagelayer_history_obj['action_data'].length - 1;
2449
  pagelayer_history_setup();
2450
+
2451
  }
2452
 
2453
  // Setup pagelayer history
2460
  return;
2461
  }
2462
 
2463
+ // The current active action id
2464
+ var current_id = pagelayer_history_obj['current_active_item_id'];
2465
+
2466
  // pagelayer-HISTORY - Element Properties Dialog
2467
  var pagelayer_history_html = '<div class="pagelayer-history-tabs">'+
2468
  '<div class="pagelayer-history-tab" pagelayer-history-tab="actions" pagelayer-history-active-tab="1">Actions</div>'+
2474
  // Any actions
2475
  if(pagelayer_history_obj['action_data'].length > 0){
2476
 
 
 
2477
  for(var x in pagelayer_history_obj['action_data']){
2478
 
2479
  if(pagelayer_empty(pagelayer_history_obj['action_data'][x])){continue;}
2488
  eAttr = "pagelayer-history-hidden";
2489
  }
2490
 
2491
+ pagelayer_history_html += '<div class="pagelayer-history-holder '+((current_id == x) ? 'current_active_item' : '' )+' '+eAttr+'" history-action-id="'+x+'" >'+
2492
  '<div class="pagelayer-history-detail-holder">'+
2493
  '<span class="pagelayer-history-title"><b> '+title+' </b></span>'+
2494
  '<span class="pagelayer-history-subtitle"> '+subTitle+' </span>'+
2547
  var prev_item_id = pagelayer_history_obj['current_active_item_id'];
2548
  hEle.parent().children().removeClass('current_active_item');
2549
  hEle.addClass('current_active_item');
2550
+ var do_item_id = parseInt(hEle.attr('history-action-id'));
2551
+ pagelayer_history_action_setup(do_item_id, prev_item_id);
2552
  });
2553
 
2554
  // Apply revision
2656
  // Do the history action - use for ctrl-z and ctrl-y
2657
  function pagelayer_do_history(action){
2658
 
2659
+ var cur_id = pagelayer_history_obj['current_active_item_id'];
2660
+ var new_id = cur_id;
2661
+ var action_data_len = pagelayer_history_obj['action_data'].length;
2662
+
2663
 
2664
  if(action == 'undo'){
2665
+
2666
+ // You cannot undo from the first movement
2667
+ if(cur_id == 0){
2668
+ return true;
2669
+ }
2670
+
2671
+ for(var i = (cur_id - 1); i => 0; i--){
2672
+
2673
+ var action = pagelayer_history_obj['action_data'][i];
2674
+
2675
+ if('attrType' in action && action['attrType'] == 'tmp_attr'){
2676
+ continue;
2677
+ }
2678
+
2679
+ new_id = i;
2680
+ break;
2681
+
2682
+ }
2683
+
2684
  }else if(action == 'redo'){
2685
+ for(var i = cur_id + 1; i < action_data_len; i++){
2686
+
2687
+ var action = pagelayer_history_obj['action_data'][i];
2688
+
2689
+ if('attrType' in action && action['attrType'] == 'tmp_attr'){
2690
+ continue;
2691
+ }
2692
+
2693
+ new_id = i;
2694
+ break;
2695
+
2696
+ }
2697
  }
2698
 
2699
+ // Do the action
2700
+ pagelayer_history_action_setup(new_id, cur_id);
2701
+ pagelayer_history_setup();
2702
 
2703
  };
2704
 
2705
  // Action setup handle on ctrl-z and ctrl-y
2706
+ function pagelayer_history_action_setup(current_item_id, prev_item_id){
2707
+
2708
+ // Set this as the current active
2709
+ pagelayer_history_obj['current_active_item_id'] = current_item_id;
2710
 
2711
  // Delete the element
2712
  var delete_ele = function(id){
pagelayer.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: PageLayer
4
  Plugin URI: http://wordpress.org/plugins/pagelayer/
5
  Description: PageLayer is a WordPress page builder plugin. Its very easy to use and very light on the browser.
6
- Version: 0.9.5
7
  Author: Pagelayer Team
8
  Author URI: https://pagelayer.com/
9
  License: LGPL v2.1
3
  Plugin Name: PageLayer
4
  Plugin URI: http://wordpress.org/plugins/pagelayer/
5
  Description: PageLayer is a WordPress page builder plugin. Its very easy to use and very light on the browser.
6
+ Version: 0.9.6
7
  Author: Pagelayer Team
8
  Author URI: https://pagelayer.com/
9
  License: LGPL v2.1
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: page builder, editor, landing page, drag-and-drop, pagelayer, softaculous,
4
  Requires at least: 4.7
5
  Tested up to: 5.2
6
  Requires PHP: 5.2.4
7
- Stable tag: 0.9.5
8
  License: LGPL v2.1
9
  License URI: http://www.gnu.org/licenses/lgpl-2.1.html
10
 
@@ -113,6 +113,9 @@ Do you have questions related to PageLayer ? Use the following links :
113
 
114
  == Changelog ==
115
 
 
 
 
116
  = 0.9.5 (June 21, 2019) =
117
  * [Feature] Added revision control
118
  * [Feature] Added the ability to manage actions while editing i.e. undo and redo
4
  Requires at least: 4.7
5
  Tested up to: 5.2
6
  Requires PHP: 5.2.4
7
+ Stable tag: 0.9.6
8
  License: LGPL v2.1
9
  License URI: http://www.gnu.org/licenses/lgpl-2.1.html
10
 
113
 
114
  == Changelog ==
115
 
116
+ = 0.9.6 (June 25, 2019) =
117
+ * [Bug Fix] Undo History small fix
118
+
119
  = 0.9.5 (June 21, 2019) =
120
  * [Feature] Added revision control
121
  * [Feature] Added the ability to manage actions while editing i.e. undo and redo