| @@ -47,13 +47,20 @@ | ||
| 47 | 47 | echo 'var win = window.dialogArguments || opener || parent || top;'; |
| 48 | 48 | echo 'if (win.visualizer) {'; |
| 49 | 49 | echo 'win.visualizer.charts.canvas.series = ', $this->series, ';'; |
| 50 | 50 | echo 'win.visualizer.charts.canvas.data = ', $this->data, ';'; |
| 51 | - echo 'win.visualizer.update();'; | |
| 51 | + if ( $this->settings ) { | |
| 52 | + echo 'win.visualizer.charts.canvas.settings = ', $this->settings, ';'; | |
| 53 | + } | |
| 54 | + echo 'win.updateChartPreview();'; | |
| 55 | + | |
| 56 | + echo $this->updateEditorAndSettings(); | |
| 57 | + | |
| 52 | 58 | echo '}'; |
| 53 | 59 | |
| 54 | - // added by Ash/Upwork | |
| 55 | - if ( VISUALIZER_PRO ) { | |
| 60 | + do_action( 'visualizer_add_update_hook', $this->series, $this->data ); | |
| 61 | + | |
| 62 | + if ( Visualizer_Module::is_pro() && Visualizer_Module::is_pro_older_than( '1.9.0' ) ) { | |
| 56 | 63 | global $Visualizer_Pro; |
| 57 | 64 | $Visualizer_Pro->_addUpdateHook( $this->series, $this->data ); |
| 58 | 65 | } |
| 59 | 66 | } else { |
| @@ -63,7 +70,24 @@ | ||
| 63 | 70 | echo '</script>'; |
| 64 | 71 | echo '</head>'; |
| 65 | 72 | echo '<body></body>'; |
| 66 | 73 | echo '</html>'; |
| 74 | + } | |
| 75 | + | |
| 76 | + | |
| 77 | + /** | |
| 78 | + * Update the hidden content in the LHS and the advanced settings | |
| 79 | + */ | |
| 80 | + private function updateEditorAndSettings() { | |
| 81 | + $editor = ''; | |
| 82 | + if ( Visualizer_Module::can_show_feature( 'simple-editor' ) ) { | |
| 83 | + ob_start(); | |
| 84 | + Visualizer_Render_Layout::show( 'simple-editor-screen', $this->id ); | |
| 85 | + $editor = ob_get_clean(); | |
| 86 | + } | |
| 87 | + | |
| 88 | + $sidebar = apply_filters( 'visualizer_get_sidebar', '', $this->id ); | |
| 89 | + | |
| 90 | + return 'win.updateHTML(' . json_encode( array( 'html' => $editor ) ) . ', ' . json_encode( array( 'html' => $sidebar ) ) . ');'; | |
| 67 | 91 | } |
| 68 | 92 | |
| 69 | 93 | } |