diff --git a/layouts/joomla/tinymce/textarea.php b/layouts/joomla/tinymce/textarea.php index 0c969b423a03e..c116c3a2f4118 100644 --- a/layouts/joomla/tinymce/textarea.php +++ b/layouts/joomla/tinymce/textarea.php @@ -19,6 +19,7 @@ rows="rows; ?>" style="width: width; ?>; height: height; ?>;" class="class) ? 'mce_editable' : $data->class; ?>" + readonly ? ' readonly disabled' : ''; ?> > content; ?> \ No newline at end of file diff --git a/libraries/cms/editor/editor.php b/libraries/cms/editor/editor.php index 5f0ce39beb95d..cdc9150be784e 100644 --- a/libraries/cms/editor/editor.php +++ b/libraries/cms/editor/editor.php @@ -315,6 +315,9 @@ public function display($name, $html, $width, $height, $col, $row, $buttons = tr $args['row'] = $row; $args['buttons'] = $buttons; $args['id'] = $id ?: $name; + $args['asset'] = $asset; + $args['author'] = $author; + $args['params'] = $params; $args['event'] = 'onDisplay'; $results[] = $this->_editor->update($args); diff --git a/libraries/cms/form/field/editor.php b/libraries/cms/form/field/editor.php index 486a9beb5f982..ab3287f7d6f16 100644 --- a/libraries/cms/form/field/editor.php +++ b/libraries/cms/form/field/editor.php @@ -241,11 +241,12 @@ protected function getInput() { // Get an editor object. $editor = $this->getEditor(); + $readonly = $this->readonly || $this->disabled; return $editor->display( $this->name, htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8'), $this->width, $this->height, $this->columns, $this->rows, $this->buttons ? (is_array($this->buttons) ? array_merge($this->buttons, $this->hide) : $this->hide) : false, $this->id, $this->asset, - $this->form->getValue($this->authorField), array('syntax' => (string) $this->element['syntax']) + $this->form->getValue($this->authorField), array('syntax' => (string) $this->element['syntax'], 'readonly' => $readonly) ); } diff --git a/plugins/editors/codemirror/codemirror.php b/plugins/editors/codemirror/codemirror.php index 4cc1e3a4391bb..4073e85110ade 100644 --- a/plugins/editors/codemirror/codemirror.php +++ b/plugins/editors/codemirror/codemirror.php @@ -196,6 +196,12 @@ public function onDisplay( // Options for the CodeMirror constructor. $options = new stdClass; + // Is field readonly? + if (!empty($params['readonly'])) + { + $options->readOnly = 'nocursor'; + } + // Should we focus on the editor on load? $options->autofocus = (boolean) $this->params->get('autoFocus', true); diff --git a/plugins/editors/none/none.php b/plugins/editors/none/none.php index 9b520321de03a..81dfb59cef494 100644 --- a/plugins/editors/none/none.php +++ b/plugins/editors/none/none.php @@ -122,9 +122,11 @@ public function onDisplay($name, $content, $width, $height, $col, $row, $buttons $height .= 'px'; } + $readonly = !empty($params['readonly']) ? ' readonly disabled' : ''; + $editor = '