PluginProbe
TablePress – Tables in WordPress made easy / 3.4
TablePress – Tables in WordPress made easy v3.4
3.4 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 All 45 releases
← All changes | admin/js/edit/data/contextmenu.js +18 -10 3.3.3 → 3.4 View file →
@@ -219,8 +219,9 @@
219 219 title: _n( 'Move row up', 'Move rows up', numSelectedRows, 'tablepress' ),
220 220 shortcut: sprintf( _x( '%1$s⇧↑', 'keyboard shortcut for Move up', 'tablepress' ), metaKey ),
221 221 onclick: tp.callbacks.move.bind( null, 'up', 'rows' ),
222 222 disabled: ! tp.helpers.move_allowed( 'rows', 'up' ),
223 + tooltip: ! tp.helpers.move_allowed( 'rows', 'up' ) ? __( 'This option is disabled.', 'tablepress' ) + ' ' + _n( 'The selected row is already at the top.', 'The selected rows are already at the top.', numSelectedRows, 'tablepress' ) : '',
223 224 },
224 225 {
225 226 title: _n( 'Move row down', 'Move rows down', numSelectedRows, 'tablepress' ),
226 227 shortcut: sprintf( _x( '%1$s⇧↓', 'keyboard shortcut for Move down', 'tablepress' ), metaKey ),
@@ -225,8 +226,9 @@
225 226 title: _n( 'Move row down', 'Move rows down', numSelectedRows, 'tablepress' ),
226 227 shortcut: sprintf( _x( '%1$s⇧↓', 'keyboard shortcut for Move down', 'tablepress' ), metaKey ),
227 228 onclick: tp.callbacks.move.bind( null, 'down', 'rows' ),
228 229 disabled: ! tp.helpers.move_allowed( 'rows', 'down' ),
230 + tooltip: ! tp.helpers.move_allowed( 'rows', 'down' ) ? __( 'This option is disabled.', 'tablepress' ) + ' ' + _n( 'The selected row is already at the bottom.', 'The selected rows are already at the bottom.', numSelectedRows, 'tablepress' ) : '',
229 231 },
230 232 {
231 233 title: _n( 'Move column left', 'Move columns left', numSelectedColumns, 'tablepress' ),
232 234 shortcut: sprintf( _x( '%1$s⇧←', 'keyboard shortcut for Move left', 'tablepress' ), metaKey ),
@@ -231,8 +233,9 @@
231 233 title: _n( 'Move column left', 'Move columns left', numSelectedColumns, 'tablepress' ),
232 234 shortcut: sprintf( _x( '%1$s⇧←', 'keyboard shortcut for Move left', 'tablepress' ), metaKey ),
233 235 onclick: tp.callbacks.move.bind( null, 'left', 'columns' ),
234 236 disabled: ! tp.helpers.move_allowed( 'columns', 'left' ),
237 + tooltip: ! tp.helpers.move_allowed( 'columns', 'left' ) ? __( 'This option is disabled.', 'tablepress' ) + ' ' + _n( 'The selected column is already at the left edge of the table.', 'The selected columns are already at the left edge of the table.', numSelectedColumns, 'tablepress' ) : '',
235 238 },
236 239 {
237 240 title: _n( 'Move column right', 'Move columns right', numSelectedColumns, 'tablepress' ),
238 241 shortcut: sprintf( _x( '%1$s⇧→', 'keyboard shortcut for Move right', 'tablepress' ), metaKey ),
@@ -237,8 +240,9 @@
237 240 title: _n( 'Move column right', 'Move columns right', numSelectedColumns, 'tablepress' ),
238 241 shortcut: sprintf( _x( '%1$s⇧→', 'keyboard shortcut for Move right', 'tablepress' ), metaKey ),
239 242 onclick: tp.callbacks.move.bind( null, 'right', 'columns' ),
240 243 disabled: ! tp.helpers.move_allowed( 'columns', 'right' ),
244 + tooltip: ! tp.helpers.move_allowed( 'columns', 'right' ) ? __( 'This option is disabled.', 'tablepress' ) + ' ' + _n( 'The selected column is already at the right edge of the table.', 'The selected columns are already at the right edge of the table.', numSelectedColumns, 'tablepress' ) : '',
241 245 },
242 246 {
243 247 type: 'divisor',
244 248 },
@@ -246,8 +250,9 @@
246 250 title: _n( 'Move row to the top', 'Move rows to the top', numSelectedRows, 'tablepress' ),
247 251 shortcut: sprintf( _x( '%1$s%2$s⇧↑', 'keyboard shortcut for Move to the top', 'tablepress' ), metaKey, optionKey ),
248 252 onclick: tp.callbacks.move.bind( null, 'top', 'rows' ),
249 253 disabled: ! tp.helpers.move_allowed( 'rows', 'top' ),
254 + tooltip: ! tp.helpers.move_allowed( 'rows', 'top' ) ? __( 'This option is disabled.', 'tablepress' ) + ' ' + _n( 'The selected row is already at the top.', 'The selected rows are already at the top.', numSelectedRows, 'tablepress' ) : '',
250 255 },
251 256 {
252 257 title: _n( 'Move row to the bottom', 'Move rows to the bottom', numSelectedRows, 'tablepress' ),
253 258 shortcut: sprintf( _x( '%1$s%2$s⇧↓', 'keyboard shortcut for Move to the bottom', 'tablepress' ), metaKey, optionKey ),
@@ -252,8 +257,9 @@
252 257 title: _n( 'Move row to the bottom', 'Move rows to the bottom', numSelectedRows, 'tablepress' ),
253 258 shortcut: sprintf( _x( '%1$s%2$s⇧↓', 'keyboard shortcut for Move to the bottom', 'tablepress' ), metaKey, optionKey ),
254 259 onclick: tp.callbacks.move.bind( null, 'bottom', 'rows' ),
255 260 disabled: ! tp.helpers.move_allowed( 'rows', 'bottom' ),
261 + tooltip: ! tp.helpers.move_allowed( 'rows', 'bottom' ) ? __( 'This option is disabled.', 'tablepress' ) + ' ' + _n( 'The selected row is already at the bottom.', 'The selected rows are already at the bottom.', numSelectedRows, 'tablepress' ) : '',
256 262 },
257 263 {
258 264 title: _n( 'Move column to first', 'Move columns to first', numSelectedColumns, 'tablepress' ),
259 265 shortcut: sprintf( _x( '%1$s%2$s⇧←', 'keyboard shortcut for Move to first', 'tablepress' ), metaKey, optionKey ),
@@ -258,8 +264,9 @@
258 264 title: _n( 'Move column to first', 'Move columns to first', numSelectedColumns, 'tablepress' ),
259 265 shortcut: sprintf( _x( '%1$s%2$s⇧←', 'keyboard shortcut for Move to first', 'tablepress' ), metaKey, optionKey ),
260 266 onclick: tp.callbacks.move.bind( null, 'first', 'columns' ),
261 267 disabled: ! tp.helpers.move_allowed( 'columns', 'first' ),
268 + tooltip: ! tp.helpers.move_allowed( 'columns', 'first' ) ? __( 'This option is disabled.', 'tablepress' ) + ' ' + _n( 'The selected column is already at the left edge of the table.', 'The selected columns are already at the left edge of the table.', numSelectedColumns, 'tablepress' ) : '',
262 269 },
263 270 {
264 271 title: _n( 'Move column to last', 'Move columns to last', numSelectedColumns, 'tablepress' ),
265 272 shortcut: sprintf( _x( '%1$s%2$s⇧→', 'keyboard shortcut for Move to last', 'tablepress' ), metaKey, optionKey ),
@@ -264,8 +271,9 @@
264 271 title: _n( 'Move column to last', 'Move columns to last', numSelectedColumns, 'tablepress' ),
265 272 shortcut: sprintf( _x( '%1$s%2$s⇧→', 'keyboard shortcut for Move to last', 'tablepress' ), metaKey, optionKey ),
266 273 onclick: tp.callbacks.move.bind( null, 'last', 'columns' ),
267 274 disabled: ! tp.helpers.move_allowed( 'columns', 'last' ),
275 + tooltip: ! tp.helpers.move_allowed( 'columns', 'last' ) ? __( 'This option is disabled.', 'tablepress' ) + ' ' + _n( 'The selected column is already at the right edge of the table.', 'The selected columns are already at the right edge of the table.', numSelectedColumns, 'tablepress' ) : '',
268 276 },
269 277 ],
270 278 },
271 279 {
@@ -273,16 +281,16 @@
273 281 submenu: [
274 282 {
275 283 title: __( 'Sort by column ascending', 'tablepress' ),
276 284 onclick: tp.callbacks.sort.bind( null, 'asc' ),
277 - disabled: 1 !== numSelectedColumns,
278 - tooltip: 1 !== numSelectedColumns ? __( 'This option is disabled because more than one column was selected.', 'tablepress' ) : '',
285 + disabled: 1 !== numSelectedColumns || 1 === numRows,
286 + tooltip: 1 !== numSelectedColumns ? __( 'This option is disabled.', 'tablepress' ) + ' ' + __( 'More than one column was selected.', 'tablepress' ) : ( 1 === numRows ? __( 'This option is disabled.', 'tablepress' ) + ' ' + __( 'The table has only one row.', 'tablepress' ) : '' ), // eslint-disable-line no-nested-ternary
279 287 },
280 288 {
281 289 title: __( 'Sort by column descending', 'tablepress' ),
282 290 onclick: tp.callbacks.sort.bind( null, 'desc' ),
283 - disabled: 1 !== numSelectedColumns,
284 - tooltip: 1 !== numSelectedColumns ? __( 'This option is disabled because more than one column was selected.', 'tablepress' ) : '',
291 + disabled: 1 !== numSelectedColumns || 1 === numRows,
292 + tooltip: 1 !== numSelectedColumns ? __( 'This option is disabled.', 'tablepress' ) + ' ' + __( 'More than one column was selected.', 'tablepress' ) : ( 1 === numRows ? __( 'This option is disabled.', 'tablepress' ) + ' ' + __( 'The table has only one row.', 'tablepress' ) : '' ), // eslint-disable-line no-nested-ternary
285 293 },
286 294 ],
287 295 },
288 296
@@ -296,27 +304,27 @@
296 304 {
297 305 title: _n( 'Hide row', 'Hide rows', numSelectedRows, 'tablepress' ),
298 306 onclick: tp.callbacks.hide_unhide.bind( null, 'hide', 'rows' ),
299 307 disabled: ! tp.helpers.visibility.selection_contains( 'rows', 1 ),
300 - tooltip: ! tp.helpers.visibility.selection_contains( 'rows', 1 ) ? __( 'This option is disabled because no visible rows were selected.', 'tablepress' ) : '',
308 + tooltip: ! tp.helpers.visibility.selection_contains( 'rows', 1 ) ? __( 'This option is disabled.', 'tablepress' ) + ' ' + _n( 'The selected row is already hidden.', 'The selected rows are already hidden.', numSelectedRows, 'tablepress' ) : '',
301 309 },
302 310 {
303 311 title: _n( 'Hide column', 'Hide columns', numSelectedColumns, 'tablepress' ),
304 312 onclick: tp.callbacks.hide_unhide.bind( null, 'hide', 'columns' ),
305 313 disabled: ! tp.helpers.visibility.selection_contains( 'columns', 1 ),
306 - tooltip: ! tp.helpers.visibility.selection_contains( 'columns', 1 ) ? __( 'This option is disabled because no visible columns were selected.', 'tablepress' ) : '',
314 + tooltip: ! tp.helpers.visibility.selection_contains( 'columns', 1 ) ? __( 'This option is disabled.', 'tablepress' ) + ' ' + _n( 'The selected column is already hidden.', 'The selected columns are already hidden.', numSelectedColumns, 'tablepress' ) : '',
307 315 },
308 316 {
309 317 title: _n( 'Show row', 'Show rows', numSelectedRows, 'tablepress' ),
310 318 onclick: tp.callbacks.hide_unhide.bind( null, 'unhide', 'rows' ),
311 319 disabled: ! tp.helpers.visibility.selection_contains( 'rows', 0 ),
312 - tooltip: ! tp.helpers.visibility.selection_contains( 'rows', 0 ) ? __( 'This option is disabled because no hidden rows were selected.', 'tablepress' ) : '',
320 + tooltip: ! tp.helpers.visibility.selection_contains( 'rows', 0 ) ? __( 'This option is disabled.', 'tablepress' ) + ' ' + _n( 'The selected row is already visible.', 'The selected rows are already visible.', numSelectedRows, 'tablepress' ) : '',
313 321 },
314 322 {
315 323 title: _n( 'Show column', 'Show columns', numSelectedColumns, 'tablepress' ),
316 324 onclick: tp.callbacks.hide_unhide.bind( null, 'unhide', 'columns' ),
317 325 disabled: ! tp.helpers.visibility.selection_contains( 'columns', 0 ),
318 - tooltip: ! tp.helpers.visibility.selection_contains( 'columns', 0 ) ? __( 'This option is disabled because no hidden columns were selected.', 'tablepress' ) : '',
326 + tooltip: ! tp.helpers.visibility.selection_contains( 'columns', 0 ) ? __( 'This option is disabled.', 'tablepress' ) + ' ' + _n( 'The selected column is already visible.', 'The selected columns are already visible.', numSelectedColumns, 'tablepress' ) : '',
319 327 },
320 328 ],
321 329 },
322 330
@@ -326,10 +334,10 @@
326 334 },
327 335 {
328 336 title: __( 'Combine/Merge cells', 'tablepress' ),
329 337 onclick: tp.callbacks.merge_cells,
330 - disabled: ( 1 === numSelectedRows && 1 === numSelectedColumns ) || ! tp.helpers.cell_merge_allowed( 'no-alert' ),
331 - tooltip: ( 1 === numSelectedRows && 1 === numSelectedColumns ) || ! tp.helpers.cell_merge_allowed( 'no-alert', errorMessage ) ? __( 'This option is disabled.', 'tablepress' ) + ' ' + errorMessage.text : '',
338 + disabled: ( 1 === numSelectedRows && 1 === numSelectedColumns ) || ! tp.helpers.cell_merge_allowed(),
339 + tooltip: ( 1 === numSelectedRows && 1 === numSelectedColumns ) || ! tp.helpers.cell_merge_allowed( errorMessage ) ? __( 'This option is disabled.', 'tablepress' ) + ' ' + errorMessage.text : '',
332 340 },
333 341 ];
334 342
335 343 // Allow other scripts to modify the context menu.