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/contextmenu | |
| parent | 3d3b786cc43266f6292f5edd25733dbb9bd6ed06 (diff) | |
added tinymce editor for body area of pages
Diffstat (limited to 'public/javascripts/tiny_mce/plugins/contextmenu')
| -rwxr-xr-x | public/javascripts/tiny_mce/plugins/contextmenu/editor_plugin.js | 1 | ||||
| -rwxr-xr-x | public/javascripts/tiny_mce/plugins/contextmenu/editor_plugin_src.js | 95 |
2 files changed, 96 insertions, 0 deletions
diff --git a/public/javascripts/tiny_mce/plugins/contextmenu/editor_plugin.js b/public/javascripts/tiny_mce/plugins/contextmenu/editor_plugin.js new file mode 100755 index 0000000..f68744d --- /dev/null +++ b/public/javascripts/tiny_mce/plugins/contextmenu/editor_plugin.js | |||
| @@ -0,0 +1 @@ | |||
| (function(){var Event=tinymce.dom.Event,each=tinymce.each,DOM=tinymce.DOM;tinymce.create('tinymce.plugins.ContextMenu',{init:function(ed){var t=this;t.editor=ed;t.onContextMenu=new tinymce.util.Dispatcher(this);ed.onContextMenu.add(function(ed,e){if(!e.ctrlKey){t._getMenu(ed).showMenu(e.clientX,e.clientY);Event.add(ed.getDoc(),'click',hide);Event.cancel(e);}});function hide(){if(t._menu){t._menu.removeAll();t._menu.destroy();Event.remove(ed.getDoc(),'click',hide);}};ed.onMouseDown.add(hide);ed.onKeyDown.add(hide);},getInfo:function(){return{longname:'Contextmenu',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/contextmenu',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_getMenu:function(ed){var t=this,m=t._menu,se=ed.selection,col=se.isCollapsed(),el=se.getNode()||ed.getBody(),am,p1,p2;if(m){m.removeAll();m.destroy();}p1=DOM.getPos(ed.getContentAreaContainer());p2=DOM.getPos(ed.getContainer());m=ed.controlManager.createDropMenu('contextmenu',{offset_x:p1.x+ed.getParam('contextmenu_offset_x',0),offset_y:p1.y+ed.getParam('contextmenu_offset_y',0),constrain:1});t._menu=m;m.add({title:'advanced.cut_desc',icon:'cut',cmd:'Cut'}).setDisabled(col);m.add({title:'advanced.copy_desc',icon:'copy',cmd:'Copy'}).setDisabled(col);m.add({title:'advanced.paste_desc',icon:'paste',cmd:'Paste'});if((el.nodeName=='A'&&!ed.dom.getAttrib(el,'name'))||!col){m.addSeparator();m.add({title:'advanced.link_desc',icon:'link',cmd:ed.plugins.advlink?'mceAdvLink':'mceLink',ui:true});m.add({title:'advanced.unlink_desc',icon:'unlink',cmd:'UnLink'});}m.addSeparator();m.add({title:'advanced.image_desc',icon:'image',cmd:ed.plugins.advimage?'mceAdvImage':'mceImage',ui:true});m.addSeparator();am=m.addMenu({title:'contextmenu.align'});am.add({title:'contextmenu.left',icon:'justifyleft',cmd:'JustifyLeft'});am.add({title:'contextmenu.center',icon:'justifycenter',cmd:'JustifyCenter'});am.add({title:'contextmenu.right',icon:'justifyright',cmd:'JustifyRight'});am.add({title:'contextmenu.full',icon:'justifyfull',cmd:'JustifyFull'});t.onContextMenu.dispatch(t,m,el,col);return m;}});tinymce.PluginManager.add('contextmenu',tinymce.plugins.ContextMenu);})(); \ No newline at end of file | |||
diff --git a/public/javascripts/tiny_mce/plugins/contextmenu/editor_plugin_src.js b/public/javascripts/tiny_mce/plugins/contextmenu/editor_plugin_src.js new file mode 100755 index 0000000..a2c1866 --- /dev/null +++ b/public/javascripts/tiny_mce/plugins/contextmenu/editor_plugin_src.js | |||
| @@ -0,0 +1,95 @@ | |||
| 1 | /** | ||
| 2 | * $Id: editor_plugin_src.js 848 2008-05-15 11:54:40Z spocke $ | ||
| 3 | * | ||
| 4 | * @author Moxiecode | ||
| 5 | * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. | ||
| 6 | */ | ||
| 7 | |||
| 8 | (function() { | ||
| 9 | var Event = tinymce.dom.Event, each = tinymce.each, DOM = tinymce.DOM; | ||
| 10 | |||
| 11 | tinymce.create('tinymce.plugins.ContextMenu', { | ||
| 12 | init : function(ed) { | ||
| 13 | var t = this; | ||
| 14 | |||
| 15 | t.editor = ed; | ||
| 16 | t.onContextMenu = new tinymce.util.Dispatcher(this); | ||
| 17 | |||
| 18 | ed.onContextMenu.add(function(ed, e) { | ||
| 19 | if (!e.ctrlKey) { | ||
| 20 | t._getMenu(ed).showMenu(e.clientX, e.clientY); | ||
| 21 | Event.add(ed.getDoc(), 'click', hide); | ||
| 22 | Event.cancel(e); | ||
| 23 | } | ||
| 24 | }); | ||
| 25 | |||
| 26 | function hide() { | ||
| 27 | if (t._menu) { | ||
| 28 | t._menu.removeAll(); | ||
| 29 | t._menu.destroy(); | ||
| 30 | Event.remove(ed.getDoc(), 'click', hide); | ||
| 31 | } | ||
| 32 | }; | ||
| 33 | |||
| 34 | ed.onMouseDown.add(hide); | ||
| 35 | ed.onKeyDown.add(hide); | ||
| 36 | }, | ||
| 37 | |||
| 38 | getInfo : function() { | ||
| 39 | return { | ||
| 40 | longname : 'Contextmenu', | ||
| 41 | author : 'Moxiecode Systems AB', | ||
| 42 | authorurl : 'http://tinymce.moxiecode.com', | ||
| 43 | infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/contextmenu', | ||
| 44 | version : tinymce.majorVersion + "." + tinymce.minorVersion | ||
| 45 | }; | ||
| 46 | }, | ||
| 47 | |||
| 48 | _getMenu : function(ed) { | ||
| 49 | var t = this, m = t._menu, se = ed.selection, col = se.isCollapsed(), el = se.getNode() || ed.getBody(), am, p1, p2; | ||
| 50 | |||
| 51 | if (m) { | ||
| 52 | m.removeAll(); | ||
| 53 | m.destroy(); | ||
| 54 | } | ||
| 55 | |||
| 56 | p1 = DOM.getPos(ed.getContentAreaContainer()); | ||
| 57 | p2 = DOM.getPos(ed.getContainer()); | ||
| 58 | |||
| 59 | m = ed.controlManager.createDropMenu('contextmenu', { | ||
| 60 | offset_x : p1.x + ed.getParam('contextmenu_offset_x', 0), | ||
| 61 | offset_y : p1.y + ed.getParam('contextmenu_offset_y', 0), | ||
| 62 | constrain : 1 | ||
| 63 | }); | ||
| 64 | |||
| 65 | t._menu = m; | ||
| 66 | |||
| 67 | m.add({title : 'advanced.cut_desc', icon : 'cut', cmd : 'Cut'}).setDisabled(col); | ||
| 68 | m.add({title : 'advanced.copy_desc', icon : 'copy', cmd : 'Copy'}).setDisabled(col); | ||
| 69 | m.add({title : 'advanced.paste_desc', icon : 'paste', cmd : 'Paste'}); | ||
| 70 | |||
| 71 | if ((el.nodeName == 'A' && !ed.dom.getAttrib(el, 'name')) || !col) { | ||
| 72 | m.addSeparator(); | ||
| 73 | m.add({title : 'advanced.link_desc', icon : 'link', cmd : ed.plugins.advlink ? 'mceAdvLink' : 'mceLink', ui : true}); | ||
| 74 | m.add({title : 'advanced.unlink_desc', icon : 'unlink', cmd : 'UnLink'}); | ||
| 75 | } | ||
| 76 | |||
| 77 | m.addSeparator(); | ||
| 78 | m.add({title : 'advanced.image_desc', icon : 'image', cmd : ed.plugins.advimage ? 'mceAdvImage' : 'mceImage', ui : true}); | ||
| 79 | |||
| 80 | m.addSeparator(); | ||
| 81 | am = m.addMenu({title : 'contextmenu.align'}); | ||
| 82 | am.add({title : 'contextmenu.left', icon : 'justifyleft', cmd : 'JustifyLeft'}); | ||
| 83 | am.add({title : 'contextmenu.center', icon : 'justifycenter', cmd : 'JustifyCenter'}); | ||
| 84 | am.add({title : 'contextmenu.right', icon : 'justifyright', cmd : 'JustifyRight'}); | ||
| 85 | am.add({title : 'contextmenu.full', icon : 'justifyfull', cmd : 'JustifyFull'}); | ||
| 86 | |||
| 87 | t.onContextMenu.dispatch(t, m, el, col); | ||
| 88 | |||
| 89 | return m; | ||
| 90 | } | ||
| 91 | }); | ||
| 92 | |||
| 93 | // Register plugin | ||
| 94 | tinymce.PluginManager.add('contextmenu', tinymce.plugins.ContextMenu); | ||
| 95 | })(); \ No newline at end of file | ||
