Get text editor toolbar preference working with webcomponents

This commit is contained in:
nathan 2022-07-14 13:22:48 -06:00
parent 53e5e45a5d
commit 96354be5ec
3 changed files with 26 additions and 26 deletions

View File

@ -105,26 +105,29 @@ class HtmlArea extends Etemplate\Widget
* Create an array of toolbar as sel options
*
* @return array
* [
* id => {string}
* label => {string}
* title => {string}
* icon => {string}
* app => {string}
* ]
* [
* id => {string}
* value => {string}
* label => {string}
* title => {string}
* icon => {string}
* app => {string}
* ]
*/
public static function get_toolbar_as_selOptions ()
{
$toolbar_selOptions = array();
foreach (self::$toolbar_list as $toolbar)
{
$file = '/api/templates/default/images/htmlarea/'.$toolbar.'.svg';
$toolbar_selOptions[$toolbar] = array (
'id' => $toolbar,
$file = '/api/templates/default/images/htmlarea/' . $toolbar . '.svg';
$toolbar_selOptions[$toolbar] = array(
'id' => $toolbar,
// Selectbox validation can't understand all these options without value
'value' => $toolbar,
'label' => lang($toolbar),
'title' => lang($toolbar),
'icon' => file_exists(EGW_SERVER_ROOT.$file)?Api\Framework::getUrl($GLOBALS['egw_info']['server']['webserver_url'].$file):'',
'app' => 'api'
'icon' => file_exists(EGW_SERVER_ROOT . $file) ? Api\Framework::getUrl($GLOBALS['egw_info']['server']['webserver_url'] . $file) : '',
'app' => 'api'
);
}
return $toolbar_selOptions;

View File

@ -456,19 +456,12 @@ class preferences_hooks
'default' => '1',
),
'rte_toolbar' => array(
'type' => 'taglist',
'label' => 'Enabled features in toolbar',
'name' => 'rte_toolbar',
'values'=> '',
'help' => 'You may select features to be enabled in toolbar. Selecting any of the tools from here means seleted "Feature of the editor" preference would be ignored.',
'admin' => true,
'attributes' => array(
'allowFreeEntries' => false,
//'multiple' => 'toggle',
'editModeEnabled' => false,
'autocomplete_url' => ' ',
'select_options' => Api\Etemplate\Widget\HtmlArea::get_toolbar_as_selOptions()
)
'type' => 'taglist',
'label' => 'Enabled features in toolbar',
'name' => 'rte_toolbar',
'values' => Api\Etemplate\Widget\HtmlArea::get_toolbar_as_selOptions(),
'help' => 'You may select features to be enabled in toolbar. Selecting any of the tools from here means seleted "Feature of the editor" preference would be ignored.',
'admin' => true
)
);
// disable thumbnails, if no size configured by admin

View File

@ -479,6 +479,7 @@ class preferences_settings
$tpl->setElementAttribute($tab . '[' . $setting['name'] . ']', 'autocomplete_url', '');
}
$setting['type'] = 'et2-select';
$setting['multiple'] = true;
$tpl->setElementAttribute($tab . '[' . $setting['name'] . ']', 'multiple', true);
break;
}
@ -532,7 +533,10 @@ class preferences_settings
'onchange' => $setting['onchange']
);
// 'attributes' => $setting['attributes']
foreach($setting['attributes'] as $attr => $attr_value)
{
$tpl->setElementAttribute($tab . '[' . $setting['name'] . ']', $attr, $attr_value);
}
//error_log("appname=$appname, attribute=$attribute, setting=".array2string($setting));
$content[$tab][$setting['name']] = $GLOBALS['egw']->preferences->{$attribute}[$appname][$setting['name']];
//if ($old_type == 'multiselect') $content[$tab][$setting['name']] = explode(',', $content[$tab][$setting['name']]);