View source
<?php
function wysiwyg_nicedit_editor() {
$editor = array();
$editor['nicedit'] = array(
'title' => 'NicEdit',
'vendor url' => 'http://nicedit.com',
'download url' => 'http://nicedit.com/download.php',
'library path' => wysiwyg_get_path('nicedit'),
'libraries' => array(
'' => array(
'title' => 'Source',
'files' => array(
'nicEdit.js',
),
),
),
'version callback' => 'wysiwyg_nicedit_version',
'settings callback' => 'wysiwyg_nicedit_settings',
'plugin callback' => 'wysiwyg_nicedit_plugins',
'versions' => array(
'0.9' => array(
'js files' => array(
'nicedit.js',
),
),
),
);
return $editor;
}
function wysiwyg_nicedit_version($editor) {
return '0.9';
}
function wysiwyg_nicedit_settings($editor, $config, $theme) {
$settings = array(
'iconsPath' => wysiwyg_get_path('nicedit', TRUE) . '/nicEditorIcons.gif',
);
if (!empty($config['buttons'])) {
$buttons = array();
foreach ($config['buttons'] as $plugin) {
$buttons = array_merge($buttons, $plugin);
}
$settings['buttonList'] = array_keys($buttons);
}
else {
$settings['fullPanel'] = TRUE;
}
if (isset($config['css_setting'])) {
if ($config['css_setting'] == 'theme') {
$css = path_to_theme() . '/style.css';
if (file_exists($css)) {
$settings['externalCSS'] = base_path() . $css;
}
}
else {
if ($config['css_setting'] == 'self' && isset($config['css_path'])) {
$settings['externalCSS'] = strtr($config['css_path'], array(
'%b' => base_path(),
'%t' => path_to_theme(),
));
}
}
}
return $settings;
}
function wysiwyg_nicedit_plugins($editor) {
return array(
'default' => array(
'buttons' => array(
'bold' => t('Bold'),
'italic' => t('Italic'),
'underline' => t('Underline'),
'strikethrough' => t('Strike-through'),
'left' => t('Align left'),
'center' => t('Align center'),
'right' => t('Align right'),
'ul' => t('Bullet list'),
'ol' => t('Numbered list'),
'outdent' => t('Outdent'),
'indent' => t('Indent'),
'image' => t('Image'),
'forecolor' => t('Forecolor'),
'bgcolor' => t('Backcolor'),
'superscript' => t('Sup'),
'subscript' => t('Sub'),
'hr' => t('Horizontal rule'),
'link' => t('Link'),
'unlink' => t('Unlink'),
'fontFormat' => t('HTML block format'),
'fontFamily' => t('Font'),
'fontSize' => t('Font size'),
'xhtml' => t('Source code'),
),
'internal' => TRUE,
),
);
}