Skip to content

Commit 88015a9

Browse files
Add classic editor and block editor support Codeinwp/visualizer-pro#343
1 parent 2755455 commit 88015a9

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

classes/Visualizer/Module/Wizard.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,17 @@ private function setup_wizard_create_draft_page( $return_page_id = false ) {
282282
)
283283
);
284284
}
285+
if ( function_exists( 'use_block_editor_for_post_type' ) && use_block_editor_for_post_type( 'page' ) ) {
286+
$this->wizard_data = get_option( self::OPTION_NAME, array() );
287+
if ( ! empty( $this->wizard_data['chart_id'] ) ) {
288+
$block_data = array(
289+
'id' => $this->wizard_data['chart_id'],
290+
'lazy' => '-1',
291+
'route' => 'chartSelect',
292+
);
293+
$basic_shortcode = '<!-- wp:visualizer/chart ' . wp_json_encode( $block_data ) . ' /-->';
294+
}
295+
}
285296
$post_title = __( 'Visualizer Demo Page', 'visualizer' );
286297
$page_id = post_exists( $post_title, '', '', 'page' );
287298
$args = array(

css/style-wizard.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,6 +1198,9 @@ display: none;
11981198
background: #39C3D2;
11991199
transition: all .3s ease-in-out;
12001200
}
1201+
.vz-chart-list .slick-arrow[disabled="disabled"], .vz-chart-list .slick-arrow[aria-disabled="true"] {
1202+
color: #eeeeee
1203+
}
12011204

12021205
@media (max-width: 767px){
12031206
.wp-toolbar .vz-wizard-fullscreen{margin-top: 0;}

js/setup-wizard.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,5 +291,19 @@ jQuery(function ($) {
291291
slidesToShow: 1,
292292
centerMode: false,
293293
variableWidth: true
294-
});
294+
})
295+
.on( 'afterChange', function(event, slick, currentSlide) {
296+
// Disable next buttion.
297+
if( currentSlide === 4 ) {
298+
$('.slick-next').attr('disabled', true).css('pointer-events', 'none');
299+
} else {
300+
$('.slick-next').removeAttr('disabled').css('pointer-events', 'all');
301+
}
302+
// Disable prev buttion.
303+
if( currentSlide === 0 ) {
304+
$('.slick-prev').attr('disabled', true).css('pointer-events', 'none');
305+
} else {
306+
$('.slick-prev').removeAttr('disabled').css('pointer-events', 'all');
307+
}
308+
} );
295309
});

0 commit comments

Comments
 (0)