diff options
| author | hukl <contact@smyck.org> | 2009-02-17 21:54:39 +0100 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-02-17 21:54:39 +0100 |
| commit | f61b5b0597e0c25f084ee67d402f12a43a7a9947 (patch) | |
| tree | 3b4c3f9f38637f1a7ecf703ece4fd3bc4c6e2934 /public/javascripts/tiny_mce/plugins/preview | |
| parent | 3d3b786cc43266f6292f5edd25733dbb9bd6ed06 (diff) | |
added tinymce editor for body area of pages
Diffstat (limited to 'public/javascripts/tiny_mce/plugins/preview')
5 files changed, 171 insertions, 0 deletions
diff --git a/public/javascripts/tiny_mce/plugins/preview/editor_plugin.js b/public/javascripts/tiny_mce/plugins/preview/editor_plugin.js new file mode 100755 index 0000000..deb4bce --- /dev/null +++ b/public/javascripts/tiny_mce/plugins/preview/editor_plugin.js | |||
| @@ -0,0 +1 @@ | |||
| (function(){tinymce.create('tinymce.plugins.Preview',{init:function(ed,url){var t=this,css=tinymce.explode(ed.settings.content_css);t.editor=ed;tinymce.each(css,function(u,k){css[k]=ed.documentBaseURI.toAbsolute(u);});ed.addCommand('mcePreview',function(){ed.windowManager.open({file:ed.getParam("plugin_preview_pageurl",url+"/preview.html"),width:parseInt(ed.getParam("plugin_preview_width","550")),height:parseInt(ed.getParam("plugin_preview_height","600")),resizable:"yes",scrollbars:"yes",popup_css:css.join(','),inline:ed.getParam("plugin_preview_inline",1)},{base:ed.documentBaseURI.getURI()});});ed.addButton('preview',{title:'preview.preview_desc',cmd:'mcePreview'});},getInfo:function(){return{longname:'Preview',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/preview',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('preview',tinymce.plugins.Preview);})(); \ No newline at end of file | |||
diff --git a/public/javascripts/tiny_mce/plugins/preview/editor_plugin_src.js b/public/javascripts/tiny_mce/plugins/preview/editor_plugin_src.js new file mode 100755 index 0000000..b2d27f7 --- /dev/null +++ b/public/javascripts/tiny_mce/plugins/preview/editor_plugin_src.js | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | /** | ||
| 2 | * $Id: editor_plugin_src.js 895 2008-07-10 14:34:23Z spocke $ | ||
| 3 | * | ||
| 4 | * @author Moxiecode | ||
| 5 | * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. | ||
| 6 | */ | ||
| 7 | |||
| 8 | (function() { | ||
| 9 | tinymce.create('tinymce.plugins.Preview', { | ||
| 10 | init : function(ed, url) { | ||
| 11 | var t = this, css = tinymce.explode(ed.settings.content_css); | ||
| 12 | |||
| 13 | t.editor = ed; | ||
| 14 | |||
| 15 | // Force absolute CSS urls | ||
| 16 | tinymce.each(css, function(u, k) { | ||
| 17 | css[k] = ed.documentBaseURI.toAbsolute(u); | ||
| 18 | }); | ||
| 19 | |||
| 20 | ed.addCommand('mcePreview', function() { | ||
| 21 | ed.windowManager.open({ | ||
| 22 | file : ed.getParam("plugin_preview_pageurl", url + "/preview.html"), | ||
| 23 | width : parseInt(ed.getParam("plugin_preview_width", "550")), | ||
| 24 | height : parseInt(ed.getParam("plugin_preview_height", "600")), | ||
| 25 | resizable : "yes", | ||
| 26 | scrollbars : "yes", | ||
| 27 | popup_css : css.join(','), | ||
| 28 | inline : ed.getParam("plugin_preview_inline", 1) | ||
| 29 | }, { | ||
| 30 | base : ed.documentBaseURI.getURI() | ||
| 31 | }); | ||
| 32 | }); | ||
| 33 | |||
| 34 | ed.addButton('preview', {title : 'preview.preview_desc', cmd : 'mcePreview'}); | ||
| 35 | }, | ||
| 36 | |||
| 37 | getInfo : function() { | ||
| 38 | return { | ||
| 39 | longname : 'Preview', | ||
| 40 | author : 'Moxiecode Systems AB', | ||
| 41 | authorurl : 'http://tinymce.moxiecode.com', | ||
| 42 | infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/preview', | ||
| 43 | version : tinymce.majorVersion + "." + tinymce.minorVersion | ||
| 44 | }; | ||
| 45 | } | ||
| 46 | }); | ||
| 47 | |||
| 48 | // Register plugin | ||
| 49 | tinymce.PluginManager.add('preview', tinymce.plugins.Preview); | ||
| 50 | })(); \ No newline at end of file | ||
diff --git a/public/javascripts/tiny_mce/plugins/preview/example.html b/public/javascripts/tiny_mce/plugins/preview/example.html new file mode 100755 index 0000000..b2c3d90 --- /dev/null +++ b/public/javascripts/tiny_mce/plugins/preview/example.html | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | <html xmlns="http://www.w3.org/1999/xhtml"> | ||
| 2 | <head> | ||
| 3 | <script language="javascript" src="../../tiny_mce_popup.js"></script> | ||
| 4 | <script type="text/javascript" src="jscripts/embed.js"></script> | ||
| 5 | <script type="text/javascript"> | ||
| 6 | tinyMCEPopup.onInit.add(function(ed) { | ||
| 7 | var dom = tinyMCEPopup.dom; | ||
| 8 | |||
| 9 | // Load editor content_css | ||
| 10 | tinymce.each(ed.settings.content_css.split(','), function(u) { | ||
| 11 | dom.loadCSS(ed.documentBaseURI.toAbsolute(u)); | ||
| 12 | }); | ||
| 13 | |||
| 14 | // Place contents inside div container | ||
| 15 | dom.setHTML('content', ed.getContent()); | ||
| 16 | }); | ||
| 17 | </script> | ||
| 18 | <title>Example of a custom preview page</title> | ||
| 19 | </head> | ||
| 20 | <body> | ||
| 21 | |||
| 22 | Editor contents: <br /> | ||
| 23 | <div id="content"> | ||
| 24 | <!-- Gets filled with editor contents --> | ||
| 25 | </div> | ||
| 26 | |||
| 27 | </body> | ||
| 28 | </html> | ||
diff --git a/public/javascripts/tiny_mce/plugins/preview/jscripts/embed.js b/public/javascripts/tiny_mce/plugins/preview/jscripts/embed.js new file mode 100755 index 0000000..f8dc810 --- /dev/null +++ b/public/javascripts/tiny_mce/plugins/preview/jscripts/embed.js | |||
| @@ -0,0 +1,73 @@ | |||
| 1 | /** | ||
| 2 | * This script contains embed functions for common plugins. This scripts are complety free to use for any purpose. | ||
| 3 | */ | ||
| 4 | |||
| 5 | function writeFlash(p) { | ||
| 6 | writeEmbed( | ||
| 7 | 'D27CDB6E-AE6D-11cf-96B8-444553540000', | ||
| 8 | 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0', | ||
| 9 | 'application/x-shockwave-flash', | ||
| 10 | p | ||
| 11 | ); | ||
| 12 | } | ||
| 13 | |||
| 14 | function writeShockWave(p) { | ||
| 15 | writeEmbed( | ||
| 16 | '166B1BCA-3F9C-11CF-8075-444553540000', | ||
| 17 | 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0', | ||
| 18 | 'application/x-director', | ||
| 19 | p | ||
| 20 | ); | ||
| 21 | } | ||
| 22 | |||
| 23 | function writeQuickTime(p) { | ||
| 24 | writeEmbed( | ||
| 25 | '02BF25D5-8C17-4B23-BC80-D3488ABDDC6B', | ||
| 26 | 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0', | ||
| 27 | 'video/quicktime', | ||
| 28 | p | ||
| 29 | ); | ||
| 30 | } | ||
| 31 | |||
| 32 | function writeRealMedia(p) { | ||
| 33 | writeEmbed( | ||
| 34 | 'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA', | ||
| 35 | 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0', | ||
| 36 | 'audio/x-pn-realaudio-plugin', | ||
| 37 | p | ||
| 38 | ); | ||
| 39 | } | ||
| 40 | |||
| 41 | function writeWindowsMedia(p) { | ||
| 42 | p.url = p.src; | ||
| 43 | writeEmbed( | ||
| 44 | '6BF52A52-394A-11D3-B153-00C04F79FAA6', | ||
| 45 | 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701', | ||
| 46 | 'application/x-mplayer2', | ||
| 47 | p | ||
| 48 | ); | ||
| 49 | } | ||
| 50 | |||
| 51 | function writeEmbed(cls, cb, mt, p) { | ||
| 52 | var h = '', n; | ||
| 53 | |||
| 54 | h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"'; | ||
| 55 | h += typeof(p.id) != "undefined" ? 'id="' + p.id + '"' : ''; | ||
| 56 | h += typeof(p.name) != "undefined" ? 'name="' + p.name + '"' : ''; | ||
| 57 | h += typeof(p.width) != "undefined" ? 'width="' + p.width + '"' : ''; | ||
| 58 | h += typeof(p.height) != "undefined" ? 'height="' + p.height + '"' : ''; | ||
| 59 | h += typeof(p.align) != "undefined" ? 'align="' + p.align + '"' : ''; | ||
| 60 | h += '>'; | ||
| 61 | |||
| 62 | for (n in p) | ||
| 63 | h += '<param name="' + n + '" value="' + p[n] + '">'; | ||
| 64 | |||
| 65 | h += '<embed type="' + mt + '"'; | ||
| 66 | |||
| 67 | for (n in p) | ||
| 68 | h += n + '="' + p[n] + '" '; | ||
| 69 | |||
| 70 | h += '></embed></object>'; | ||
| 71 | |||
| 72 | document.write(h); | ||
| 73 | } | ||
diff --git a/public/javascripts/tiny_mce/plugins/preview/preview.html b/public/javascripts/tiny_mce/plugins/preview/preview.html new file mode 100755 index 0000000..7960f78 --- /dev/null +++ b/public/javascripts/tiny_mce/plugins/preview/preview.html | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | <html xmlns="http://www.w3.org/1999/xhtml"> | ||
| 2 | <head> | ||
| 3 | <script language="javascript" src="../../tiny_mce_popup.js"></script> | ||
| 4 | <script type="text/javascript" src="jscripts/embed.js"></script> | ||
| 5 | <script type="text/javascript"> | ||
| 6 | tinyMCEPopup.onInit.add(function(ed) { | ||
| 7 | var dom = tinyMCEPopup.dom; | ||
| 8 | |||
| 9 | dom.setHTML('content', ed.getContent()); | ||
| 10 | }); | ||
| 11 | |||
| 12 | document.write('<base href="' + tinyMCEPopup.getWindowArg("base") + '">'); | ||
| 13 | </script> | ||
| 14 | <title>{#preview.preview_desc}</title> | ||
| 15 | </head> | ||
| 16 | <body id="content"> | ||
| 17 | <!-- Gets filled with editor contents --> | ||
| 18 | </body> | ||
| 19 | </html> | ||
