CoreFiles by mySites.guru
admin-modules-modal.js46 lines, 1,835 bytes, from Joomla_4.0.0-alpha9-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha8
md5
b9f44e7a817ba9b96b7b40e931d0b671
sha1
b45e188be842b2a7474aff29cb1b11e433ccd588
sha256
dec6b63c70675bf78c2c6fe71251bc039b90b6ab6cd4bb417c5904f793882588
/**
* PLEASE DO NOT MODIFY THIS FILE. WORK ON THE ES6 VERSION.
* OTHERWISE YOUR CHANGES WILL BE REPLACED ON THE NEXT BUILD.
**/

/**
 * @copyright  Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */
document.addEventListener('DOMContentLoaded', function () {
  'use strict';
  /** Get the elements * */

  var modulesLinks = [].slice.call(document.querySelectorAll('.js-module-insert'));
  var positionsLinks = [].slice.call(document.querySelectorAll('.js-position-insert'));
  /** Assign listener for click event (for single module id insertion) * */

  modulesLinks.forEach(function (modulesLink) {
    modulesLink.addEventListener('click', function (event) {
      event.preventDefault();
      var modid = event.target.getAttribute('data-module');
      var editor = event.target.getAttribute('data-editor'); // Insert the short tag in the editor

      window.parent.Joomla.editors.instances[editor].replaceSelection("{loadmoduleid ".concat(modid, "}")); // Close the modal

      if (window.parent.Joomla.Modal) {
        window.parent.Joomla.Modal.getCurrent().close();
      }
    });
  });
  /** Assign listener for click event (for position insertion) * */

  positionsLinks.forEach(function (positionsLink) {
    positionsLink.addEventListener('click', function (event) {
      event.preventDefault();
      var position = event.target.getAttribute('data-position');
      var editor = event.target.getAttribute('data-editor'); // Insert the short tag in the editor

      window.parent.Joomla.editors.instances[editor].replaceSelection("{loadposition ".concat(position, "}")); // Close the modal

      if (window.parent.Joomla.Modal) {
        window.parent.Joomla.Modal.getCurrent().close();
      }
    });
  });
});

The same content is in 3 releases, Joomla 4.0.0-alpha8 to 4.0.0-alpha10. See them all, or every version of this file.