CoreFiles by mySites.guru
admin-article-readmore.js29 lines, 896 bytes, from Joomla_4.0.4-Stable-Full_Package.zip
Raw History Compare with 4.0.3
md5
2f2a0e2fcc48444f30cfdd5c3828f9f7
sha1
bd326bac3a7fd9f100850c1f70b923500cf28674
sha256
628831638f6f1e4f6ebb860cc8ecb83f97519b74c713b6923d8b417917573a82
/**
 * @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 28 releases, Joomla 4.0.0-rc1 to 4.1.0-beta3. See them all, or every version of this file.