Commit c53a5ade authored by Carsten  Rose's avatar Carsten Rose
Browse files

UsersManual/index.rst: update documentation for editor. FE types cleanup.

AbstractBuildForm.html: more default configs for the editor. Setting size of the editor.
richttexteditor.html: third RTE to show min/max_height.
parent 1f2dd9dd
...@@ -2029,23 +2029,44 @@ abstract class AbstractBuildForm { ...@@ -2029,23 +2029,44 @@ abstract class AbstractBuildForm {
* @return array * @return array
*/ */
private function setEditorConfig(array $formElement, $htmlFormElementId) { private function setEditorConfig(array $formElement, $htmlFormElementId) {
$flagMaxHeight = false;
// plugins
if (!isset($formElement[FE_EDITOR_PREFIX . 'plugins'])) { if (!isset($formElement[FE_EDITOR_PREFIX . 'plugins'])) {
$formElement[FE_EDITOR_PREFIX . 'plugins'] = 'code link searchreplace table textcolor textpattern visualchars'; $formElement[FE_EDITOR_PREFIX . 'plugins'] = 'code link searchreplace table textcolor textpattern visualchars';
} }
// toolbar: https://www.tinymce.com/docs/advanced/editor-control-identifiers/#toolbarcontrols
if (!isset($formElement[FE_EDITOR_PREFIX . 'toolbar'])) { if (!isset($formElement[FE_EDITOR_PREFIX . 'toolbar'])) {
$formElement[FE_EDITOR_PREFIX . 'toolbar'] = 'code link searchreplace table forecolor backcolor visualchars'; $formElement[FE_EDITOR_PREFIX . 'toolbar'] = 'code searchreplace undo redo | ' .
'styleselect link table | fontselect fontsizeselect | ' .
'bullist numlist outdent indent | forecolor backcolor bold italic';
}
// menubar
if (!isset($formElement[FE_EDITOR_PREFIX . 'menubar'])) {
$formElement[FE_EDITOR_PREFIX . 'menubar'] = 'false';
} }
// autofocus
if (isset($formElement['autofocus']) && $formElement['autofocus'] == 'yes') { if (isset($formElement['autofocus']) && $formElement['autofocus'] == 'yes') {
$formElement[FE_EDITOR_PREFIX . 'auto_focus'] = $htmlFormElementId; $formElement[FE_EDITOR_PREFIX . 'auto_focus'] = $htmlFormElementId;
} }
// Check for min_height, max_height
$minMax = explode(',', $formElement['size'], 2);
if (isset($minMax[0]) && ctype_digit($minMax[0]) && !isset($formElement[FE_EDITOR_PREFIX . 'min_height'])) {
$formElement[FE_EDITOR_PREFIX . 'min_height'] = $minMax[0];
}
if (isset($minMax[1]) && ctype_digit($minMax[1]) && !isset($formElement[FE_EDITOR_PREFIX . 'max_height'])) {
$formElement[FE_EDITOR_PREFIX . 'max_height'] = $minMax[1];
$flagMaxHeight = true;
}
// Disable the element path within the status bar at the bottom of the editor. // statusbar: disable if not user defined and if no max_height is given.
$formElement[FE_EDITOR_PREFIX . 'elementpath'] = 'false'; if (!$flagMaxHeight && !isset($formElement[FE_EDITOR_PREFIX . 'statusbar'])) {
$formElement[FE_EDITOR_PREFIX . 'statusbar'] = 'false';
}
return $formElement; return $formElement;
} }
...@@ -2074,7 +2095,11 @@ abstract class AbstractBuildForm { ...@@ -2074,7 +2095,11 @@ abstract class AbstractBuildForm {
throw new UserFormException("Empty '" . $prefix . "*' keyname: '" . $keyName . "'", ERROR_INVALID_EDITOR_PROPERTY_NAME); throw new UserFormException("Empty '" . $prefix . "*' keyname: '" . $keyName . "'", ERROR_INVALID_EDITOR_PROPERTY_NAME);
} }
if ($value != '') { // $value might be boolean false, which should be used! Do not compare with ''.
if (isset($value)) {
// real boolean are important for TinyMCE config 'statusbar', 'menubar', ...
if ($value === 'false') $value = false;
if ($value === 'true') $value = true;
$settings[$keyName] = $value; $settings[$keyName] = $value;
} }
} }
......
...@@ -68,12 +68,24 @@ ...@@ -68,12 +68,24 @@
<div class="form-group"> <div class="form-group">
<div class="col-md-2"> <div class="col-md-2">
<label for="text:2" class="control-label">Rich Text Editor (plugins, autofocus)</label> <label for="text:2" class="control-label">Rich Text Editor (plugins, autofocus, no statusbar)</label>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<textarea id="text:2" class="qfq-tinymce" name="rte" <textarea id="text:2" class="qfq-tinymce" name="rte"
data-config="{ &quot;plugins&quot;: &quot;advlist autolink link image lists charmap print preview&quot;, &quot;auto_focus&quot;: &quot;text:2&quot;}">Input data-config="{ &quot;plugins&quot;: &quot;advlist autolink link image lists charmap print preview&quot;, &quot;auto_focus&quot;: &quot;text:2&quot;, &quot;statusbar&quot;: false }">Input
</textarea>
</div>
</div>
<div class="form-group">
<div class="col-md-2">
<label for="text:3" class="control-label">Rich Text Editor (min_height, max_height)</label>
</div>
<div class="col-md-6">
<textarea id="text:3" class="qfq-tinymce" name="rte"
data-config="{ &quot;min_height&quot;: &quot;200&quot;, &quot;max_height&quot;: &quot;400&quot; }">Input
</textarea> </textarea>
</div> </div>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment