CoreFiles by mySites.guru
admin-article-readmore.js30 lines, 899 bytes, from Joomla_4.2.7-Stable-Full_Package.zip
Raw History Compare with 4.2.6
md5
b9299a334c0465804e9bd028df3f803d
sha1
142735b4f3ea3234fdf0a9a2fb1311629a9bf676
sha256
0b94fe65c391f6f9c9ee1ef3e3a99e71eb753568b69606f1e4790886087b58ac
/**
 * @copyright  (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */
(() => {

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

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

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

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

    return true;
  };
})();

The same content is in 5 releases, Joomla 4.2.7-rc1 to 4.2.9. See them all, or every version of this file.