Restore wysiwyg plugin api (#147)
Partly. Plugins still need to use a different JS, fitting for the ckeditor. And plugins are bundled in the other-part of the toolbar instead of trying to follow the (xinha-)toolbar parameter
This commit is contained in:
parent
3b3018b173
commit
1b80ba69a1
@ -161,7 +161,6 @@ function serendipity_emit_htmlarea_code($item, $jsname, $spawnMulti = false) {
|
|||||||
if ($init && $spawnMulti) {
|
if ($init && $spawnMulti) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($serendipity['wysiwyg']) && $serendipity['wysiwyg']) {
|
if (isset($serendipity['wysiwyg']) && $serendipity['wysiwyg']) {
|
||||||
|
|
||||||
$eventData = array(
|
$eventData = array(
|
||||||
@ -171,25 +170,14 @@ function serendipity_emit_htmlarea_code($item, $jsname, $spawnMulti = false) {
|
|||||||
'skip' => false,
|
'skip' => false,
|
||||||
'buttons'=> array()
|
'buttons'=> array()
|
||||||
);
|
);
|
||||||
|
|
||||||
serendipity_plugin_api::hook_event('backend_wysiwyg', $eventData);
|
serendipity_plugin_api::hook_event('backend_wysiwyg', $eventData);
|
||||||
|
|
||||||
if ($eventData['skip']) {
|
if ($eventData['skip']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// entryform, staticpages, html nuggets
|
$data = array('init' => $init, 'spawnMulti' => $spawnMulti, 'jsname' => $jsname, 'item' => $item, 'buttons' => $eventData['buttons']);
|
||||||
if (isset($serendipity['GET']['adminModule']) && ($serendipity['GET']['adminModule'] == 'entries' || $serendipity['GET']['adminModule'] == 'event_display' || $serendipity['GET']['adminModule'] == 'plugins') )
|
|
||||||
{
|
|
||||||
$backend_wysiwyg = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$data = array();
|
|
||||||
$data['init'] = $init;
|
|
||||||
$data['spawnMulti'] = $spawnMulti;
|
|
||||||
$data['jsname'] = $jsname;
|
|
||||||
$data['eventData'] = $eventData;
|
|
||||||
$data['item'] = $item;
|
|
||||||
$data['backend_wysiwyg'] = $backend_wysiwyg ? $backend_wysiwyg : false;
|
|
||||||
|
|
||||||
echo serendipity_smarty_show('admin/wysiwyg_init.tpl', $data);
|
echo serendipity_smarty_show('admin/wysiwyg_init.tpl', $data);
|
||||||
}
|
}
|
||||||
|
@ -19,9 +19,29 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
{foreach $buttons as $button}
|
||||||
|
CKEDITOR.plugins.add('{$button.id}', {
|
||||||
|
init: function( editor ) {
|
||||||
|
editor.addCommand( '{$button.name}', {
|
||||||
|
exec : function( editor ) {
|
||||||
|
{$button.javascript}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
editor.ui.addButton('{$button.id}', {
|
||||||
|
label: '{$button.name}',
|
||||||
|
command: '{$button.name}',
|
||||||
|
icon: '{$button.img_url}'
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
{/foreach}
|
||||||
|
|
||||||
|
|
||||||
CKEDITOR.replace($('#'+serendipity.escapeBrackets('{$item}')).get(0), {
|
CKEDITOR.replace($('#'+serendipity.escapeBrackets('{$item}')).get(0), {
|
||||||
customConfig : '{$serendipityHTTPPath}htmlarea/ckeditor_custom_config.js',
|
customConfig : '{$serendipityHTTPPath}htmlarea/ckeditor_custom_config.js',
|
||||||
extraPlugins : 's9y_medialibrary{$item}',
|
extraPlugins : 's9y_medialibrary{$item}{foreach $buttons as $button},{$button.id}{/foreach}',
|
||||||
|
|
||||||
toolbar: [
|
toolbar: [
|
||||||
{ name: 'tools', items: [ 'Maximize' ] },
|
{ name: 'tools', items: [ 'Maximize' ] },
|
||||||
{ name: 'styles', items: [ 'Format' ] },
|
{ name: 'styles', items: [ 'Format' ] },
|
||||||
@ -31,7 +51,7 @@
|
|||||||
{ name: 'insert', items: [ 'Image', 's9y_medialibrary{$item}', 'Table', 'HorizontalRule', 'SpecialChar' ] },
|
{ name: 'insert', items: [ 'Image', 's9y_medialibrary{$item}', 'Table', 'HorizontalRule', 'SpecialChar' ] },
|
||||||
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ], items: [ 'Cut', 'Copy', 'Paste', 'PasteText', '-', 'Undo', 'Redo' ] },
|
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ], items: [ 'Cut', 'Copy', 'Paste', 'PasteText', '-', 'Undo', 'Redo' ] },
|
||||||
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ], items: [ 'Scayt' ] },
|
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ], items: [ 'Scayt' ] },
|
||||||
{ name: 'others', items: [ '-' ] },
|
{ name: 'others', items: [ '-' {foreach $buttons as $button}, '{$button.id}'{/foreach} ] },
|
||||||
{ name: 'document', groups: [ 'mode', 'document', 'doctools' ], items: [ 'Source' ] },
|
{ name: 'document', groups: [ 'mode', 'document', 'doctools' ], items: [ 'Source' ] },
|
||||||
{ name: 'about', items: [ 'About' ] }
|
{ name: 'about', items: [ 'About' ] }
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user