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/advhr | |
| parent | 3d3b786cc43266f6292f5edd25733dbb9bd6ed06 (diff) | |
added tinymce editor for body area of pages
Diffstat (limited to 'public/javascripts/tiny_mce/plugins/advhr')
6 files changed, 171 insertions, 0 deletions
diff --git a/public/javascripts/tiny_mce/plugins/advhr/css/advhr.css b/public/javascripts/tiny_mce/plugins/advhr/css/advhr.css new file mode 100755 index 0000000..0e22834 --- /dev/null +++ b/public/javascripts/tiny_mce/plugins/advhr/css/advhr.css | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | input.radio {border:1px none #000; background:transparent; vertical-align:middle;} | ||
| 2 | .panel_wrapper div.current {height:80px;} | ||
| 3 | #width {width:50px; vertical-align:middle;} | ||
| 4 | #width2 {width:50px; vertical-align:middle;} | ||
| 5 | #size {width:100px;} | ||
diff --git a/public/javascripts/tiny_mce/plugins/advhr/editor_plugin.js b/public/javascripts/tiny_mce/plugins/advhr/editor_plugin.js new file mode 100755 index 0000000..f335004 --- /dev/null +++ b/public/javascripts/tiny_mce/plugins/advhr/editor_plugin.js | |||
| @@ -0,0 +1 @@ | |||
| (function(){tinymce.create('tinymce.plugins.AdvancedHRPlugin',{init:function(ed,url){ed.addCommand('mceAdvancedHr',function(){ed.windowManager.open({file:url+'/rule.htm',width:250+parseInt(ed.getLang('advhr.delta_width',0)),height:160+parseInt(ed.getLang('advhr.delta_height',0)),inline:1},{plugin_url:url});});ed.addButton('advhr',{title:'advhr.advhr_desc',cmd:'mceAdvancedHr'});ed.onNodeChange.add(function(ed,cm,n){cm.setActive('advhr',n.nodeName=='HR');});ed.onClick.add(function(ed,e){e=e.target;if(e.nodeName==='HR')ed.selection.select(e);});},getInfo:function(){return{longname:'Advanced HR',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advhr',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('advhr',tinymce.plugins.AdvancedHRPlugin);})(); \ No newline at end of file | |||
diff --git a/public/javascripts/tiny_mce/plugins/advhr/editor_plugin_src.js b/public/javascripts/tiny_mce/plugins/advhr/editor_plugin_src.js new file mode 100755 index 0000000..8a84753 --- /dev/null +++ b/public/javascripts/tiny_mce/plugins/advhr/editor_plugin_src.js | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | /** | ||
| 2 | * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z 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.AdvancedHRPlugin', { | ||
| 10 | init : function(ed, url) { | ||
| 11 | // Register commands | ||
| 12 | ed.addCommand('mceAdvancedHr', function() { | ||
| 13 | ed.windowManager.open({ | ||
| 14 | file : url + '/rule.htm', | ||
| 15 | width : 250 + parseInt(ed.getLang('advhr.delta_width', 0)), | ||
| 16 | height : 160 + parseInt(ed.getLang('advhr.delta_height', 0)), | ||
| 17 | inline : 1 | ||
| 18 | }, { | ||
| 19 | plugin_url : url | ||
| 20 | }); | ||
| 21 | }); | ||
| 22 | |||
| 23 | // Register buttons | ||
| 24 | ed.addButton('advhr', { | ||
| 25 | title : 'advhr.advhr_desc', | ||
| 26 | cmd : 'mceAdvancedHr' | ||
| 27 | }); | ||
| 28 | |||
| 29 | ed.onNodeChange.add(function(ed, cm, n) { | ||
| 30 | cm.setActive('advhr', n.nodeName == 'HR'); | ||
| 31 | }); | ||
| 32 | |||
| 33 | ed.onClick.add(function(ed, e) { | ||
| 34 | e = e.target; | ||
| 35 | |||
| 36 | if (e.nodeName === 'HR') | ||
| 37 | ed.selection.select(e); | ||
| 38 | }); | ||
| 39 | }, | ||
| 40 | |||
| 41 | getInfo : function() { | ||
| 42 | return { | ||
| 43 | longname : 'Advanced HR', | ||
| 44 | author : 'Moxiecode Systems AB', | ||
| 45 | authorurl : 'http://tinymce.moxiecode.com', | ||
| 46 | infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advhr', | ||
| 47 | version : tinymce.majorVersion + "." + tinymce.minorVersion | ||
| 48 | }; | ||
| 49 | } | ||
| 50 | }); | ||
| 51 | |||
| 52 | // Register plugin | ||
| 53 | tinymce.PluginManager.add('advhr', tinymce.plugins.AdvancedHRPlugin); | ||
| 54 | })(); \ No newline at end of file | ||
diff --git a/public/javascripts/tiny_mce/plugins/advhr/js/rule.js b/public/javascripts/tiny_mce/plugins/advhr/js/rule.js new file mode 100755 index 0000000..b6cbd66 --- /dev/null +++ b/public/javascripts/tiny_mce/plugins/advhr/js/rule.js | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | var AdvHRDialog = { | ||
| 2 | init : function(ed) { | ||
| 3 | var dom = ed.dom, f = document.forms[0], n = ed.selection.getNode(), w; | ||
| 4 | |||
| 5 | w = dom.getAttrib(n, 'width'); | ||
| 6 | f.width.value = w ? parseInt(w) : (dom.getStyle('width') || ''); | ||
| 7 | f.size.value = dom.getAttrib(n, 'size') || parseInt(dom.getStyle('height')) || ''; | ||
| 8 | f.noshade.checked = !!dom.getAttrib(n, 'noshade') || !!dom.getStyle('border-width'); | ||
| 9 | selectByValue(f, 'width2', w.indexOf('%') != -1 ? '%' : 'px'); | ||
| 10 | }, | ||
| 11 | |||
| 12 | update : function() { | ||
| 13 | var ed = tinyMCEPopup.editor, h, f = document.forms[0], st = ''; | ||
| 14 | |||
| 15 | h = '<hr'; | ||
| 16 | |||
| 17 | if (f.size.value) { | ||
| 18 | h += ' size="' + f.size.value + '"'; | ||
| 19 | st += ' height:' + f.size.value + 'px;'; | ||
| 20 | } | ||
| 21 | |||
| 22 | if (f.width.value) { | ||
| 23 | h += ' width="' + f.width.value + (f.width2.value == '%' ? '%' : '') + '"'; | ||
| 24 | st += ' width:' + f.width.value + (f.width2.value == '%' ? '%' : 'px') + ';'; | ||
| 25 | } | ||
| 26 | |||
| 27 | if (f.noshade.checked) { | ||
| 28 | h += ' noshade="noshade"'; | ||
| 29 | st += ' border-width: 1px; border-style: solid; border-color: #CCCCCC; color: #ffffff;'; | ||
| 30 | } | ||
| 31 | |||
| 32 | if (ed.settings.inline_styles) | ||
| 33 | h += ' style="' + tinymce.trim(st) + '"'; | ||
| 34 | |||
| 35 | h += ' />'; | ||
| 36 | |||
| 37 | ed.execCommand("mceInsertContent", false, h); | ||
| 38 | tinyMCEPopup.close(); | ||
| 39 | } | ||
| 40 | }; | ||
| 41 | |||
| 42 | tinyMCEPopup.requireLangPack(); | ||
| 43 | tinyMCEPopup.onInit.add(AdvHRDialog.init, AdvHRDialog); | ||
diff --git a/public/javascripts/tiny_mce/plugins/advhr/langs/en_dlg.js b/public/javascripts/tiny_mce/plugins/advhr/langs/en_dlg.js new file mode 100755 index 0000000..873bfd8 --- /dev/null +++ b/public/javascripts/tiny_mce/plugins/advhr/langs/en_dlg.js | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | tinyMCE.addI18n('en.advhr_dlg',{ | ||
| 2 | width:"Width", | ||
| 3 | size:"Height", | ||
| 4 | noshade:"No shadow" | ||
| 5 | }); \ No newline at end of file | ||
diff --git a/public/javascripts/tiny_mce/plugins/advhr/rule.htm b/public/javascripts/tiny_mce/plugins/advhr/rule.htm new file mode 100755 index 0000000..8f20f7f --- /dev/null +++ b/public/javascripts/tiny_mce/plugins/advhr/rule.htm | |||
| @@ -0,0 +1,63 @@ | |||
| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
| 2 | <html xmlns="http://www.w3.org/1999/xhtml"> | ||
| 3 | <head> | ||
| 4 | <title>{#advhr.advhr_desc}</title> | ||
| 5 | <script type="text/javascript" src="../../tiny_mce_popup.js"></script> | ||
| 6 | <script type="text/javascript" src="js/rule.js"></script> | ||
| 7 | <script type="text/javascript" src="../../utils/mctabs.js"></script> | ||
| 8 | <script type="text/javascript" src="../../utils/form_utils.js"></script> | ||
| 9 | <link href="css/advhr.css" rel="stylesheet" type="text/css" /> | ||
| 10 | <base target="_self" /> | ||
| 11 | </head> | ||
| 12 | <body> | ||
| 13 | <form onsubmit="AdvHRDialog.update();return false;" action="#"> | ||
| 14 | <div class="tabs"> | ||
| 15 | <ul> | ||
| 16 | <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advhr.advhr_desc}</a></span></li> | ||
| 17 | </ul> | ||
| 18 | </div> | ||
| 19 | |||
| 20 | <div class="panel_wrapper"> | ||
| 21 | <div id="general_panel" class="panel current"> | ||
| 22 | <table border="0" cellpadding="4" cellspacing="0"> | ||
| 23 | <tr> | ||
| 24 | <td><label for="width">{#advhr_dlg.width}</label></td> | ||
| 25 | <td nowrap="nowrap"> | ||
| 26 | <input id="width" name="width" type="text" value="" class="mceFocus" /> | ||
| 27 | <select name="width2" id="width2"> | ||
| 28 | <option value="">px</option> | ||
| 29 | <option value="%">%</option> | ||
| 30 | </select> | ||
| 31 | </td> | ||
| 32 | </tr> | ||
| 33 | <tr> | ||
| 34 | <td><label for="size">{#advhr_dlg.size}</label></td> | ||
| 35 | <td><select id="size" name="size"> | ||
| 36 | <option value="">Normal</option> | ||
| 37 | <option value="1">1</option> | ||
| 38 | <option value="2">2</option> | ||
| 39 | <option value="3">3</option> | ||
| 40 | <option value="4">4</option> | ||
| 41 | <option value="5">5</option> | ||
| 42 | </select></td> | ||
| 43 | </tr> | ||
| 44 | <tr> | ||
| 45 | <td><label for="noshade">{#advhr_dlg.noshade}</label></td> | ||
| 46 | <td><input type="checkbox" name="noshade" id="noshade" class="radio" /></td> | ||
| 47 | </tr> | ||
| 48 | </table> | ||
| 49 | </div> | ||
| 50 | </div> | ||
| 51 | |||
| 52 | <div class="mceActionPanel"> | ||
| 53 | <div style="float: left"> | ||
| 54 | <input type="submit" id="insert" name="insert" value="{#insert}" /> | ||
| 55 | </div> | ||
| 56 | |||
| 57 | <div style="float: right"> | ||
| 58 | <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> | ||
| 59 | </div> | ||
| 60 | </div> | ||
| 61 | </form> | ||
| 62 | </body> | ||
| 63 | </html> | ||
