1
0

fix core to read ckeditor and handle hook-ins

This supports custom ckeditor plugins and a custom ckeditor config
and reads $eventData for
- normal entry form (case1) textareas,
- staticpage (case2) textareas and
- other nugget plugins (case3) textareas.
They all are build differently, therfore we needed three cases.
Please test!

Based to following commits
 8e26bd9 prepare core ckeditor for custom config and plugins
 44ea050 fix virtual js
 40609d8 add backend_footer hook

References #72
This commit is contained in:
Ian
2014-03-15 19:02:13 +01:00
parent 8e26bd9711
commit faae4b0533
5 changed files with 85 additions and 63 deletions

View File

@ -166,8 +166,17 @@
</footer>
{/if}
{if $admin_vars.admin_installed}
{serendipity_hookPlugin hook="backend_footer" hookAll="true"}
{if $admin_vars.admin_installed}{serendipity_hookPlugin hook="backend_footer" hookAll="true"}{/if}
{if $init === false}
{* CKEDITOR_CCPATHFILE could also be a custom path to a templates ckekeditor_custom_config.js file *}
<script type="text/javascript">
CKEDITOR_CCPATHFILE = '{$serendipityHTTPPath}htmlarea/';
CKEDITOR_CCIMGPATH = '{$serendipityHTTPPath}templates/2k11/admin/img/thumbnail.png';
CKEDITOR_S9YPLUGPATH = '{$serendipityHTTPPath}plugins/';
CKEDITOR_S9Y_BASEURL = '{$serendipityHTTPPath}';
</script>
<script src="{$serendipityHTTPPath}htmlarea/ckeditor/ckeditor.js"></script>
<script src="{$serendipityHTTPPath}htmlarea/ckeditor_custom_plugin.js"></script>
{/if}
</body>

View File

@ -52,11 +52,11 @@
{serendipity_hookPlugin hook="backend_wysiwyg_nuggets" eventData=$ev hookAll=true}
{if $ev['skip_nuggets'] === false}
<script>
<script type="text/javascript">
function Spawnnugget() {
{foreach $ev['nuggets'] AS $nuggetid}
if (window.Spawnnuggets) Spawnnuggets('{$nuggetid}');
if (window.Spawnnuggets) Spawnnuggets('{$nuggetid}');//case3{* plugin nuggets via function serendipity_plugin_config() eg side html nuggets *}
{/foreach}

View File

@ -1,38 +1,4 @@
{if $init == false}
<script src="{$serendipityHTTPPath}htmlarea/ckeditor/ckeditor.js"></script>
{/if}
<script>
$('document').ready(function() {
CKEDITOR.plugins.add('s9y_medialibrary{$item}', {
init: function( editor ) {
editor.addCommand( 'openML', {
exec : function( editor ) {
serendipity.openPopup('serendipity_admin.php?serendipity[adminModule]=media&serendipity[noBanner]=true&serendipity[noSidebar]=true&serendipity[noFooter]=true&serendipity[showMediaToolbar]=false&serendipity[showUpload]=true&serendipity[textarea]={$item}');
}
});
editor.ui.addButton('s9y_medialibrary{$item}', {
label: 'Media',
command: 'openML',
icon: '{serendipity_getFile file="admin/img/thumbnail.png"}'
});
}
});
CKEDITOR.replace($('#'+serendipity.escapeBrackets('{$item}')).get(0), {
extraPlugins : 's9y_medialibrary{$item}',
toolbar: [
{ name: 'tools', items: [ 'Maximize' ] },
{ name: 'styles', items: [ 'Format' ] },
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ], items: [ 'Bold', 'Italic', 'RemoveFormat' ] },
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align' ], items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote' ] },
{ name: 'links', items: [ 'Link', 'Unlink', 'Anchor' ] },
{ name: 'insert', items: [ 'Image', 's9y_medialibrary{$item}', 'Table', 'HorizontalRule', 'SpecialChar' ] },
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ], items: [ 'Cut', 'Copy', 'Paste', 'PasteText', '-', 'Undo', 'Redo' ] },
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ], items: [ 'Scayt' ] },
{ name: 'others', items: [ '-' ] },
{ name: 'document', groups: [ 'mode', 'document', 'doctools' ], items: [ 'Source' ] },
{ name: 'about', items: [ 'About' ] }
]
});
});
{* this is build for normal backend entry (body/extended) textareas in function serendipity_emit_htmlarea_code() *}
<script type="text/javascript">
{$jsEventData};{* do not use $('document').ready(function() here, since needs to happen when set *}
</script>