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
tablepress / views / view-edit.php

view-edit.php in TablePress – Tables in WordPress made easy 3.0, at views/view-edit.php

530 lines 22.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Edit Table View
4 *
5 * @package TablePress
6 * @subpackage Views
7 * @author Tobias Bäthge
8 * @since 1.0.0
9 */
10
11 // Prohibit direct script loading.
12 defined( 'ABSPATH' ) || die( 'No direct script access allowed!' );
13
14 /**
15 * Edit Table View class
16 *
17 * @package TablePress
18 * @subpackage Views
19 * @author Tobias Bäthge
20 * @since 1.0.0
21 */
22 class TablePress_Edit_View extends TablePress_View {
23
24 /**
25 * List of WP feature pointers for this view.
26 *
27 * @since 2.0.0
28 * @var string[]
29 */
30 protected array $wp_pointers = array( 'tp20_edit_context_menu', 'tp21_edit_screen_options' );
31
32 /**
33 * Sets up the view with data and do things that are specific for this view.
34 *
35 * @since 1.0.0
36 *
37 * @param string $action Action for this view.
38 * @param array<string, mixed> $data Data for this view.
39 */
40 #[\Override]
41 public function setup( /* string */ $action, array $data ) /* : void */ {
42 // Don't use type hints in the method declaration to prevent PHP errors, as the method is inherited.
43
44 parent::setup( $action, $data );
45
46 $this->add_text_box( 'no-javascript', array( $this, 'textbox_no_javascript' ), 'header' );
47
48 if ( isset( $data['table']['is_corrupted'] ) && $data['table']['is_corrupted'] ) {
49 $this->add_text_box( 'table-corrupted', array( $this, 'textbox_corrupted_table' ), 'header' );
50 return;
51 }
52
53 $this->process_action_messages( array(
54 'success_add' => __( 'The table was added successfully.', 'tablepress' ),
55 'success_copy' => _n( 'The table was copied successfully.', 'The tables were copied successfully.', 1, 'tablepress' ) . ' ' . sprintf( __( 'You are now seeing the copied table, which has the table ID &#8220;%s&#8221;.', 'tablepress' ), esc_html( $data['table']['id'] ) ),
56 'success_import' => __( 'The table was imported successfully.', 'tablepress' ),
57 'error_delete' => __( 'Error: The table could not be deleted.', 'tablepress' ),
58 ) );
59
60 wp_enqueue_style( 'wp-jquery-ui-dialog' );
61 wp_enqueue_style( 'editor-buttons' );
62 wp_enqueue_script( 'wpdialogs' ); // For the Advanced Editor, Table Preview, and Help Boxes.
63 add_filter( 'media_view_strings', array( $this, 'change_media_view_strings' ) );
64 wp_enqueue_media();
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' ) );
69 if ( ! TABLEPRESS_IS_PLAYGROUND_PREVIEW && tb_tp_fs()->is_free_plan() ) {
70 $this->admin_page->enqueue_style( 'edit-features', array( 'tablepress-edit' ) );
71 }
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' ) );
75
76 $this->add_text_box( 'head', array( $this, 'textbox_head' ), 'normal' );
77 $this->add_text_box( 'buttons-1', array( $this, 'textbox_buttons' ), 'normal' );
78 $this->add_meta_box( 'table-information', __( 'Table Information', 'tablepress' ), array( $this, 'postbox_table_information' ), 'normal' );
79 $this->add_meta_box( 'table-data', __( 'Table Content', 'tablepress' ), array( $this, 'postbox_table_data' ), 'normal' );
80 $this->add_meta_box( 'table-manipulation', __( 'Table Manipulation', 'tablepress' ), array( $this, 'postbox_table_manipulation' ), 'normal' );
81 $this->add_meta_box( 'table-options', __( 'Table Options', 'tablepress' ), array( $this, 'postbox_table_options' ), 'normal' );
82 $this->add_meta_box( 'datatables-features', __( 'Table Features for Site Visitors', 'tablepress' ), array( $this, 'postbox_datatables_features' ), 'normal' );
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' );
86
87 add_filter( 'screen_settings', array( $this, 'add_screen_options_output' ), 10, 2 );
88 }
89
90 /**
91 * Changes the Media View string "Insert into post" to "Insert into Table".
92 *
93 * @since 1.0.0
94 *
95 * @param array<string, string> $strings Current set of Media View strings.
96 * @return array<string, string> Changed Media View strings.
97 */
98 public function change_media_view_strings( array $strings ): array {
99 $strings['insertIntoPost'] = __( 'Insert into Table', 'tablepress' );
100 return $strings;
101 }
102
103 /**
104 * Adds custom screen options to the screen.
105 *
106 * @since 2.1.0
107 *
108 * @param string $screen_settings Screen settings.
109 * @param WP_Screen $screen WP_Screen object.
110 * @return string Extended Screen settings.
111 */
112 public function add_screen_options_output( /* string */ $screen_settings, WP_Screen $screen ): string {
113 // Don't use a type hint for the `$screen_settings` argument as many WordPress plugins seem to be returning `null` in their filter hook handlers.
114
115 // Protect against other plugins not returning a string for the `$screen_settings` argument.
116 if ( ! is_string( $screen_settings ) ) { // @phpstan-ignore function.alreadyNarrowedType (The `is_string()` check is needed as the input is coming from a filter hook.)
117 $screen_settings = '';
118 }
119
120 $screen_settings = '<fieldset id="tablepress-screen-options" class="screen-options">';
121 $screen_settings .= '<legend>' . __( 'Table editor settings', 'tablepress' ) . '</legend>';
122 $screen_settings .= '<p>' . __( 'Adjust the default size of the table cells in the table editor below.', 'tablepress' ) . ' ' . __( 'Cells with many lines of text will expand to their full height when they are edited.', 'tablepress' ) . '</p>';
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>';
124 $screen_settings .= '<div>';
125 $screen_settings .= '<label for="table_editor_column_width">' . __( 'Default column width:', 'tablepress' ) . '</label> ';
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">';
127 $screen_settings .= sprintf( __( '%s pixels', 'tablepress' ), $input );
128 $screen_settings .= '</div>';
129 $screen_settings .= '<div style="margin-top: 6px;">';
130 $screen_settings .= '<label for="table_editor_line_clamp">' . __( 'Maximum visible lines of text:', 'tablepress' ) . '</label> ';
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">';
132 $screen_settings .= sprintf( __( '%s lines', 'tablepress' ), $input );
133 $screen_settings .= '</div>';
134 $screen_settings .= '</fieldset>';
135 return $screen_settings;
136 }
137
138 /**
139 * Renders the current view.
140 *
141 * In comparison to the parent class method, this contains handling for the no-js case and adjusts the HTML code structure.
142 *
143 * @since 2.0.0
144 */
145 #[\Override]
146 public function render(): void {
147 $this->print_javascript_data();
148
149 ?>
150 <div id="tablepress-page" class="wrap">
151 <form>
152 <?php
153 $this->print_nav_tab_menu();
154 ?>
155 <div id="tablepress-body">
156 <hr class="wp-header-end">
157 <?php
158 // Print all header messages.
159 foreach ( $this->header_messages as $message ) {
160 echo $message;
161 }
162
163 $this->do_text_boxes( 'header' );
164 ?>
165 <div id="poststuff" class="hide-if-no-js">
166 <div id="post-body" class="metabox-holder columns-1">
167 <div id="postbox-container-2" class="postbox-container">
168 <?php
169 $this->do_text_boxes( 'normal' );
170 $this->do_meta_boxes( 'normal' );
171
172 $this->do_text_boxes( 'additional' );
173 $this->do_meta_boxes( 'additional' );
174
175 $this->do_text_boxes( 'submit' );
176
177 $this->do_text_boxes( 'side' );
178 $this->do_meta_boxes( 'side' );
179 ?>
180 </div>
181 </div>
182 <br class="clear">
183 </div>
184 </form>
185 </div>
186 </div>
187 <?php
188 }
189
190 /**
191 * Overrides parent class method, as the nonces for this view are generated in the JS code.
192 *
193 * @since 1.0.0
194 *
195 * @param array<string, mixed> $data Data for this screen.
196 * @param array<string, mixed> $box Information about the text box.
197 */
198 #[\Override]
199 protected function action_nonce_field( array $data, array $box ): void {
200 // Intentionally left empty. Nonces for this view are generated in postbox_table_data().
201 }
202
203 /**
204 * Prints the table data for use in JS code and the main React container.
205 *
206 * @since 3.0.0
207 */
208 public function print_javascript_data(): void {
209 echo "<script>\n";
210 echo "window.tp = window.tp || {};\n";
211
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";
218
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";
222
223 // Add the table meta data.
224 $this->data['table']['meta'] = array(
225 'newId' => $this->data['table']['id'],
226 'name' => $this->data['table']['name'],
227 'description' => $this->data['table']['description'],
228 'lastModified' => TablePress::format_datetime( $this->data['table']['last_modified'] ),
229 'lastEditor' => TablePress::get_user_display_name( $this->data['table']['options']['last_editor'] ),
230 );
231
232 // JSON-encode array items separately to save some PHP memory.
233 foreach ( array( 'meta', 'data', 'options', 'visibility' ) as $item ) {
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 );
236 }
237
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";
245 echo "</script>\n";
246
247 echo '<div id="tablepress-edit-screen"></div>'; // React container.
248 }
249
250 /**
251 * Prints the content of the "Table Information" post meta box.
252 *
253 * @since 1.0.0
254 *
255 * @param array<string, mixed> $data Data for this screen.
256 * @param array<string, mixed> $box Information about the meta box.
257 */
258 public function postbox_table_information( array $data, array $box ): void {
259 echo '<div id="tablepress-table-information-section"></div>';
260
261 if ( ! TABLEPRESS_IS_PLAYGROUND_PREVIEW && tb_tp_fs()->is_free_plan() ) :
262 ?>
263 <div class="postbox premium-features">
264 <div>
265 <div>
266 <div class="postbox-header">
267 <h2><span class="dashicons dashicons-heart"></span> <?php _e( 'TablePress has more to offer!', 'tablepress' ); ?></h2>
268 </div>
269 <div class="inside">
270 <?php
271 TablePress::init_modules();
272 $random_module_slug = array_rand( TablePress::$modules );
273 $feature_module = TablePress::$modules[ $random_module_slug ];
274 $module_url = esc_url( "https://tablepress.org/modules/{$random_module_slug}/?utm_source=plugin&utm_medium=textlink&utm_content=edit-screen" );
275
276 echo '<strong>' . __( 'Supercharge your tables with exceptional features:', 'tablepress' ) . '</strong>';
277 echo '<h3><a href="' . $module_url . '">' . $feature_module['name'] . '</a></h3>';
278 echo '<span>' . $feature_module['description'] . ' <a href="' . $module_url . '">' . __( 'Read more!', 'tablepress' ) . '</a></span>';
279 ?>
280 </div>
281 </div>
282 <div class="buttons">
283 <a href="https://tablepress.org/premium/?utm_source=plugin&utm_medium=textlink&utm_content=edit-screen" class="tablepress-button">
284 <span><?php _e( 'Compare the TablePress premium versions', 'tablepress' ); ?></span>
285 <span class="dashicons dashicons-arrow-right-alt"></span>
286 </a>
287 </div>
288 </div>
289 </div>
290 <?php
291 endif;
292 }
293
294 /**
295 * Prints the content of the "Table Content" post meta box.
296 *
297 * @since 1.0.0
298 *
299 * @param array<string, mixed> $data Data for this screen.
300 * @param array<string, mixed> $box Information about the meta box.
301 */
302 public function postbox_table_data( array $data, array $box ): void {
303 $css_variables = '--table-editor-line-clamp:' . absint( TablePress::$model_options->get( 'table_editor_line_clamp' ) ) . ';';
304 $css_variables = esc_attr( $css_variables );
305 echo "<div id=\"table-editor\" style=\"{$css_variables}\"></div>";
306 }
307
308 /**
309 * Prints the content of the "Table Manipulation" post meta box.
310 *
311 * @since 1.0.0
312 *
313 * @param array<string, mixed> $data Data for this screen.
314 * @param array<string, mixed> $box Information about the meta box.
315 */
316 public function postbox_table_manipulation( array $data, array $box ): void {
317 echo '<div id="tablepress-table-manipulation-section"></div>';
318 }
319
320 /**
321 * Prints the container for the "Preview" and "Save Changes" buttons.
322 *
323 * @since 1.0.0
324 *
325 * @param array<string, mixed> $data Data for this screen.
326 * @param array<string, mixed> $box Information about the text box.
327 */
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;
347 }
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>';
361 }
362
363 /**
364 * Prints the hidden containers for the Preview.
365 *
366 * @since 1.0.0
367 *
368 * @param array<string, mixed> $data Data for this screen.
369 * @param array<string, mixed> $box Information about the text box.
370 */
371 public function textbox_hidden_containers( array $data, array $box ): void {
372 ?>
373 <div class="hidden-container">
374 <div id="advanced-editor">
375 <label id="advanced-editor-label" for="advanced-editor-content" class="screen-reader-text"><?php esc_html_e( 'Advanced Editor', 'tablepress' ); ?></label>
376 <?php
377 $wp_editor_options = array(
378 'textarea_rows' => 10,
379 'tinymce' => false,
380 'quicktags' => array(
381 'buttons' => 'strong,em,link,del,ins,img,code,spell,close',
382 ),
383 );
384 wp_editor( '', 'advanced-editor-content', $wp_editor_options );
385 ?>
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">
394 <textarea id="textarea-insert-helper" class="hidden"></textarea>
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">
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
408 }
409
410 /**
411 * Prints the content of the "Table Options" post meta box.
412 *
413 * @since 1.0.0
414 *
415 * @param array<string, mixed> $data Data for this screen.
416 * @param array<string, mixed> $box Information about the meta box.
417 */
418 public function postbox_table_options( array $data, array $box ): void {
419 echo '<div id="tablepress-table-options-section"></div>';
420 }
421
422 /**
423 * Prints the content of the "Table Features for Site Visitors" post meta box.
424 *
425 * @since 1.0.0
426 *
427 * @param array<string, mixed> $data Data for this screen.
428 * @param array<string, mixed> $box Information about the meta box.
429 */
430 public function postbox_datatables_features( array $data, array $box ): void {
431 echo '<div id="tablepress-datatables-features-section"></div>';
432 }
433
434 /**
435 * Prints a notification about a corrupted table.
436 *
437 * @since 1.4.0
438 *
439 * @param array<string, mixed> $data Data for this screen.
440 * @param array<string, mixed> $box Information about the text box.
441 */
442 public function textbox_corrupted_table( array $data, array $box ): void {
443 ?>
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>
465 </div>
466 <?php
467 }
468
469 /**
470 * Prints the screen head text.
471 *
472 * @since 1.0.0
473 *
474 * @param array<string, mixed> $data Data for this screen.
475 * @param array<string, mixed> $box Information about the text box.
476 */
477 public function textbox_head( array $data, array $box ): void {
478 echo '<p>';
479 _e( 'To edit the content or modify the structure of this table, use the input fields and buttons below.', 'tablepress' );
480 echo ' ';
481 // Show the instructions string depending on whether the Block Editor is used on the site or not.
482 if ( $data['site_uses_block_editor'] ) {
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' ) );
484 } else {
485 _e( 'To insert a table into a post or page, paste its Shortcode at the desired place in the editor.', 'tablepress' );
486 }
487 echo '</p>';
488 }
489
490 /**
491 * Sets the content for the WP feature pointer about the drag and drop and sort on the "Edit" screen.
492 *
493 * @since 2.0.0
494 */
495 public function wp_pointer_tp20_edit_context_menu(): void {
496 $content = '<h3>' . __( 'TablePress feature: Context menu', 'tablepress' ) . '</h3>';
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>';
498
499 $this->admin_page->print_wp_pointer_js(
500 'tp20_edit_context_menu',
501 '#table-editor',
502 array(
503 'content' => $content,
504 'position' => array( 'edge' => 'bottom', 'align' => 'center' ),
505 ),
506 );
507 }
508
509 /**
510 * Sets the content for the WP feature pointer about the screen options for changing the cell size.
511 *
512 * @since 2.1.0
513 */
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>';
517
518 $this->admin_page->print_wp_pointer_js(
519 'tp21_edit_screen_options',
520 '#screen-options-link-wrap',
521 array(
522 'content' => $content,
523 'position' => array( 'edge' => 'top', 'align' => 'right' ),
524 'pointerClass' => 'wp-pointer pointer-tp21_edit_screen_options',
525 ),
526 );
527 }
528
529 } // class TablePress_Edit_View
530