cable 0.9.16 → 0.9.17
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/app/controllers/admin_controller.rb +1 -1
- data/app/views/layouts/admin.html.erb +3 -1
- data/lib/generators/cable/install_generator.rb +1 -0
- data/lib/generators/cable/menu/templates/erb/menus/_menu.html.erb +1 -1
- data/lib/generators/cable/menu/templates/erb/menus/_resources.html.erb +1 -1
- data/lib/generators/cable/menu/templates/erb/menus/show.html.erb +1 -1
- data/public/javascripts/admin.js +16 -16
- metadata +2 -254
- data/public/javascripts/tinymce/jquery.tinymce.js +0 -1
- data/public/javascripts/tinymce/langs/en.js +0 -222
- data/public/javascripts/tinymce/license.txt +0 -504
- data/public/javascripts/tinymce/plugins/advhr/css/advhr.css +0 -5
- data/public/javascripts/tinymce/plugins/advhr/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/advhr/editor_plugin_src.js +0 -57
- data/public/javascripts/tinymce/plugins/advhr/js/rule.js +0 -43
- data/public/javascripts/tinymce/plugins/advhr/langs/en_dlg.js +0 -7
- data/public/javascripts/tinymce/plugins/advhr/rule.htm +0 -58
- data/public/javascripts/tinymce/plugins/advimage/css/advimage.css +0 -13
- data/public/javascripts/tinymce/plugins/advimage/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/advimage/editor_plugin_src.js +0 -50
- data/public/javascripts/tinymce/plugins/advimage/image.htm +0 -235
- data/public/javascripts/tinymce/plugins/advimage/img/sample.gif +0 -0
- data/public/javascripts/tinymce/plugins/advimage/js/image.js +0 -445
- data/public/javascripts/tinymce/plugins/advimage/langs/en_dlg.js +0 -45
- data/public/javascripts/tinymce/plugins/advlink/css/advlink.css +0 -8
- data/public/javascripts/tinymce/plugins/advlink/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/advlink/editor_plugin_src.js +0 -61
- data/public/javascripts/tinymce/plugins/advlink/js/advlink.js +0 -523
- data/public/javascripts/tinymce/plugins/advlink/langs/en_dlg.js +0 -54
- data/public/javascripts/tinymce/plugins/advlink/link.htm +0 -338
- data/public/javascripts/tinymce/plugins/advlist/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/advlist/editor_plugin_src.js +0 -154
- data/public/javascripts/tinymce/plugins/autolink/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/autolink/editor_plugin_src.js +0 -169
- data/public/javascripts/tinymce/plugins/autoresize/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/autoresize/editor_plugin_src.js +0 -119
- data/public/javascripts/tinymce/plugins/autosave/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/autosave/editor_plugin_src.js +0 -431
- data/public/javascripts/tinymce/plugins/autosave/langs/en.js +0 -4
- data/public/javascripts/tinymce/plugins/bbcode/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/bbcode/editor_plugin_src.js +0 -120
- data/public/javascripts/tinymce/plugins/contextmenu/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/contextmenu/editor_plugin_src.js +0 -156
- data/public/javascripts/tinymce/plugins/directionality/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/directionality/editor_plugin_src.js +0 -82
- data/public/javascripts/tinymce/plugins/emotions/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/emotions/editor_plugin_src.js +0 -43
- data/public/javascripts/tinymce/plugins/emotions/emotions.htm +0 -41
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-cool.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-cry.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-embarassed.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-foot-in-mouth.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-frown.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-innocent.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-kiss.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-laughing.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-money-mouth.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-sealed.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-smile.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-surprised.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-tongue-out.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-undecided.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-wink.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/img/smiley-yell.gif +0 -0
- data/public/javascripts/tinymce/plugins/emotions/js/emotions.js +0 -22
- data/public/javascripts/tinymce/plugins/emotions/langs/en_dlg.js +0 -20
- data/public/javascripts/tinymce/plugins/example/dialog.htm +0 -22
- data/public/javascripts/tinymce/plugins/example/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/example/editor_plugin_src.js +0 -84
- data/public/javascripts/tinymce/plugins/example/img/example.gif +0 -0
- data/public/javascripts/tinymce/plugins/example/js/dialog.js +0 -19
- data/public/javascripts/tinymce/plugins/example/langs/en.js +0 -3
- data/public/javascripts/tinymce/plugins/example/langs/en_dlg.js +0 -3
- data/public/javascripts/tinymce/plugins/fullpage/css/fullpage.css +0 -184
- data/public/javascripts/tinymce/plugins/fullpage/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/fullpage/editor_plugin_src.js +0 -198
- data/public/javascripts/tinymce/plugins/fullpage/fullpage.htm +0 -571
- data/public/javascripts/tinymce/plugins/fullpage/js/fullpage.js +0 -497
- data/public/javascripts/tinymce/plugins/fullpage/langs/en_dlg.js +0 -85
- data/public/javascripts/tinymce/plugins/fullscreen/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/fullscreen/editor_plugin_src.js +0 -159
- data/public/javascripts/tinymce/plugins/fullscreen/fullscreen.htm +0 -109
- data/public/javascripts/tinymce/plugins/iespell/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/iespell/editor_plugin_src.js +0 -54
- data/public/javascripts/tinymce/plugins/inlinepopups/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/inlinepopups/editor_plugin_src.js +0 -696
- data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif +0 -0
- data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/button.gif +0 -0
- data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif +0 -0
- data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif +0 -0
- data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif +0 -0
- data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif +0 -0
- data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif +0 -0
- data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css +0 -90
- data/public/javascripts/tinymce/plugins/inlinepopups/template.htm +0 -387
- data/public/javascripts/tinymce/plugins/insertdatetime/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/insertdatetime/editor_plugin_src.js +0 -83
- data/public/javascripts/tinymce/plugins/layer/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/layer/editor_plugin_src.js +0 -214
- data/public/javascripts/tinymce/plugins/legacyoutput/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/legacyoutput/editor_plugin_src.js +0 -139
- data/public/javascripts/tinymce/plugins/lists/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/lists/editor_plugin_src.js +0 -617
- data/public/javascripts/tinymce/plugins/media/css/media.css +0 -17
- data/public/javascripts/tinymce/plugins/media/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/media/editor_plugin_src.js +0 -770
- data/public/javascripts/tinymce/plugins/media/js/embed.js +0 -73
- data/public/javascripts/tinymce/plugins/media/js/media.js +0 -354
- data/public/javascripts/tinymce/plugins/media/langs/en_dlg.js +0 -109
- data/public/javascripts/tinymce/plugins/media/media.htm +0 -812
- data/public/javascripts/tinymce/plugins/media/moxieplayer.swf +0 -0
- data/public/javascripts/tinymce/plugins/nonbreaking/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/nonbreaking/editor_plugin_src.js +0 -53
- data/public/javascripts/tinymce/plugins/noneditable/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/noneditable/editor_plugin_src.js +0 -90
- data/public/javascripts/tinymce/plugins/pagebreak/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/pagebreak/editor_plugin_src.js +0 -74
- data/public/javascripts/tinymce/plugins/paste/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/paste/editor_plugin_src.js +0 -930
- data/public/javascripts/tinymce/plugins/paste/js/pastetext.js +0 -36
- data/public/javascripts/tinymce/plugins/paste/js/pasteword.js +0 -51
- data/public/javascripts/tinymce/plugins/paste/langs/en_dlg.js +0 -5
- data/public/javascripts/tinymce/plugins/paste/pastetext.htm +0 -27
- data/public/javascripts/tinymce/plugins/paste/pasteword.htm +0 -21
- data/public/javascripts/tinymce/plugins/preview/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/preview/editor_plugin_src.js +0 -53
- data/public/javascripts/tinymce/plugins/preview/example.html +0 -28
- data/public/javascripts/tinymce/plugins/preview/jscripts/embed.js +0 -73
- data/public/javascripts/tinymce/plugins/preview/preview.html +0 -17
- data/public/javascripts/tinymce/plugins/print/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/print/editor_plugin_src.js +0 -34
- data/public/javascripts/tinymce/plugins/save/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/save/editor_plugin_src.js +0 -101
- data/public/javascripts/tinymce/plugins/searchreplace/css/searchreplace.css +0 -6
- data/public/javascripts/tinymce/plugins/searchreplace/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/searchreplace/editor_plugin_src.js +0 -61
- data/public/javascripts/tinymce/plugins/searchreplace/js/searchreplace.js +0 -142
- data/public/javascripts/tinymce/plugins/searchreplace/langs/en_dlg.js +0 -16
- data/public/javascripts/tinymce/plugins/searchreplace/searchreplace.htm +0 -100
- data/public/javascripts/tinymce/plugins/spellchecker/css/content.css +0 -1
- data/public/javascripts/tinymce/plugins/spellchecker/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/spellchecker/editor_plugin_src.js +0 -435
- data/public/javascripts/tinymce/plugins/spellchecker/img/wline.gif +0 -0
- data/public/javascripts/tinymce/plugins/style/css/props.css +0 -13
- data/public/javascripts/tinymce/plugins/style/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/style/editor_plugin_src.js +0 -55
- data/public/javascripts/tinymce/plugins/style/js/props.js +0 -635
- data/public/javascripts/tinymce/plugins/style/langs/en_dlg.js +0 -70
- data/public/javascripts/tinymce/plugins/style/props.htm +0 -838
- data/public/javascripts/tinymce/plugins/tabfocus/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/tabfocus/editor_plugin_src.js +0 -114
- data/public/javascripts/tinymce/plugins/table/cell.htm +0 -178
- data/public/javascripts/tinymce/plugins/table/css/cell.css +0 -17
- data/public/javascripts/tinymce/plugins/table/css/row.css +0 -25
- data/public/javascripts/tinymce/plugins/table/css/table.css +0 -13
- data/public/javascripts/tinymce/plugins/table/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/table/editor_plugin_src.js +0 -1198
- data/public/javascripts/tinymce/plugins/table/js/cell.js +0 -284
- data/public/javascripts/tinymce/plugins/table/js/merge_cells.js +0 -27
- data/public/javascripts/tinymce/plugins/table/js/row.js +0 -232
- data/public/javascripts/tinymce/plugins/table/js/table.js +0 -450
- data/public/javascripts/tinymce/plugins/table/langs/en_dlg.js +0 -74
- data/public/javascripts/tinymce/plugins/table/merge_cells.htm +0 -32
- data/public/javascripts/tinymce/plugins/table/row.htm +0 -157
- data/public/javascripts/tinymce/plugins/table/table.htm +0 -188
- data/public/javascripts/tinymce/plugins/template/blank.htm +0 -12
- data/public/javascripts/tinymce/plugins/template/css/template.css +0 -23
- data/public/javascripts/tinymce/plugins/template/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/template/editor_plugin_src.js +0 -159
- data/public/javascripts/tinymce/plugins/template/js/template.js +0 -106
- data/public/javascripts/tinymce/plugins/template/langs/en_dlg.js +0 -15
- data/public/javascripts/tinymce/plugins/template/template.htm +0 -31
- data/public/javascripts/tinymce/plugins/visualchars/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/visualchars/editor_plugin_src.js +0 -83
- data/public/javascripts/tinymce/plugins/wordcount/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/wordcount/editor_plugin_src.js +0 -114
- data/public/javascripts/tinymce/plugins/xhtmlxtras/abbr.htm +0 -142
- data/public/javascripts/tinymce/plugins/xhtmlxtras/acronym.htm +0 -142
- data/public/javascripts/tinymce/plugins/xhtmlxtras/attributes.htm +0 -149
- data/public/javascripts/tinymce/plugins/xhtmlxtras/cite.htm +0 -142
- data/public/javascripts/tinymce/plugins/xhtmlxtras/css/attributes.css +0 -11
- data/public/javascripts/tinymce/plugins/xhtmlxtras/css/popup.css +0 -9
- data/public/javascripts/tinymce/plugins/xhtmlxtras/del.htm +0 -162
- data/public/javascripts/tinymce/plugins/xhtmlxtras/editor_plugin.js +0 -1
- data/public/javascripts/tinymce/plugins/xhtmlxtras/editor_plugin_src.js +0 -132
- data/public/javascripts/tinymce/plugins/xhtmlxtras/ins.htm +0 -162
- data/public/javascripts/tinymce/plugins/xhtmlxtras/js/abbr.js +0 -28
- data/public/javascripts/tinymce/plugins/xhtmlxtras/js/acronym.js +0 -28
- data/public/javascripts/tinymce/plugins/xhtmlxtras/js/attributes.js +0 -125
- data/public/javascripts/tinymce/plugins/xhtmlxtras/js/cite.js +0 -28
- data/public/javascripts/tinymce/plugins/xhtmlxtras/js/del.js +0 -53
- data/public/javascripts/tinymce/plugins/xhtmlxtras/js/element_common.js +0 -229
- data/public/javascripts/tinymce/plugins/xhtmlxtras/js/ins.js +0 -53
- data/public/javascripts/tinymce/plugins/xhtmlxtras/langs/en_dlg.js +0 -32
- data/public/javascripts/tinymce/themes/advanced/about.htm +0 -52
- data/public/javascripts/tinymce/themes/advanced/anchor.htm +0 -26
- data/public/javascripts/tinymce/themes/advanced/charmap.htm +0 -51
- data/public/javascripts/tinymce/themes/advanced/color_picker.htm +0 -74
- data/public/javascripts/tinymce/themes/advanced/editor_template.js +0 -1
- data/public/javascripts/tinymce/themes/advanced/editor_template_src.js +0 -1360
- data/public/javascripts/tinymce/themes/advanced/image.htm +0 -80
- data/public/javascripts/tinymce/themes/advanced/img/colorpicker.jpg +0 -0
- data/public/javascripts/tinymce/themes/advanced/img/flash.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/img/icons.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/img/iframe.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/img/pagebreak.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/img/quicktime.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/img/realmedia.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/img/shockwave.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/img/trans.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/img/video.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/img/windowsmedia.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/js/about.js +0 -73
- data/public/javascripts/tinymce/themes/advanced/js/anchor.js +0 -42
- data/public/javascripts/tinymce/themes/advanced/js/charmap.js +0 -355
- data/public/javascripts/tinymce/themes/advanced/js/color_picker.js +0 -329
- data/public/javascripts/tinymce/themes/advanced/js/image.js +0 -247
- data/public/javascripts/tinymce/themes/advanced/js/link.js +0 -153
- data/public/javascripts/tinymce/themes/advanced/js/source_editor.js +0 -56
- data/public/javascripts/tinymce/themes/advanced/langs/en.js +0 -68
- data/public/javascripts/tinymce/themes/advanced/langs/en_dlg.js +0 -54
- data/public/javascripts/tinymce/themes/advanced/link.htm +0 -57
- data/public/javascripts/tinymce/themes/advanced/shortcuts.htm +0 -47
- data/public/javascripts/tinymce/themes/advanced/skins/default/content.css +0 -47
- data/public/javascripts/tinymce/themes/advanced/skins/default/dialog.css +0 -117
- data/public/javascripts/tinymce/themes/advanced/skins/default/img/buttons.png +0 -0
- data/public/javascripts/tinymce/themes/advanced/skins/default/img/items.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/skins/default/img/menu_arrow.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/skins/default/img/menu_check.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/skins/default/img/progress.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/skins/default/img/tabs.gif +0 -0
- data/public/javascripts/tinymce/themes/advanced/skins/default/ui.css +0 -213
- data/public/javascripts/tinymce/themes/advanced/skins/highcontrast/content.css +0 -23
- data/public/javascripts/tinymce/themes/advanced/skins/highcontrast/dialog.css +0 -105
- data/public/javascripts/tinymce/themes/advanced/skins/highcontrast/ui.css +0 -101
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/content.css +0 -46
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/dialog.css +0 -117
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/img/button_bg.png +0 -0
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/img/button_bg_black.png +0 -0
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/img/button_bg_silver.png +0 -0
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/ui.css +0 -216
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/ui_black.css +0 -8
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/ui_silver.css +0 -5
- data/public/javascripts/tinymce/themes/advanced/source_editor.htm +0 -25
- data/public/javascripts/tinymce/themes/simple/editor_template.js +0 -1
- data/public/javascripts/tinymce/themes/simple/editor_template_src.js +0 -84
- data/public/javascripts/tinymce/themes/simple/img/icons.gif +0 -0
- data/public/javascripts/tinymce/themes/simple/langs/en.js +0 -11
- data/public/javascripts/tinymce/themes/simple/skins/default/content.css +0 -25
- data/public/javascripts/tinymce/themes/simple/skins/default/ui.css +0 -32
- data/public/javascripts/tinymce/themes/simple/skins/o2k7/content.css +0 -17
- data/public/javascripts/tinymce/themes/simple/skins/o2k7/img/button_bg.png +0 -0
- data/public/javascripts/tinymce/themes/simple/skins/o2k7/ui.css +0 -35
- data/public/javascripts/tinymce/tiny_mce.js +0 -1
- data/public/javascripts/tinymce/tiny_mce_popup.js +0 -5
- data/public/javascripts/tinymce/tiny_mce_src.js +0 -15752
- data/public/javascripts/tinymce/utils/editable_selects.js +0 -70
- data/public/javascripts/tinymce/utils/form_utils.js +0 -210
- data/public/javascripts/tinymce/utils/mctabs.js +0 -162
- data/public/javascripts/tinymce/utils/validate.js +0 -252
@@ -1 +0,0 @@
|
|
1
|
-
(function(){var c=tinymce.DOM,a=tinymce.dom.Event,d=tinymce.each,b=tinymce.explode;tinymce.create("tinymce.plugins.TabFocusPlugin",{init:function(f,g){function e(i,j){if(j.keyCode===9){return a.cancel(j)}}function h(l,p){var j,m,o,n,k;function q(r){n=c.select(":input:enabled,*[tabindex]");function i(s){return s.type!="hidden"&&s.tabIndex!="-1"&&!(n[m].style.display=="none")&&!(n[m].style.visibility=="hidden")}d(n,function(t,s){if(t.id==l.id){j=s;return false}});if(r>0){for(m=j+1;m<n.length;m++){if(i(n[m])){return n[m]}}}else{for(m=j-1;m>=0;m--){if(i(n[m])){return n[m]}}}return null}if(p.keyCode===9){k=b(l.getParam("tab_focus",l.getParam("tabfocus_elements",":prev,:next")));if(k.length==1){k[1]=k[0];k[0]=":prev"}if(p.shiftKey){if(k[0]==":prev"){n=q(-1)}else{n=c.get(k[0])}}else{if(k[1]==":next"){n=q(1)}else{n=c.get(k[1])}}if(n){if(n.id&&(l=tinymce.get(n.id||n.name))){l.focus()}else{window.setTimeout(function(){if(!tinymce.isWebKit){window.focus()}n.focus()},10)}return a.cancel(p)}}}f.onKeyUp.add(e);if(tinymce.isGecko){f.onKeyPress.add(h);f.onKeyDown.add(e)}else{f.onKeyDown.add(h)}},getInfo:function(){return{longname:"Tabfocus",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("tabfocus",tinymce.plugins.TabFocusPlugin)})();
|
@@ -1,114 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* editor_plugin_src.js
|
3
|
-
*
|
4
|
-
* Copyright 2009, Moxiecode Systems AB
|
5
|
-
* Released under LGPL License.
|
6
|
-
*
|
7
|
-
* License: http://tinymce.moxiecode.com/license
|
8
|
-
* Contributing: http://tinymce.moxiecode.com/contributing
|
9
|
-
*/
|
10
|
-
|
11
|
-
(function() {
|
12
|
-
var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, explode = tinymce.explode;
|
13
|
-
|
14
|
-
tinymce.create('tinymce.plugins.TabFocusPlugin', {
|
15
|
-
init : function(ed, url) {
|
16
|
-
function tabCancel(ed, e) {
|
17
|
-
if (e.keyCode === 9)
|
18
|
-
return Event.cancel(e);
|
19
|
-
};
|
20
|
-
|
21
|
-
function tabHandler(ed, e) {
|
22
|
-
var x, i, f, el, v;
|
23
|
-
|
24
|
-
function find(d) {
|
25
|
-
el = DOM.select(':input:enabled,*[tabindex]');
|
26
|
-
function canSelect(e) {
|
27
|
-
return e.type != 'hidden' &&
|
28
|
-
e.tabIndex != '-1' &&
|
29
|
-
!(el[i].style.display == "none") &&
|
30
|
-
!(el[i].style.visibility == "hidden");
|
31
|
-
}
|
32
|
-
|
33
|
-
each(el, function(e, i) {
|
34
|
-
if (e.id == ed.id) {
|
35
|
-
x = i;
|
36
|
-
return false;
|
37
|
-
}
|
38
|
-
});
|
39
|
-
|
40
|
-
if (d > 0) {
|
41
|
-
for (i = x + 1; i < el.length; i++) {
|
42
|
-
if (canSelect(el[i]))
|
43
|
-
return el[i];
|
44
|
-
}
|
45
|
-
} else {
|
46
|
-
for (i = x - 1; i >= 0; i--) {
|
47
|
-
if (canSelect(el[i]))
|
48
|
-
return el[i];
|
49
|
-
}
|
50
|
-
}
|
51
|
-
|
52
|
-
return null;
|
53
|
-
};
|
54
|
-
|
55
|
-
if (e.keyCode === 9) {
|
56
|
-
v = explode(ed.getParam('tab_focus', ed.getParam('tabfocus_elements', ':prev,:next')));
|
57
|
-
|
58
|
-
if (v.length == 1) {
|
59
|
-
v[1] = v[0];
|
60
|
-
v[0] = ':prev';
|
61
|
-
}
|
62
|
-
|
63
|
-
// Find element to focus
|
64
|
-
if (e.shiftKey) {
|
65
|
-
if (v[0] == ':prev')
|
66
|
-
el = find(-1);
|
67
|
-
else
|
68
|
-
el = DOM.get(v[0]);
|
69
|
-
} else {
|
70
|
-
if (v[1] == ':next')
|
71
|
-
el = find(1);
|
72
|
-
else
|
73
|
-
el = DOM.get(v[1]);
|
74
|
-
}
|
75
|
-
|
76
|
-
if (el) {
|
77
|
-
if (el.id && (ed = tinymce.get(el.id || el.name)))
|
78
|
-
ed.focus();
|
79
|
-
else
|
80
|
-
window.setTimeout(function() {
|
81
|
-
if (!tinymce.isWebKit)
|
82
|
-
window.focus();
|
83
|
-
el.focus();
|
84
|
-
}, 10);
|
85
|
-
|
86
|
-
return Event.cancel(e);
|
87
|
-
}
|
88
|
-
}
|
89
|
-
};
|
90
|
-
|
91
|
-
ed.onKeyUp.add(tabCancel);
|
92
|
-
|
93
|
-
if (tinymce.isGecko) {
|
94
|
-
ed.onKeyPress.add(tabHandler);
|
95
|
-
ed.onKeyDown.add(tabCancel);
|
96
|
-
} else
|
97
|
-
ed.onKeyDown.add(tabHandler);
|
98
|
-
|
99
|
-
},
|
100
|
-
|
101
|
-
getInfo : function() {
|
102
|
-
return {
|
103
|
-
longname : 'Tabfocus',
|
104
|
-
author : 'Moxiecode Systems AB',
|
105
|
-
authorurl : 'http://tinymce.moxiecode.com',
|
106
|
-
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus',
|
107
|
-
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
108
|
-
};
|
109
|
-
}
|
110
|
-
});
|
111
|
-
|
112
|
-
// Register plugin
|
113
|
-
tinymce.PluginManager.add('tabfocus', tinymce.plugins.TabFocusPlugin);
|
114
|
-
})();
|
@@ -1,178 +0,0 @@
|
|
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>{#table_dlg.cell_title}</title>
|
5
|
-
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
|
6
|
-
<script type="text/javascript" src="../../utils/mctabs.js"></script>
|
7
|
-
<script type="text/javascript" src="../../utils/form_utils.js"></script>
|
8
|
-
<script type="text/javascript" src="../../utils/editable_selects.js"></script>
|
9
|
-
<script type="text/javascript" src="js/cell.js"></script>
|
10
|
-
<link href="css/cell.css" rel="stylesheet" type="text/css" />
|
11
|
-
</head>
|
12
|
-
<body id="tablecell" style="display: none" role="application">
|
13
|
-
<form onsubmit="updateAction();return false;" action="#">
|
14
|
-
<div class="tabs">
|
15
|
-
<ul>
|
16
|
-
<li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#table_dlg.general_tab}</a></span></li>
|
17
|
-
<li id="advanced_tab" aria-controls="advanced_panel"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#table_dlg.advanced_tab}</a></span></li>
|
18
|
-
</ul>
|
19
|
-
</div>
|
20
|
-
|
21
|
-
<div class="panel_wrapper">
|
22
|
-
<div id="general_panel" class="panel current">
|
23
|
-
<fieldset>
|
24
|
-
<legend>{#table_dlg.general_props}</legend>
|
25
|
-
|
26
|
-
<table role="presentation" border="0" cellpadding="4" cellspacing="0">
|
27
|
-
<tr>
|
28
|
-
<td><label for="align">{#table_dlg.align}</label></td>
|
29
|
-
<td>
|
30
|
-
<select id="align" name="align" class="mceFocus">
|
31
|
-
<option value="">{#not_set}</option>
|
32
|
-
<option value="center">{#table_dlg.align_middle}</option>
|
33
|
-
<option value="left">{#table_dlg.align_left}</option>
|
34
|
-
<option value="right">{#table_dlg.align_right}</option>
|
35
|
-
</select>
|
36
|
-
</td>
|
37
|
-
|
38
|
-
<td><label for="celltype">{#table_dlg.cell_type}</label></td>
|
39
|
-
<td>
|
40
|
-
<select id="celltype" name="celltype">
|
41
|
-
<option value="td">{#table_dlg.td}</option>
|
42
|
-
<option value="th">{#table_dlg.th}</option>
|
43
|
-
</select>
|
44
|
-
</td>
|
45
|
-
</tr>
|
46
|
-
|
47
|
-
<tr>
|
48
|
-
<td><label for="valign">{#table_dlg.valign}</label></td>
|
49
|
-
<td>
|
50
|
-
<select id="valign" name="valign">
|
51
|
-
<option value="">{#not_set}</option>
|
52
|
-
<option value="top">{#table_dlg.align_top}</option>
|
53
|
-
<option value="middle">{#table_dlg.align_middle}</option>
|
54
|
-
<option value="bottom">{#table_dlg.align_bottom}</option>
|
55
|
-
</select>
|
56
|
-
</td>
|
57
|
-
|
58
|
-
<td><label for="scope">{#table_dlg.scope}</label></td>
|
59
|
-
<td>
|
60
|
-
<select id="scope" name="scope">
|
61
|
-
<option value="">{#not_set}</option>
|
62
|
-
<option value="col">{#table.col}</option>
|
63
|
-
<option value="row">{#table.row}</option>
|
64
|
-
<option value="rowgroup">{#table_dlg.rowgroup}</option>
|
65
|
-
<option value="colgroup">{#table_dlg.colgroup}</option>
|
66
|
-
</select>
|
67
|
-
</td>
|
68
|
-
|
69
|
-
</tr>
|
70
|
-
|
71
|
-
<tr>
|
72
|
-
<td><label for="width">{#table_dlg.width}</label></td>
|
73
|
-
<td><input id="width" name="width" type="text" value="" size="4" maxlength="4" onchange="changedSize();" /></td>
|
74
|
-
|
75
|
-
<td><label for="height">{#table_dlg.height}</label></td>
|
76
|
-
<td><input id="height" name="height" type="text" value="" size="4" maxlength="4" onchange="changedSize();" /></td>
|
77
|
-
</tr>
|
78
|
-
|
79
|
-
<tr id="styleSelectRow">
|
80
|
-
<td><label for="class">{#class_name}</label></td>
|
81
|
-
<td colspan="3">
|
82
|
-
<select id="class" name="class" class="mceEditableSelect">
|
83
|
-
<option value="" selected="selected">{#not_set}</option>
|
84
|
-
</select>
|
85
|
-
</td>
|
86
|
-
</tr>
|
87
|
-
</table>
|
88
|
-
</fieldset>
|
89
|
-
</div>
|
90
|
-
|
91
|
-
<div id="advanced_panel" class="panel">
|
92
|
-
<fieldset>
|
93
|
-
<legend>{#table_dlg.advanced_props}</legend>
|
94
|
-
|
95
|
-
<table role="presentation" border="0" cellpadding="0" cellspacing="4">
|
96
|
-
<tr>
|
97
|
-
<td class="column1"><label for="id">{#table_dlg.id}</label></td>
|
98
|
-
<td><input id="id" name="id" type="text" value="" style="width: 200px" /></td>
|
99
|
-
</tr>
|
100
|
-
|
101
|
-
<tr>
|
102
|
-
<td><label for="style">{#table_dlg.style}</label></td>
|
103
|
-
<td><input type="text" id="style" name="style" value="" style="width: 200px;" onchange="changedStyle();" /></td>
|
104
|
-
</tr>
|
105
|
-
|
106
|
-
<tr>
|
107
|
-
<td class="column1"><label for="dir">{#table_dlg.langdir}</label></td>
|
108
|
-
<td>
|
109
|
-
<select id="dir" name="dir" style="width: 200px">
|
110
|
-
<option value="">{#not_set}</option>
|
111
|
-
<option value="ltr">{#table_dlg.ltr}</option>
|
112
|
-
<option value="rtl">{#table_dlg.rtl}</option>
|
113
|
-
</select>
|
114
|
-
</td>
|
115
|
-
</tr>
|
116
|
-
|
117
|
-
<tr>
|
118
|
-
<td class="column1"><label for="lang">{#table_dlg.langcode}</label></td>
|
119
|
-
<td>
|
120
|
-
<input id="lang" name="lang" type="text" value="" style="width: 200px" />
|
121
|
-
</td>
|
122
|
-
</tr>
|
123
|
-
|
124
|
-
<tr>
|
125
|
-
<td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td>
|
126
|
-
<td>
|
127
|
-
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
128
|
-
<tr>
|
129
|
-
<td><input id="backgroundimage" name="backgroundimage" type="text" value="" style="width: 200px" onchange="changedBackgroundImage();" /></td>
|
130
|
-
<td id="backgroundimagebrowsercontainer"> </td>
|
131
|
-
</tr>
|
132
|
-
</table>
|
133
|
-
</td>
|
134
|
-
</tr>
|
135
|
-
|
136
|
-
<tr role="group" aria-labelledby="bordercolor_label">
|
137
|
-
<td class="column1"><label id="bordercolor_label" for="bordercolor">{#table_dlg.bordercolor}</label></td>
|
138
|
-
<td>
|
139
|
-
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
140
|
-
<tr>
|
141
|
-
<td><input id="bordercolor" name="bordercolor" type="text" value="" size="9" onchange="updateColor('bordercolor_pick','bordercolor');changedColor();" /></td>
|
142
|
-
<td id="bordercolor_pickcontainer"> </td>
|
143
|
-
</tr>
|
144
|
-
</table>
|
145
|
-
</td>
|
146
|
-
</tr>
|
147
|
-
|
148
|
-
<tr role="group" aria-labelledby="bgcolor_label">
|
149
|
-
<td class="column1"><label id="bgcolor_label" for="bgcolor">{#table_dlg.bgcolor}</label></td>
|
150
|
-
<td>
|
151
|
-
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
152
|
-
<tr>
|
153
|
-
<td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedColor();" /></td>
|
154
|
-
<td id="bgcolor_pickcontainer"> </td>
|
155
|
-
</tr>
|
156
|
-
</table>
|
157
|
-
</td>
|
158
|
-
</tr>
|
159
|
-
</table>
|
160
|
-
</fieldset>
|
161
|
-
</div>
|
162
|
-
</div>
|
163
|
-
|
164
|
-
<div class="mceActionPanel">
|
165
|
-
<div>
|
166
|
-
<select id="action" name="action">
|
167
|
-
<option value="cell">{#table_dlg.cell_cell}</option>
|
168
|
-
<option value="row">{#table_dlg.cell_row}</option>
|
169
|
-
<option value="all">{#table_dlg.cell_all}</option>
|
170
|
-
</select>
|
171
|
-
</div>
|
172
|
-
|
173
|
-
<input type="submit" id="insert" name="insert" value="{#update}" />
|
174
|
-
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
175
|
-
</div>
|
176
|
-
</form>
|
177
|
-
</body>
|
178
|
-
</html>
|
@@ -1,25 +0,0 @@
|
|
1
|
-
/* CSS file for row dialog in the table plugin */
|
2
|
-
|
3
|
-
.panel_wrapper div.current {
|
4
|
-
height: 200px;
|
5
|
-
}
|
6
|
-
|
7
|
-
.advfield {
|
8
|
-
width: 200px;
|
9
|
-
}
|
10
|
-
|
11
|
-
#action {
|
12
|
-
margin-bottom: 3px;
|
13
|
-
}
|
14
|
-
|
15
|
-
#rowtype,#align,#valign,#class,#height {
|
16
|
-
width: 150px;
|
17
|
-
}
|
18
|
-
|
19
|
-
#height {
|
20
|
-
width: 50px;
|
21
|
-
}
|
22
|
-
|
23
|
-
.col2 {
|
24
|
-
padding-left: 20px;
|
25
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
(function(c){var d=c.each;function b(f,g){var h=g.ownerDocument,e=h.createRange(),j;e.setStartBefore(g);e.setEnd(f.endContainer,f.endOffset);j=h.createElement("body");j.appendChild(e.cloneContents());return j.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi,"-").replace(/<[^>]+>/g,"").length==0}function a(H,G,K){var f,L,D,o;t();o=G.getParent(K.getStart(),"th,td");if(o){L=F(o);D=I();o=z(L.x,L.y)}function A(N,M){N=N.cloneNode(M);N.removeAttribute("id");return N}function t(){var M=0;f=[];d(["thead","tbody","tfoot"],function(N){var O=G.select("> "+N+" tr",H);d(O,function(P,Q){Q+=M;d(G.select("> td, > th",P),function(W,R){var S,T,U,V;if(f[Q]){while(f[Q][R]){R++}}U=h(W,"rowspan");V=h(W,"colspan");for(T=Q;T<Q+U;T++){if(!f[T]){f[T]=[]}for(S=R;S<R+V;S++){f[T][S]={part:N,real:T==Q&&S==R,elm:W,rowspan:U,colspan:V}}}})});M+=O.length})}function z(M,O){var N;N=f[O];if(N){return N[M]}}function h(N,M){return parseInt(N.getAttribute(M)||1)}function s(O,M,N){if(O){N=parseInt(N);if(N===1){O.removeAttribute(M,1)}else{O.setAttribute(M,N,1)}}}function j(M){return M&&(G.hasClass(M.elm,"mceSelected")||M==o)}function k(){var M=[];d(H.rows,function(N){d(N.cells,function(O){if(G.hasClass(O,"mceSelected")||O==o.elm){M.push(N);return false}})});return M}function r(){var M=G.createRng();M.setStartAfter(H);M.setEndAfter(H);K.setRng(M);G.remove(H)}function e(M){var N;c.walk(M,function(P){var O;if(P.nodeType==3){d(G.getParents(P.parentNode,null,M).reverse(),function(Q){Q=A(Q,false);if(!N){N=O=Q}else{if(O){O.appendChild(Q)}}O=Q});if(O){O.innerHTML=c.isIE?" ":'<br data-mce-bogus="1" />'}return false}},"childNodes");M=A(M,false);s(M,"rowspan",1);s(M,"colspan",1);if(N){M.appendChild(N)}else{if(!c.isIE){M.innerHTML='<br data-mce-bogus="1" />'}}return M}function q(){var M=G.createRng();d(G.select("tr",H),function(N){if(N.cells.length==0){G.remove(N)}});if(G.select("tr",H).length==0){M.setStartAfter(H);M.setEndAfter(H);K.setRng(M);G.remove(H);return}d(G.select("thead,tbody,tfoot",H),function(N){if(N.rows.length==0){G.remove(N)}});t();row=f[Math.min(f.length-1,L.y)];if(row){K.select(row[Math.min(row.length-1,L.x)].elm,true);K.collapse(true)}}function u(S,Q,U,R){var P,N,M,O,T;P=f[Q][S].elm.parentNode;for(M=1;M<=U;M++){P=G.getNext(P,"tr");if(P){for(N=S;N>=0;N--){T=f[Q+M][N].elm;if(T.parentNode==P){for(O=1;O<=R;O++){G.insertAfter(e(T),T)}break}}if(N==-1){for(O=1;O<=R;O++){P.insertBefore(e(P.cells[0]),P.cells[0])}}}}}function C(){d(f,function(M,N){d(M,function(P,O){var S,R,T,Q;if(j(P)){P=P.elm;S=h(P,"colspan");R=h(P,"rowspan");if(S>1||R>1){s(P,"rowspan",1);s(P,"colspan",1);for(Q=0;Q<S-1;Q++){G.insertAfter(e(P),P)}u(O,N,R-1,S)}}})})}function p(V,S,Y){var P,O,X,W,U,R,T,M,V,N,Q;if(V){pos=F(V);P=pos.x;O=pos.y;X=P+(S-1);W=O+(Y-1)}else{P=L.x;O=L.y;X=D.x;W=D.y}T=z(P,O);M=z(X,W);if(T&&M&&T.part==M.part){C();t();T=z(P,O).elm;s(T,"colspan",(X-P)+1);s(T,"rowspan",(W-O)+1);for(R=O;R<=W;R++){for(U=P;U<=X;U++){if(!f[R]||!f[R][U]){continue}V=f[R][U].elm;if(V!=T){N=c.grep(V.childNodes);d(N,function(Z){T.appendChild(Z)});if(N.length){N=c.grep(T.childNodes);Q=0;d(N,function(Z){if(Z.nodeName=="BR"&&G.getAttrib(Z,"data-mce-bogus")&&Q++<N.length-1){T.removeChild(Z)}})}G.remove(V)}}}q()}}function l(Q){var M,S,P,R,T,U,N,V,O;d(f,function(W,X){d(W,function(Z,Y){if(j(Z)){Z=Z.elm;T=Z.parentNode;U=A(T,false);M=X;if(Q){return false}}});if(Q){return !M}});for(R=0;R<f[0].length;R++){if(!f[M][R]){continue}S=f[M][R].elm;if(S!=P){if(!Q){O=h(S,"rowspan");if(O>1){s(S,"rowspan",O+1);continue}}else{if(M>0&&f[M-1][R]){V=f[M-1][R].elm;O=h(V,"rowspan");if(O>1){s(V,"rowspan",O+1);continue}}}N=e(S);s(N,"colspan",S.colSpan);U.appendChild(N);P=S}}if(U.hasChildNodes()){if(!Q){G.insertAfter(U,T)}else{T.parentNode.insertBefore(U,T)}}}function g(N){var O,M;d(f,function(P,Q){d(P,function(S,R){if(j(S)){O=R;if(N){return false}}});if(N){return !O}});d(f,function(S,T){var P,Q,R;if(!S[O]){return}P=S[O].elm;if(P!=M){R=h(P,"colspan");Q=h(P,"rowspan");if(R==1){if(!N){G.insertAfter(e(P),P);u(O,T,Q-1,R)}else{P.parentNode.insertBefore(e(P),P);u(O,T,Q-1,R)}}else{s(P,"colspan",P.colSpan+1)}M=P}})}function n(){var M=[];d(f,function(N,O){d(N,function(Q,P){if(j(Q)&&c.inArray(M,P)===-1){d(f,function(T){var R=T[P].elm,S;S=h(R,"colspan");if(S>1){s(R,"colspan",S-1)}else{G.remove(R)}});M.push(P)}})});q()}function m(){var N;function M(Q){var P,R,O;P=G.getNext(Q,"tr");d(Q.cells,function(S){var T=h(S,"rowspan");if(T>1){s(S,"rowspan",T-1);R=F(S);u(R.x,R.y,1,1)}});R=F(Q.cells[0]);d(f[R.y],function(S){var T;S=S.elm;if(S!=O){T=h(S,"rowspan");if(T<=1){G.remove(S)}else{s(S,"rowspan",T-1)}O=S}})}N=k();d(N.reverse(),function(O){M(O)});q()}function E(){var M=k();G.remove(M);q();return M}function J(){var M=k();d(M,function(O,N){M[N]=A(O,true)});return M}function B(O,N){var P=k(),M=P[N?0:P.length-1],Q=M.cells.length;d(f,function(S){var R;Q=0;d(S,function(U,T){if(U.real){Q+=U.colspan}if(U.elm.parentNode==M){R=1}});if(R){return false}});if(!N){O.reverse()}d(O,function(T){var S=T.cells.length,R;for(i=0;i<S;i++){R=T.cells[i];s(R,"colspan",1);s(R,"rowspan",1)}for(i=S;i<Q;i++){T.appendChild(e(T.cells[S-1]))}for(i=Q;i<S;i++){G.remove(T.cells[i])}if(N){M.parentNode.insertBefore(T,M)}else{G.insertAfter(T,M)}})}function F(M){var N;d(f,function(O,P){d(O,function(R,Q){if(R.elm==M){N={x:Q,y:P};return false}});return !N});return N}function w(M){L=F(M)}function I(){var O,N,M;N=M=0;d(f,function(P,Q){d(P,function(S,R){var U,T;if(j(S)){S=f[Q][R];if(R>N){N=R}if(Q>M){M=Q}if(S.real){U=S.colspan-1;T=S.rowspan-1;if(U){if(R+U>N){N=R+U}}if(T){if(Q+T>M){M=Q+T}}}}})});return{x:N,y:M}}function v(S){var P,O,U,T,N,M,Q,R;D=F(S);if(L&&D){P=Math.min(L.x,D.x);O=Math.min(L.y,D.y);U=Math.max(L.x,D.x);T=Math.max(L.y,D.y);N=U;M=T;for(y=O;y<=M;y++){S=f[y][P];if(!S.real){if(P-(S.colspan-1)<P){P-=S.colspan-1}}}for(x=P;x<=N;x++){S=f[O][x];if(!S.real){if(O-(S.rowspan-1)<O){O-=S.rowspan-1}}}for(y=O;y<=T;y++){for(x=P;x<=U;x++){S=f[y][x];if(S.real){Q=S.colspan-1;R=S.rowspan-1;if(Q){if(x+Q>N){N=x+Q}}if(R){if(y+R>M){M=y+R}}}}}G.removeClass(G.select("td.mceSelected,th.mceSelected"),"mceSelected");for(y=O;y<=M;y++){for(x=P;x<=N;x++){if(f[y][x]){G.addClass(f[y][x].elm,"mceSelected")}}}}}c.extend(this,{deleteTable:r,split:C,merge:p,insertRow:l,insertCol:g,deleteCols:n,deleteRows:m,cutRows:E,copyRows:J,pasteRows:B,getPos:F,setStartCell:w,setEndCell:v})}c.create("tinymce.plugins.TablePlugin",{init:function(f,g){var e,k;function j(n){var m=f.selection,l=f.dom.getParent(n||m.getNode(),"table");if(l){return new a(l,f.dom,m)}}function h(){f.getBody().style.webkitUserSelect="";f.dom.removeClass(f.dom.select("td.mceSelected,th.mceSelected"),"mceSelected")}d([["table","table.desc","mceInsertTable",true],["delete_table","table.del","mceTableDelete"],["delete_col","table.delete_col_desc","mceTableDeleteCol"],["delete_row","table.delete_row_desc","mceTableDeleteRow"],["col_after","table.col_after_desc","mceTableInsertColAfter"],["col_before","table.col_before_desc","mceTableInsertColBefore"],["row_after","table.row_after_desc","mceTableInsertRowAfter"],["row_before","table.row_before_desc","mceTableInsertRowBefore"],["row_props","table.row_desc","mceTableRowProps",true],["cell_props","table.cell_desc","mceTableCellProps",true],["split_cells","table.split_cells_desc","mceTableSplitCells",true],["merge_cells","table.merge_cells_desc","mceTableMergeCells",true]],function(l){f.addButton(l[0],{title:l[1],cmd:l[2],ui:l[3]})});if(!c.isIE){f.onClick.add(function(l,m){m=m.target;if(m.nodeName==="TABLE"){l.selection.select(m);l.nodeChanged()}})}f.onPreProcess.add(function(m,n){var l,o,p,r=m.dom,q;l=r.select("table",n.node);o=l.length;while(o--){p=l[o];r.setAttrib(p,"data-mce-style","");if((q=r.getAttrib(p,"width"))){r.setStyle(p,"width",q);r.setAttrib(p,"width","")}if((q=r.getAttrib(p,"height"))){r.setStyle(p,"height",q);r.setAttrib(p,"height","")}}});f.onNodeChange.add(function(m,l,q){var o;q=m.selection.getStart();o=m.dom.getParent(q,"td,th,caption");l.setActive("table",q.nodeName==="TABLE"||!!o);if(o&&o.nodeName==="CAPTION"){o=0}l.setDisabled("delete_table",!o);l.setDisabled("delete_col",!o);l.setDisabled("delete_table",!o);l.setDisabled("delete_row",!o);l.setDisabled("col_after",!o);l.setDisabled("col_before",!o);l.setDisabled("row_after",!o);l.setDisabled("row_before",!o);l.setDisabled("row_props",!o);l.setDisabled("cell_props",!o);l.setDisabled("split_cells",!o);l.setDisabled("merge_cells",!o)});f.onInit.add(function(m){var l,p,q=m.dom,n;e=m.windowManager;m.onMouseDown.add(function(r,s){if(s.button!=2){h();p=q.getParent(s.target,"td,th");l=q.getParent(p,"table")}});q.bind(m.getDoc(),"mouseover",function(u){var s,r,t=u.target;if(p&&(n||t!=p)&&(t.nodeName=="TD"||t.nodeName=="TH")){r=q.getParent(t,"table");if(r==l){if(!n){n=j(r);n.setStartCell(p);m.getBody().style.webkitUserSelect="none"}n.setEndCell(t)}s=m.selection.getSel();if(s.removeAllRanges){s.removeAllRanges()}else{s.empty()}u.preventDefault()}});m.onMouseUp.add(function(A,B){var s,u=A.selection,C,D=u.getSel(),r,v,t,z;if(p){if(n){A.getBody().style.webkitUserSelect=""}function w(E,G){var F=new c.dom.TreeWalker(E,E);do{if(E.nodeType==3&&c.trim(E.nodeValue).length!=0){if(G){s.setStart(E,0)}else{s.setEnd(E,E.nodeValue.length)}return}if(E.nodeName=="BR"){if(G){s.setStartBefore(E)}else{s.setEndBefore(E)}return}}while(E=(G?F.next():F.prev()))}C=q.select("td.mceSelected,th.mceSelected");if(C.length>0){s=q.createRng();v=C[0];z=C[C.length-1];w(v,1);r=new c.dom.TreeWalker(v,q.getParent(C[0],"table"));do{if(v.nodeName=="TD"||v.nodeName=="TH"){if(!q.hasClass(v,"mceSelected")){break}t=v}}while(v=r.next());w(t);u.setRng(s)}A.nodeChanged();p=n=l=null}});m.onKeyUp.add(function(r,s){h()});if(m&&m.plugins.contextmenu){m.plugins.contextmenu.onContextMenu.add(function(t,r,v){var w,u=m.selection,s=u.getNode()||m.getBody();if(m.dom.getParent(v,"td")||m.dom.getParent(v,"th")||m.dom.select("td.mceSelected,th.mceSelected").length){r.removeAll();if(s.nodeName=="A"&&!m.dom.getAttrib(s,"name")){r.add({title:"advanced.link_desc",icon:"link",cmd:m.plugins.advlink?"mceAdvLink":"mceLink",ui:true});r.add({title:"advanced.unlink_desc",icon:"unlink",cmd:"UnLink"});r.addSeparator()}if(s.nodeName=="IMG"&&s.className.indexOf("mceItem")==-1){r.add({title:"advanced.image_desc",icon:"image",cmd:m.plugins.advimage?"mceAdvImage":"mceImage",ui:true});r.addSeparator()}r.add({title:"table.desc",icon:"table",cmd:"mceInsertTable",value:{action:"insert"}});r.add({title:"table.props_desc",icon:"table_props",cmd:"mceInsertTable"});r.add({title:"table.del",icon:"delete_table",cmd:"mceTableDelete"});r.addSeparator();w=r.addMenu({title:"table.cell"});w.add({title:"table.cell_desc",icon:"cell_props",cmd:"mceTableCellProps"});w.add({title:"table.split_cells_desc",icon:"split_cells",cmd:"mceTableSplitCells"});w.add({title:"table.merge_cells_desc",icon:"merge_cells",cmd:"mceTableMergeCells"});w=r.addMenu({title:"table.row"});w.add({title:"table.row_desc",icon:"row_props",cmd:"mceTableRowProps"});w.add({title:"table.row_before_desc",icon:"row_before",cmd:"mceTableInsertRowBefore"});w.add({title:"table.row_after_desc",icon:"row_after",cmd:"mceTableInsertRowAfter"});w.add({title:"table.delete_row_desc",icon:"delete_row",cmd:"mceTableDeleteRow"});w.addSeparator();w.add({title:"table.cut_row_desc",icon:"cut",cmd:"mceTableCutRow"});w.add({title:"table.copy_row_desc",icon:"copy",cmd:"mceTableCopyRow"});w.add({title:"table.paste_row_before_desc",icon:"paste",cmd:"mceTablePasteRowBefore"}).setDisabled(!k);w.add({title:"table.paste_row_after_desc",icon:"paste",cmd:"mceTablePasteRowAfter"}).setDisabled(!k);w=r.addMenu({title:"table.col"});w.add({title:"table.col_before_desc",icon:"col_before",cmd:"mceTableInsertColBefore"});w.add({title:"table.col_after_desc",icon:"col_after",cmd:"mceTableInsertColAfter"});w.add({title:"table.delete_col_desc",icon:"delete_col",cmd:"mceTableDeleteCol"})}else{r.add({title:"table.desc",icon:"table",cmd:"mceInsertTable"})}})}if(!c.isIE){function o(){var r;for(r=m.getBody().lastChild;r&&r.nodeType==3&&!r.nodeValue.length;r=r.previousSibling){}if(r&&r.nodeName=="TABLE"){m.dom.add(m.getBody(),"p",null,'<br mce_bogus="1" />')}}if(c.isGecko){m.onKeyDown.add(function(s,u){var r,t,v=s.dom;if(u.keyCode==37||u.keyCode==38){r=s.selection.getRng();t=v.getParent(r.startContainer,"table");if(t&&s.getBody().firstChild==t){if(b(r,t)){r=v.createRng();r.setStartBefore(t);r.setEndBefore(t);s.selection.setRng(r);u.preventDefault()}}}})}m.onKeyUp.add(o);m.onSetContent.add(o);m.onVisualAid.add(o);m.onPreProcess.add(function(r,t){var s=t.node.lastChild;if(s&&s.childNodes.length==1&&s.firstChild.nodeName=="BR"){r.dom.remove(s)}});o()}});d({mceTableSplitCells:function(l){l.split()},mceTableMergeCells:function(m){var n,o,l;l=f.dom.getParent(f.selection.getNode(),"th,td");if(l){n=l.rowSpan;o=l.colSpan}if(!f.dom.select("td.mceSelected,th.mceSelected").length){e.open({url:g+"/merge_cells.htm",width:240+parseInt(f.getLang("table.merge_cells_delta_width",0)),height:110+parseInt(f.getLang("table.merge_cells_delta_height",0)),inline:1},{rows:n,cols:o,onaction:function(p){m.merge(l,p.cols,p.rows)},plugin_url:g})}else{m.merge()}},mceTableInsertRowBefore:function(l){l.insertRow(true)},mceTableInsertRowAfter:function(l){l.insertRow()},mceTableInsertColBefore:function(l){l.insertCol(true)},mceTableInsertColAfter:function(l){l.insertCol()},mceTableDeleteCol:function(l){l.deleteCols()},mceTableDeleteRow:function(l){l.deleteRows()},mceTableCutRow:function(l){k=l.cutRows()},mceTableCopyRow:function(l){k=l.copyRows()},mceTablePasteRowBefore:function(l){l.pasteRows(k,true)},mceTablePasteRowAfter:function(l){l.pasteRows(k)},mceTableDelete:function(l){l.deleteTable()}},function(m,l){f.addCommand(l,function(){var n=j();if(n){m(n);f.execCommand("mceRepaint");h()}})});d({mceInsertTable:function(l){e.open({url:g+"/table.htm",width:400+parseInt(f.getLang("table.table_delta_width",0)),height:320+parseInt(f.getLang("table.table_delta_height",0)),inline:1},{plugin_url:g,action:l?l.action:0})},mceTableRowProps:function(){e.open({url:g+"/row.htm",width:400+parseInt(f.getLang("table.rowprops_delta_width",0)),height:295+parseInt(f.getLang("table.rowprops_delta_height",0)),inline:1},{plugin_url:g})},mceTableCellProps:function(){e.open({url:g+"/cell.htm",width:400+parseInt(f.getLang("table.cellprops_delta_width",0)),height:295+parseInt(f.getLang("table.cellprops_delta_height",0)),inline:1},{plugin_url:g})}},function(m,l){f.addCommand(l,function(n,o){m(o)})})}});c.PluginManager.add("table",c.plugins.TablePlugin)})(tinymce);
|
@@ -1,1198 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* editor_plugin_src.js
|
3
|
-
*
|
4
|
-
* Copyright 2009, Moxiecode Systems AB
|
5
|
-
* Released under LGPL License.
|
6
|
-
*
|
7
|
-
* License: http://tinymce.moxiecode.com/license
|
8
|
-
* Contributing: http://tinymce.moxiecode.com/contributing
|
9
|
-
*/
|
10
|
-
|
11
|
-
(function(tinymce) {
|
12
|
-
var each = tinymce.each;
|
13
|
-
|
14
|
-
// Checks if the selection/caret is at the start of the specified block element
|
15
|
-
function isAtStart(rng, par) {
|
16
|
-
var doc = par.ownerDocument, rng2 = doc.createRange(), elm;
|
17
|
-
|
18
|
-
rng2.setStartBefore(par);
|
19
|
-
rng2.setEnd(rng.endContainer, rng.endOffset);
|
20
|
-
|
21
|
-
elm = doc.createElement('body');
|
22
|
-
elm.appendChild(rng2.cloneContents());
|
23
|
-
|
24
|
-
// Check for text characters of other elements that should be treated as content
|
25
|
-
return elm.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi, '-').replace(/<[^>]+>/g, '').length == 0;
|
26
|
-
};
|
27
|
-
|
28
|
-
/**
|
29
|
-
* Table Grid class.
|
30
|
-
*/
|
31
|
-
function TableGrid(table, dom, selection) {
|
32
|
-
var grid, startPos, endPos, selectedCell;
|
33
|
-
|
34
|
-
buildGrid();
|
35
|
-
selectedCell = dom.getParent(selection.getStart(), 'th,td');
|
36
|
-
if (selectedCell) {
|
37
|
-
startPos = getPos(selectedCell);
|
38
|
-
endPos = findEndPos();
|
39
|
-
selectedCell = getCell(startPos.x, startPos.y);
|
40
|
-
}
|
41
|
-
|
42
|
-
function cloneNode(node, children) {
|
43
|
-
node = node.cloneNode(children);
|
44
|
-
node.removeAttribute('id');
|
45
|
-
|
46
|
-
return node;
|
47
|
-
}
|
48
|
-
|
49
|
-
function buildGrid() {
|
50
|
-
var startY = 0;
|
51
|
-
|
52
|
-
grid = [];
|
53
|
-
|
54
|
-
each(['thead', 'tbody', 'tfoot'], function(part) {
|
55
|
-
var rows = dom.select('> ' + part + ' tr', table);
|
56
|
-
|
57
|
-
each(rows, function(tr, y) {
|
58
|
-
y += startY;
|
59
|
-
|
60
|
-
each(dom.select('> td, > th', tr), function(td, x) {
|
61
|
-
var x2, y2, rowspan, colspan;
|
62
|
-
|
63
|
-
// Skip over existing cells produced by rowspan
|
64
|
-
if (grid[y]) {
|
65
|
-
while (grid[y][x])
|
66
|
-
x++;
|
67
|
-
}
|
68
|
-
|
69
|
-
// Get col/rowspan from cell
|
70
|
-
rowspan = getSpanVal(td, 'rowspan');
|
71
|
-
colspan = getSpanVal(td, 'colspan');
|
72
|
-
|
73
|
-
// Fill out rowspan/colspan right and down
|
74
|
-
for (y2 = y; y2 < y + rowspan; y2++) {
|
75
|
-
if (!grid[y2])
|
76
|
-
grid[y2] = [];
|
77
|
-
|
78
|
-
for (x2 = x; x2 < x + colspan; x2++) {
|
79
|
-
grid[y2][x2] = {
|
80
|
-
part : part,
|
81
|
-
real : y2 == y && x2 == x,
|
82
|
-
elm : td,
|
83
|
-
rowspan : rowspan,
|
84
|
-
colspan : colspan
|
85
|
-
};
|
86
|
-
}
|
87
|
-
}
|
88
|
-
});
|
89
|
-
});
|
90
|
-
|
91
|
-
startY += rows.length;
|
92
|
-
});
|
93
|
-
};
|
94
|
-
|
95
|
-
function getCell(x, y) {
|
96
|
-
var row;
|
97
|
-
|
98
|
-
row = grid[y];
|
99
|
-
if (row)
|
100
|
-
return row[x];
|
101
|
-
};
|
102
|
-
|
103
|
-
function getSpanVal(td, name) {
|
104
|
-
return parseInt(td.getAttribute(name) || 1);
|
105
|
-
};
|
106
|
-
|
107
|
-
function setSpanVal(td, name, val) {
|
108
|
-
if (td) {
|
109
|
-
val = parseInt(val);
|
110
|
-
|
111
|
-
if (val === 1)
|
112
|
-
td.removeAttribute(name, 1);
|
113
|
-
else
|
114
|
-
td.setAttribute(name, val, 1);
|
115
|
-
}
|
116
|
-
}
|
117
|
-
|
118
|
-
function isCellSelected(cell) {
|
119
|
-
return cell && (dom.hasClass(cell.elm, 'mceSelected') || cell == selectedCell);
|
120
|
-
};
|
121
|
-
|
122
|
-
function getSelectedRows() {
|
123
|
-
var rows = [];
|
124
|
-
|
125
|
-
each(table.rows, function(row) {
|
126
|
-
each(row.cells, function(cell) {
|
127
|
-
if (dom.hasClass(cell, 'mceSelected') || cell == selectedCell.elm) {
|
128
|
-
rows.push(row);
|
129
|
-
return false;
|
130
|
-
}
|
131
|
-
});
|
132
|
-
});
|
133
|
-
|
134
|
-
return rows;
|
135
|
-
};
|
136
|
-
|
137
|
-
function deleteTable() {
|
138
|
-
var rng = dom.createRng();
|
139
|
-
|
140
|
-
rng.setStartAfter(table);
|
141
|
-
rng.setEndAfter(table);
|
142
|
-
|
143
|
-
selection.setRng(rng);
|
144
|
-
|
145
|
-
dom.remove(table);
|
146
|
-
};
|
147
|
-
|
148
|
-
function cloneCell(cell) {
|
149
|
-
var formatNode;
|
150
|
-
|
151
|
-
// Clone formats
|
152
|
-
tinymce.walk(cell, function(node) {
|
153
|
-
var curNode;
|
154
|
-
|
155
|
-
if (node.nodeType == 3) {
|
156
|
-
each(dom.getParents(node.parentNode, null, cell).reverse(), function(node) {
|
157
|
-
node = cloneNode(node, false);
|
158
|
-
|
159
|
-
if (!formatNode)
|
160
|
-
formatNode = curNode = node;
|
161
|
-
else if (curNode)
|
162
|
-
curNode.appendChild(node);
|
163
|
-
|
164
|
-
curNode = node;
|
165
|
-
});
|
166
|
-
|
167
|
-
// Add something to the inner node
|
168
|
-
if (curNode)
|
169
|
-
curNode.innerHTML = tinymce.isIE ? ' ' : '<br data-mce-bogus="1" />';
|
170
|
-
|
171
|
-
return false;
|
172
|
-
}
|
173
|
-
}, 'childNodes');
|
174
|
-
|
175
|
-
cell = cloneNode(cell, false);
|
176
|
-
setSpanVal(cell, 'rowspan', 1);
|
177
|
-
setSpanVal(cell, 'colspan', 1);
|
178
|
-
|
179
|
-
if (formatNode) {
|
180
|
-
cell.appendChild(formatNode);
|
181
|
-
} else {
|
182
|
-
if (!tinymce.isIE)
|
183
|
-
cell.innerHTML = '<br data-mce-bogus="1" />';
|
184
|
-
}
|
185
|
-
|
186
|
-
return cell;
|
187
|
-
};
|
188
|
-
|
189
|
-
function cleanup() {
|
190
|
-
var rng = dom.createRng();
|
191
|
-
|
192
|
-
// Empty rows
|
193
|
-
each(dom.select('tr', table), function(tr) {
|
194
|
-
if (tr.cells.length == 0)
|
195
|
-
dom.remove(tr);
|
196
|
-
});
|
197
|
-
|
198
|
-
// Empty table
|
199
|
-
if (dom.select('tr', table).length == 0) {
|
200
|
-
rng.setStartAfter(table);
|
201
|
-
rng.setEndAfter(table);
|
202
|
-
selection.setRng(rng);
|
203
|
-
dom.remove(table);
|
204
|
-
return;
|
205
|
-
}
|
206
|
-
|
207
|
-
// Empty header/body/footer
|
208
|
-
each(dom.select('thead,tbody,tfoot', table), function(part) {
|
209
|
-
if (part.rows.length == 0)
|
210
|
-
dom.remove(part);
|
211
|
-
});
|
212
|
-
|
213
|
-
// Restore selection to start position if it still exists
|
214
|
-
buildGrid();
|
215
|
-
|
216
|
-
// Restore the selection to the closest table position
|
217
|
-
row = grid[Math.min(grid.length - 1, startPos.y)];
|
218
|
-
if (row) {
|
219
|
-
selection.select(row[Math.min(row.length - 1, startPos.x)].elm, true);
|
220
|
-
selection.collapse(true);
|
221
|
-
}
|
222
|
-
};
|
223
|
-
|
224
|
-
function fillLeftDown(x, y, rows, cols) {
|
225
|
-
var tr, x2, r, c, cell;
|
226
|
-
|
227
|
-
tr = grid[y][x].elm.parentNode;
|
228
|
-
for (r = 1; r <= rows; r++) {
|
229
|
-
tr = dom.getNext(tr, 'tr');
|
230
|
-
|
231
|
-
if (tr) {
|
232
|
-
// Loop left to find real cell
|
233
|
-
for (x2 = x; x2 >= 0; x2--) {
|
234
|
-
cell = grid[y + r][x2].elm;
|
235
|
-
|
236
|
-
if (cell.parentNode == tr) {
|
237
|
-
// Append clones after
|
238
|
-
for (c = 1; c <= cols; c++)
|
239
|
-
dom.insertAfter(cloneCell(cell), cell);
|
240
|
-
|
241
|
-
break;
|
242
|
-
}
|
243
|
-
}
|
244
|
-
|
245
|
-
if (x2 == -1) {
|
246
|
-
// Insert nodes before first cell
|
247
|
-
for (c = 1; c <= cols; c++)
|
248
|
-
tr.insertBefore(cloneCell(tr.cells[0]), tr.cells[0]);
|
249
|
-
}
|
250
|
-
}
|
251
|
-
}
|
252
|
-
};
|
253
|
-
|
254
|
-
function split() {
|
255
|
-
each(grid, function(row, y) {
|
256
|
-
each(row, function(cell, x) {
|
257
|
-
var colSpan, rowSpan, newCell, i;
|
258
|
-
|
259
|
-
if (isCellSelected(cell)) {
|
260
|
-
cell = cell.elm;
|
261
|
-
colSpan = getSpanVal(cell, 'colspan');
|
262
|
-
rowSpan = getSpanVal(cell, 'rowspan');
|
263
|
-
|
264
|
-
if (colSpan > 1 || rowSpan > 1) {
|
265
|
-
setSpanVal(cell, 'rowspan', 1);
|
266
|
-
setSpanVal(cell, 'colspan', 1);
|
267
|
-
|
268
|
-
// Insert cells right
|
269
|
-
for (i = 0; i < colSpan - 1; i++)
|
270
|
-
dom.insertAfter(cloneCell(cell), cell);
|
271
|
-
|
272
|
-
fillLeftDown(x, y, rowSpan - 1, colSpan);
|
273
|
-
}
|
274
|
-
}
|
275
|
-
});
|
276
|
-
});
|
277
|
-
};
|
278
|
-
|
279
|
-
function merge(cell, cols, rows) {
|
280
|
-
var startX, startY, endX, endY, x, y, startCell, endCell, cell, children, count;
|
281
|
-
|
282
|
-
// Use specified cell and cols/rows
|
283
|
-
if (cell) {
|
284
|
-
pos = getPos(cell);
|
285
|
-
startX = pos.x;
|
286
|
-
startY = pos.y;
|
287
|
-
endX = startX + (cols - 1);
|
288
|
-
endY = startY + (rows - 1);
|
289
|
-
} else {
|
290
|
-
// Use selection
|
291
|
-
startX = startPos.x;
|
292
|
-
startY = startPos.y;
|
293
|
-
endX = endPos.x;
|
294
|
-
endY = endPos.y;
|
295
|
-
}
|
296
|
-
|
297
|
-
// Find start/end cells
|
298
|
-
startCell = getCell(startX, startY);
|
299
|
-
endCell = getCell(endX, endY);
|
300
|
-
|
301
|
-
// Check if the cells exists and if they are of the same part for example tbody = tbody
|
302
|
-
if (startCell && endCell && startCell.part == endCell.part) {
|
303
|
-
// Split and rebuild grid
|
304
|
-
split();
|
305
|
-
buildGrid();
|
306
|
-
|
307
|
-
// Set row/col span to start cell
|
308
|
-
startCell = getCell(startX, startY).elm;
|
309
|
-
setSpanVal(startCell, 'colspan', (endX - startX) + 1);
|
310
|
-
setSpanVal(startCell, 'rowspan', (endY - startY) + 1);
|
311
|
-
|
312
|
-
// Remove other cells and add it's contents to the start cell
|
313
|
-
for (y = startY; y <= endY; y++) {
|
314
|
-
for (x = startX; x <= endX; x++) {
|
315
|
-
if (!grid[y] || !grid[y][x])
|
316
|
-
continue;
|
317
|
-
|
318
|
-
cell = grid[y][x].elm;
|
319
|
-
|
320
|
-
if (cell != startCell) {
|
321
|
-
// Move children to startCell
|
322
|
-
children = tinymce.grep(cell.childNodes);
|
323
|
-
each(children, function(node) {
|
324
|
-
startCell.appendChild(node);
|
325
|
-
});
|
326
|
-
|
327
|
-
// Remove bogus nodes if there is children in the target cell
|
328
|
-
if (children.length) {
|
329
|
-
children = tinymce.grep(startCell.childNodes);
|
330
|
-
count = 0;
|
331
|
-
each(children, function(node) {
|
332
|
-
if (node.nodeName == 'BR' && dom.getAttrib(node, 'data-mce-bogus') && count++ < children.length - 1)
|
333
|
-
startCell.removeChild(node);
|
334
|
-
});
|
335
|
-
}
|
336
|
-
|
337
|
-
// Remove cell
|
338
|
-
dom.remove(cell);
|
339
|
-
}
|
340
|
-
}
|
341
|
-
}
|
342
|
-
|
343
|
-
// Remove empty rows etc and restore caret location
|
344
|
-
cleanup();
|
345
|
-
}
|
346
|
-
};
|
347
|
-
|
348
|
-
function insertRow(before) {
|
349
|
-
var posY, cell, lastCell, x, rowElm, newRow, newCell, otherCell, rowSpan;
|
350
|
-
|
351
|
-
// Find first/last row
|
352
|
-
each(grid, function(row, y) {
|
353
|
-
each(row, function(cell, x) {
|
354
|
-
if (isCellSelected(cell)) {
|
355
|
-
cell = cell.elm;
|
356
|
-
rowElm = cell.parentNode;
|
357
|
-
newRow = cloneNode(rowElm, false);
|
358
|
-
posY = y;
|
359
|
-
|
360
|
-
if (before)
|
361
|
-
return false;
|
362
|
-
}
|
363
|
-
});
|
364
|
-
|
365
|
-
if (before)
|
366
|
-
return !posY;
|
367
|
-
});
|
368
|
-
|
369
|
-
for (x = 0; x < grid[0].length; x++) {
|
370
|
-
// Cell not found could be because of an invalid table structure
|
371
|
-
if (!grid[posY][x])
|
372
|
-
continue;
|
373
|
-
|
374
|
-
cell = grid[posY][x].elm;
|
375
|
-
|
376
|
-
if (cell != lastCell) {
|
377
|
-
if (!before) {
|
378
|
-
rowSpan = getSpanVal(cell, 'rowspan');
|
379
|
-
if (rowSpan > 1) {
|
380
|
-
setSpanVal(cell, 'rowspan', rowSpan + 1);
|
381
|
-
continue;
|
382
|
-
}
|
383
|
-
} else {
|
384
|
-
// Check if cell above can be expanded
|
385
|
-
if (posY > 0 && grid[posY - 1][x]) {
|
386
|
-
otherCell = grid[posY - 1][x].elm;
|
387
|
-
rowSpan = getSpanVal(otherCell, 'rowspan');
|
388
|
-
if (rowSpan > 1) {
|
389
|
-
setSpanVal(otherCell, 'rowspan', rowSpan + 1);
|
390
|
-
continue;
|
391
|
-
}
|
392
|
-
}
|
393
|
-
}
|
394
|
-
|
395
|
-
// Insert new cell into new row
|
396
|
-
newCell = cloneCell(cell);
|
397
|
-
setSpanVal(newCell, 'colspan', cell.colSpan);
|
398
|
-
|
399
|
-
newRow.appendChild(newCell);
|
400
|
-
|
401
|
-
lastCell = cell;
|
402
|
-
}
|
403
|
-
}
|
404
|
-
|
405
|
-
if (newRow.hasChildNodes()) {
|
406
|
-
if (!before)
|
407
|
-
dom.insertAfter(newRow, rowElm);
|
408
|
-
else
|
409
|
-
rowElm.parentNode.insertBefore(newRow, rowElm);
|
410
|
-
}
|
411
|
-
};
|
412
|
-
|
413
|
-
function insertCol(before) {
|
414
|
-
var posX, lastCell;
|
415
|
-
|
416
|
-
// Find first/last column
|
417
|
-
each(grid, function(row, y) {
|
418
|
-
each(row, function(cell, x) {
|
419
|
-
if (isCellSelected(cell)) {
|
420
|
-
posX = x;
|
421
|
-
|
422
|
-
if (before)
|
423
|
-
return false;
|
424
|
-
}
|
425
|
-
});
|
426
|
-
|
427
|
-
if (before)
|
428
|
-
return !posX;
|
429
|
-
});
|
430
|
-
|
431
|
-
each(grid, function(row, y) {
|
432
|
-
var cell, rowSpan, colSpan;
|
433
|
-
|
434
|
-
if (!row[posX])
|
435
|
-
return;
|
436
|
-
|
437
|
-
cell = row[posX].elm;
|
438
|
-
if (cell != lastCell) {
|
439
|
-
colSpan = getSpanVal(cell, 'colspan');
|
440
|
-
rowSpan = getSpanVal(cell, 'rowspan');
|
441
|
-
|
442
|
-
if (colSpan == 1) {
|
443
|
-
if (!before) {
|
444
|
-
dom.insertAfter(cloneCell(cell), cell);
|
445
|
-
fillLeftDown(posX, y, rowSpan - 1, colSpan);
|
446
|
-
} else {
|
447
|
-
cell.parentNode.insertBefore(cloneCell(cell), cell);
|
448
|
-
fillLeftDown(posX, y, rowSpan - 1, colSpan);
|
449
|
-
}
|
450
|
-
} else
|
451
|
-
setSpanVal(cell, 'colspan', cell.colSpan + 1);
|
452
|
-
|
453
|
-
lastCell = cell;
|
454
|
-
}
|
455
|
-
});
|
456
|
-
};
|
457
|
-
|
458
|
-
function deleteCols() {
|
459
|
-
var cols = [];
|
460
|
-
|
461
|
-
// Get selected column indexes
|
462
|
-
each(grid, function(row, y) {
|
463
|
-
each(row, function(cell, x) {
|
464
|
-
if (isCellSelected(cell) && tinymce.inArray(cols, x) === -1) {
|
465
|
-
each(grid, function(row) {
|
466
|
-
var cell = row[x].elm, colSpan;
|
467
|
-
|
468
|
-
colSpan = getSpanVal(cell, 'colspan');
|
469
|
-
|
470
|
-
if (colSpan > 1)
|
471
|
-
setSpanVal(cell, 'colspan', colSpan - 1);
|
472
|
-
else
|
473
|
-
dom.remove(cell);
|
474
|
-
});
|
475
|
-
|
476
|
-
cols.push(x);
|
477
|
-
}
|
478
|
-
});
|
479
|
-
});
|
480
|
-
|
481
|
-
cleanup();
|
482
|
-
};
|
483
|
-
|
484
|
-
function deleteRows() {
|
485
|
-
var rows;
|
486
|
-
|
487
|
-
function deleteRow(tr) {
|
488
|
-
var nextTr, pos, lastCell;
|
489
|
-
|
490
|
-
nextTr = dom.getNext(tr, 'tr');
|
491
|
-
|
492
|
-
// Move down row spanned cells
|
493
|
-
each(tr.cells, function(cell) {
|
494
|
-
var rowSpan = getSpanVal(cell, 'rowspan');
|
495
|
-
|
496
|
-
if (rowSpan > 1) {
|
497
|
-
setSpanVal(cell, 'rowspan', rowSpan - 1);
|
498
|
-
pos = getPos(cell);
|
499
|
-
fillLeftDown(pos.x, pos.y, 1, 1);
|
500
|
-
}
|
501
|
-
});
|
502
|
-
|
503
|
-
// Delete cells
|
504
|
-
pos = getPos(tr.cells[0]);
|
505
|
-
each(grid[pos.y], function(cell) {
|
506
|
-
var rowSpan;
|
507
|
-
|
508
|
-
cell = cell.elm;
|
509
|
-
|
510
|
-
if (cell != lastCell) {
|
511
|
-
rowSpan = getSpanVal(cell, 'rowspan');
|
512
|
-
|
513
|
-
if (rowSpan <= 1)
|
514
|
-
dom.remove(cell);
|
515
|
-
else
|
516
|
-
setSpanVal(cell, 'rowspan', rowSpan - 1);
|
517
|
-
|
518
|
-
lastCell = cell;
|
519
|
-
}
|
520
|
-
});
|
521
|
-
};
|
522
|
-
|
523
|
-
// Get selected rows and move selection out of scope
|
524
|
-
rows = getSelectedRows();
|
525
|
-
|
526
|
-
// Delete all selected rows
|
527
|
-
each(rows.reverse(), function(tr) {
|
528
|
-
deleteRow(tr);
|
529
|
-
});
|
530
|
-
|
531
|
-
cleanup();
|
532
|
-
};
|
533
|
-
|
534
|
-
function cutRows() {
|
535
|
-
var rows = getSelectedRows();
|
536
|
-
|
537
|
-
dom.remove(rows);
|
538
|
-
cleanup();
|
539
|
-
|
540
|
-
return rows;
|
541
|
-
};
|
542
|
-
|
543
|
-
function copyRows() {
|
544
|
-
var rows = getSelectedRows();
|
545
|
-
|
546
|
-
each(rows, function(row, i) {
|
547
|
-
rows[i] = cloneNode(row, true);
|
548
|
-
});
|
549
|
-
|
550
|
-
return rows;
|
551
|
-
};
|
552
|
-
|
553
|
-
function pasteRows(rows, before) {
|
554
|
-
var selectedRows = getSelectedRows(),
|
555
|
-
targetRow = selectedRows[before ? 0 : selectedRows.length - 1],
|
556
|
-
targetCellCount = targetRow.cells.length;
|
557
|
-
|
558
|
-
// Calc target cell count
|
559
|
-
each(grid, function(row) {
|
560
|
-
var match;
|
561
|
-
|
562
|
-
targetCellCount = 0;
|
563
|
-
each(row, function(cell, x) {
|
564
|
-
if (cell.real)
|
565
|
-
targetCellCount += cell.colspan;
|
566
|
-
|
567
|
-
if (cell.elm.parentNode == targetRow)
|
568
|
-
match = 1;
|
569
|
-
});
|
570
|
-
|
571
|
-
if (match)
|
572
|
-
return false;
|
573
|
-
});
|
574
|
-
|
575
|
-
if (!before)
|
576
|
-
rows.reverse();
|
577
|
-
|
578
|
-
each(rows, function(row) {
|
579
|
-
var cellCount = row.cells.length, cell;
|
580
|
-
|
581
|
-
// Remove col/rowspans
|
582
|
-
for (i = 0; i < cellCount; i++) {
|
583
|
-
cell = row.cells[i];
|
584
|
-
setSpanVal(cell, 'colspan', 1);
|
585
|
-
setSpanVal(cell, 'rowspan', 1);
|
586
|
-
}
|
587
|
-
|
588
|
-
// Needs more cells
|
589
|
-
for (i = cellCount; i < targetCellCount; i++)
|
590
|
-
row.appendChild(cloneCell(row.cells[cellCount - 1]));
|
591
|
-
|
592
|
-
// Needs less cells
|
593
|
-
for (i = targetCellCount; i < cellCount; i++)
|
594
|
-
dom.remove(row.cells[i]);
|
595
|
-
|
596
|
-
// Add before/after
|
597
|
-
if (before)
|
598
|
-
targetRow.parentNode.insertBefore(row, targetRow);
|
599
|
-
else
|
600
|
-
dom.insertAfter(row, targetRow);
|
601
|
-
});
|
602
|
-
};
|
603
|
-
|
604
|
-
function getPos(target) {
|
605
|
-
var pos;
|
606
|
-
|
607
|
-
each(grid, function(row, y) {
|
608
|
-
each(row, function(cell, x) {
|
609
|
-
if (cell.elm == target) {
|
610
|
-
pos = {x : x, y : y};
|
611
|
-
return false;
|
612
|
-
}
|
613
|
-
});
|
614
|
-
|
615
|
-
return !pos;
|
616
|
-
});
|
617
|
-
|
618
|
-
return pos;
|
619
|
-
};
|
620
|
-
|
621
|
-
function setStartCell(cell) {
|
622
|
-
startPos = getPos(cell);
|
623
|
-
};
|
624
|
-
|
625
|
-
function findEndPos() {
|
626
|
-
var pos, maxX, maxY;
|
627
|
-
|
628
|
-
maxX = maxY = 0;
|
629
|
-
|
630
|
-
each(grid, function(row, y) {
|
631
|
-
each(row, function(cell, x) {
|
632
|
-
var colSpan, rowSpan;
|
633
|
-
|
634
|
-
if (isCellSelected(cell)) {
|
635
|
-
cell = grid[y][x];
|
636
|
-
|
637
|
-
if (x > maxX)
|
638
|
-
maxX = x;
|
639
|
-
|
640
|
-
if (y > maxY)
|
641
|
-
maxY = y;
|
642
|
-
|
643
|
-
if (cell.real) {
|
644
|
-
colSpan = cell.colspan - 1;
|
645
|
-
rowSpan = cell.rowspan - 1;
|
646
|
-
|
647
|
-
if (colSpan) {
|
648
|
-
if (x + colSpan > maxX)
|
649
|
-
maxX = x + colSpan;
|
650
|
-
}
|
651
|
-
|
652
|
-
if (rowSpan) {
|
653
|
-
if (y + rowSpan > maxY)
|
654
|
-
maxY = y + rowSpan;
|
655
|
-
}
|
656
|
-
}
|
657
|
-
}
|
658
|
-
});
|
659
|
-
});
|
660
|
-
|
661
|
-
return {x : maxX, y : maxY};
|
662
|
-
};
|
663
|
-
|
664
|
-
function setEndCell(cell) {
|
665
|
-
var startX, startY, endX, endY, maxX, maxY, colSpan, rowSpan;
|
666
|
-
|
667
|
-
endPos = getPos(cell);
|
668
|
-
|
669
|
-
if (startPos && endPos) {
|
670
|
-
// Get start/end positions
|
671
|
-
startX = Math.min(startPos.x, endPos.x);
|
672
|
-
startY = Math.min(startPos.y, endPos.y);
|
673
|
-
endX = Math.max(startPos.x, endPos.x);
|
674
|
-
endY = Math.max(startPos.y, endPos.y);
|
675
|
-
|
676
|
-
// Expand end positon to include spans
|
677
|
-
maxX = endX;
|
678
|
-
maxY = endY;
|
679
|
-
|
680
|
-
// Expand startX
|
681
|
-
for (y = startY; y <= maxY; y++) {
|
682
|
-
cell = grid[y][startX];
|
683
|
-
|
684
|
-
if (!cell.real) {
|
685
|
-
if (startX - (cell.colspan - 1) < startX)
|
686
|
-
startX -= cell.colspan - 1;
|
687
|
-
}
|
688
|
-
}
|
689
|
-
|
690
|
-
// Expand startY
|
691
|
-
for (x = startX; x <= maxX; x++) {
|
692
|
-
cell = grid[startY][x];
|
693
|
-
|
694
|
-
if (!cell.real) {
|
695
|
-
if (startY - (cell.rowspan - 1) < startY)
|
696
|
-
startY -= cell.rowspan - 1;
|
697
|
-
}
|
698
|
-
}
|
699
|
-
|
700
|
-
// Find max X, Y
|
701
|
-
for (y = startY; y <= endY; y++) {
|
702
|
-
for (x = startX; x <= endX; x++) {
|
703
|
-
cell = grid[y][x];
|
704
|
-
|
705
|
-
if (cell.real) {
|
706
|
-
colSpan = cell.colspan - 1;
|
707
|
-
rowSpan = cell.rowspan - 1;
|
708
|
-
|
709
|
-
if (colSpan) {
|
710
|
-
if (x + colSpan > maxX)
|
711
|
-
maxX = x + colSpan;
|
712
|
-
}
|
713
|
-
|
714
|
-
if (rowSpan) {
|
715
|
-
if (y + rowSpan > maxY)
|
716
|
-
maxY = y + rowSpan;
|
717
|
-
}
|
718
|
-
}
|
719
|
-
}
|
720
|
-
}
|
721
|
-
|
722
|
-
// Remove current selection
|
723
|
-
dom.removeClass(dom.select('td.mceSelected,th.mceSelected'), 'mceSelected');
|
724
|
-
|
725
|
-
// Add new selection
|
726
|
-
for (y = startY; y <= maxY; y++) {
|
727
|
-
for (x = startX; x <= maxX; x++) {
|
728
|
-
if (grid[y][x])
|
729
|
-
dom.addClass(grid[y][x].elm, 'mceSelected');
|
730
|
-
}
|
731
|
-
}
|
732
|
-
}
|
733
|
-
};
|
734
|
-
|
735
|
-
// Expose to public
|
736
|
-
tinymce.extend(this, {
|
737
|
-
deleteTable : deleteTable,
|
738
|
-
split : split,
|
739
|
-
merge : merge,
|
740
|
-
insertRow : insertRow,
|
741
|
-
insertCol : insertCol,
|
742
|
-
deleteCols : deleteCols,
|
743
|
-
deleteRows : deleteRows,
|
744
|
-
cutRows : cutRows,
|
745
|
-
copyRows : copyRows,
|
746
|
-
pasteRows : pasteRows,
|
747
|
-
getPos : getPos,
|
748
|
-
setStartCell : setStartCell,
|
749
|
-
setEndCell : setEndCell
|
750
|
-
});
|
751
|
-
};
|
752
|
-
|
753
|
-
tinymce.create('tinymce.plugins.TablePlugin', {
|
754
|
-
init : function(ed, url) {
|
755
|
-
var winMan, clipboardRows;
|
756
|
-
|
757
|
-
function createTableGrid(node) {
|
758
|
-
var selection = ed.selection, tblElm = ed.dom.getParent(node || selection.getNode(), 'table');
|
759
|
-
|
760
|
-
if (tblElm)
|
761
|
-
return new TableGrid(tblElm, ed.dom, selection);
|
762
|
-
};
|
763
|
-
|
764
|
-
function cleanup() {
|
765
|
-
// Restore selection possibilities
|
766
|
-
ed.getBody().style.webkitUserSelect = '';
|
767
|
-
ed.dom.removeClass(ed.dom.select('td.mceSelected,th.mceSelected'), 'mceSelected');
|
768
|
-
};
|
769
|
-
|
770
|
-
// Register buttons
|
771
|
-
each([
|
772
|
-
['table', 'table.desc', 'mceInsertTable', true],
|
773
|
-
['delete_table', 'table.del', 'mceTableDelete'],
|
774
|
-
['delete_col', 'table.delete_col_desc', 'mceTableDeleteCol'],
|
775
|
-
['delete_row', 'table.delete_row_desc', 'mceTableDeleteRow'],
|
776
|
-
['col_after', 'table.col_after_desc', 'mceTableInsertColAfter'],
|
777
|
-
['col_before', 'table.col_before_desc', 'mceTableInsertColBefore'],
|
778
|
-
['row_after', 'table.row_after_desc', 'mceTableInsertRowAfter'],
|
779
|
-
['row_before', 'table.row_before_desc', 'mceTableInsertRowBefore'],
|
780
|
-
['row_props', 'table.row_desc', 'mceTableRowProps', true],
|
781
|
-
['cell_props', 'table.cell_desc', 'mceTableCellProps', true],
|
782
|
-
['split_cells', 'table.split_cells_desc', 'mceTableSplitCells', true],
|
783
|
-
['merge_cells', 'table.merge_cells_desc', 'mceTableMergeCells', true]
|
784
|
-
], function(c) {
|
785
|
-
ed.addButton(c[0], {title : c[1], cmd : c[2], ui : c[3]});
|
786
|
-
});
|
787
|
-
|
788
|
-
// Select whole table is a table border is clicked
|
789
|
-
if (!tinymce.isIE) {
|
790
|
-
ed.onClick.add(function(ed, e) {
|
791
|
-
e = e.target;
|
792
|
-
|
793
|
-
if (e.nodeName === 'TABLE') {
|
794
|
-
ed.selection.select(e);
|
795
|
-
ed.nodeChanged();
|
796
|
-
}
|
797
|
-
});
|
798
|
-
}
|
799
|
-
|
800
|
-
ed.onPreProcess.add(function(ed, args) {
|
801
|
-
var nodes, i, node, dom = ed.dom, value;
|
802
|
-
|
803
|
-
nodes = dom.select('table', args.node);
|
804
|
-
i = nodes.length;
|
805
|
-
while (i--) {
|
806
|
-
node = nodes[i];
|
807
|
-
dom.setAttrib(node, 'data-mce-style', '');
|
808
|
-
|
809
|
-
if ((value = dom.getAttrib(node, 'width'))) {
|
810
|
-
dom.setStyle(node, 'width', value);
|
811
|
-
dom.setAttrib(node, 'width', '');
|
812
|
-
}
|
813
|
-
|
814
|
-
if ((value = dom.getAttrib(node, 'height'))) {
|
815
|
-
dom.setStyle(node, 'height', value);
|
816
|
-
dom.setAttrib(node, 'height', '');
|
817
|
-
}
|
818
|
-
}
|
819
|
-
});
|
820
|
-
|
821
|
-
// Handle node change updates
|
822
|
-
ed.onNodeChange.add(function(ed, cm, n) {
|
823
|
-
var p;
|
824
|
-
|
825
|
-
n = ed.selection.getStart();
|
826
|
-
p = ed.dom.getParent(n, 'td,th,caption');
|
827
|
-
cm.setActive('table', n.nodeName === 'TABLE' || !!p);
|
828
|
-
|
829
|
-
// Disable table tools if we are in caption
|
830
|
-
if (p && p.nodeName === 'CAPTION')
|
831
|
-
p = 0;
|
832
|
-
|
833
|
-
cm.setDisabled('delete_table', !p);
|
834
|
-
cm.setDisabled('delete_col', !p);
|
835
|
-
cm.setDisabled('delete_table', !p);
|
836
|
-
cm.setDisabled('delete_row', !p);
|
837
|
-
cm.setDisabled('col_after', !p);
|
838
|
-
cm.setDisabled('col_before', !p);
|
839
|
-
cm.setDisabled('row_after', !p);
|
840
|
-
cm.setDisabled('row_before', !p);
|
841
|
-
cm.setDisabled('row_props', !p);
|
842
|
-
cm.setDisabled('cell_props', !p);
|
843
|
-
cm.setDisabled('split_cells', !p);
|
844
|
-
cm.setDisabled('merge_cells', !p);
|
845
|
-
});
|
846
|
-
|
847
|
-
ed.onInit.add(function(ed) {
|
848
|
-
var startTable, startCell, dom = ed.dom, tableGrid;
|
849
|
-
|
850
|
-
winMan = ed.windowManager;
|
851
|
-
|
852
|
-
// Add cell selection logic
|
853
|
-
ed.onMouseDown.add(function(ed, e) {
|
854
|
-
if (e.button != 2) {
|
855
|
-
cleanup();
|
856
|
-
|
857
|
-
startCell = dom.getParent(e.target, 'td,th');
|
858
|
-
startTable = dom.getParent(startCell, 'table');
|
859
|
-
}
|
860
|
-
});
|
861
|
-
|
862
|
-
dom.bind(ed.getDoc(), 'mouseover', function(e) {
|
863
|
-
var sel, table, target = e.target;
|
864
|
-
|
865
|
-
if (startCell && (tableGrid || target != startCell) && (target.nodeName == 'TD' || target.nodeName == 'TH')) {
|
866
|
-
table = dom.getParent(target, 'table');
|
867
|
-
if (table == startTable) {
|
868
|
-
if (!tableGrid) {
|
869
|
-
tableGrid = createTableGrid(table);
|
870
|
-
tableGrid.setStartCell(startCell);
|
871
|
-
|
872
|
-
ed.getBody().style.webkitUserSelect = 'none';
|
873
|
-
}
|
874
|
-
|
875
|
-
tableGrid.setEndCell(target);
|
876
|
-
}
|
877
|
-
|
878
|
-
// Remove current selection
|
879
|
-
sel = ed.selection.getSel();
|
880
|
-
|
881
|
-
if (sel.removeAllRanges)
|
882
|
-
sel.removeAllRanges();
|
883
|
-
else
|
884
|
-
sel.empty();
|
885
|
-
|
886
|
-
e.preventDefault();
|
887
|
-
}
|
888
|
-
});
|
889
|
-
|
890
|
-
ed.onMouseUp.add(function(ed, e) {
|
891
|
-
var rng, sel = ed.selection, selectedCells, nativeSel = sel.getSel(), walker, node, lastNode, endNode;
|
892
|
-
|
893
|
-
// Move selection to startCell
|
894
|
-
if (startCell) {
|
895
|
-
if (tableGrid)
|
896
|
-
ed.getBody().style.webkitUserSelect = '';
|
897
|
-
|
898
|
-
function setPoint(node, start) {
|
899
|
-
var walker = new tinymce.dom.TreeWalker(node, node);
|
900
|
-
|
901
|
-
do {
|
902
|
-
// Text node
|
903
|
-
if (node.nodeType == 3 && tinymce.trim(node.nodeValue).length != 0) {
|
904
|
-
if (start)
|
905
|
-
rng.setStart(node, 0);
|
906
|
-
else
|
907
|
-
rng.setEnd(node, node.nodeValue.length);
|
908
|
-
|
909
|
-
return;
|
910
|
-
}
|
911
|
-
|
912
|
-
// BR element
|
913
|
-
if (node.nodeName == 'BR') {
|
914
|
-
if (start)
|
915
|
-
rng.setStartBefore(node);
|
916
|
-
else
|
917
|
-
rng.setEndBefore(node);
|
918
|
-
|
919
|
-
return;
|
920
|
-
}
|
921
|
-
} while (node = (start ? walker.next() : walker.prev()));
|
922
|
-
};
|
923
|
-
|
924
|
-
// Try to expand text selection as much as we can only Gecko supports cell selection
|
925
|
-
selectedCells = dom.select('td.mceSelected,th.mceSelected');
|
926
|
-
if (selectedCells.length > 0) {
|
927
|
-
rng = dom.createRng();
|
928
|
-
node = selectedCells[0];
|
929
|
-
endNode = selectedCells[selectedCells.length - 1];
|
930
|
-
|
931
|
-
setPoint(node, 1);
|
932
|
-
walker = new tinymce.dom.TreeWalker(node, dom.getParent(selectedCells[0], 'table'));
|
933
|
-
|
934
|
-
do {
|
935
|
-
if (node.nodeName == 'TD' || node.nodeName == 'TH') {
|
936
|
-
if (!dom.hasClass(node, 'mceSelected'))
|
937
|
-
break;
|
938
|
-
|
939
|
-
lastNode = node;
|
940
|
-
}
|
941
|
-
} while (node = walker.next());
|
942
|
-
|
943
|
-
setPoint(lastNode);
|
944
|
-
|
945
|
-
sel.setRng(rng);
|
946
|
-
}
|
947
|
-
|
948
|
-
ed.nodeChanged();
|
949
|
-
startCell = tableGrid = startTable = null;
|
950
|
-
}
|
951
|
-
});
|
952
|
-
|
953
|
-
ed.onKeyUp.add(function(ed, e) {
|
954
|
-
cleanup();
|
955
|
-
});
|
956
|
-
|
957
|
-
// Add context menu
|
958
|
-
if (ed && ed.plugins.contextmenu) {
|
959
|
-
ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) {
|
960
|
-
var sm, se = ed.selection, el = se.getNode() || ed.getBody();
|
961
|
-
|
962
|
-
if (ed.dom.getParent(e, 'td') || ed.dom.getParent(e, 'th') || ed.dom.select('td.mceSelected,th.mceSelected').length) {
|
963
|
-
m.removeAll();
|
964
|
-
|
965
|
-
if (el.nodeName == 'A' && !ed.dom.getAttrib(el, 'name')) {
|
966
|
-
m.add({title : 'advanced.link_desc', icon : 'link', cmd : ed.plugins.advlink ? 'mceAdvLink' : 'mceLink', ui : true});
|
967
|
-
m.add({title : 'advanced.unlink_desc', icon : 'unlink', cmd : 'UnLink'});
|
968
|
-
m.addSeparator();
|
969
|
-
}
|
970
|
-
|
971
|
-
if (el.nodeName == 'IMG' && el.className.indexOf('mceItem') == -1) {
|
972
|
-
m.add({title : 'advanced.image_desc', icon : 'image', cmd : ed.plugins.advimage ? 'mceAdvImage' : 'mceImage', ui : true});
|
973
|
-
m.addSeparator();
|
974
|
-
}
|
975
|
-
|
976
|
-
m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', value : {action : 'insert'}});
|
977
|
-
m.add({title : 'table.props_desc', icon : 'table_props', cmd : 'mceInsertTable'});
|
978
|
-
m.add({title : 'table.del', icon : 'delete_table', cmd : 'mceTableDelete'});
|
979
|
-
m.addSeparator();
|
980
|
-
|
981
|
-
// Cell menu
|
982
|
-
sm = m.addMenu({title : 'table.cell'});
|
983
|
-
sm.add({title : 'table.cell_desc', icon : 'cell_props', cmd : 'mceTableCellProps'});
|
984
|
-
sm.add({title : 'table.split_cells_desc', icon : 'split_cells', cmd : 'mceTableSplitCells'});
|
985
|
-
sm.add({title : 'table.merge_cells_desc', icon : 'merge_cells', cmd : 'mceTableMergeCells'});
|
986
|
-
|
987
|
-
// Row menu
|
988
|
-
sm = m.addMenu({title : 'table.row'});
|
989
|
-
sm.add({title : 'table.row_desc', icon : 'row_props', cmd : 'mceTableRowProps'});
|
990
|
-
sm.add({title : 'table.row_before_desc', icon : 'row_before', cmd : 'mceTableInsertRowBefore'});
|
991
|
-
sm.add({title : 'table.row_after_desc', icon : 'row_after', cmd : 'mceTableInsertRowAfter'});
|
992
|
-
sm.add({title : 'table.delete_row_desc', icon : 'delete_row', cmd : 'mceTableDeleteRow'});
|
993
|
-
sm.addSeparator();
|
994
|
-
sm.add({title : 'table.cut_row_desc', icon : 'cut', cmd : 'mceTableCutRow'});
|
995
|
-
sm.add({title : 'table.copy_row_desc', icon : 'copy', cmd : 'mceTableCopyRow'});
|
996
|
-
sm.add({title : 'table.paste_row_before_desc', icon : 'paste', cmd : 'mceTablePasteRowBefore'}).setDisabled(!clipboardRows);
|
997
|
-
sm.add({title : 'table.paste_row_after_desc', icon : 'paste', cmd : 'mceTablePasteRowAfter'}).setDisabled(!clipboardRows);
|
998
|
-
|
999
|
-
// Column menu
|
1000
|
-
sm = m.addMenu({title : 'table.col'});
|
1001
|
-
sm.add({title : 'table.col_before_desc', icon : 'col_before', cmd : 'mceTableInsertColBefore'});
|
1002
|
-
sm.add({title : 'table.col_after_desc', icon : 'col_after', cmd : 'mceTableInsertColAfter'});
|
1003
|
-
sm.add({title : 'table.delete_col_desc', icon : 'delete_col', cmd : 'mceTableDeleteCol'});
|
1004
|
-
} else
|
1005
|
-
m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable'});
|
1006
|
-
});
|
1007
|
-
}
|
1008
|
-
|
1009
|
-
// Fixes an issue on Gecko where it's impossible to place the caret behind a table
|
1010
|
-
// This fix will force a paragraph element after the table but only when the forced_root_block setting is enabled
|
1011
|
-
if (!tinymce.isIE) {
|
1012
|
-
function fixTableCaretPos() {
|
1013
|
-
var last;
|
1014
|
-
|
1015
|
-
// Skip empty text nodes form the end
|
1016
|
-
for (last = ed.getBody().lastChild; last && last.nodeType == 3 && !last.nodeValue.length; last = last.previousSibling) ;
|
1017
|
-
|
1018
|
-
if (last && last.nodeName == 'TABLE')
|
1019
|
-
ed.dom.add(ed.getBody(), 'p', null, '<br mce_bogus="1" />');
|
1020
|
-
};
|
1021
|
-
|
1022
|
-
// Fixes an bug where it's impossible to place the caret before a table in Gecko
|
1023
|
-
// this fix solves it by detecting when the caret is at the beginning of such a table
|
1024
|
-
// and then manually moves the caret infront of the table
|
1025
|
-
if (tinymce.isGecko) {
|
1026
|
-
ed.onKeyDown.add(function(ed, e) {
|
1027
|
-
var rng, table, dom = ed.dom;
|
1028
|
-
|
1029
|
-
// On gecko it's not possible to place the caret before a table
|
1030
|
-
if (e.keyCode == 37 || e.keyCode == 38) {
|
1031
|
-
rng = ed.selection.getRng();
|
1032
|
-
table = dom.getParent(rng.startContainer, 'table');
|
1033
|
-
|
1034
|
-
if (table && ed.getBody().firstChild == table) {
|
1035
|
-
if (isAtStart(rng, table)) {
|
1036
|
-
rng = dom.createRng();
|
1037
|
-
|
1038
|
-
rng.setStartBefore(table);
|
1039
|
-
rng.setEndBefore(table);
|
1040
|
-
|
1041
|
-
ed.selection.setRng(rng);
|
1042
|
-
|
1043
|
-
e.preventDefault();
|
1044
|
-
}
|
1045
|
-
}
|
1046
|
-
}
|
1047
|
-
});
|
1048
|
-
}
|
1049
|
-
|
1050
|
-
ed.onKeyUp.add(fixTableCaretPos);
|
1051
|
-
ed.onSetContent.add(fixTableCaretPos);
|
1052
|
-
ed.onVisualAid.add(fixTableCaretPos);
|
1053
|
-
|
1054
|
-
ed.onPreProcess.add(function(ed, o) {
|
1055
|
-
var last = o.node.lastChild;
|
1056
|
-
|
1057
|
-
if (last && last.childNodes.length == 1 && last.firstChild.nodeName == 'BR')
|
1058
|
-
ed.dom.remove(last);
|
1059
|
-
});
|
1060
|
-
|
1061
|
-
fixTableCaretPos();
|
1062
|
-
}
|
1063
|
-
});
|
1064
|
-
|
1065
|
-
// Register action commands
|
1066
|
-
each({
|
1067
|
-
mceTableSplitCells : function(grid) {
|
1068
|
-
grid.split();
|
1069
|
-
},
|
1070
|
-
|
1071
|
-
mceTableMergeCells : function(grid) {
|
1072
|
-
var rowSpan, colSpan, cell;
|
1073
|
-
|
1074
|
-
cell = ed.dom.getParent(ed.selection.getNode(), 'th,td');
|
1075
|
-
if (cell) {
|
1076
|
-
rowSpan = cell.rowSpan;
|
1077
|
-
colSpan = cell.colSpan;
|
1078
|
-
}
|
1079
|
-
|
1080
|
-
if (!ed.dom.select('td.mceSelected,th.mceSelected').length) {
|
1081
|
-
winMan.open({
|
1082
|
-
url : url + '/merge_cells.htm',
|
1083
|
-
width : 240 + parseInt(ed.getLang('table.merge_cells_delta_width', 0)),
|
1084
|
-
height : 110 + parseInt(ed.getLang('table.merge_cells_delta_height', 0)),
|
1085
|
-
inline : 1
|
1086
|
-
}, {
|
1087
|
-
rows : rowSpan,
|
1088
|
-
cols : colSpan,
|
1089
|
-
onaction : function(data) {
|
1090
|
-
grid.merge(cell, data.cols, data.rows);
|
1091
|
-
},
|
1092
|
-
plugin_url : url
|
1093
|
-
});
|
1094
|
-
} else
|
1095
|
-
grid.merge();
|
1096
|
-
},
|
1097
|
-
|
1098
|
-
mceTableInsertRowBefore : function(grid) {
|
1099
|
-
grid.insertRow(true);
|
1100
|
-
},
|
1101
|
-
|
1102
|
-
mceTableInsertRowAfter : function(grid) {
|
1103
|
-
grid.insertRow();
|
1104
|
-
},
|
1105
|
-
|
1106
|
-
mceTableInsertColBefore : function(grid) {
|
1107
|
-
grid.insertCol(true);
|
1108
|
-
},
|
1109
|
-
|
1110
|
-
mceTableInsertColAfter : function(grid) {
|
1111
|
-
grid.insertCol();
|
1112
|
-
},
|
1113
|
-
|
1114
|
-
mceTableDeleteCol : function(grid) {
|
1115
|
-
grid.deleteCols();
|
1116
|
-
},
|
1117
|
-
|
1118
|
-
mceTableDeleteRow : function(grid) {
|
1119
|
-
grid.deleteRows();
|
1120
|
-
},
|
1121
|
-
|
1122
|
-
mceTableCutRow : function(grid) {
|
1123
|
-
clipboardRows = grid.cutRows();
|
1124
|
-
},
|
1125
|
-
|
1126
|
-
mceTableCopyRow : function(grid) {
|
1127
|
-
clipboardRows = grid.copyRows();
|
1128
|
-
},
|
1129
|
-
|
1130
|
-
mceTablePasteRowBefore : function(grid) {
|
1131
|
-
grid.pasteRows(clipboardRows, true);
|
1132
|
-
},
|
1133
|
-
|
1134
|
-
mceTablePasteRowAfter : function(grid) {
|
1135
|
-
grid.pasteRows(clipboardRows);
|
1136
|
-
},
|
1137
|
-
|
1138
|
-
mceTableDelete : function(grid) {
|
1139
|
-
grid.deleteTable();
|
1140
|
-
}
|
1141
|
-
}, function(func, name) {
|
1142
|
-
ed.addCommand(name, function() {
|
1143
|
-
var grid = createTableGrid();
|
1144
|
-
|
1145
|
-
if (grid) {
|
1146
|
-
func(grid);
|
1147
|
-
ed.execCommand('mceRepaint');
|
1148
|
-
cleanup();
|
1149
|
-
}
|
1150
|
-
});
|
1151
|
-
});
|
1152
|
-
|
1153
|
-
// Register dialog commands
|
1154
|
-
each({
|
1155
|
-
mceInsertTable : function(val) {
|
1156
|
-
winMan.open({
|
1157
|
-
url : url + '/table.htm',
|
1158
|
-
width : 400 + parseInt(ed.getLang('table.table_delta_width', 0)),
|
1159
|
-
height : 320 + parseInt(ed.getLang('table.table_delta_height', 0)),
|
1160
|
-
inline : 1
|
1161
|
-
}, {
|
1162
|
-
plugin_url : url,
|
1163
|
-
action : val ? val.action : 0
|
1164
|
-
});
|
1165
|
-
},
|
1166
|
-
|
1167
|
-
mceTableRowProps : function() {
|
1168
|
-
winMan.open({
|
1169
|
-
url : url + '/row.htm',
|
1170
|
-
width : 400 + parseInt(ed.getLang('table.rowprops_delta_width', 0)),
|
1171
|
-
height : 295 + parseInt(ed.getLang('table.rowprops_delta_height', 0)),
|
1172
|
-
inline : 1
|
1173
|
-
}, {
|
1174
|
-
plugin_url : url
|
1175
|
-
});
|
1176
|
-
},
|
1177
|
-
|
1178
|
-
mceTableCellProps : function() {
|
1179
|
-
winMan.open({
|
1180
|
-
url : url + '/cell.htm',
|
1181
|
-
width : 400 + parseInt(ed.getLang('table.cellprops_delta_width', 0)),
|
1182
|
-
height : 295 + parseInt(ed.getLang('table.cellprops_delta_height', 0)),
|
1183
|
-
inline : 1
|
1184
|
-
}, {
|
1185
|
-
plugin_url : url
|
1186
|
-
});
|
1187
|
-
}
|
1188
|
-
}, function(func, name) {
|
1189
|
-
ed.addCommand(name, function(ui, val) {
|
1190
|
-
func(val);
|
1191
|
-
});
|
1192
|
-
});
|
1193
|
-
}
|
1194
|
-
});
|
1195
|
-
|
1196
|
-
// Register plugin
|
1197
|
-
tinymce.PluginManager.add('table', tinymce.plugins.TablePlugin);
|
1198
|
-
})(tinymce);
|