diff --git a/administrator/components/com_media/controllers/folder.php b/administrator/components/com_media/controllers/folder.php index 532cf733a37dc..b507a0ccfc8bc 100644 --- a/administrator/components/com_media/controllers/folder.php +++ b/administrator/components/com_media/controllers/folder.php @@ -166,7 +166,7 @@ function create() if (in_array(false, $result, true)) { // There are some errors in the plugins JError::raiseWarning(100, JText::plural('COM_MEDIA_ERROR_BEFORE_SAVE', count($errors = $object_file->getErrors()), implode('
', $errors))); - continue; + return false; } JFolder::create($path); diff --git a/administrator/language/en-GB/en-GB.plg_editors_codemirror.ini b/administrator/language/en-GB/en-GB.plg_editors_codemirror.ini index 4749573f57e58..e63a784936137 100644 --- a/administrator/language/en-GB/en-GB.plg_editors_codemirror.ini +++ b/administrator/language/en-GB/en-GB.plg_editors_codemirror.ini @@ -11,4 +11,12 @@ PLG_CODEMIRROR_FIELD_TABMODE_LABEL="Tab mode" PLG_CODEMIRROR_FIELD_VALUE_TABMODE_INDENT="Indent" PLG_CODEMIRROR_FIELD_VALUE_TABMODE_SHIFT="Shift" PLG_CODEMIRROR_XML_DESCRIPTION="This plugin loads the CodeMirror editor." -PLG_EDITORS_CODEMIRROR="Editor - CodeMirror" \ No newline at end of file +PLG_EDITORS_CODEMIRROR="Editor - CodeMirror" + +PLG_CODEMIRROR_FIELD_MINHEIGHT_DESC="The minimum height of the editor display in pixels." +PLG_CODEMIRROR_FIELD_MINHEIGHT_LABEL="Minimum height (px)" +PLG_CODEMIRROR_FIELD_FONTSIZE_DESC="The size of the font in the editor." +PLG_CODEMIRROR_FIELD_FONTSIZE_LABEL="Font size (px)" +PLG_CODEMIRROR_FIELD_FONT_DESC="The font to use in the editor. If not installed, will be loaded from http://www.google.com/webfonts" +PLG_CODEMIRROR_FIELD_FONT_LABEL="Font" +PLG_CODEMIRROR_FIELD_VALUE_FONT_DEFAULT="Browser Default" \ No newline at end of file diff --git a/media/editors/codemirror/css/codemirror.css b/media/editors/codemirror/css/codemirror.css index 103020dbc2077..93153f47e0067 100644 --- a/media/editors/codemirror/css/codemirror.css +++ b/media/editors/codemirror/css/codemirror.css @@ -7,4 +7,10 @@ font-size: 10pt; font-family: monospace; padding-top: .4em; +} + +.CodeMirror-wrapping +{ + box-shadow: inset 0px 0px 3px #333; + background: #fafafa; } \ No newline at end of file diff --git a/plugins/editors/codemirror/codemirror.php b/plugins/editors/codemirror/codemirror.php index a5445501d5bb5..8d8317b31c561 100644 --- a/plugins/editors/codemirror/codemirror.php +++ b/plugins/editors/codemirror/codemirror.php @@ -125,7 +125,11 @@ public function onDisplay($name, $content, $width, $height, $col, $row, $buttons $width .= 'px'; } + // if height is given in pixels, compare it to the minheight param and keep the bigger of the two + $height = trim($height, 'px'); + $minheight = (int) $this->params->get('editor_minheight', 100); if (is_numeric($height)) { + $height = max($height, $minheight); $height .= 'px'; } @@ -174,6 +178,7 @@ public function onDisplay($name, $content, $width, $height, $col, $row, $buttons { $style = JURI::root(true).'/'.$this->_basePath.'/css/'.$style; } + $styleSheet[] = $this->getFontStyleSheet(); $options = new stdClass; @@ -194,13 +199,16 @@ public function onDisplay($name, $content, $width, $height, $col, $row, $buttons $options->tabMode = 'shift'; } + $editorStyles = $this->getEditorStyles(); + $html = array(); $html[] = ""; $html[] = $buttons; $html[] = ''; @@ -258,4 +266,57 @@ protected function _displayButtons($name, $buttons, $asset, $author) return implode("\n", $html); } + + /** + * Gets the url of a font stylesheet (from google web fonts) based on param values + * + * @return string $styleSheet a url (or empty string) + * @access protected + */ + protected function getFontStyleSheet() + { + $key = $this->params->get('font_family', 0); + $styleSheets = array( + 'anonymous_pro' => 'http://fonts.googleapis.com/css?family=Anonymous+Pro:400,700,400italic,700italic&subset=latin,latin-ext&v2', + 'cousine' => 'http://fonts.googleapis.com/css?family=Cousine:400,700italic,700,400italic&subset=latin,latin-ext&v2', + 'droid_sans_mono' => 'http://fonts.googleapis.com/css?family=Droid+Sans+Mono&subset=latin,latin-ext&v2', + 'inconsolata' => 'http://fonts.googleapis.com/css?family=Inconsolata&subset=latin,latin-ext&v2', + 'lekton' => 'http://fonts.googleapis.com/css?family=Lekton:400,400italic,700&subset=latin,latin-ext&v2', + 'nova_mono' => 'http://fonts.googleapis.com/css?family=Nova+Mono&subset=latin,latin-ext&v2', + 'ubuntu_mono' => 'http://fonts.googleapis.com/css?family=Ubuntu+Mono&subset=latin,latin-ext&v2', + 'vt323' => 'http://fonts.googleapis.com/css?family=VT323&subset=latin,latin-ext&v2' + ); + + return isset($styleSheets[$key]) ? $styleSheets[$key] : ''; + } + + /** + * Gets style declarations for using the select font and size from params + * returning as array for json encoding + * + * @return array + * @access protected + */ + protected function getEditorStyles() + { + $key = $this->params->get('font_family', 0); + $fonts = array( + 'anonymous_pro' => 'Anonymous Pro, monospace', + 'cousine' => 'Cousine, monospace', + 'droid_sans_mono' => 'Droid Sans Mono, monospace', + 'inconsolata' => 'Inconsolata, monospace', + 'lekton' => 'Tekton, monospace', + 'nova_mono' => 'Nova Mono, monospace', + 'ubuntu_mono' => 'Ubuntu Mono, monospace', + 'vt323' => 'VT323, monospace' + ); + + $size = (int) $this->params->get('font_size', 10); + + $styles = array( + 'font-family' => isset($fonts[$key]) ? $fonts[$key] : 'monospace', + 'font-size' => $size.'px' + ); + return $styles; + } } diff --git a/plugins/editors/codemirror/codemirror.xml b/plugins/editors/codemirror/codemirror.xml index c4a3c1f3307f6..d4f2d1b996449 100644 --- a/plugins/editors/codemirror/codemirror.xml +++ b/plugins/editors/codemirror/codemirror.xml @@ -37,6 +37,35 @@ + + + + + + + + + + + + + + + + +