TinyMCE editor for HTML textareas (except description)

Textareas with HTML enabled - except the description field - should be
editable with a (simple) rich text editor. This allows also users
without HTML skills to create formatted text. The description field is
excluded to ensure a working layout with this common field.

These are just some quick changes working well for our use cases.
Probably there's a more elegant implementation possible.
This commit is contained in:
purplewhite
2015-12-29 18:11:23 +01:00
parent 9fa189cadb
commit bfb8a79aaf
3 changed files with 38 additions and 3 deletions
+10
View File
@@ -428,6 +428,16 @@ p.um-notice.warning {
outline: none !important;
}
.um-form .wp-editor-container {
border: 1px solid #ddd;
}
.um-form .wp-editor-container textarea {
background: #ddd !important;
color: #222 !important;
border-radius: 0;
}
/*
- Radio & Checkboxes
*/
+1 -1
View File
File diff suppressed because one or more lines are too long
+27 -2
View File
@@ -1215,8 +1215,33 @@ class UM_Fields {
$output .= '<div class="um-field-area">';
$output .= '<textarea style="height: '.$height.';" class="'.$this->get_class($key, $data).'" name="'.$key.'" id="'.$key.'" placeholder="'.$placeholder.'">'.$this->field_value( $key, $default, $data ).'</textarea>
if ( isset( $data['html'] ) && $data['html'] != 0 && $key != "description" ) {
$textarea_settings = array(
'media_buttons' => false,
'wpautop' => false,
'editor_class' => $this->get_class($key, $data),
'editor_height' => $height,
'tinymce'=> array(
'toolbar1' => 'formatselect,bullist,numlist,bold,italic,underline,forecolor,blockquote,hr,removeformat,link,unlink,undo,redo',
'toolbar2' => ''
)
);
// turn on the output buffer
ob_start();
// echo the editor to the buffer
wp_editor( $this->field_value( $key, $default, $data ) , $key, $textarea_settings );
// add the contents of the buffer to the output variable
$output .= ob_get_clean();
}
else $output .= '<textarea style="height: '.$height.';" class="'.$this->get_class($key, $data).'" name="'.$key.'" id="'.$key.'" placeholder="'.$placeholder.'">'.$this->field_value( $key, $default, $data ).'</textarea>';
$output .= '
</div>';
if ( $this->is_error($key) ) {