Use old method to init ckeditor
Instead of using global JS-variables and ignoring serendipity[textarea]={$view}, this approach actually uses the variable and therefore reinstates wysiwyg_init.tpl. ckeditor_custom_config.js (Thx Ian!) is still respected, but the toolbar got restored to the old version. We need an easy way to remove _underline_, for example. It could be extended though. This fixes #{107} somewhat, as serendipity_image_selector.php is useable now, but still with display errors (and without an upload widget). Probably still a good idea to copy the ML-eapproach of the normal textareas This also works with htmlnuggets, without using spawnnugget from the core, instead wysiwyg_init.tpl gets reused in the plugin-config. ckeditor_custom_plugin.js got emptied, the relevant code (which should only be the part that adds the plugins into the toolbar) should be integrated into wysiwyg_init.tpl).
This commit is contained in:
@ -183,23 +183,13 @@ function serendipity_emit_htmlarea_code($item, $jsname, $spawnMulti = false) {
|
||||
$backend_wysiwyg = true;
|
||||
}
|
||||
|
||||
//actually we don't even need this any more...
|
||||
if (is_array($eventData['buttons'])) {
|
||||
foreach($eventData['buttons'] as $button) {
|
||||
$toolbar['other'][] = $button;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$data = array();
|
||||
$data['init'] = $init;
|
||||
$data['spawnMulti'] = $spawnMulti;
|
||||
$data['jsname'] = $jsname;
|
||||
$data['eventData'] = $eventData;
|
||||
$data['item'] = $item;
|
||||
$data['toolbar'] = $toolbar;
|
||||
$data['backend_wysiwyg'] = $backend_wysiwyg ? $backend_wysiwyg : false;
|
||||
$data['jsEventData'] = 'jsEventData = '.json_encode($eventData['buttons']);
|
||||
|
||||
echo serendipity_smarty_show('admin/wysiwyg_init.tpl', $data);
|
||||
}
|
||||
|
@ -85,50 +85,6 @@ function create(htmlStr) {
|
||||
}
|
||||
break;
|
||||
|
||||
case 'backend_wysiwyg':
|
||||
if (preg_match('@^nugget@i', $eventData['item'])) {
|
||||
// switch to wysiwyg finisher directly, in case of nuggets
|
||||
serendipity_plugin_api::hook_event('backend_wysiwyg_finish', $bag, $eventData);
|
||||
} else {
|
||||
// this only builds textareas of normal entry forms, the possible button data will be passed to 'backend_footer' via serendipity_emit_htmlarea_code() function
|
||||
if (isset($eventData['item']) && !empty($eventData['item'])) {
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
$( document ).ready(function() {
|
||||
if (window.Spawnnuggets) Spawnnuggets('<?php echo $eventData['item']; ?>', 'entryforms<?php echo $eventData['jsname']; ?>', null);//case1
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'backend_wysiwyg_finish':
|
||||
// pass nugget $eventData['item'] and $eventData['buttons'] into the 'backend_footer' hook
|
||||
serendipity_plugin_api::hook_event('backend_footer', $bag, $eventData);
|
||||
break;
|
||||
|
||||
case 'backend_footer':
|
||||
if ($serendipity['wysiwyg']) {
|
||||
if (isset($eventData['item']) && !empty($eventData['item'])) {
|
||||
if (isset($eventData['buttons']) && (is_array($eventData['buttons']) && !empty($eventData['buttons']))) {
|
||||
// case staticpage nuggets - pulled by if (window.Spawnnuggets) Spawnnuggets(n);
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
$( document ).ready(function() {
|
||||
jsEventData = <?php echo json_encode($eventData['buttons']); ?>;//case2
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user