mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
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:
@@ -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
|
||||
*/
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+27
-2
@@ -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) ) {
|
||||
|
||||
Reference in New Issue
Block a user