diff options
Diffstat (limited to 'mod/tinymce/views/default/tinymce/init.php')
-rw-r--r-- | mod/tinymce/views/default/tinymce/init.php | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/mod/tinymce/views/default/tinymce/init.php b/mod/tinymce/views/default/tinymce/init.php new file mode 100644 index 000000000..6282fa0f6 --- /dev/null +++ b/mod/tinymce/views/default/tinymce/init.php @@ -0,0 +1,62 @@ +<?php +/** + * TinyMCE initialization script + * + * You can find configuration information here: + * http://tinymce.moxiecode.com/wiki.php/Configuration + */ +?> + +<script type="text/javascript"> +tinyMCE.init({ + mode : "specific_textareas", + editor_selector : "mceEditor", + theme : "advanced", + plugins : "spellchecker,autosave,fullscreen,paste", + relative_urls : false, + remove_script_host : false, + document_base_url : "<?php echo elgg_get_site_url(); ?>", + theme_advanced_buttons1 : "bold,italic,underline,separator,strikethrough,bullist,numlist,undo,redo,link,unlink,image,blockquote,code,pastetext,pasteword,more,fullscreen", + theme_advanced_buttons2 : "", + theme_advanced_buttons3 : "", + theme_advanced_toolbar_location : "top", + theme_advanced_toolbar_align : "left", + theme_advanced_statusbar_location : "bottom", + theme_advanced_resizing : true, + theme_advanced_path : true, + extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|style],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]", + setup : function(ed) { + //show the number of words + ed.onLoadContent.add(function(ed, o) { + var strip = (tinyMCE.activeEditor.getContent()).replace(/(<([^>]+)>)/ig,""); + var text = " <?php echo elgg_echo('tinymce:word_count'); ?>" + strip.split(' ').length + ' '; + tinymce.DOM.setHTML(tinymce.DOM.get(tinyMCE.activeEditor.id + '_path_row'), text); + }); + + ed.onKeyUp.add(function(ed, e) { + var strip = (tinyMCE.activeEditor.getContent()).replace(/(<([^>]+)>)/ig,""); + var text = " <?php echo elgg_echo('tinymce:word_count'); ?>" + strip.split(' ').length + ' '; + tinymce.DOM.setHTML(tinymce.DOM.get(tinyMCE.activeEditor.id + '_path_row'), text); + }); + }, + content_css: '<?php echo elgg_get_site_url(); ?>mod/tinymce/tinymce_content.css' +}); + +function toggleEditor(id) { + if (!tinyMCE.get(id)) { + tinyMCE.execCommand('mceAddControl', false, id); + <?php $toggleEditor_linktext = elgg_echo('tinymce:remove'); ?> + $("a.tinymce-toggle-editor").html('<?php echo $toggleEditor_linktext ?>'); + } else { + tinyMCE.execCommand('mceRemoveControl', false, id); + <?php $toggleEditor_linktext = elgg_echo('tinymce:add'); ?> + $("a.tinymce-toggle-editor").html('<?php echo $toggleEditor_linktext ?>'); + } +} + +$(document).ready(function() { + $('textarea').parents('form').submit(function() { + tinyMCE.triggerSave(); + }); +}); +</script> |