Sha256: bdd32aa0dbf7afecf1e58712b7514c59eed51adadc0557c22cda3c0f1d5b558e

Contents?: true

Size: 654 Bytes

Versions: 13

Compression:

Stored size: 654 Bytes

Contents

/**
 * When switching tabs in i18n fields, autofocus on the input to save clicks #212
 */
$(() => {
  // Event launched by foundation
  $("[data-tabs]").on("change.zf.tabs", (event) => {
    const $container = $(event.target).parent().next(".tabs-content").find(".tabs-panel.is-active");
    // Detect rich text editor inside the tabs-panel
    let $content = $container.find(".editor .ProseMirror");
    if ($content.length > 0) {
      $content.focus();
    // Detect if inside the tabs-panel have an input
    } else {
      $content = $container.find("input:first");
      if ($content.length > 0) {
        $content.focus();
      }
    }
  });
});

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
decidim-admin-0.29.1 app/packs/src/decidim/admin/tab_focus.js
decidim-admin-0.28.4 app/packs/src/decidim/admin/tab_focus.js
decidim-admin-0.29.0 app/packs/src/decidim/admin/tab_focus.js
decidim-admin-0.28.3 app/packs/src/decidim/admin/tab_focus.js
decidim-admin-0.29.0.rc4 app/packs/src/decidim/admin/tab_focus.js
decidim-admin-0.29.0.rc3 app/packs/src/decidim/admin/tab_focus.js
decidim-admin-0.29.0.rc2 app/packs/src/decidim/admin/tab_focus.js
decidim-admin-0.29.0.rc1 app/packs/src/decidim/admin/tab_focus.js
decidim-admin-0.28.2 app/packs/src/decidim/admin/tab_focus.js
decidim-admin-0.28.1 app/packs/src/decidim/admin/tab_focus.js
decidim-admin-0.28.0 app/packs/src/decidim/admin/tab_focus.js
decidim-admin-0.28.0.rc5 app/packs/src/decidim/admin/tab_focus.js
decidim-admin-0.28.0.rc4 app/packs/src/decidim/admin/tab_focus.js