CoreFiles by mySites.guru
admin-article-readmore.js33 lines, 950 bytes, from Joomla_4.0.0-alpha9-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha8
md5
21215c65e8ebe638ae10f7e38be036ea
sha1
fde2cd6aea425bf00366c73adea9e277c5645437
sha256
68270d3847eb42b4ac8f9c93005a8abd74c4e920b152c5c73c9c887ce349e44a
/**
* 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
 */
(function () {
  'use strict';

  var options = window.Joomla.getOptions('xtd-readmore');

  window.insertReadmore = function (editor) {
    if (!options) {
      // Something went wrong!
      throw new Error('XTD Button \'read more\' not properly initialized');
    }

    var content = window.Joomla.editors.instances[editor].getValue();

    if (content && !content.match(/<hr\s+id=("|')system-readmore("|')\s*\/*>/i)) {
      Joomla.editors.instances[editor].replaceSelection('<hr id="system-readmore">');
    } else {
      // TODO replace with joomla-alert
      alert(options.exists);
      return false;
    }

    return true;
  };
})();

The same content is in 5 releases, Joomla 4.0.0-alpha7 to 4.0.0-alpha11. See them all, or every version of this file.