Skip to content

Commit

Permalink
chore: add temp save under debug flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Soare-Robert-Daniel committed Jul 18, 2023
1 parent 0d0e374 commit c6e6d0e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
29 changes: 29 additions & 0 deletions inc/class-registration.php
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,10 @@ function() {
),
)
);

if ( Pro::is_pro_active() ) {
add_action( 'wp_footer', array( $this, 'test_add_temp_save' ) );
}
}

if ( ! self::$scripts_loaded['google-map'] && has_block( 'themeisle-blocks/google-map', $post ) ) {
Expand Down Expand Up @@ -962,6 +966,31 @@ public static function sticky_style() {
echo '<style id="o-sticky-inline-css">.o-sticky.o-sticky-float { height: 0px; } </style>';
}

/**
* Add inline script for temporary save mode.
*
* @static
* @access public
*/
public static function test_add_temp_save() {

/**
* In this function we add a script that will activate the temporary save mode.
* This will be for the Pro users. This will be removed in the future and moved to the Pro plugin.
*/

if ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) {
return;
}

echo "<script id='o-tmp-save'>
window.activateTempSave = () => {
saveMode = 'temporary';
console.log( 'Temporary save mode activated' );
};
</script>";
}

/**
* Get the content of all active widgets.
*
Expand Down
7 changes: 0 additions & 7 deletions src/blocks/frontend/form/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -600,10 +600,3 @@ domReady( () => {
});
});
});


window.activateTempSave = () => {
saveMode = 'temporary';
console.log( 'Temporary save mode activated' );
};

0 comments on commit c6e6d0e

Please sign in to comment.