PluginProbe
TablePress – Tables in WordPress made easy / 3.0
TablePress – Tables in WordPress made easy v3.0
3.3.4 3.3.3 3.3.2 3.3.1 trunk 1.12 1.14 1.9.2 2.0.4 2.1.7 2.1.8 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3 2.3.1 2.3.2 2.4 2.4.1 2.4.2 2.4.3 2.4.4 All 44 releases
← All changes | views/view-edit.php +120 -104 trunk3.0 View file →
@@ -26,9 +26,9 @@
26 26 *
27 27 * @since 2.0.0
28 28 * @var string[]
29 29 */
30 - protected array $wp_pointers = array( 'tp20_edit_context_menu', 'tp33_edit_quick_navigation' );
30 + protected array $wp_pointers = array( 'tp20_edit_context_menu', 'tp21_edit_screen_options' );
31 31
32 32 /**
33 33 * Sets up the view with data and do things that are specific for this view.
34 34 *
@@ -42,10 +42,8 @@
42 42 // Don't use type hints in the method declaration to prevent PHP errors, as the method is inherited.
43 43
44 44 parent::setup( $action, $data );
45 45
46 - TablePress::enqueue_script( 'common', array( 'jquery-core', 'postbox' ) );
47 -
48 46 $this->add_text_box( 'no-javascript', array( $this, 'textbox_no_javascript' ), 'header' );
49 47
50 48 if ( isset( $data['table']['is_corrupted'] ) && $data['table']['is_corrupted'] ) {
51 49 $this->add_text_box( 'table-corrupted', array( $this, 'textbox_corrupted_table' ), 'header' );
@@ -58,30 +56,26 @@
58 56 'success_import' => __( 'The table was imported successfully.', 'tablepress' ),
59 57 'error_delete' => __( 'Error: The table could not be deleted.', 'tablepress' ),
60 58 ) );
61 59
62 - // For the Advanced Editor.
63 60 wp_enqueue_style( 'wp-jquery-ui-dialog' );
64 61 wp_enqueue_style( 'editor-buttons' );
65 - wp_enqueue_script( 'wpdialogs' );
66 - // For the "Insert Image" dialog.
62 + wp_enqueue_script( 'wpdialogs' ); // For the Advanced Editor, Table Preview, and Help Boxes.
67 63 add_filter( 'media_view_strings', array( $this, 'change_media_view_strings' ) );
68 64 wp_enqueue_media();
69 - // For the "Insert Link" dialog.
70 - wp_enqueue_script( 'wplink' );
71 -
72 - TablePress::enqueue_style( 'jspreadsheet' );
73 - TablePress::enqueue_style( 'jsuites', array( 'tablepress-jspreadsheet' ) );
74 - TablePress::enqueue_style( 'edit', array( 'tablepress-jspreadsheet', 'tablepress-jsuites' ) );
65 + wp_enqueue_script( 'wplink' ); // JS for the "Insert Link" button.
66 + $this->admin_page->enqueue_style( 'jspreadsheet' );
67 + $this->admin_page->enqueue_style( 'jsuites', array( 'tablepress-jspreadsheet' ) );
68 + $this->admin_page->enqueue_style( 'edit', array( 'tablepress-jspreadsheet', 'tablepress-jsuites' ) );
75 69 if ( ! TABLEPRESS_IS_PLAYGROUND_PREVIEW && tb_tp_fs()->is_free_plan() ) {
76 - TablePress::enqueue_style( 'edit-features', array( 'tablepress-edit' ) );
70 + $this->admin_page->enqueue_style( 'edit-features', array( 'tablepress-edit' ) );
77 71 }
78 - TablePress::enqueue_script( 'jspreadsheet' );
79 - TablePress::enqueue_script( 'jsuites', array( 'tablepress-jspreadsheet' ) );
80 - TablePress::enqueue_script( 'edit', array( 'tablepress-jspreadsheet', 'tablepress-jsuites', 'jquery-core' ) );
72 + $this->admin_page->enqueue_script( 'jspreadsheet' );
73 + $this->admin_page->enqueue_script( 'jsuites', array( 'tablepress-jspreadsheet' ) );
74 + $this->admin_page->enqueue_script( 'edit', array( 'tablepress-jspreadsheet', 'tablepress-jsuites', 'jquery-core' ) );
81 75
82 76 $this->add_text_box( 'head', array( $this, 'textbox_head' ), 'normal' );
83 - $this->add_text_box( 'header-bar', array( $this, 'textbox_header_bar' ), 'normal' );
77 + $this->add_text_box( 'buttons-1', array( $this, 'textbox_buttons' ), 'normal' );
84 78 $this->add_meta_box( 'table-information', __( 'Table Information', 'tablepress' ), array( $this, 'postbox_table_information' ), 'normal' );
85 79 $this->add_meta_box( 'table-data', __( 'Table Content', 'tablepress' ), array( $this, 'postbox_table_data' ), 'normal' );
86 80 $this->add_meta_box( 'table-manipulation', __( 'Table Manipulation', 'tablepress' ), array( $this, 'postbox_table_manipulation' ), 'normal' );
87 81 $this->add_meta_box( 'table-options', __( 'Table Options', 'tablepress' ), array( $this, 'postbox_table_options' ), 'normal' );
@@ -86,8 +80,10 @@
86 80 $this->add_meta_box( 'table-manipulation', __( 'Table Manipulation', 'tablepress' ), array( $this, 'postbox_table_manipulation' ), 'normal' );
87 81 $this->add_meta_box( 'table-options', __( 'Table Options', 'tablepress' ), array( $this, 'postbox_table_options' ), 'normal' );
88 82 $this->add_meta_box( 'datatables-features', __( 'Table Features for Site Visitors', 'tablepress' ), array( $this, 'postbox_datatables_features' ), 'normal' );
89 83 $this->add_text_box( 'hidden-containers', array( $this, 'textbox_hidden_containers' ), 'additional' );
84 + $this->add_text_box( 'buttons-2', array( $this, 'textbox_buttons' ), 'additional' );
85 + $this->add_text_box( 'other-actions', array( $this, 'textbox_other_actions' ), 'submit' );
90 86
91 87 add_filter( 'screen_settings', array( $this, 'add_screen_options_output' ), 10, 2 );
92 88 }
93 89
@@ -127,15 +123,13 @@
127 123 $screen_settings .= '<p><em>' . __( 'Please note: These settings only influence the table editor view on this screen, but not the table that the site visitor sees!', 'tablepress' ) . '</em></p>';
128 124 $screen_settings .= '<div>';
129 125 $screen_settings .= '<label for="table_editor_column_width">' . __( 'Default column width:', 'tablepress' ) . '</label> ';
130 126 $input = '<input type="number" id="table_editor_column_width" class="small-text" value="' . esc_attr( TablePress::$model_options->get( 'table_editor_column_width' ) ) . '" min="30" max="9999">';
131 - /* translators: %s: Input field for the number of pixels */
132 127 $screen_settings .= sprintf( __( '%s pixels', 'tablepress' ), $input );
133 128 $screen_settings .= '</div>';
134 129 $screen_settings .= '<div style="margin-top: 6px;">';
135 130 $screen_settings .= '<label for="table_editor_line_clamp">' . __( 'Maximum visible lines of text:', 'tablepress' ) . '</label> ';
136 131 $input = '<input type="number" id="table_editor_line_clamp" class="tiny-text" value="' . esc_attr( TablePress::$model_options->get( 'table_editor_line_clamp' ) ) . '" min="0" max="999">';
137 - /* translators: %s: Input field for the number of lines */
138 132 $screen_settings .= sprintf( __( '%s lines', 'tablepress' ), $input );
139 133 $screen_settings .= '</div>';
140 134 $screen_settings .= '</fieldset>';
141 135 return $screen_settings;
@@ -202,9 +196,9 @@
202 196 * @param array<string, mixed> $box Information about the text box.
203 197 */
204 198 #[\Override]
205 199 protected function action_nonce_field( array $data, array $box ): void {
206 - // Intentionally left empty. Nonces for this view are generated in `print_javascript_data()`.
200 + // Intentionally left empty. Nonces for this view are generated in postbox_table_data().
207 201 }
208 202
209 203 /**
210 204 * Prints the table data for use in JS code and the main React container.
@@ -214,23 +208,22 @@
214 208 public function print_javascript_data(): void {
215 209 echo "<script>\n";
216 210 echo "window.tp = window.tp || {};\n";
217 211
218 - echo "tp.nonces = {\n";
219 - echo "\tedit_table: '" . wp_create_nonce( TablePress::nonce( $this->action, $this->data['table']['id'] ) ) . "',\n";
220 - echo "\tpreview_table: '" . wp_create_nonce( TablePress::nonce( 'preview_table', $this->data['table']['id'] ) ) . "',\n";
221 - echo "\tcopy_table: '" . wp_create_nonce( TablePress::nonce( 'copy_table', $this->data['table']['id'] ) ) . "',\n";
222 - echo "\tdelete_table: '" . wp_create_nonce( TablePress::nonce( 'delete_table', $this->data['table']['id'] ) ) . "',\n";
223 - echo "\tscreen_options: '" . wp_create_nonce( TablePress::nonce( 'screen_options' ) ) . "',\n";
224 - echo "};\n";
212 + echo "tp.nonces = {};\n";
213 + echo "tp.nonces.edit_table = '" . wp_create_nonce( TablePress::nonce( $this->action, $this->data['table']['id'] ) ) . "';\n";
214 + echo "tp.nonces.preview_table = '" . wp_create_nonce( TablePress::nonce( 'preview_table', $this->data['table']['id'] ) ) . "';\n";
215 + echo "tp.nonces.copy_table = '" . wp_create_nonce( TablePress::nonce( 'copy_table', $this->data['table']['id'] ) ) . "';\n";
216 + echo "tp.nonces.delete_table = '" . wp_create_nonce( TablePress::nonce( 'delete_table', $this->data['table']['id'] ) ) . "';\n";
217 + echo "tp.nonces.screen_options = '" . wp_create_nonce( TablePress::nonce( 'screen_options' ) ) . "';\n";
225 218
226 - echo "tp.table = {\n";
227 - echo "\tid: '{$this->data['table']['id']}',\n";
228 - echo "\tshortcode: '" . esc_js( TablePress::$shortcode ) . "',\n";
219 + echo "tp.table = {};\n";
220 + echo "tp.table.shortcode = '" . esc_js( TablePress::$shortcode ) . "';\n";
221 + echo "tp.table.id = '{$this->data['table']['id']}';\n";
229 222
230 223 // Add the table meta data.
231 224 $this->data['table']['meta'] = array(
232 - 'id' => $this->data['table']['id'],
225 + 'newId' => $this->data['table']['id'],
233 226 'name' => $this->data['table']['name'],
234 227 'description' => $this->data['table']['description'],
235 228 'lastModified' => TablePress::format_datetime( $this->data['table']['last_modified'] ),
236 229 'lastEditor' => TablePress::get_user_display_name( $this->data['table']['options']['last_editor'] ),
@@ -237,28 +230,19 @@
237 230 );
238 231
239 232 // JSON-encode array items separately to save some PHP memory.
240 233 foreach ( array( 'meta', 'data', 'options', 'visibility' ) as $item ) {
241 - $json = $this->convert_to_json_parse_output( $this->data['table'][ $item ] );
242 - echo "\t{$item}: {$json},\n";
234 + $json = $this->admin_page->convert_to_json_parse_output( $this->data['table'][ $item ] );
235 + printf( 'tp.table.%1$s = %2$s;' . "\n", $item, $json );
243 236 }
244 - echo "};\n";
245 237
246 - echo "tp.screenOptions = {\n";
247 - echo "\ttable_editor_column_width: " . absint( TablePress::$model_options->get( 'table_editor_column_width' ) ) . ",\n";
248 - echo "\tshowCustomCommands: " . ( current_user_can( 'unfiltered_html' ) ? 'true' : 'false' ) . ",\n";
249 - echo "\toptionsUrl: '" . TablePress::url( array( 'action' => 'options' ) ) . "',\n";
250 - echo "\tcurrentUserCanEditTableId: " . ( current_user_can( 'tablepress_edit_table_id', $this->data['table']['id'] ) ? 'true' : 'false' ) . ",\n";
251 - echo "\tcurrentUserCanCopyTable: " . ( current_user_can( 'tablepress_copy_table', $this->data['table']['id'] ) ? 'true' : 'false' ) . ",\n";
252 - echo "\tcurrentUserCanDeleteTable: " . ( current_user_can( 'tablepress_delete_table', $this->data['table']['id'] ) ? 'true' : 'false' ) . ",\n";
253 - echo "\tcurrentUserCanExportTable: " . ( current_user_can( 'tablepress_export_table', $this->data['table']['id'] ) ? 'true' : 'false' ) . ",\n";
254 - echo "\tcurrentUserCanPreviewTable: " . ( current_user_can( 'tablepress_preview_table', $this->data['table']['id'] ) ? 'true' : 'false' ) . ",\n";
255 - echo "\tcopyUrl: '" . str_replace( '&amp;', '&', TablePress::url( array( 'action' => 'copy_table', 'item' => $this->data['table']['id'], 'return' => 'edit' ), true, 'admin-post.php' ) ) . "',\n";
256 - echo "\tdeleteUrl: '" . str_replace( '&amp;', '&', TablePress::url( array( 'action' => 'delete_table', 'item' => $this->data['table']['id'], 'return' => 'edit', 'return_item' => $this->data['table']['id'] ), true, 'admin-post.php' ) ) . "',\n";
257 - echo "\texportUrl: '" . str_replace( '&amp;', '&', TablePress::url( array( 'action' => 'export', 'table_id' => $this->data['table']['id'] ) ) ) . "',\n";
258 - echo "\tpreviewUrl: '" . str_replace( '&amp;', '&', TablePress::url( array( 'action' => 'preview_table', 'item' => $this->data['table']['id'], 'return' => 'edit', 'return_item' => $this->data['table']['id'] ), true, 'admin-post.php' ) ) . "',\n";
259 - echo "};\n";
260 -
238 + echo "tp.screen_options = {};\n";
239 + echo 'tp.screen_options.table_editor_column_width = ' . absint( TablePress::$model_options->get( 'table_editor_column_width' ) ) . ";\n";
240 + echo 'tp.screen_options.showCustomCommands = ' . ( current_user_can( 'unfiltered_html' ) ? 'true' : 'false' ) . ";\n";
241 + echo "tp.screen_options.optionsUrl = '" . TablePress::url( array( 'action' => 'options' ) ) . "';\n";
242 + echo 'tp.screen_options.currentUserCanEditTableId = ' . ( current_user_can( 'tablepress_edit_table_id', $this->data['table']['id'] ) ? 'true' : 'false' ) . ";\n";
243 + echo 'tp.screen_options.currentUserCanPreviewTable = ' . ( current_user_can( 'tablepress_preview_table', $this->data['table']['id'] ) ? 'true' : 'false' ) . ";\n";
244 + echo "tp.screen_options.previewUrl = '" . str_replace( '&amp;', '&', TablePress::url( array( 'action' => 'preview_table', 'item' => $this->data['table']['id'], 'return' => 'edit', 'return_item' => $this->data['table']['id'] ), true, 'admin-post.php' ) ) . "';\n";
261 245 echo "</script>\n";
262 246
263 247 echo '<div id="tablepress-edit-screen"></div>'; // React container.
264 248 }
@@ -279,13 +263,13 @@
279 263 <div class="postbox premium-features">
280 264 <div>
281 265 <div>
282 266 <div class="postbox-header">
283 - <h2><span class="dashicons dashicons-lightbulb"></span> <?php _e( 'TablePress has more to offer!', 'tablepress' ); ?></h2>
267 + <h2><span class="dashicons dashicons-heart"></span> <?php _e( 'TablePress has more to offer!', 'tablepress' ); ?></h2>
284 268 </div>
285 269 <div class="inside">
286 270 <?php
287 - TablePress::load_modules_data();
271 + TablePress::init_modules();
288 272 $random_module_slug = array_rand( TablePress::$modules );
289 273 $feature_module = TablePress::$modules[ $random_module_slug ];
290 274 $module_url = esc_url( "https://tablepress.org/modules/{$random_module_slug}/?utm_source=plugin&utm_medium=textlink&utm_content=edit-screen" );
291 275
@@ -333,26 +317,48 @@
333 317 echo '<div id="tablepress-table-manipulation-section"></div>';
334 318 }
335 319
336 320 /**
337 - * Prints the container for the sticky "Header Bar".
321 + * Prints the container for the "Preview" and "Save Changes" buttons.
338 322 *
339 - * @since 3.3.0
323 + * @since 1.0.0
340 324 *
341 325 * @param array<string, mixed> $data Data for this screen.
342 326 * @param array<string, mixed> $box Information about the text box.
343 327 */
344 - public function textbox_header_bar( array $data, array $box ): void {
345 - 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>';
328 + public function textbox_buttons( array $data, array $box ): void {
329 + echo '<div id="tablepress-' . $box['id'] . '-section"></div>';
330 + }
331 +
332 + /**
333 + * Prints the "Delete Table" and "Export Table" buttons.
334 + *
335 + * @since 1.0.0
336 + *
337 + * @param array<string, mixed> $data Data for this screen.
338 + * @param array<string, mixed> $box Information about the text box.
339 + */
340 + public function textbox_other_actions( array $data, array $box ): void {
341 + $user_can_copy_table = current_user_can( 'tablepress_copy_table', $data['table']['id'] );
342 + $user_can_export_table = current_user_can( 'tablepress_export_table', $data['table']['id'] );
343 + $user_can_delete_table = current_user_can( 'tablepress_delete_table', $data['table']['id'] );
344 +
345 + if ( ! $user_can_copy_table && ! $user_can_export_table && ! $user_can_delete_table ) {
346 + return;
353 347 }
354 - echo '</div>';
348 +
349 + echo '<p class="submit">';
350 + echo __( 'Other Actions', 'tablepress' ) . ':&nbsp; ';
351 + if ( $user_can_copy_table ) {
352 + echo '<a href="' . esc_url( TablePress::url( array( 'action' => 'copy_table', 'item' => $data['table']['id'], 'return' => 'edit' ), true, 'admin-post.php' ) ) . '" class="components-button is-secondary is-compact button-copy">' . __( 'Copy Table', 'tablepress' ) . '</a> ';
353 + }
354 + if ( $user_can_export_table ) {
355 + echo '<a href="' . esc_url( TablePress::url( array( 'action' => 'export', 'table_id' => $data['table']['id'] ) ) ) . '" class="components-button is-secondary is-compact button-export">' . __( 'Export Table', 'tablepress' ) . '</a> ';
356 + }
357 + if ( $user_can_delete_table ) {
358 + echo '<a href="' . esc_url( TablePress::url( array( 'action' => 'delete_table', 'item' => $data['table']['id'], 'return' => 'edit', 'return_item' => $data['table']['id'] ), true, 'admin-post.php' ) ) . '" class="components-button is-secondary is-compact button-delete delete-link">' . __( 'Delete Table', 'tablepress' ) . '</a>';
359 + }
360 + echo '</p>';
355 361 }
356 362
357 363 /**
358 364 * Prints the hidden containers for the Preview.
@@ -363,9 +369,8 @@
363 369 * @param array<string, mixed> $box Information about the text box.
364 370 */
365 371 public function textbox_hidden_containers( array $data, array $box ): void {
366 372 ?>
367 -<div id="tablepress-table-preview-section"></div>
368 373 <div class="hidden-container">
369 374 <div id="advanced-editor">
370 375 <label id="advanced-editor-label" for="advanced-editor-content" class="screen-reader-text"><?php esc_html_e( 'Advanced Editor', 'tablepress' ); ?></label>
371 376 <?php
@@ -378,11 +383,29 @@
378 383 );
379 384 wp_editor( '', 'advanced-editor-content', $wp_editor_options );
380 385 ?>
381 386 </div>
387 +</div>
388 +<div id="preview-container" class="hidden-container">
389 + <div id="table-preview">
390 + <iframe id="table-preview-iframe" src="about:blank"></iframe>
391 + </div>
392 +</div>
393 +<div class="hidden-container">
382 394 <textarea id="textarea-insert-helper" class="hidden"></textarea>
383 395 </div>
396 +<div id="help-box-combine-cells" class="help-box hidden-container" title="<?php esc_attr_e( 'Help on combining cells', 'tablepress' ); ?>" data-height="420" data-width="500">
384 397 <?php
398 + echo '<p>' . __( 'Table cells can span across more than one column or row.', 'tablepress' ) . '</p>';
399 + echo '<p>' . __( 'Combining consecutive cells within the same row is called &#8220;colspanning&#8221;.', 'tablepress' )
400 + . ' ' . __( 'Combining consecutive cells within the same column is called &#8220;rowspanning&#8221;.', 'tablepress' ) . '</p>';
401 + echo '<p>' . sprintf( __( 'To combine adjacent cells, select the desired cells and click the “%s” button or use the context menu.', 'tablepress' ), __( 'Combine/Merge', 'tablepress' ) )
402 + . ' ' . __( 'The corresponding keywords, <code>#colspan#</code> and <code>#rowspan#</code>, will then be added for you.', 'tablepress' ) . '</p>';
403 + echo '<p><strong>' . __( 'Be aware that the Table Features for Site Visitors, like sorting, filtering, and pagination, will not work in tables which have combined cells in their body rows.', 'tablepress' ) . '</strong>'
404 + . ' ' . __( 'It is however possible to use these features in tables that have combined cells in the table header or footer rows, to allow for creating complex header and footer layouts.', 'tablepress' ) . '</p>';
405 + ?>
406 +</div>
407 + <?php
385 408 }
386 409
387 410 /**
388 411 * Prints the content of the "Table Options" post meta box.
@@ -417,34 +440,29 @@
417 440 * @param array<string, mixed> $box Information about the text box.
418 441 */
419 442 public function textbox_corrupted_table( array $data, array $box ): void {
420 443 ?>
421 - <div class="notice components-notice is-error">
422 - <div class="components-notice__content">
423 - <h3><em>
424 - <?php _e( 'Attention: Unfortunately, an error occurred.', 'tablepress' ); ?>
425 - </em></h3>
426 - <p>
427 - <?php
428 - /* translators: %1$s: Table name, %2$s: Table ID */
429 - printf( __( 'The internal data of table &#8220;%1$s&#8221; (ID %2$s) is corrupted.', 'tablepress' ), esc_html( $data['table']['name'] ), esc_html( $data['table']['id'] ) );
430 - echo ' ';
431 - /* translators: %s: Error message */
432 - printf( __( 'The following error was registered: %s.', 'tablepress' ), '<code>' . esc_html( $data['table']['json_error'] ) . '</code>' );
433 - ?>
434 - </p>
435 - <p>
436 - <?php
437 - _e( 'Because of this error, the table can not be edited at this time, to prevent possible further data loss.', 'tablepress' );
438 - echo ' ';
439 - /* translators: %s: URL to TablePress FAQ page */
440 - printf( __( 'Please see the <a href="%s">TablePress FAQ page</a> for further instructions.', 'tablepress' ), 'https://tablepress.org/faq/corrupted-tables/' );
441 - ?>
442 - </p>
443 - <p>
444 - <?php echo '<a href="' . esc_url( TablePress::url( array( 'action' => 'list' ) ) ) . '" class="components-button is-secondary is-compact">' . __( 'Back to the List of Tables', 'tablepress' ) . '</a>'; ?>
445 - </p>
446 - </div>
444 + <div class="notice notice-error notice-large">
445 + <h3><em>
446 + <?php _e( 'Attention: Unfortunately, an error occurred.', 'tablepress' ); ?>
447 + </em></h3>
448 + <p>
449 + <?php
450 + printf( __( 'The internal data of table &#8220;%1$s&#8221; (ID %2$s) is corrupted.', 'tablepress' ), esc_html( $data['table']['name'] ), esc_html( $data['table']['id'] ) );
451 + echo ' ';
452 + printf( __( 'The following error was registered: %s.', 'tablepress' ), '<code>' . esc_html( $data['table']['json_error'] ) . '</code>' );
453 + ?>
454 + </p>
455 + <p>
456 + <?php
457 + _e( 'Because of this error, the table can not be edited at this time, to prevent possible further data loss.', 'tablepress' );
458 + echo ' ';
459 + printf( __( 'Please see the <a href="%s">TablePress FAQ page</a> for further instructions.', 'tablepress' ), 'https://tablepress.org/faq/corrupted-tables/' );
460 + ?>
461 + </p>
462 + <p>
463 + <?php echo '<a href="' . esc_url( TablePress::url( array( 'action' => 'list' ) ) ) . '" class="components-button is-secondary is-compact">' . __( 'Back to the List of Tables', 'tablepress' ) . '</a>'; ?>
464 + </p>
447 465 </div>
448 466 <?php
449 467 }
450 468
@@ -460,12 +478,10 @@
460 478 echo '<p>';
461 479 _e( 'To edit the content or modify the structure of this table, use the input fields and buttons below.', 'tablepress' );
462 480 echo ' ';
463 481 // Show the instructions string depending on whether the Block Editor is used on the site or not.
464 - if ( 'block' === $data['site_used_editor'] ) {
482 + if ( $data['site_uses_block_editor'] ) {
465 483 printf( __( 'To insert a table into a post or page, add a “%1$s” block in the block editor and select the desired table.', 'tablepress' ), __( 'TablePress table', 'tablepress' ) );
466 - } elseif ( 'elementor' === $data['site_used_editor'] ) {
467 - printf( __( 'To insert a table into a post or page, add a “%1$s” widget in the Elementor editor and select the desired table.', 'tablepress' ), __( 'TablePress table', 'tablepress' ) );
468 484 } else {
469 485 _e( 'To insert a table into a post or page, paste its Shortcode at the desired place in the editor.', 'tablepress' );
470 486 }
471 487 echo '</p>';
@@ -479,9 +495,9 @@
479 495 public function wp_pointer_tp20_edit_context_menu(): void {
480 496 $content = '<h3>' . __( 'TablePress feature: Context menu', 'tablepress' ) . '</h3>';
481 497 $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>';
482 498
483 - $this->print_wp_pointer_js(
499 + $this->admin_page->print_wp_pointer_js(
484 500 'tp20_edit_context_menu',
485 501 '#table-editor',
486 502 array(
487 503 'content' => $content,
@@ -490,23 +506,23 @@
490 506 );
491 507 }
492 508
493 509 /**
494 - * Sets the content for the WP feature pointer about the Quick Navigation on the "Edit" screen.
510 + * Sets the content for the WP feature pointer about the screen options for changing the cell size.
495 511 *
496 - * @since 3.3.0
512 + * @since 2.1.0
497 513 */
498 - public function wp_pointer_tp33_edit_quick_navigation(): void {
499 - $content = '<h3>' . __( 'TablePress feature: Quick Navigation', 'tablepress' ) . '</h3>';
500 - $content .= '<p style="text-wrap:balance">' . __( 'You can quickly navigate between different sections of the table editor using the Quick Navigation menu.', 'tablepress' ) . ' ' . __( 'Just click the logo or use the <kbd>%metaKey%J</kbd> keyboard shortcut!', 'tablepress' ) . '</p>';
514 + public function wp_pointer_tp21_edit_screen_options(): void {
515 + $content = '<h3>' . __( 'TablePress feature: Column width and row height of the table editor', 'tablepress' ) . '</h3>';
516 + $content .= '<p>' . __( 'Did you know?', 'tablepress' ) . ' ' . sprintf( __( 'You can change the default cell size for the table editor on this “Edit” screen in the “%s”.', 'tablepress' ), __( 'Screen Options', 'default' ) ) . '</p>';
501 517
502 - $this->print_wp_pointer_js(
503 - 'tp33_edit_quick_navigation',
504 - '#tablepress-header-bar-section',
518 + $this->admin_page->print_wp_pointer_js(
519 + 'tp21_edit_screen_options',
520 + '#screen-options-link-wrap',
505 521 array(
506 522 'content' => $content,
507 - 'position' => array( 'edge' => 'top', 'align' => is_rtl() ? 'right+16' : 'left-16' ),
508 - 'pointerWidth' => 330,
523 + 'position' => array( 'edge' => 'top', 'align' => 'right' ),
524 + 'pointerClass' => 'wp-pointer pointer-tp21_edit_screen_options',
509 525 ),
510 526 );
511 527 }
512 528