CoreFiles by mySites.guru
admin-article-readmore.es6.js27 lines, 813 bytes, from Joomla_4.0.0-alpha6-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha5
md5
5b38fe36afa30439767c32b314781255
sha1
ed8708eb1a5efc13893d9de700d45f1141568a19
sha256
7040579d3d4c703db728af512a25bf1f9b15a64164cc32bd99eeb915be441294
/**
 * @copyright  Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */
(() => {
  'use strict';

  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 && !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.0.0-alpha5 to 4.0.0-alpha6. See them all, or every version of this file.