CoreFiles by mySites.guru
admin-article-readmore.js25 lines, 893 bytes, from Joomla_4.3.0-alpha2-Alpha-Full_Package.zip
Raw History Compare with 4.3.0-alpha1
md5
fbf8a53d452458beb6616b2fd7a5ec93
sha1
e597b8793b8ed3847b87fa74d1eab87a972d8941
sha256
5e44e5829a22a760fe3f376d9c2c266fb9805bf7d8f3b655860ce02712184bb0
/**
 * @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 {
      // @todo replace with joomla-alert
      alert(options.exists);
      return false;
    }
    return true;
  };
})();

The same content is in 2 releases, Joomla 4.3.0-alpha1 to 4.3.0-alpha2. See them all, or every version of this file.