Making WordPress.org

Changeset 12408


Ignore:
Timestamp:
02/20/2023 06:24:22 PM (16 months ago)
Author:
amieiro
Message:

Translate: Update the events and selector to load the tabs in the right sidebar with different events

Currently, the tab content was only loaded when a user double click on the row.
With this udpate, the info is loaded with double click, clicking in the "Details"
button and with the hotkeys, because the loading is fired when the translation
textarea gets the focus.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/js/editor.js

    r12405 r12408  
    1212    } );
    1313
    14     // When a new translation row is opened (with double click), the tabs
    15     // (header tab and content) for this row are updated with the Ajax query.
    16     $gp.editor.table.on( 'dblclick', 'tr.preview td', function() {
    17         loadTabsAndDivs( $( this ) );
    18     } );
    19 
    20     // When a new translation row is opened (clicking in the "Details" button), the
    21     // tabs (header tab and content) for this row are updated with the Ajax query.
    22     $gp.editor.table.on( 'click', '.action.edit', function( ) {
    23         loadTabsAndDivs( $( this ) );
     14    // When a new translation row is opened (with double click, clicking in the "Details" button,
     15    // or with the hotkeys), the translation textarea is focused, so the tabs (header tabs and
     16    // divs with the content) for the right sidebar are updated.
     17    $gp.editor.table.on( 'focus input', 'tr.editor textarea.foreign-text', function() {
     18        var tr = $( this ).closest( 'tr.editor' );
     19        loadTabsAndDivs( tr );
    2420    } );
    2521
     
    203199     */
    204200    function loadTabsAndDivs( element ) {
    205         var originalId = element.closest( 'tr' ).attr( 'id' ).substring( 8 );
     201        var originalId = element.closest( 'tr' ).attr( 'id' ).substring( 7 );
    206202        var requestUrl = $gp_translation_helpers_editor.translation_helper_url + originalId + '?nohc';
    207203        $.getJSON( requestUrl, function( data ) {
Note: See TracChangeset for help on using the changeset viewer.