[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/plugins/editors/codemirror/layouts/editors/codemirror/ -> styles.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Plugin
   5   * @subpackage  Editors.codemirror
   6   *
   7   * @copyright   (C) 2015 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9   */
  10  
  11  // No direct access
  12  defined('_JEXEC') or die;
  13  
  14  use Joomla\CMS\Factory;
  15  
  16  $params     = $displayData->params;
  17  $fontFamily = $displayData->fontFamily ?? 'monospace';
  18  $fontSize   = $params->get('fontSize', 13) . 'px;';
  19  $lineHeight = $params->get('lineHeight', 1.2) . 'em;';
  20  
  21  // Set the active line color.
  22  $color           = $params->get('activeLineColor', '#a4c2eb');
  23  $r               = hexdec($color[1] . $color[2]);
  24  $g               = hexdec($color[3] . $color[4]);
  25  $b               = hexdec($color[5] . $color[6]);
  26  $activeLineColor = 'rgba(' . $r . ', ' . $g . ', ' . $b . ', .5)';
  27  
  28  // Set the color for matched tags.
  29  $color               = $params->get('highlightMatchColor', '#fa542f');
  30  $r                   = hexdec($color[1] . $color[2]);
  31  $g                   = hexdec($color[3] . $color[4]);
  32  $b                   = hexdec($color[5] . $color[6]);
  33  $highlightMatchColor = 'rgba(' . $r . ', ' . $g . ', ' . $b . ', .5)';
  34  
  35  /** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
  36  $wa = Factory::getApplication()->getDocument()->getWebAssetManager();
  37  $wa->registerAndUseStyle('plg_editors_codemirror', 'plg_editors_codemirror/codemirror.css');
  38  $wa->addInlineStyle(
  39  <<<CSS
  40          .CodeMirror {
  41              font-family: $fontFamily;
  42              font-size: $fontSize;
  43              line-height: $lineHeight;
  44              height: calc(100vh - 600px);
  45              min-height: 400px;
  46              max-height: 800px;
  47          }
  48          .CodeMirror-activeline-background { background: $activeLineColor; }
  49          .CodeMirror-matchingtag { background: $highlightMatchColor; }
  50          .cm-matchhighlight {background-color: $highlightMatchColor; }
  51          .CodeMirror-selection-highlight-scrollbar {background-color: $highlightMatchColor; }
  52  CSS
  53  );


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer