[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
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 use Joomla\CMS\HTML\HTMLHelper; 16 use Joomla\CMS\Language\Text; 17 use Joomla\CMS\Uri\Uri; 18 19 $options = $displayData->options; 20 $params = $displayData->params; 21 $name = $displayData->name; 22 $id = $displayData->id; 23 $cols = $displayData->cols; 24 $rows = $displayData->rows; 25 $content = $displayData->content; 26 $extJS = JDEBUG ? '.js' : '.min.js'; 27 $modifier = $params->get('fullScreenMod', array()) ? implode(' + ', $params->get('fullScreenMod', array())) . ' + ' : ''; 28 $basePath = $displayData->basePath; 29 $modePath = $displayData->modePath; 30 $modPath = 'mod-path="' . Uri::root() . $modePath . $extJS . '"'; 31 $fskeys = $params->get('fullScreenMod', array()); 32 $fskeys[] = $params->get('fullScreen', 'F10'); 33 $fullScreenCombo = implode('-', $fskeys); 34 $fsCombo = 'fs-combo=' . json_encode($fullScreenCombo); 35 $option = 'options=\'' . json_encode($options) . '\''; 36 $mediaVersion = Factory::getDocument()->getMediaVersion(); 37 $editor = 'editor="' . ltrim(HTMLHelper::_('script', $basePath . 'lib/codemirror' . $extJS, ['version' => 'auto', 'pathOnly' => true]), '/') . '?' . $mediaVersion . '"'; 38 $addons = 'addons="' . ltrim(HTMLHelper::_('script', $basePath . 'lib/addons' . $extJS, ['version' => 'auto', 'pathOnly' => true]), '/') . '?' . $mediaVersion . '"'; 39 40 Factory::getDocument()->getWebAssetManager() 41 ->registerAndUseStyle('codemirror.lib.main', $basePath . 'lib/codemirror.css') 42 ->registerAndUseStyle('codemirror.lib.addons', $basePath . 'lib/addons.css', [], [], ['codemirror.lib.main']) 43 ->registerScript( 44 'webcomponent.editor-codemirror-es5', 45 'plg_editors_codemirror/joomla-editor-codemirror-es5.min.js', 46 ['dependencies' => ['wcpolyfill']], 47 ['defer' => true, 'nomodule' => true], 48 ['wcpolyfill'] 49 ) 50 ->registerAndUseScript( 51 'webcomponent.editor-codemirror', 52 'plg_editors_codemirror/joomla-editor-codemirror.min.js', 53 [], 54 ['type' => 'module'], 55 ['webcomponent.editor-codemirror-es5'] 56 ); 57 ?> 58 <joomla-editor-codemirror <?php echo $editor . ' ' . $addons . ' ' . $modPath . ' ' . $fsCombo . ' ' . $option; ?>> 59 <?php echo '<textarea name="', $name, '" id="', $id, '" cols="', $cols, '" rows="', $rows, '">', $content, '</textarea>'; ?> 60 <p class="small float-end"> 61 <?php echo Text::sprintf('PLG_CODEMIRROR_TOGGLE_FULL_SCREEN', $fullScreenCombo); ?> 62 </p> 63 </joomla-editor-codemirror> 64 <?php echo $displayData->buttons; ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |