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/pagebreak | |
| parent | 3d3b786cc43266f6292f5edd25733dbb9bd6ed06 (diff) | |
added tinymce editor for body area of pages
Diffstat (limited to 'public/javascripts/tiny_mce/plugins/pagebreak')
| -rwxr-xr-x | public/javascripts/tiny_mce/plugins/pagebreak/css/content.css | 1 | ||||
| -rwxr-xr-x | public/javascripts/tiny_mce/plugins/pagebreak/editor_plugin.js | 1 | ||||
| -rwxr-xr-x | public/javascripts/tiny_mce/plugins/pagebreak/editor_plugin_src.js | 74 | ||||
| -rwxr-xr-x | public/javascripts/tiny_mce/plugins/pagebreak/img/pagebreak.gif | bin | 0 -> 325 bytes | |||
| -rwxr-xr-x | public/javascripts/tiny_mce/plugins/pagebreak/img/trans.gif | bin | 0 -> 43 bytes |
5 files changed, 76 insertions, 0 deletions
diff --git a/public/javascripts/tiny_mce/plugins/pagebreak/css/content.css b/public/javascripts/tiny_mce/plugins/pagebreak/css/content.css new file mode 100755 index 0000000..c949d58 --- /dev/null +++ b/public/javascripts/tiny_mce/plugins/pagebreak/css/content.css | |||
| @@ -0,0 +1 @@ | |||
| .mcePageBreak {display:block;border:0;width:100%;height:12px;border-top:1px dotted #ccc;margin-top:15px;background:#fff url(../img/pagebreak.gif) no-repeat center top;} | |||
diff --git a/public/javascripts/tiny_mce/plugins/pagebreak/editor_plugin.js b/public/javascripts/tiny_mce/plugins/pagebreak/editor_plugin.js new file mode 100755 index 0000000..177ea95 --- /dev/null +++ b/public/javascripts/tiny_mce/plugins/pagebreak/editor_plugin.js | |||
| @@ -0,0 +1 @@ | |||
| (function(){tinymce.create('tinymce.plugins.PageBreakPlugin',{init:function(ed,url){var pb='<img src="'+url+'/img/trans.gif" class="mcePageBreak mceItemNoResize" />',cls='mcePageBreak',sep=ed.getParam('pagebreak_separator','<!-- pagebreak -->'),pbRE;pbRE=new RegExp(sep.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g,function(a){return'\\'+a;}),'g');ed.addCommand('mcePageBreak',function(){ed.execCommand('mceInsertContent',0,pb);});ed.addButton('pagebreak',{title:'pagebreak.desc',cmd:cls});ed.onInit.add(function(){if(ed.settings.content_css!==false)ed.dom.loadCSS(url+"/css/content.css");if(ed.theme.onResolveName){ed.theme.onResolveName.add(function(th,o){if(o.node.nodeName=='IMG'&&ed.dom.hasClass(o.node,cls))o.name='pagebreak';});}});ed.onClick.add(function(ed,e){e=e.target;if(e.nodeName==='IMG'&&ed.dom.hasClass(e,cls))ed.selection.select(e);});ed.onNodeChange.add(function(ed,cm,n){cm.setActive('pagebreak',n.nodeName==='IMG'&&ed.dom.hasClass(n,cls));});ed.onBeforeSetContent.add(function(ed,o){o.content=o.content.replace(pbRE,pb);});ed.onPostProcess.add(function(ed,o){if(o.get)o.content=o.content.replace(/<img[^>]+>/g,function(im){if(im.indexOf('class="mcePageBreak')!==-1)im=sep;return im;});});},getInfo:function(){return{longname:'PageBreak',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/pagebreak',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('pagebreak',tinymce.plugins.PageBreakPlugin);})(); \ No newline at end of file | |||
diff --git a/public/javascripts/tiny_mce/plugins/pagebreak/editor_plugin_src.js b/public/javascripts/tiny_mce/plugins/pagebreak/editor_plugin_src.js new file mode 100755 index 0000000..16f5748 --- /dev/null +++ b/public/javascripts/tiny_mce/plugins/pagebreak/editor_plugin_src.js | |||
| @@ -0,0 +1,74 @@ | |||
| 1 | /** | ||
| 2 | * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z 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.PageBreakPlugin', { | ||
| 10 | init : function(ed, url) { | ||
| 11 | var pb = '<img src="' + url + '/img/trans.gif" class="mcePageBreak mceItemNoResize" />', cls = 'mcePageBreak', sep = ed.getParam('pagebreak_separator', '<!-- pagebreak -->'), pbRE; | ||
| 12 | |||
| 13 | pbRE = new RegExp(sep.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g, function(a) {return '\\' + a;}), 'g'); | ||
| 14 | |||
| 15 | // Register commands | ||
| 16 | ed.addCommand('mcePageBreak', function() { | ||
| 17 | ed.execCommand('mceInsertContent', 0, pb); | ||
| 18 | }); | ||
| 19 | |||
| 20 | // Register buttons | ||
| 21 | ed.addButton('pagebreak', {title : 'pagebreak.desc', cmd : cls}); | ||
| 22 | |||
| 23 | ed.onInit.add(function() { | ||
| 24 | if (ed.settings.content_css !== false) | ||
| 25 | ed.dom.loadCSS(url + "/css/content.css"); | ||
| 26 | |||
| 27 | if (ed.theme.onResolveName) { | ||
| 28 | ed.theme.onResolveName.add(function(th, o) { | ||
| 29 | if (o.node.nodeName == 'IMG' && ed.dom.hasClass(o.node, cls)) | ||
| 30 | o.name = 'pagebreak'; | ||
| 31 | }); | ||
| 32 | } | ||
| 33 | }); | ||
| 34 | |||
| 35 | ed.onClick.add(function(ed, e) { | ||
| 36 | e = e.target; | ||
| 37 | |||
| 38 | if (e.nodeName === 'IMG' && ed.dom.hasClass(e, cls)) | ||
| 39 | ed.selection.select(e); | ||
| 40 | }); | ||
| 41 | |||
| 42 | ed.onNodeChange.add(function(ed, cm, n) { | ||
| 43 | cm.setActive('pagebreak', n.nodeName === 'IMG' && ed.dom.hasClass(n, cls)); | ||
| 44 | }); | ||
| 45 | |||
| 46 | ed.onBeforeSetContent.add(function(ed, o) { | ||
| 47 | o.content = o.content.replace(pbRE, pb); | ||
| 48 | }); | ||
| 49 | |||
| 50 | ed.onPostProcess.add(function(ed, o) { | ||
| 51 | if (o.get) | ||
| 52 | o.content = o.content.replace(/<img[^>]+>/g, function(im) { | ||
| 53 | if (im.indexOf('class="mcePageBreak') !== -1) | ||
| 54 | im = sep; | ||
| 55 | |||
| 56 | return im; | ||
| 57 | }); | ||
| 58 | }); | ||
| 59 | }, | ||
| 60 | |||
| 61 | getInfo : function() { | ||
| 62 | return { | ||
| 63 | longname : 'PageBreak', | ||
| 64 | author : 'Moxiecode Systems AB', | ||
| 65 | authorurl : 'http://tinymce.moxiecode.com', | ||
| 66 | infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/pagebreak', | ||
| 67 | version : tinymce.majorVersion + "." + tinymce.minorVersion | ||
| 68 | }; | ||
| 69 | } | ||
| 70 | }); | ||
| 71 | |||
| 72 | // Register plugin | ||
| 73 | tinymce.PluginManager.add('pagebreak', tinymce.plugins.PageBreakPlugin); | ||
| 74 | })(); \ No newline at end of file | ||
diff --git a/public/javascripts/tiny_mce/plugins/pagebreak/img/pagebreak.gif b/public/javascripts/tiny_mce/plugins/pagebreak/img/pagebreak.gif new file mode 100755 index 0000000..acdf408 --- /dev/null +++ b/public/javascripts/tiny_mce/plugins/pagebreak/img/pagebreak.gif | |||
| Binary files differ | |||
diff --git a/public/javascripts/tiny_mce/plugins/pagebreak/img/trans.gif b/public/javascripts/tiny_mce/plugins/pagebreak/img/trans.gif new file mode 100755 index 0000000..3884865 --- /dev/null +++ b/public/javascripts/tiny_mce/plugins/pagebreak/img/trans.gif | |||
| Binary files differ | |||
