1
0

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:
onli
2014-03-23 23:03:09 +01:00
parent 31eba101f6
commit 0d54063c5e
7 changed files with 44 additions and 306 deletions

View File

@ -167,17 +167,6 @@
{/if}
{if $admin_vars.admin_installed}{serendipity_hookPlugin hook="backend_footer" hookAll="true"}{/if}
{if $backend_wysiwyg}
{* 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>
</html>

View File

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

View File

@ -1,4 +1,40 @@
{* 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 *}
{if $init == false}
<script src="{$serendipityHTTPPath}htmlarea/ckeditor/ckeditor.js"></script>
<script src="{$serendipityHTTPPath}htmlarea/ckeditor_custom_plugin.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), {
customConfig : '{$serendipityHTTPPath}htmlarea/ckeditor_custom_config.js',
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' ] }
]
});
});
</script>