| Current Path : /home/wuectly/www/03cbe/ |
| Current File : /home/wuectly/www/03cbe/codemirror.zip |
PK \$]GL:* * element.phpnu &1i� <?php
/**
* @package Joomla.Plugin
* @subpackage Editors.codemirror
*
* @copyright (C) 2015 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access
defined('_JEXEC') or die;
$options = $displayData->options;
$params = $displayData->params;
$name = $displayData->name;
$id = $displayData->id;
$cols = $displayData->cols;
$rows = $displayData->rows;
$content = $displayData->content;
$buttons = $displayData->buttons;
$modifier = $params->get('fullScreenMod', array()) ? implode(' + ', $params->get('fullScreenMod', array())) . ' + ' : '';
?>
<p class="label">
<?php echo JText::sprintf('PLG_CODEMIRROR_TOGGLE_FULL_SCREEN', $modifier, $params->get('fullScreen', 'F10')); ?>
</p>
<?php
echo '<textarea class="codemirror-source" name="', $name,
'" id="', $id,
'" cols="', $cols,
'" rows="', $rows,
'" data-options="', htmlspecialchars(json_encode($options)),
'">', $content, '</textarea>';
?>
<?php echo $buttons; ?>
PK \$]�1nB B
styles.phpnu &1i� <?php
/**
* @package Joomla.Plugin
* @subpackage Editors.codemirror
*
* @copyright (C) 2015 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access
defined('_JEXEC') or die;
$params = $displayData->params;
$fontFamily = isset($displayData->fontFamily) ? $displayData->fontFamily : 'monospace';
$fontSize = $params->get('fontSize', 13) . 'px;';
$lineHeight = $params->get('lineHeight', 1.2) . 'em;';
// Set the active line color.
$color = $params->get('activeLineColor', '#a4c2eb');
$r = hexdec($color[1] . $color[2]);
$g = hexdec($color[3] . $color[4]);
$b = hexdec($color[5] . $color[6]);
$activeLineColor = 'rgba(' . $r . ', ' . $g . ', ' . $b . ', .5)';
// Set the color for matched tags.
$color = $params->get('highlightMatchColor', '#fa542f');
$r = hexdec($color[1] . $color[2]);
$g = hexdec($color[3] . $color[4]);
$b = hexdec($color[5] . $color[6]);
$highlightMatchColor = 'rgba(' . $r . ', ' . $g . ', ' . $b . ', .5)';
JFactory::getDocument()->addStyleDeclaration(
<<<CSS
.CodeMirror
{
font-family: $fontFamily;
font-size: $fontSize;
line-height: $lineHeight;
border: 1px solid #ccc;
}
/* In order to hid the Joomla menu */
.CodeMirror-fullscreen
{
z-index: 1040;
}
/* Make the fold marker a little more visible/nice */
.CodeMirror-foldmarker
{
background: rgb(255, 128, 0);
background: rgba(255, 128, 0, .5);
box-shadow: inset 0 0 2px rgba(255, 255, 255, .5);
font-family: serif;
font-size: 90%;
border-radius: 1em;
padding: 0 1em;
vertical-align: middle;
color: white;
text-shadow: none;
}
.CodeMirror-foldgutter, .CodeMirror-markergutter { width: 1.2em; text-align: center; }
.CodeMirror-markergutter { cursor: pointer; }
.CodeMirror-markergutter-mark { cursor: pointer; text-align: center; }
.CodeMirror-markergutter-mark:after { content: "\25CF"; }
.CodeMirror-activeline-background { background: $activeLineColor; }
.CodeMirror-matchingtag { background: $highlightMatchColor; }
.cm-matchhighlight {background-color: $highlightMatchColor; }
.CodeMirror-selection-highlight-scrollbar {background-color: $highlightMatchColor; }
CSS
);
PK \$]��'d� � init.phpnu &1i� <?php
/**
* @package Joomla.Plugin
* @subpackage Editors.codemirror
*
* @copyright (C) 2015 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access
defined('_JEXEC') or die;
$params = $displayData->params;
$basePath = $params->get('basePath', 'media/editors/codemirror/');
$modePath = $params->get('modePath', 'media/editors/codemirror/mode/%N/%N');
$extJS = JDEBUG ? '.js' : '.min.js';
$extCSS = JDEBUG ? '.css' : '.min.css';
JHtml::_('script', $basePath . 'lib/codemirror' . $extJS, array('version' => 'auto'));
JHtml::_('script', $basePath . 'lib/addons' . $extJS, array('version' => 'auto'));
JHtml::_('stylesheet', $basePath . 'lib/codemirror' . $extCSS, array('version' => 'auto'));
JHtml::_('stylesheet', $basePath . 'lib/addons' . $extCSS, array('version' => 'auto'));
$fskeys = $params->get('fullScreenMod', array());
$fskeys[] = $params->get('fullScreen', 'F10');
$fullScreenCombo = implode('-', $fskeys);
$fsCombo = json_encode($fullScreenCombo);
$modPath = json_encode(JUri::root(true) . '/' . $modePath . $extJS);
JFactory::getDocument()->addScriptDeclaration(
<<<JS
;(function (cm, $) {
cm.commands.toggleFullScreen = function (cm) {
cm.setOption('fullScreen', !cm.getOption('fullScreen'));
};
cm.commands.closeFullScreen = function (cm) {
cm.getOption('fullScreen') && cm.setOption('fullScreen', false);
};
cm.keyMap.default['Ctrl-Q'] = 'toggleFullScreen';
cm.keyMap.default[$fsCombo] = 'toggleFullScreen';
cm.keyMap.default['Esc'] = 'closeFullScreen';
// For mode autoloading.
cm.modeURL = $modPath;
// Fire this function any time an editor is created.
cm.defineInitHook(function (editor)
{
// Try to set up the mode
var mode = cm.findModeByMIME(editor.options.mode || '') ||
cm.findModeByName(editor.options.mode || '') ||
cm.findModeByExtension(editor.options.mode || '');
cm.autoLoadMode(editor, mode ? mode.mode : editor.options.mode);
if (mode && mode.mime)
{
editor.setOption('mode', mode.mime);
}
// Handle gutter clicks (place or remove a marker).
editor.on('gutterClick', function (ed, n, gutter) {
if (gutter != 'CodeMirror-markergutter') { return; }
var info = ed.lineInfo(n),
hasMarker = !!info.gutterMarkers && !!info.gutterMarkers['CodeMirror-markergutter'];
ed.setGutterMarker(n, 'CodeMirror-markergutter', hasMarker ? null : makeMarker());
});
// jQuery's ready function.
$(function () {
// Some browsers do something weird with the fieldset which doesn't work well with CodeMirror. Fix it.
$(editor.getWrapperElement()).parent('fieldset').css('min-width', 0);
// Listen for Bootstrap's 'shown' event. If this editor was in a hidden element when created, it may need to be refreshed.
$(document.body).on('shown shown.bs.tab shown.bs.modal', function () { editor.refresh(); });
});
});
function makeMarker()
{
var marker = document.createElement('div');
marker.className = 'CodeMirror-markergutter-mark';
return marker;
}
// Initialize any CodeMirrors on page load and when a subform is added
$(function ($) {
initCodeMirror();
$('body').on('subform-row-add', initCodeMirror);
});
function initCodeMirror(event, container)
{
container = container || document;
$(container).find('textarea.codemirror-source').each(function () {
var input = $(this).removeClass('codemirror-source');
var id = input.prop('id');
Joomla.editors.instances[id] = cm.fromTextArea(this, input.data('options'));
});
}
}(CodeMirror, jQuery));
JS
);
PK \$]GL:* * element.phpnu &1i� PK \$]�1nB B
e styles.phpnu &1i� PK \$]��'d� � �
init.phpnu &1i� PK � �