| @@ -7,8 +7,10 @@ | ||
| 7 | 7 | * @author Tobias Bäthge |
| 8 | 8 | * @since 1.0.0 |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | +declare(strict_types=1); | |
| 12 | + | |
| 11 | 13 | // Prohibit direct script loading. |
| 12 | 14 | defined( 'ABSPATH' ) || die( 'No direct script access allowed!' ); |
| 13 | 15 | |
| 14 | 16 | /** |
| @@ -26,9 +28,9 @@ | ||
| 26 | 28 | * |
| 27 | 29 | * @since 2.0.0 |
| 28 | 30 | * @var string[] |
| 29 | 31 | */ |
| 30 | - protected array $wp_pointers = array( 'tp20_edit_context_menu', 'tp33_edit_quick_navigation' ); | |
| 32 | + protected array $wp_pointers = array( 'tp34_edit_toolbar', 'tp33_edit_quick_navigation' ); | |
| 31 | 33 | |
| 32 | 34 | /** |
| 33 | 35 | * Sets up the view with data and do things that are specific for this view. |
| 34 | 36 | * |
| @@ -82,9 +84,8 @@ | ||
| 82 | 84 | $this->add_text_box( 'head', array( $this, 'textbox_head' ), 'normal' ); |
| 83 | 85 | $this->add_text_box( 'header-bar', array( $this, 'textbox_header_bar' ), 'normal' ); |
| 84 | 86 | $this->add_meta_box( 'table-information', __( 'Table Information', 'tablepress' ), array( $this, 'postbox_table_information' ), 'normal' ); |
| 85 | 87 | $this->add_meta_box( 'table-data', __( 'Table Content', 'tablepress' ), array( $this, 'postbox_table_data' ), 'normal' ); |
| 86 | - $this->add_meta_box( 'table-manipulation', __( 'Table Manipulation', 'tablepress' ), array( $this, 'postbox_table_manipulation' ), 'normal' ); | |
| 87 | 88 | $this->add_meta_box( 'table-options', __( 'Table Options', 'tablepress' ), array( $this, 'postbox_table_options' ), 'normal' ); |
| 88 | 89 | $this->add_meta_box( 'datatables-features', __( 'Table Features for Site Visitors', 'tablepress' ), array( $this, 'postbox_datatables_features' ), 'normal' ); |
| 89 | 90 | $this->add_text_box( 'hidden-containers', array( $this, 'textbox_hidden_containers' ), 'additional' ); |
| 90 | 91 | |
| @@ -159,8 +160,9 @@ | ||
| 159 | 160 | $this->print_nav_tab_menu(); |
| 160 | 161 | ?> |
| 161 | 162 | <div id="tablepress-body"> |
| 162 | 163 | <hr class="wp-header-end"> |
| 164 | + <script>document.querySelectorAll('.notice:has(~#tablepress-page)').forEach(e=>document.querySelector('.wp-header-end').after(e));</script> | |
| 163 | 165 | <?php |
| 164 | 166 | // Print all header messages. |
| 165 | 167 | foreach ( $this->header_messages as $message ) { |
| 166 | 168 | echo $message; |
| @@ -315,8 +317,9 @@ | ||
| 315 | 317 | * @param array<string, mixed> $data Data for this screen. |
| 316 | 318 | * @param array<string, mixed> $box Information about the meta box. |
| 317 | 319 | */ |
| 318 | 320 | public function postbox_table_data( array $data, array $box ): void { |
| 321 | + echo '<div id="tablepress-table-editor-toolbar-section"></div>'; | |
| 319 | 322 | $css_variables = '--table-editor-line-clamp:' . absint( TablePress::$model_options->get( 'table_editor_line_clamp' ) ) . ';'; |
| 320 | 323 | $css_variables = esc_attr( $css_variables ); |
| 321 | 324 | echo "<div id=\"table-editor\" style=\"{$css_variables}\"></div>"; |
| 322 | 325 | } |
| @@ -321,20 +324,8 @@ | ||
| 321 | 324 | echo "<div id=\"table-editor\" style=\"{$css_variables}\"></div>"; |
| 322 | 325 | } |
| 323 | 326 | |
| 324 | 327 | /** |
| 325 | - * Prints the content of the "Table Manipulation" post meta box. | |
| 326 | - * | |
| 327 | - * @since 1.0.0 | |
| 328 | - * | |
| 329 | - * @param array<string, mixed> $data Data for this screen. | |
| 330 | - * @param array<string, mixed> $box Information about the meta box. | |
| 331 | - */ | |
| 332 | - public function postbox_table_manipulation( array $data, array $box ): void { | |
| 333 | - echo '<div id="tablepress-table-manipulation-section"></div>'; | |
| 334 | - } | |
| 335 | - | |
| 336 | - /** | |
| 337 | 328 | * Prints the container for the sticky "Header Bar". |
| 338 | 329 | * |
| 339 | 330 | * @since 3.3.0 |
| 340 | 331 | * |
| @@ -342,16 +333,8 @@ | ||
| 342 | 333 | * @param array<string, mixed> $box Information about the text box. |
| 343 | 334 | */ |
| 344 | 335 | public function textbox_header_bar( array $data, array $box ): void { |
| 345 | 336 | echo '<div id="tablepress-header-bar-section" class="section-has-react-loading-text">'; |
| 346 | - if ( tb_tp_fs()->is_plan_or_trial__premium_only( 'pro' ) ) { | |
| 347 | - echo '<div class="react-loading-text" style="line-height:36px;font-weight:bold">'; | |
| 348 | - printf( | |
| 349 | - __( 'The page is being loaded. If this text does not disappear soon, <a href="%1$s">click here to reload the page.</a>', 'tablepress' ), | |
| 350 | - esc_url( TablePress::url( array( 'action' => 'edit', 'table_id' => $data['table']['id'], 'refresh_table_options' => 'true' ) ) ), | |
| 351 | - ); | |
| 352 | - echo '</div>'; | |
| 353 | - } | |
| 354 | 337 | echo '</div>'; |
| 355 | 338 | } |
| 356 | 339 | |
| 357 | 340 | /** |
| @@ -417,9 +400,9 @@ | ||
| 417 | 400 | * @param array<string, mixed> $box Information about the text box. |
| 418 | 401 | */ |
| 419 | 402 | public function textbox_corrupted_table( array $data, array $box ): void { |
| 420 | 403 | ?> |
| 421 | - <div class="notice components-notice is-error"> | |
| 404 | + <div class="notice components-notice is-error notice-error"> | |
| 422 | 405 | <div class="components-notice__content"> |
| 423 | 406 | <h3><em> |
| 424 | 407 | <?php _e( 'Attention: Unfortunately, an error occurred.', 'tablepress' ); ?> |
| 425 | 408 | </em></h3> |
| @@ -471,22 +454,23 @@ | ||
| 471 | 454 | echo '</p>'; |
| 472 | 455 | } |
| 473 | 456 | |
| 474 | 457 | /** |
| 475 | - * Sets the content for the WP feature pointer about the drag and drop and sort on the "Edit" screen. | |
| 458 | + * Sets the content for the WP feature pointer about the Table Editor Toolbar on the "Edit" screen. | |
| 476 | 459 | * |
| 477 | - * @since 2.0.0 | |
| 460 | + * @since 3.4.0 | |
| 478 | 461 | */ |
| 479 | - public function wp_pointer_tp20_edit_context_menu(): void { | |
| 480 | - $content = '<h3>' . __( 'TablePress feature: Context menu', 'tablepress' ) . '</h3>'; | |
| 481 | - $content .= '<p>' . __( 'Did you know?', 'tablepress' ) . ' ' . __( 'Right-clicking the table content fields will open a context menu for quick access to common editing tools.', 'tablepress' ) . '</p>'; | |
| 462 | + public function wp_pointer_tp34_edit_toolbar(): void { | |
| 463 | + $content = '<h3>' . __( 'TablePress feature: Toolbar', 'tablepress' ) . '</h3>'; | |
| 464 | + $content .= '<p style="text-wrap:balance">' . __( 'Adding links or images or modifying the structure of your tables is very easy with the sticky Table Editor Toolbar!', 'tablepress' ) . '</p>'; | |
| 482 | 465 | |
| 483 | 466 | $this->print_wp_pointer_js( |
| 484 | - 'tp20_edit_context_menu', | |
| 485 | - '#table-editor', | |
| 467 | + 'tp34_edit_toolbar', | |
| 468 | + '#tablepress-table-editor-toolbar-section > div > div > div:first-child', | |
| 486 | 469 | array( |
| 487 | - 'content' => $content, | |
| 488 | - 'position' => array( 'edge' => 'bottom', 'align' => 'center' ), | |
| 470 | + 'content' => $content, | |
| 471 | + 'position' => array( 'edge' => is_rtl() ? 'right' : 'left', 'align' => 'center' ), | |
| 472 | + 'pointerWidth' => 290, | |
| 489 | 473 | ), |
| 490 | 474 | ); |
| 491 | 475 | } |
| 492 | 476 | |