spree_editor 0.50.0 → 0.50.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Versionfile +3 -0
- data/app/controllers/admin/editor_settings_controller.rb +5 -11
- data/app/views/admin/editor_settings/edit.html.erb +20 -19
- data/app/views/shared/editor_engines/_tiny_mce.html.erb +16 -33
- data/app/views/shared/editor_engines/_yui_rich_editor.html.erb +60 -7
- data/config/locales/en.yml +1 -0
- data/config/locales/es.yml +45 -0
- data/config/locales/ru.yml +2 -0
- data/lib/editor_configuration.rb +2 -2
- data/public/images/html_editor.gif +0 -0
- data/public/javascripts/tinymce/langs/en.js +56 -3
- data/public/javascripts/tinymce/plugins/advhr/langs/en_dlg.js +2 -0
- data/public/javascripts/tinymce/plugins/advhr/rule.htm +30 -29
- data/public/javascripts/tinymce/plugins/advimage/image.htm +34 -31
- data/public/javascripts/tinymce/plugins/advimage/js/image.js +20 -5
- data/public/javascripts/tinymce/plugins/advimage/langs/en_dlg.js +2 -0
- data/public/javascripts/tinymce/plugins/advlink/js/advlink.js +21 -17
- data/public/javascripts/tinymce/plugins/advlink/langs/en_dlg.js +4 -2
- data/public/javascripts/tinymce/plugins/advlink/link.htm +35 -30
- data/public/javascripts/tinymce/plugins/advlist/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/advlist/editor_plugin_src.js +10 -3
- data/public/javascripts/tinymce/plugins/autolink/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/autolink/editor_plugin_src.js +169 -0
- data/public/javascripts/tinymce/plugins/autoresize/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/autoresize/editor_plugin_src.js +12 -3
- data/public/javascripts/tinymce/plugins/autosave/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/autosave/editor_plugin_src.js +13 -4
- data/public/javascripts/tinymce/plugins/bbcode/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/bbcode/editor_plugin_src.js +1 -1
- data/public/javascripts/tinymce/plugins/contextmenu/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/contextmenu/editor_plugin_src.js +30 -16
- data/public/javascripts/tinymce/plugins/emotions/emotions.htm +15 -14
- data/public/javascripts/tinymce/plugins/fullpage/css/fullpage.css +3 -42
- data/public/javascripts/tinymce/plugins/fullpage/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/fullpage/editor_plugin_src.js +309 -63
- data/public/javascripts/tinymce/plugins/fullpage/fullpage.htm +18 -330
- data/public/javascripts/tinymce/plugins/fullpage/js/fullpage.js +199 -438
- data/public/javascripts/tinymce/plugins/fullscreen/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/fullscreen/editor_plugin_src.js +10 -2
- data/public/javascripts/tinymce/plugins/inlinepopups/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/inlinepopups/editor_plugin_src.js +76 -15
- data/public/javascripts/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css +0 -10
- data/public/javascripts/tinymce/plugins/layer/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/layer/editor_plugin_src.js +2 -0
- data/public/javascripts/tinymce/plugins/legacyoutput/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/legacyoutput/editor_plugin_src.js +31 -28
- data/public/javascripts/tinymce/plugins/lists/editor_plugin.js +1 -0
- data/public/javascripts/tinymce/plugins/lists/editor_plugin_src.js +617 -0
- data/public/javascripts/tinymce/plugins/media/css/media.css +5 -4
- data/public/javascripts/tinymce/plugins/media/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/media/editor_plugin_src.js +652 -296
- data/public/javascripts/tinymce/plugins/media/js/media.js +327 -603
- data/public/javascripts/tinymce/plugins/media/langs/en_dlg.js +8 -2
- data/public/javascripts/tinymce/plugins/media/media.htm +283 -288
- data/public/javascripts/tinymce/plugins/media/moxieplayer.swf +0 -0
- data/public/javascripts/tinymce/plugins/nonbreaking/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/nonbreaking/editor_plugin_src.js +1 -1
- data/public/javascripts/tinymce/plugins/noneditable/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/noneditable/editor_plugin_src.js +2 -0
- data/public/javascripts/tinymce/plugins/pagebreak/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/pagebreak/editor_plugin_src.js +1 -4
- data/public/javascripts/tinymce/plugins/paste/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/paste/editor_plugin_src.js +118 -137
- data/public/javascripts/tinymce/plugins/searchreplace/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/searchreplace/editor_plugin_src.js +4 -0
- data/public/javascripts/tinymce/plugins/searchreplace/js/searchreplace.js +14 -10
- data/public/javascripts/tinymce/plugins/searchreplace/searchreplace.htm +17 -16
- data/public/javascripts/tinymce/plugins/spellchecker/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/spellchecker/editor_plugin_src.js +55 -37
- data/public/javascripts/tinymce/plugins/style/js/props.js +2 -8
- data/public/javascripts/tinymce/plugins/style/langs/en_dlg.js +8 -1
- data/public/javascripts/tinymce/plugins/style/props.htm +513 -398
- data/public/javascripts/tinymce/plugins/tabfocus/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/tabfocus/editor_plugin_src.js +30 -28
- data/public/javascripts/tinymce/plugins/table/cell.htm +12 -12
- data/public/javascripts/tinymce/plugins/table/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/table/editor_plugin_src.js +97 -34
- data/public/javascripts/tinymce/plugins/table/js/cell.js +9 -11
- data/public/javascripts/tinymce/plugins/table/js/row.js +13 -18
- data/public/javascripts/tinymce/plugins/table/js/table.js +8 -12
- data/public/javascripts/tinymce/plugins/table/langs/en_dlg.js +1 -1
- data/public/javascripts/tinymce/plugins/table/merge_cells.htm +11 -11
- data/public/javascripts/tinymce/plugins/table/row.htm +10 -8
- data/public/javascripts/tinymce/plugins/table/table.htm +54 -53
- data/public/javascripts/tinymce/plugins/template/js/template.js +1 -1
- data/public/javascripts/tinymce/plugins/visualchars/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/visualchars/editor_plugin_src.js +1 -1
- data/public/javascripts/tinymce/plugins/wordcount/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/wordcount/editor_plugin_src.js +35 -19
- data/public/javascripts/tinymce/plugins/xhtmlxtras/abbr.htm +6 -5
- data/public/javascripts/tinymce/plugins/xhtmlxtras/acronym.htm +6 -5
- data/public/javascripts/tinymce/plugins/xhtmlxtras/attributes.htm +6 -5
- data/public/javascripts/tinymce/plugins/xhtmlxtras/cite.htm +5 -4
- data/public/javascripts/tinymce/plugins/xhtmlxtras/del.htm +9 -8
- data/public/javascripts/tinymce/plugins/xhtmlxtras/editor_plugin.js +1 -1
- data/public/javascripts/tinymce/plugins/xhtmlxtras/editor_plugin_src.js +6 -6
- data/public/javascripts/tinymce/plugins/xhtmlxtras/ins.htm +11 -10
- data/public/javascripts/tinymce/plugins/xhtmlxtras/js/attributes.js +1 -16
- data/public/javascripts/tinymce/plugins/xhtmlxtras/js/del.js +2 -2
- data/public/javascripts/tinymce/plugins/xhtmlxtras/js/element_common.js +3 -5
- data/public/javascripts/tinymce/plugins/xhtmlxtras/js/ins.js +4 -3
- data/public/javascripts/tinymce/themes/advanced/about.htm +3 -5
- data/public/javascripts/tinymce/themes/advanced/anchor.htm +5 -5
- data/public/javascripts/tinymce/themes/advanced/charmap.htm +39 -40
- data/public/javascripts/tinymce/themes/advanced/color_picker.htm +10 -9
- data/public/javascripts/tinymce/themes/advanced/editor_template.js +1 -1
- data/public/javascripts/tinymce/themes/advanced/editor_template_src.js +172 -41
- data/public/javascripts/tinymce/themes/advanced/image.htm +51 -51
- data/public/javascripts/tinymce/themes/advanced/img/flash.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 +1 -0
- data/public/javascripts/tinymce/themes/advanced/js/anchor.js +5 -0
- data/public/javascripts/tinymce/themes/advanced/js/charmap.js +26 -6
- data/public/javascripts/tinymce/themes/advanced/js/color_picker.js +108 -32
- data/public/javascripts/tinymce/themes/advanced/js/image.js +3 -1
- data/public/javascripts/tinymce/themes/advanced/js/link.js +4 -7
- data/public/javascripts/tinymce/themes/advanced/js/source_editor.js +1 -1
- data/public/javascripts/tinymce/themes/advanced/langs/en.js +8 -2
- data/public/javascripts/tinymce/themes/advanced/langs/en_dlg.js +6 -3
- data/public/javascripts/tinymce/themes/advanced/link.htm +27 -28
- data/public/javascripts/tinymce/themes/advanced/shortcuts.htm +47 -0
- data/public/javascripts/tinymce/themes/advanced/skins/default/content.css +11 -0
- data/public/javascripts/tinymce/themes/advanced/skins/default/ui.css +4 -4
- data/public/javascripts/tinymce/themes/advanced/skins/highcontrast/content.css +23 -0
- data/public/javascripts/tinymce/themes/advanced/skins/highcontrast/dialog.css +105 -0
- data/public/javascripts/tinymce/themes/advanced/skins/highcontrast/ui.css +101 -0
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/content.css +10 -0
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/dialog.css +1 -0
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/ui.css +5 -4
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/ui_black.css +1 -1
- data/public/javascripts/tinymce/themes/advanced/skins/o2k7/ui_silver.css +1 -1
- data/public/javascripts/tinymce/themes/advanced/source_editor.htm +3 -3
- data/public/javascripts/tinymce/themes/simple/editor_template.js +1 -1
- data/public/javascripts/tinymce/themes/simple/editor_template_src.js +1 -2
- data/public/javascripts/tinymce/tiny_mce.js +1 -1
- data/public/javascripts/tinymce/tiny_mce_popup.js +1 -1
- data/public/javascripts/tinymce/tiny_mce_src.js +6488 -4070
- data/public/javascripts/tinymce/utils/form_utils.js +14 -4
- data/public/javascripts/tinymce/utils/mctabs.js +95 -10
- data/public/javascripts/tinymce/utils/validate.js +35 -3
- data/public/stylesheets/editor.css +23 -0
- data/spree_editor.gemspec +2 -2
- metadata +25 -4
@@ -1 +1 @@
|
|
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(
|
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)})();
|
@@ -22,27 +22,30 @@
|
|
22
22
|
var x, i, f, el, v;
|
23
23
|
|
24
24
|
function find(d) {
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
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];
|
46
49
|
}
|
47
50
|
}
|
48
51
|
|
@@ -71,10 +74,14 @@
|
|
71
74
|
}
|
72
75
|
|
73
76
|
if (el) {
|
74
|
-
if (ed = tinymce.get(el.id || el.name))
|
77
|
+
if (el.id && (ed = tinymce.get(el.id || el.name)))
|
75
78
|
ed.focus();
|
76
79
|
else
|
77
|
-
window.setTimeout(function() {
|
80
|
+
window.setTimeout(function() {
|
81
|
+
if (!tinymce.isWebKit)
|
82
|
+
window.focus();
|
83
|
+
el.focus();
|
84
|
+
}, 10);
|
78
85
|
|
79
86
|
return Event.cancel(e);
|
80
87
|
}
|
@@ -89,11 +96,6 @@
|
|
89
96
|
} else
|
90
97
|
ed.onKeyDown.add(tabHandler);
|
91
98
|
|
92
|
-
ed.onInit.add(function() {
|
93
|
-
each(DOM.select('a:first,a:last', ed.getContainer()), function(n) {
|
94
|
-
Event.add(n, 'focus', function() {ed.focus();});
|
95
|
-
});
|
96
|
-
});
|
97
99
|
},
|
98
100
|
|
99
101
|
getInfo : function() {
|
@@ -9,12 +9,12 @@
|
|
9
9
|
<script type="text/javascript" src="js/cell.js"></script>
|
10
10
|
<link href="css/cell.css" rel="stylesheet" type="text/css" />
|
11
11
|
</head>
|
12
|
-
<body id="tablecell" style="display: none">
|
12
|
+
<body id="tablecell" style="display: none" role="application">
|
13
13
|
<form onsubmit="updateAction();return false;" action="#">
|
14
14
|
<div class="tabs">
|
15
15
|
<ul>
|
16
|
-
<li id="general_tab" class="current"><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"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#table_dlg.advanced_tab}</a></span></li>
|
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
18
|
</ul>
|
19
19
|
</div>
|
20
20
|
|
@@ -23,7 +23,7 @@
|
|
23
23
|
<fieldset>
|
24
24
|
<legend>{#table_dlg.general_props}</legend>
|
25
25
|
|
26
|
-
<table border="0" cellpadding="4" cellspacing="0">
|
26
|
+
<table role="presentation" border="0" cellpadding="4" cellspacing="0">
|
27
27
|
<tr>
|
28
28
|
<td><label for="align">{#table_dlg.align}</label></td>
|
29
29
|
<td>
|
@@ -92,7 +92,7 @@
|
|
92
92
|
<fieldset>
|
93
93
|
<legend>{#table_dlg.advanced_props}</legend>
|
94
94
|
|
95
|
-
<table border="0" cellpadding="0" cellspacing="4">
|
95
|
+
<table role="presentation" border="0" cellpadding="0" cellspacing="4">
|
96
96
|
<tr>
|
97
97
|
<td class="column1"><label for="id">{#table_dlg.id}</label></td>
|
98
98
|
<td><input id="id" name="id" type="text" value="" style="width: 200px" /></td>
|
@@ -124,7 +124,7 @@
|
|
124
124
|
<tr>
|
125
125
|
<td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td>
|
126
126
|
<td>
|
127
|
-
<table border="0" cellpadding="0" cellspacing="0">
|
127
|
+
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
128
128
|
<tr>
|
129
129
|
<td><input id="backgroundimage" name="backgroundimage" type="text" value="" style="width: 200px" onchange="changedBackgroundImage();" /></td>
|
130
130
|
<td id="backgroundimagebrowsercontainer"> </td>
|
@@ -133,10 +133,10 @@
|
|
133
133
|
</td>
|
134
134
|
</tr>
|
135
135
|
|
136
|
-
<tr>
|
137
|
-
<td class="column1"><label for="bordercolor">{#table_dlg.bordercolor}</label></td>
|
136
|
+
<tr role="group" aria-labelledby="bordercolor_label">
|
137
|
+
<td class="column1"><label id="bordercolor_label" for="bordercolor">{#table_dlg.bordercolor}</label></td>
|
138
138
|
<td>
|
139
|
-
<table border="0" cellpadding="0" cellspacing="0">
|
139
|
+
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
140
140
|
<tr>
|
141
141
|
<td><input id="bordercolor" name="bordercolor" type="text" value="" size="9" onchange="updateColor('bordercolor_pick','bordercolor');changedColor();" /></td>
|
142
142
|
<td id="bordercolor_pickcontainer"> </td>
|
@@ -145,10 +145,10 @@
|
|
145
145
|
</td>
|
146
146
|
</tr>
|
147
147
|
|
148
|
-
<tr>
|
149
|
-
<td class="column1"><label for="bgcolor">{#table_dlg.bgcolor}</label></td>
|
148
|
+
<tr role="group" aria-labelledby="bgcolor_label">
|
149
|
+
<td class="column1"><label id="bgcolor_label" for="bgcolor">{#table_dlg.bgcolor}</label></td>
|
150
150
|
<td>
|
151
|
-
<table border="0" cellpadding="0" cellspacing="0">
|
151
|
+
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
152
152
|
<tr>
|
153
153
|
<td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedColor();" /></td>
|
154
154
|
<td id="bgcolor_pickcontainer"> </td>
|
@@ -1 +1 @@
|
|
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(G,F,J){var f,K,C,o;s();o=F.getParent(J.getStart(),"th,td");if(o){K=E(o);C=H();o=w(K.x,K.y)}function z(M,L){M=M.cloneNode(L);M.removeAttribute("id");return M}function s(){var L=0;f=[];d(["thead","tbody","tfoot"],function(M){var N=F.select("> "+M+" tr",G);d(N,function(O,P){P+=L;d(F.select("> td, > th",O),function(V,Q){var R,S,T,U;if(f[P]){while(f[P][Q]){Q++}}T=h(V,"rowspan");U=h(V,"colspan");for(S=P;S<P+T;S++){if(!f[S]){f[S]=[]}for(R=Q;R<Q+U;R++){f[S][R]={part:M,real:S==P&&R==Q,elm:V,rowspan:T,colspan:U}}}})});L+=N.length})}function w(L,N){var M;M=f[N];if(M){return M[L]}}function h(M,L){return parseInt(M.getAttribute(L)||1)}function j(L){return F.hasClass(L.elm,"mceSelected")||L==o}function k(){var L=[];d(G.rows,function(M){d(M.cells,function(N){if(F.hasClass(N,"mceSelected")||N==o.elm){L.push(M);return false}})});return L}function r(){var L=F.createRng();L.setStartAfter(G);L.setEndAfter(G);J.setRng(L);F.remove(G)}function e(L){var M;c.walk(L,function(O){var N;if(O.nodeType==3){d(F.getParents(O.parentNode,null,L).reverse(),function(P){P=z(P,false);if(!M){M=N=P}else{if(N){N.appendChild(P)}}N=P});if(N){N.innerHTML=c.isIE?" ":'<br _mce_bogus="1" />'}return false}},"childNodes");L=z(L,false);L.rowSpan=L.colSpan=1;if(M){L.appendChild(M)}else{if(!c.isIE){L.innerHTML='<br _mce_bogus="1" />'}}return L}function q(){var L=F.createRng();d(F.select("tr",G),function(M){if(M.cells.length==0){F.remove(M)}});if(F.select("tr",G).length==0){L.setStartAfter(G);L.setEndAfter(G);J.setRng(L);F.remove(G);return}d(F.select("thead,tbody,tfoot",G),function(M){if(M.rows.length==0){F.remove(M)}});s();row=f[Math.min(f.length-1,K.y)];if(row){J.select(row[Math.min(row.length-1,K.x)].elm,true);J.collapse(true)}}function t(R,P,T,Q){var O,M,L,N,S;O=f[P][R].elm.parentNode;for(L=1;L<=T;L++){O=F.getNext(O,"tr");if(O){for(M=R;M>=0;M--){S=f[P+L][M].elm;if(S.parentNode==O){for(N=1;N<=Q;N++){F.insertAfter(e(S),S)}break}}if(M==-1){for(N=1;N<=Q;N++){O.insertBefore(e(O.cells[0]),O.cells[0])}}}}}function B(){d(f,function(L,M){d(L,function(O,N){var R,Q,S,P;if(j(O)){O=O.elm;R=h(O,"colspan");Q=h(O,"rowspan");if(R>1||Q>1){O.colSpan=O.rowSpan=1;for(P=0;P<R-1;P++){F.insertAfter(e(O),O)}t(N,M,Q-1,R)}}})})}function p(T,Q,W){var O,N,V,U,S,P,R,L,T,M;if(T){pos=E(T);O=pos.x;N=pos.y;V=O+(Q-1);U=N+(W-1)}else{O=K.x;N=K.y;V=C.x;U=C.y}R=w(O,N);L=w(V,U);if(R&&L&&R.part==L.part){B();s();R=w(O,N).elm;R.colSpan=(V-O)+1;R.rowSpan=(U-N)+1;for(P=N;P<=U;P++){for(S=O;S<=V;S++){T=f[P][S].elm;if(T!=R){M=c.grep(T.childNodes);d(M,function(Y,X){if(Y.nodeName!="BR"||X!=M.length-1){R.appendChild(Y)}});F.remove(T)}}}q()}}function l(O){var L,Q,N,P,R,S,M,T;d(f,function(U,V){d(U,function(X,W){if(j(X)){X=X.elm;R=X.parentNode;S=z(R,false);L=V;if(O){return false}}});if(O){return !L}});for(P=0;P<f[0].length;P++){Q=f[L][P].elm;if(Q!=N){if(!O){rowSpan=h(Q,"rowspan");if(rowSpan>1){Q.rowSpan=rowSpan+1;continue}}else{if(L>0&&f[L-1][P]){T=f[L-1][P].elm;rowSpan=h(T,"rowspan");if(rowSpan>1){T.rowSpan=rowSpan+1;continue}}}M=e(Q);M.colSpan=Q.colSpan;S.appendChild(M);N=Q}}if(S.hasChildNodes()){if(!O){F.insertAfter(S,R)}else{R.parentNode.insertBefore(S,R)}}}function g(M){var N,L;d(f,function(O,P){d(O,function(R,Q){if(j(R)){N=Q;if(M){return false}}});if(M){return !N}});d(f,function(R,S){var O=R[N].elm,P,Q;if(O!=L){Q=h(O,"colspan");P=h(O,"rowspan");if(Q==1){if(!M){F.insertAfter(e(O),O);t(N,S,P-1,Q)}else{O.parentNode.insertBefore(e(O),O);t(N,S,P-1,Q)}}else{O.colSpan++}L=O}})}function n(){var L=[];d(f,function(M,N){d(M,function(P,O){if(j(P)&&c.inArray(L,O)===-1){d(f,function(S){var Q=S[O].elm,R;R=h(Q,"colspan");if(R>1){Q.colSpan=R-1}else{F.remove(Q)}});L.push(O)}})});q()}function m(){var M;function L(P){var O,Q,N;O=F.getNext(P,"tr");d(P.cells,function(R){var S=h(R,"rowspan");if(S>1){R.rowSpan=S-1;Q=E(R);t(Q.x,Q.y,1,1)}});Q=E(P.cells[0]);d(f[Q.y],function(R){var S;R=R.elm;if(R!=N){S=h(R,"rowspan");if(S<=1){F.remove(R)}else{R.rowSpan=S-1}N=R}})}M=k();d(M.reverse(),function(N){L(N)});q()}function D(){var L=k();F.remove(L);q();return L}function I(){var L=k();d(L,function(N,M){L[M]=z(N,true)});return L}function A(N,M){var O=k(),L=O[M?0:O.length-1],P=L.cells.length;d(f,function(R){var Q;P=0;d(R,function(T,S){if(T.real){P+=T.colspan}if(T.elm.parentNode==L){Q=1}});if(Q){return false}});if(!M){N.reverse()}d(N,function(S){var R=S.cells.length,Q;for(i=0;i<R;i++){Q=S.cells[i];Q.colSpan=Q.rowSpan=1}for(i=R;i<P;i++){S.appendChild(e(S.cells[R-1]))}for(i=P;i<R;i++){F.remove(S.cells[i])}if(M){L.parentNode.insertBefore(S,L)}else{F.insertAfter(S,L)}})}function E(L){var M;d(f,function(N,O){d(N,function(Q,P){if(Q.elm==L){M={x:P,y:O};return false}});return !M});return M}function v(L){K=E(L)}function H(){var N,M,L;M=L=0;d(f,function(O,P){d(O,function(R,Q){var T,S;if(j(R)){R=f[P][Q];if(Q>M){M=Q}if(P>L){L=P}if(R.real){T=R.colspan-1;S=R.rowspan-1;if(T){if(Q+T>M){M=Q+T}}if(S){if(P+S>L){L=P+S}}}}})});return{x:M,y:L}}function u(R){var O,N,T,S,M,L,P,Q;C=E(R);if(K&&C){O=Math.min(K.x,C.x);N=Math.min(K.y,C.y);T=Math.max(K.x,C.x);S=Math.max(K.y,C.y);M=T;L=S;for(y=N;y<=L;y++){R=f[y][O];if(!R.real){if(O-(R.colspan-1)<O){O-=R.colspan-1}}}for(x=O;x<=M;x++){R=f[N][x];if(!R.real){if(N-(R.rowspan-1)<N){N-=R.rowspan-1}}}for(y=N;y<=S;y++){for(x=O;x<=T;x++){R=f[y][x];if(R.real){P=R.colspan-1;Q=R.rowspan-1;if(P){if(x+P>M){M=x+P}}if(Q){if(y+Q>L){L=y+Q}}}}}F.removeClass(F.select("td.mceSelected,th.mceSelected"),"mceSelected");for(y=N;y<=L;y++){for(x=O;x<=M;x++){F.addClass(f[y][x].elm,"mceSelected")}}}}c.extend(this,{deleteTable:r,split:B,merge:p,insertRow:l,insertCol:g,deleteCols:n,deleteRows:m,cutRows:D,copyRows:I,pasteRows:A,getPos:E,setStartCell:v,setEndCell:u})}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)}})}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
|
+
(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(v){var t,s,u=v.target;if(p&&(n||u!=p)&&(u.nodeName=="TD"||u.nodeName=="TH")){s=q.getParent(u,"table");if(s==l){if(!n){n=j(s);n.setStartCell(p);m.getBody().style.webkitUserSelect="none"}n.setEndCell(u)}t=m.selection.getSel();try{if(t.removeAllRanges){t.removeAllRanges()}else{t.empty()}}catch(r){}v.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);
|
@@ -104,8 +104,19 @@
|
|
104
104
|
return parseInt(td.getAttribute(name) || 1);
|
105
105
|
};
|
106
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
|
+
|
107
118
|
function isCellSelected(cell) {
|
108
|
-
return dom.hasClass(cell.elm, 'mceSelected') || cell == selectedCell;
|
119
|
+
return cell && (dom.hasClass(cell.elm, 'mceSelected') || cell == selectedCell);
|
109
120
|
};
|
110
121
|
|
111
122
|
function getSelectedRows() {
|
@@ -155,20 +166,21 @@
|
|
155
166
|
|
156
167
|
// Add something to the inner node
|
157
168
|
if (curNode)
|
158
|
-
curNode.innerHTML = tinymce.isIE ? ' ' : '<br
|
169
|
+
curNode.innerHTML = tinymce.isIE ? ' ' : '<br data-mce-bogus="1" />';
|
159
170
|
|
160
171
|
return false;
|
161
172
|
}
|
162
173
|
}, 'childNodes');
|
163
174
|
|
164
175
|
cell = cloneNode(cell, false);
|
165
|
-
cell
|
176
|
+
setSpanVal(cell, 'rowSpan', 1);
|
177
|
+
setSpanVal(cell, 'colSpan', 1);
|
166
178
|
|
167
179
|
if (formatNode) {
|
168
180
|
cell.appendChild(formatNode);
|
169
181
|
} else {
|
170
182
|
if (!tinymce.isIE)
|
171
|
-
cell.innerHTML = '<br
|
183
|
+
cell.innerHTML = '<br data-mce-bogus="1" />';
|
172
184
|
}
|
173
185
|
|
174
186
|
return cell;
|
@@ -250,7 +262,8 @@
|
|
250
262
|
rowSpan = getSpanVal(cell, 'rowspan');
|
251
263
|
|
252
264
|
if (colSpan > 1 || rowSpan > 1) {
|
253
|
-
cell
|
265
|
+
setSpanVal(cell, 'rowSpan', 1);
|
266
|
+
setSpanVal(cell, 'colSpan', 1);
|
254
267
|
|
255
268
|
// Insert cells right
|
256
269
|
for (i = 0; i < colSpan - 1; i++)
|
@@ -264,7 +277,7 @@
|
|
264
277
|
};
|
265
278
|
|
266
279
|
function merge(cell, cols, rows) {
|
267
|
-
var startX, startY, endX, endY, x, y, startCell, endCell, cell, children;
|
280
|
+
var startX, startY, endX, endY, x, y, startCell, endCell, cell, children, count;
|
268
281
|
|
269
282
|
// Use specified cell and cols/rows
|
270
283
|
if (cell) {
|
@@ -293,23 +306,34 @@
|
|
293
306
|
|
294
307
|
// Set row/col span to start cell
|
295
308
|
startCell = getCell(startX, startY).elm;
|
296
|
-
startCell
|
297
|
-
startCell
|
309
|
+
setSpanVal(startCell, 'colSpan', (endX - startX) + 1);
|
310
|
+
setSpanVal(startCell, 'rowSpan', (endY - startY) + 1);
|
298
311
|
|
299
312
|
// Remove other cells and add it's contents to the start cell
|
300
313
|
for (y = startY; y <= endY; y++) {
|
301
314
|
for (x = startX; x <= endX; x++) {
|
315
|
+
if (!grid[y] || !grid[y][x])
|
316
|
+
continue;
|
317
|
+
|
302
318
|
cell = grid[y][x].elm;
|
303
319
|
|
304
320
|
if (cell != startCell) {
|
305
321
|
// Move children to startCell
|
306
322
|
children = tinymce.grep(cell.childNodes);
|
307
|
-
each(children, function(node
|
308
|
-
|
309
|
-
if (node.nodeName != 'BR' || i != children.length - 1)
|
310
|
-
startCell.appendChild(node);
|
323
|
+
each(children, function(node) {
|
324
|
+
startCell.appendChild(node);
|
311
325
|
});
|
312
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
|
+
|
313
337
|
// Remove cell
|
314
338
|
dom.remove(cell);
|
315
339
|
}
|
@@ -322,7 +346,7 @@
|
|
322
346
|
};
|
323
347
|
|
324
348
|
function insertRow(before) {
|
325
|
-
var posY, cell, lastCell, x, rowElm, newRow, newCell, otherCell;
|
349
|
+
var posY, cell, lastCell, x, rowElm, newRow, newCell, otherCell, rowSpan;
|
326
350
|
|
327
351
|
// Find first/last row
|
328
352
|
each(grid, function(row, y) {
|
@@ -343,30 +367,35 @@
|
|
343
367
|
});
|
344
368
|
|
345
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
|
+
|
346
374
|
cell = grid[posY][x].elm;
|
347
375
|
|
348
376
|
if (cell != lastCell) {
|
349
377
|
if (!before) {
|
350
378
|
rowSpan = getSpanVal(cell, 'rowspan');
|
351
379
|
if (rowSpan > 1) {
|
352
|
-
cell
|
380
|
+
setSpanVal(cell, 'rowSpan', rowSpan + 1);
|
353
381
|
continue;
|
354
382
|
}
|
355
383
|
} else {
|
356
384
|
// Check if cell above can be expanded
|
357
385
|
if (posY > 0 && grid[posY - 1][x]) {
|
358
386
|
otherCell = grid[posY - 1][x].elm;
|
359
|
-
rowSpan = getSpanVal(otherCell, '
|
387
|
+
rowSpan = getSpanVal(otherCell, 'rowSpan');
|
360
388
|
if (rowSpan > 1) {
|
361
|
-
otherCell
|
389
|
+
setSpanVal(otherCell, 'rowSpan', rowSpan + 1);
|
362
390
|
continue;
|
363
391
|
}
|
364
392
|
}
|
365
393
|
}
|
366
394
|
|
367
395
|
// Insert new cell into new row
|
368
|
-
newCell = cloneCell(cell)
|
369
|
-
newCell
|
396
|
+
newCell = cloneCell(cell);
|
397
|
+
setSpanVal(newCell, 'colSpan', cell.colSpan);
|
398
|
+
|
370
399
|
newRow.appendChild(newCell);
|
371
400
|
|
372
401
|
lastCell = cell;
|
@@ -400,8 +429,12 @@
|
|
400
429
|
});
|
401
430
|
|
402
431
|
each(grid, function(row, y) {
|
403
|
-
var cell
|
432
|
+
var cell, rowSpan, colSpan;
|
404
433
|
|
434
|
+
if (!row[posX])
|
435
|
+
return;
|
436
|
+
|
437
|
+
cell = row[posX].elm;
|
405
438
|
if (cell != lastCell) {
|
406
439
|
colSpan = getSpanVal(cell, 'colspan');
|
407
440
|
rowSpan = getSpanVal(cell, 'rowspan');
|
@@ -415,7 +448,7 @@
|
|
415
448
|
fillLeftDown(posX, y, rowSpan - 1, colSpan);
|
416
449
|
}
|
417
450
|
} else
|
418
|
-
cell.colSpan
|
451
|
+
setSpanVal(cell, 'colSpan', cell.colSpan + 1);
|
419
452
|
|
420
453
|
lastCell = cell;
|
421
454
|
}
|
@@ -432,10 +465,10 @@
|
|
432
465
|
each(grid, function(row) {
|
433
466
|
var cell = row[x].elm, colSpan;
|
434
467
|
|
435
|
-
colSpan = getSpanVal(cell, '
|
468
|
+
colSpan = getSpanVal(cell, 'colSpan');
|
436
469
|
|
437
470
|
if (colSpan > 1)
|
438
|
-
cell
|
471
|
+
setSpanVal(cell, 'colSpan', colSpan - 1);
|
439
472
|
else
|
440
473
|
dom.remove(cell);
|
441
474
|
});
|
@@ -458,10 +491,10 @@
|
|
458
491
|
|
459
492
|
// Move down row spanned cells
|
460
493
|
each(tr.cells, function(cell) {
|
461
|
-
var rowSpan = getSpanVal(cell, '
|
494
|
+
var rowSpan = getSpanVal(cell, 'rowSpan');
|
462
495
|
|
463
496
|
if (rowSpan > 1) {
|
464
|
-
cell
|
497
|
+
setSpanVal(cell, 'rowSpan', rowSpan - 1);
|
465
498
|
pos = getPos(cell);
|
466
499
|
fillLeftDown(pos.x, pos.y, 1, 1);
|
467
500
|
}
|
@@ -475,12 +508,12 @@
|
|
475
508
|
cell = cell.elm;
|
476
509
|
|
477
510
|
if (cell != lastCell) {
|
478
|
-
rowSpan = getSpanVal(cell, '
|
511
|
+
rowSpan = getSpanVal(cell, 'rowSpan');
|
479
512
|
|
480
513
|
if (rowSpan <= 1)
|
481
514
|
dom.remove(cell);
|
482
515
|
else
|
483
|
-
cell
|
516
|
+
setSpanVal(cell, 'rowSpan', rowSpan - 1);
|
484
517
|
|
485
518
|
lastCell = cell;
|
486
519
|
}
|
@@ -548,7 +581,8 @@
|
|
548
581
|
// Remove col/rowspans
|
549
582
|
for (i = 0; i < cellCount; i++) {
|
550
583
|
cell = row.cells[i];
|
551
|
-
cell
|
584
|
+
setSpanVal(cell, 'colSpan', 1);
|
585
|
+
setSpanVal(cell, 'rowSpan', 1);
|
552
586
|
}
|
553
587
|
|
554
588
|
// Needs more cells
|
@@ -690,8 +724,10 @@
|
|
690
724
|
|
691
725
|
// Add new selection
|
692
726
|
for (y = startY; y <= maxY; y++) {
|
693
|
-
for (x = startX; x <= maxX; x++)
|
694
|
-
|
727
|
+
for (x = startX; x <= maxX; x++) {
|
728
|
+
if (grid[y][x])
|
729
|
+
dom.addClass(grid[y][x].elm, 'mceSelected');
|
730
|
+
}
|
695
731
|
}
|
696
732
|
}
|
697
733
|
};
|
@@ -754,11 +790,34 @@
|
|
754
790
|
ed.onClick.add(function(ed, e) {
|
755
791
|
e = e.target;
|
756
792
|
|
757
|
-
if (e.nodeName === 'TABLE')
|
793
|
+
if (e.nodeName === 'TABLE') {
|
758
794
|
ed.selection.select(e);
|
795
|
+
ed.nodeChanged();
|
796
|
+
}
|
759
797
|
});
|
760
798
|
}
|
761
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
|
+
|
762
821
|
// Handle node change updates
|
763
822
|
ed.onNodeChange.add(function(ed, cm, n) {
|
764
823
|
var p;
|
@@ -819,10 +878,14 @@
|
|
819
878
|
// Remove current selection
|
820
879
|
sel = ed.selection.getSel();
|
821
880
|
|
822
|
-
|
823
|
-
sel.removeAllRanges
|
824
|
-
|
825
|
-
|
881
|
+
try {
|
882
|
+
if (sel.removeAllRanges)
|
883
|
+
sel.removeAllRanges();
|
884
|
+
else
|
885
|
+
sel.empty();
|
886
|
+
} catch (ex) {
|
887
|
+
// IE9 might throw errors here
|
888
|
+
}
|
826
889
|
|
827
890
|
e.preventDefault();
|
828
891
|
}
|
@@ -83,8 +83,6 @@ function updateAction() {
|
|
83
83
|
return;
|
84
84
|
}
|
85
85
|
|
86
|
-
ed.execCommand('mceBeginUndoLevel');
|
87
|
-
|
88
86
|
switch (getSelectValue(formObj, 'action')) {
|
89
87
|
case "cell":
|
90
88
|
var celltype = getSelectValue(formObj, 'celltype');
|
@@ -166,15 +164,15 @@ function updateCell(td, skip_id) {
|
|
166
164
|
var dom = ed.dom;
|
167
165
|
|
168
166
|
if (!skip_id)
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
167
|
+
dom.setAttrib(td, 'id', formObj.id.value);
|
168
|
+
|
169
|
+
dom.setAttrib(td, 'align', formObj.align.value);
|
170
|
+
dom.setAttrib(td, 'vAlign', formObj.valign.value);
|
171
|
+
dom.setAttrib(td, 'lang', formObj.lang.value);
|
172
|
+
dom.setAttrib(td, 'dir', getSelectValue(formObj, 'dir'));
|
173
|
+
dom.setAttrib(td, 'style', ed.dom.serializeStyle(ed.dom.parseStyle(formObj.style.value)));
|
174
|
+
dom.setAttrib(td, 'scope', formObj.scope.value);
|
175
|
+
dom.setAttrib(td, 'class', getSelectValue(formObj, 'class'));
|
178
176
|
|
179
177
|
// Clear deprecated attributes
|
180
178
|
ed.dom.setAttrib(td, 'width', '');
|