Version Description
- Table toolbar is hidden or displayed along with the kitchen sink (yay!)
- Minor clean up to code base and files; optimized for WordPress 3.3
Download this release
Release Info
Developer | jakemgold |
Plugin | MCE Table Buttons |
Version | 1.5 |
Comparing to | |
See all releases |
Code changes from version 1.0.4 to 1.5
- mce_table_buttons.php +36 -22
- readme.txt +16 -9
- screenshot-1.png +0 -0
- table-old/cell.htm +0 -183
- table-old/css/cell.css +0 -17
- table-old/css/row.css +0 -25
- table-old/css/table.css +0 -13
- table-old/editor_plugin.js +0 -1
- table-old/js/cell.js +0 -269
- table-old/js/merge_cells.js +0 -29
- table-old/js/row.js +0 -212
- table-old/js/table.js +0 -440
- table-old/langs/en_dlg.js +0 -74
- table-old/merge_cells.htm +0 -37
- table-old/row.htm +0 -160
- table-old/table.htm +0 -192
- table/cell.htm +16 -14
- table/editor_plugin.js +1 -1
- table/editor_plugin_src.js +1364 -0
- table/js/cell.js +44 -11
- table/js/row.js +18 -18
- table/js/table.js +8 -12
- table/langs/en_dlg.js +1 -74
- table/merge_cells.htm +11 -11
- table/row.htm +12 -9
- table/table.htm +54 -53
mce_table_buttons.php
CHANGED
@@ -2,10 +2,10 @@
|
|
2 |
/**
|
3 |
Plugin Name: MCE Table Buttons
|
4 |
Plugin URI: http://www.get10up.com/plugins-modules/wordpress-mce-table-buttons/
|
5 |
-
Description: Add <strong>buttons for table editing</strong> to the WordPress WYSIWYG editor with this
|
6 |
-
Version: 1.
|
7 |
-
Author: Jake Goldman
|
8 |
-
Author URI: http://
|
9 |
|
10 |
Plugin: Copyright 2011 Jake Goldman (email : jake@get10up.com)
|
11 |
|
@@ -22,40 +22,54 @@
|
|
22 |
You should have received a copy of the GNU General Public License
|
23 |
along with this program; if not, write to the Free Software
|
24 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
|
|
|
|
|
25 |
*/
|
26 |
|
27 |
-
class
|
28 |
-
{
|
29 |
-
function __construct()
|
30 |
-
{
|
31 |
add_action( 'admin_init', array( $this, 'admin_init' ) );
|
32 |
add_action( 'content_save_pre', array( $this, 'content_save_pre'), 100 );
|
|
|
33 |
}
|
34 |
|
35 |
-
function admin_init()
|
36 |
-
{
|
37 |
add_filter( 'mce_external_plugins', array( $this, 'mce_external_plugins' ) );
|
38 |
add_filter( 'mce_buttons_3', array( $this, 'mce_buttons_3' ) );
|
39 |
}
|
40 |
|
41 |
-
function mce_external_plugins( $plugin_array )
|
42 |
-
|
43 |
-
if ( get_option('db_version') < 17056 ) // 17056 is WordPress 3.1
|
44 |
-
$plugin_array['table'] = plugin_dir_url( __FILE__ ) . 'table-old/editor_plugin.js';
|
45 |
-
else
|
46 |
-
$plugin_array['table'] = plugin_dir_url( __FILE__ ) . 'table/editor_plugin.js';
|
47 |
-
|
48 |
return $plugin_array;
|
49 |
}
|
50 |
|
51 |
-
function mce_buttons_3( $buttons )
|
52 |
-
{
|
53 |
array_push( $buttons, 'tablecontrols' );
|
54 |
return $buttons;
|
55 |
}
|
56 |
|
57 |
-
function
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
if ( substr( $content, -8 ) == '</table>' )
|
60 |
$content = $content . "\n<br />";
|
61 |
|
@@ -63,4 +77,4 @@ class mce_table_buttons
|
|
63 |
}
|
64 |
}
|
65 |
|
66 |
-
$mce_table_buttons = new
|
2 |
/**
|
3 |
Plugin Name: MCE Table Buttons
|
4 |
Plugin URI: http://www.get10up.com/plugins-modules/wordpress-mce-table-buttons/
|
5 |
+
Description: Add <strong>buttons for table editing</strong> to the WordPress WYSIWYG editor with this <strong>light weight</strong> plug-in.
|
6 |
+
Version: 1.5
|
7 |
+
Author: Jake Goldman (10up LLC)
|
8 |
+
Author URI: http://get10up.com
|
9 |
|
10 |
Plugin: Copyright 2011 Jake Goldman (email : jake@get10up.com)
|
11 |
|
22 |
You should have received a copy of the GNU General Public License
|
23 |
along with this program; if not, write to the Free Software
|
24 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
25 |
+
|
26 |
+
NOTE: Previous versions may have had their copyright incorrectly attributed
|
27 |
+
to employers of Mr. Goldman. The copyright belongs solely to Mr. Goldman,
|
28 |
+
personally.
|
29 |
*/
|
30 |
|
31 |
+
class MCE_Table_Buttons {
|
32 |
+
public function __construct() {
|
|
|
|
|
33 |
add_action( 'admin_init', array( $this, 'admin_init' ) );
|
34 |
add_action( 'content_save_pre', array( $this, 'content_save_pre'), 100 );
|
35 |
+
add_action( 'admin_footer', array( $this, 'admin_footer' ), 100 );
|
36 |
}
|
37 |
|
38 |
+
public function admin_init() {
|
|
|
39 |
add_filter( 'mce_external_plugins', array( $this, 'mce_external_plugins' ) );
|
40 |
add_filter( 'mce_buttons_3', array( $this, 'mce_buttons_3' ) );
|
41 |
}
|
42 |
|
43 |
+
public function mce_external_plugins( $plugin_array ) {
|
44 |
+
$plugin_array['table'] = plugin_dir_url( __FILE__ ) . 'table/editor_plugin.js';
|
|
|
|
|
|
|
|
|
|
|
45 |
return $plugin_array;
|
46 |
}
|
47 |
|
48 |
+
public function mce_buttons_3( $buttons ) {
|
|
|
49 |
array_push( $buttons, 'tablecontrols' );
|
50 |
return $buttons;
|
51 |
}
|
52 |
|
53 |
+
public function admin_footer() {
|
54 |
+
if ( ! wp_script_is( 'editor' ) )
|
55 |
+
return;
|
56 |
+
?>
|
57 |
+
<script type="text/javascript">
|
58 |
+
jQuery(window).load(function(){
|
59 |
+
jQuery('.mceToolbarRow2').each(function(){
|
60 |
+
if(!jQuery(this).is(':visible')) jQuery(this).siblings('.mceToolbarRow3').hide();
|
61 |
+
});
|
62 |
+
jQuery('.mce_wp_adv').click(function(){
|
63 |
+
var toolbar3 = jQuery(this).closest('table').siblings('.mceToolbarRow3');
|
64 |
+
if ( jQuery(this).hasClass('mceButtonActive') ) toolbar3.show();
|
65 |
+
else toolbar3.hide();
|
66 |
+
});
|
67 |
+
});
|
68 |
+
</script>
|
69 |
+
<?php
|
70 |
+
}
|
71 |
+
|
72 |
+
public function content_save_pre( $content ) {
|
73 |
if ( substr( $content, -8 ) == '</table>' )
|
74 |
$content = $content . "\n<br />";
|
75 |
|
77 |
}
|
78 |
}
|
79 |
|
80 |
+
$mce_table_buttons = new MCE_Table_Buttons;
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== MCE Table Buttons ===
|
2 |
-
Contributors: jakemgold, thinkoomph
|
3 |
Donate link: http://www.get10up.com/plugins-modules/wordpress-mce-table-buttons/
|
4 |
Tags: tables, table, editor, WYSIWYG, buttons, tinymce
|
5 |
-
Requires at least:
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag: 1.
|
8 |
|
9 |
Adds table editing buttons to a new, third row in the WordPress WYSIWYG editor.
|
10 |
|
@@ -12,10 +12,9 @@ Adds table editing buttons to a new, third row in the WordPress WYSIWYG editor.
|
|
12 |
|
13 |
Adds table editing buttons to a new, third row in the WordPress WYSIWYG editor.
|
14 |
|
15 |
-
A very light weight plug-in based on a slightly modified version of the table editor plug-in included with the full version of TinyMCE
|
16 |
-
|
17 |
-
Hoping to add the ability to hide the new table editing toolbar with the "kitchen sink" option in a future update.
|
18 |
|
|
|
19 |
|
20 |
== Installation ==
|
21 |
|
@@ -23,13 +22,16 @@ Hoping to add the ability to hide the new table editing toolbar with the "kitche
|
|
23 |
`mce-table-buttons` to the `/wp-content/plugins/` directory
|
24 |
1. Activate the plugin through the 'Plugins' menu in WordPress
|
25 |
|
26 |
-
|
27 |
== Screenshots ==
|
28 |
|
29 |
1. The editor with the new table editing controls.
|
30 |
|
31 |
== Changelog ==
|
32 |
|
|
|
|
|
|
|
|
|
33 |
= 1.0.4 =
|
34 |
* Updated TinyMCE table plug-in to corresponding TinyMCE update in WordPress 3.1 (still supports <3.1 too)
|
35 |
|
@@ -44,4 +46,9 @@ Hoping to add the ability to hide the new table editing toolbar with the "kitche
|
|
44 |
* Minor code clean up
|
45 |
|
46 |
= 1.0.1 =
|
47 |
-
* Fixed issue with WebKit browsers (Safari and Chrome) - TinyMCE bug
|
|
|
|
|
|
|
|
|
|
1 |
=== MCE Table Buttons ===
|
2 |
+
Contributors: jakemgold, 10up, thinkoomph
|
3 |
Donate link: http://www.get10up.com/plugins-modules/wordpress-mce-table-buttons/
|
4 |
Tags: tables, table, editor, WYSIWYG, buttons, tinymce
|
5 |
+
Requires at least: 3.3
|
6 |
+
Tested up to: 3.3
|
7 |
+
Stable tag: 1.5
|
8 |
|
9 |
Adds table editing buttons to a new, third row in the WordPress WYSIWYG editor.
|
10 |
|
12 |
|
13 |
Adds table editing buttons to a new, third row in the WordPress WYSIWYG editor.
|
14 |
|
15 |
+
A very light weight plug-in based on a slightly modified version of the table editor plug-in included with the full version of TinyMCE. Only includes English localization; please let us know if you would like additional localizations added. Note that this should not be used with other plug-ins that significantly alter the editor's default behavior. It is intended to be a simple, light weight solution for editors who only want to add table management to WordPress' included editor.
|
|
|
|
|
16 |
|
17 |
+
The third, editor toolbar is hidden or displayed along with the "kitchen sink."
|
18 |
|
19 |
== Installation ==
|
20 |
|
22 |
`mce-table-buttons` to the `/wp-content/plugins/` directory
|
23 |
1. Activate the plugin through the 'Plugins' menu in WordPress
|
24 |
|
|
|
25 |
== Screenshots ==
|
26 |
|
27 |
1. The editor with the new table editing controls.
|
28 |
|
29 |
== Changelog ==
|
30 |
|
31 |
+
= 1.5 =
|
32 |
+
* Table toolbar is hidden or displayed along with the kitchen sink (yay!)
|
33 |
+
* Minor clean up to code base and files; optimized for WordPress 3.3
|
34 |
+
|
35 |
= 1.0.4 =
|
36 |
* Updated TinyMCE table plug-in to corresponding TinyMCE update in WordPress 3.1 (still supports <3.1 too)
|
37 |
|
46 |
* Minor code clean up
|
47 |
|
48 |
= 1.0.1 =
|
49 |
+
* Fixed issue with WebKit browsers (Safari and Chrome) - TinyMCE bug
|
50 |
+
|
51 |
+
== Upgrade Notice ==
|
52 |
+
|
53 |
+
= 1.5 =
|
54 |
+
REQUIRES WordPress 3.3 or higher. Finally links table buttons row to kitchen sink!
|
screenshot-1.png
CHANGED
Binary file
|
table-old/cell.htm
DELETED
@@ -1,183 +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="../../../../wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
6 |
-
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/mctabs.js"></script>
|
7 |
-
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/form_utils.js"></script>
|
8 |
-
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/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">
|
13 |
-
<form onsubmit="updateAction();return false;" action="#">
|
14 |
-
<div class="tabs">
|
15 |
-
<ul>
|
16 |
-
<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#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>
|
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 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 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 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>
|
137 |
-
<td class="column1"><label for="bordercolor">{#table_dlg.bordercolor}</label></td>
|
138 |
-
<td>
|
139 |
-
<table 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>
|
149 |
-
<td class="column1"><label for="bgcolor">{#table_dlg.bgcolor}</label></td>
|
150 |
-
<td>
|
151 |
-
<table 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 |
-
<div style="float: left">
|
174 |
-
<div><input type="submit" id="insert" name="insert" value="{#update}" /></div>
|
175 |
-
</div>
|
176 |
-
|
177 |
-
<div style="float: right">
|
178 |
-
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
179 |
-
</div>
|
180 |
-
</div>
|
181 |
-
</form>
|
182 |
-
</body>
|
183 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
table-old/css/cell.css
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
/* CSS file for cell 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 |
-
#class {
|
16 |
-
width: 150px;
|
17 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
table-old/css/row.css
DELETED
@@ -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 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
table-old/css/table.css
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
/* CSS file for table dialog in the table plugin */
|
2 |
-
|
3 |
-
.panel_wrapper div.current {
|
4 |
-
height: 245px;
|
5 |
-
}
|
6 |
-
|
7 |
-
.advfield {
|
8 |
-
width: 200px;
|
9 |
-
}
|
10 |
-
|
11 |
-
#class {
|
12 |
-
width: 150px;
|
13 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
table-old/editor_plugin.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
(function(){var b=tinymce.each;function a(d,e){var f=e.ownerDocument,c=f.createRange(),g;c.setStartBefore(e);c.setEnd(d.endContainer,d.endOffset);g=f.createElement("body");g.appendChild(c.cloneContents());return g.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi,"-").replace(/<[^>]+>/g,"").length==0}tinymce.create("tinymce.plugins.TablePlugin",{init:function(c,d){var e=this;e.editor=c;e.url=d;b([["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(f){c.addButton(f[0],{title:f[1],cmd:f[2],ui:f[3]})});if(c.getParam("inline_styles")){c.onPreProcess.add(function(f,h){var g=f.dom;b(g.select("table",h.node),function(j){var i;if(i=g.getAttrib(j,"width")){g.setStyle(j,"width",i);g.setAttrib(j,"width")}if(i=g.getAttrib(j,"height")){g.setStyle(j,"height",i);g.setAttrib(j,"height")}})})}c.onInit.add(function(){if(!tinymce.isIE&&c.getParam("forced_root_block")){function f(){var g=c.getBody().lastChild;if(g&&g.nodeName=="TABLE"){c.dom.add(c.getBody(),"p",null,'<br mce_bogus="1" />')}}if(tinymce.isGecko){c.onKeyDown.add(function(h,j){var g,i,k=h.dom;if(j.keyCode==37||j.keyCode==38){g=h.selection.getRng();i=k.getParent(g.startContainer,"table");if(i&&h.getBody().firstChild==i){if(a(g,i)){g=k.createRng();g.setStartBefore(i);g.setEndBefore(i);h.selection.setRng(g);j.preventDefault()}}}})}c.onKeyUp.add(f);c.onSetContent.add(f);c.onVisualAid.add(f);c.onPreProcess.add(function(g,i){var h=i.node.lastChild;if(h&&h.childNodes.length==1&&h.firstChild.nodeName=="BR"){g.dom.remove(h)}});f()}if(c&&c.plugins.contextmenu){c.plugins.contextmenu.onContextMenu.add(function(i,g,k){var l,j=c.selection,h=j.getNode()||c.getBody();if(c.dom.getParent(k,"td")||c.dom.getParent(k,"th")){g.removeAll();if(h.nodeName=="A"&&!c.dom.getAttrib(h,"name")){g.add({title:"advanced.link_desc",icon:"link",cmd:c.plugins.advlink?"mceAdvLink":"mceLink",ui:true});g.add({title:"advanced.unlink_desc",icon:"unlink",cmd:"UnLink"});g.addSeparator()}if(h.nodeName=="IMG"&&h.className.indexOf("mceItem")==-1){g.add({title:"advanced.image_desc",icon:"image",cmd:c.plugins.advimage?"mceAdvImage":"mceImage",ui:true});g.addSeparator()}g.add({title:"table.desc",icon:"table",cmd:"mceInsertTable",ui:true,value:{action:"insert"}});g.add({title:"table.props_desc",icon:"table_props",cmd:"mceInsertTable",ui:true});g.add({title:"table.del",icon:"delete_table",cmd:"mceTableDelete",ui:true});g.addSeparator();l=g.addMenu({title:"table.cell"});l.add({title:"table.cell_desc",icon:"cell_props",cmd:"mceTableCellProps",ui:true});l.add({title:"table.split_cells_desc",icon:"split_cells",cmd:"mceTableSplitCells",ui:true});l.add({title:"table.merge_cells_desc",icon:"merge_cells",cmd:"mceTableMergeCells",ui:true});l=g.addMenu({title:"table.row"});l.add({title:"table.row_desc",icon:"row_props",cmd:"mceTableRowProps",ui:true});l.add({title:"table.row_before_desc",icon:"row_before",cmd:"mceTableInsertRowBefore"});l.add({title:"table.row_after_desc",icon:"row_after",cmd:"mceTableInsertRowAfter"});l.add({title:"table.delete_row_desc",icon:"delete_row",cmd:"mceTableDeleteRow"});l.addSeparator();l.add({title:"table.cut_row_desc",icon:"cut",cmd:"mceTableCutRow"});l.add({title:"table.copy_row_desc",icon:"copy",cmd:"mceTableCopyRow"});l.add({title:"table.paste_row_before_desc",icon:"paste",cmd:"mceTablePasteRowBefore"});l.add({title:"table.paste_row_after_desc",icon:"paste",cmd:"mceTablePasteRowAfter"});l=g.addMenu({title:"table.col"});l.add({title:"table.col_before_desc",icon:"col_before",cmd:"mceTableInsertColBefore"});l.add({title:"table.col_after_desc",icon:"col_after",cmd:"mceTableInsertColAfter"});l.add({title:"table.delete_col_desc",icon:"delete_col",cmd:"mceTableDeleteCol"})}else{g.add({title:"table.desc",icon:"table",cmd:"mceInsertTable",ui:true})}})}});c.onKeyDown.add(function(f,g){if(g.keyCode==9&&f.dom.getParent(f.selection.getNode(),"TABLE")){if(!tinymce.isGecko&&!tinymce.isOpera){tinyMCE.execInstanceCommand(f.editorId,"mceTableMoveToNextRow",true);return tinymce.dom.Event.cancel(g)}f.undoManager.add()}});if(!tinymce.isIE){if(c.getParam("table_selection",true)){c.onClick.add(function(f,g){g=g.target;if(g.nodeName==="TABLE"){f.selection.select(g)}})}}c.onNodeChange.add(function(g,f,i){var h=g.dom.getParent(i,"td,th,caption");f.setActive("table",i.nodeName==="TABLE"||!!h);if(h&&h.nodeName==="CAPTION"){h=null}f.setDisabled("delete_table",!h);f.setDisabled("delete_col",!h);f.setDisabled("delete_table",!h);f.setDisabled("delete_row",!h);f.setDisabled("col_after",!h);f.setDisabled("col_before",!h);f.setDisabled("row_after",!h);f.setDisabled("row_before",!h);f.setDisabled("row_props",!h);f.setDisabled("cell_props",!h);f.setDisabled("split_cells",!h||(parseInt(g.dom.getAttrib(h,"colspan","1"))<2&&parseInt(g.dom.getAttrib(h,"rowspan","1"))<2));f.setDisabled("merge_cells",!h)});if(!tinymce.isIE){c.onBeforeSetContent.add(function(f,g){if(g.initial){g.content=g.content.replace(/<(td|th)([^>]+|)>\s*<\/(td|th)>/g,tinymce.isOpera?"<$1$2> </$1>":'<$1$2><br mce_bogus="1" /></$1>')}})}},execCommand:function(f,e,g){var d=this.editor,c;switch(f){case"mceTableMoveToNextRow":case"mceInsertTable":case"mceTableRowProps":case"mceTableCellProps":case"mceTableSplitCells":case"mceTableMergeCells":case"mceTableInsertRowBefore":case"mceTableInsertRowAfter":case"mceTableDeleteRow":case"mceTableInsertColBefore":case"mceTableInsertColAfter":case"mceTableDeleteCol":case"mceTableCutRow":case"mceTableCopyRow":case"mceTablePasteRowBefore":case"mceTablePasteRowAfter":case"mceTableDelete":d.execCommand("mceBeginUndoLevel");this._doExecCommand(f,e,g);d.execCommand("mceEndUndoLevel");return true}return false},getInfo:function(){return{longname:"Tables",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/table",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_doExecCommand:function(s,aa,af){var W=this.editor,av=W,h=this.url;var o=W.selection.getNode();var X=W.dom.getParent(o,"tr");var ar=W.dom.getParent(o,"td,th");var G=W.dom.getParent(o,"table");var l=W.contentWindow.document;var aw=G?G.getAttribute("border"):"";if(X&&ar==null){ar=X.cells[0]}function aq(y,x){for(var ay=0;ay<y.length;ay++){if(y[ay].length>0&&aq(y[ay],x)){return true}if(y[ay]==x){return true}}return false}function ak(x,i){var y;ae=f(G);x=x||0;i=i||0;x=Math.max(p.cellindex+x,0);i=Math.max(p.rowindex+i,0);W.execCommand("mceRepaint");y=e(ae,i,x);if(y){W.selection.select(y.firstChild||y);W.selection.collapse(1)}}function ai(){var i=l.createElement("td");if(!tinymce.isIE){i.innerHTML='<br mce_bogus="1"/>'}}function k(y){var x=W.dom.getAttrib(y,"colspan");var i=W.dom.getAttrib(y,"rowspan");x=x==""?1:parseInt(x);i=i==""?1:parseInt(i);return{colspan:x,rowspan:i}}function am(ay,aA){var i,az;for(az=0;az<ay.length;az++){for(i=0;i<ay[az].length;i++){if(ay[az][i]==aA){return{cellindex:i,rowindex:az}}}}return null}function e(x,y,i){if(x[y]&&x[y][i]){return x[y][i]}return null}function B(aD,ay){var aA=[],y=0,aB,az,ay,aC;for(aB=0;aB<aD.rows.length;aB++){for(az=0;az<aD.rows[aB].cells.length;az++,y++){aA[y]=aD.rows[aB].cells[az]}}for(aB=0;aB<aA.length;aB++){if(aA[aB]==ay){if(aC=aA[aB+1]){return aC}}}}function f(aF){var i=[],aG=aF.rows,aD,aC,az,aA,aE,ay,aB;for(aC=0;aC<aG.length;aC++){for(aD=0;aD<aG[aC].cells.length;aD++){az=aG[aC].cells[aD];aA=k(az);for(aE=aD;i[aC]&&i[aC][aE];aE++){}for(aB=aC;aB<aC+aA.rowspan;aB++){if(!i[aB]){i[aB]=[]}for(ay=aE;ay<aE+aA.colspan;ay++){i[aB][ay]=az}}}}return i}function n(aH,aE,az,ay){var y=f(aH),aG=am(y,az);var aI,aD;if(ay.cells.length!=aE.childNodes.length){aI=aE.childNodes;aD=null;for(var aF=0;az=e(y,aG.rowindex,aF);aF++){var aB=true;var aC=k(az);if(aq(aI,az)){ay.childNodes[aF]._delete=true}else{if((aD==null||az!=aD)&&aC.colspan>1){for(var aA=aF;aA<aF+az.colSpan;aA++){ay.childNodes[aA]._delete=true}}}if((aD==null||az!=aD)&&aC.rowspan>1){az.rowSpan=aC.rowspan+1}aD=az}C(G)}}function P(x,i){while((x=x.previousSibling)!=null){if(x.nodeName==i){return x}}return null}function ag(ay,az){var x=az.split(",");while((ay=ay.nextSibling)!=null){for(var y=0;y<x.length;y++){if(ay.nodeName.toLowerCase()==x[y].toLowerCase()){return ay}}}return null}function C(ay){if(ay.rows==0){return}var y=ay.rows[0];do{var x=ag(y,"TR");if(y._delete){y.parentNode.removeChild(y);continue}var az=y.cells[0];if(az.cells>1){do{var i=ag(az,"TD,TH");if(az._delete){az.parentNode.removeChild(az)}}while((az=i)!=null)}}while((y=x)!=null)}function q(ay,aB,aA){ay.rowSpan=1;var x=ag(aB,"TR");for(var az=1;az<aA&&x;az++){var y=l.createElement("td");if(!tinymce.isIE){y.innerHTML='<br mce_bogus="1"/>'}if(tinymce.isIE){x.insertBefore(y,x.cells(ay.cellIndex))}else{x.insertBefore(y,x.cells[ay.cellIndex])}x=ag(x,"TR")}}function T(aG,aI,aC){var y=f(aI);var ay=aC.cloneNode(false);var aH=am(y,aC.cells[0]);var aD=null;var aB=W.dom.getAttrib(aI,"border");var aA=null;for(var aF=0;aA=e(y,aH.rowindex,aF);aF++){var aE=null;if(aD!=aA){for(var az=0;az<aC.cells.length;az++){if(aA==aC.cells[az]){aE=aA.cloneNode(true);break}}}if(aE==null){aE=aG.createElement("td");if(!tinymce.isIE){aE.innerHTML='<br mce_bogus="1"/>'}}aE.colSpan=1;aE.rowSpan=1;ay.appendChild(aE);aD=aA}return ay}switch(s){case"mceTableMoveToNextRow":var M=B(G,ar);if(!M){W.execCommand("mceTableInsertRowAfter",ar);M=B(G,ar)}W.selection.select(M);W.selection.collapse(true);return true;case"mceTableRowProps":if(X==null){return true}if(aa){W.windowManager.open({url:h+"/row.htm",width:400+parseInt(W.getLang("table.rowprops_delta_width",0)),height:295+parseInt(W.getLang("table.rowprops_delta_height",0)),inline:1},{plugin_url:h})}return true;case"mceTableCellProps":if(ar==null){return true}if(aa){W.windowManager.open({url:h+"/cell.htm",width:400+parseInt(W.getLang("table.cellprops_delta_width",0)),height:295+parseInt(W.getLang("table.cellprops_delta_height",0)),inline:1},{plugin_url:h})}return true;case"mceInsertTable":if(aa){W.windowManager.open({url:h+"/table.htm",width:400+parseInt(W.getLang("table.table_delta_width",0)),height:320+parseInt(W.getLang("table.table_delta_height",0)),inline:1},{plugin_url:h,action:af?af.action:0})}return true;case"mceTableDelete":var H=W.dom.getParent(W.selection.getNode(),"table");if(H){H.parentNode.removeChild(H);W.execCommand("mceRepaint")}return true;case"mceTableSplitCells":case"mceTableMergeCells":case"mceTableInsertRowBefore":case"mceTableInsertRowAfter":case"mceTableDeleteRow":case"mceTableInsertColBefore":case"mceTableInsertColAfter":case"mceTableDeleteCol":case"mceTableCutRow":case"mceTableCopyRow":case"mceTablePasteRowBefore":case"mceTablePasteRowAfter":if(!G){return true}if(X&&G!=X.parentNode){G=X.parentNode}if(G&&X){switch(s){case"mceTableCutRow":if(!X||!ar){return true}W.tableRowClipboard=T(l,G,X);W.execCommand("mceTableDeleteRow");break;case"mceTableCopyRow":if(!X||!ar){return true}W.tableRowClipboard=T(l,G,X);break;case"mceTablePasteRowBefore":if(!X||!ar){return true}var w=W.tableRowClipboard.cloneNode(true);var j=P(X,"TR");if(j!=null){n(G,j,j.cells[0],w)}X.parentNode.insertBefore(w,X);break;case"mceTablePasteRowAfter":if(!X||!ar){return true}var Y=ag(X,"TR");var w=W.tableRowClipboard.cloneNode(true);n(G,X,ar,w);if(Y==null){X.parentNode.appendChild(w)}else{Y.parentNode.insertBefore(w,Y)}break;case"mceTableInsertRowBefore":if(!X||!ar){return true}var ae=f(G);var p=am(ae,ar);var w=l.createElement("tr");var v=null;p.rowindex--;if(p.rowindex<0){p.rowindex=0}for(var ad=0;ar=e(ae,p.rowindex,ad);ad++){if(ar!=v){var F=k(ar);if(F.rowspan==1){var K=l.createElement("td");if(!tinymce.isIE){K.innerHTML='<br mce_bogus="1"/>'}K.colSpan=ar.colSpan;w.appendChild(K)}else{ar.rowSpan=F.rowspan+1}v=ar}}X.parentNode.insertBefore(w,X);ak(0,1);break;case"mceTableInsertRowAfter":if(!X||!ar){return true}var ae=f(G);var p=am(ae,ar);var w=l.createElement("tr");var v=null;for(var ad=0;ar=e(ae,p.rowindex,ad);ad++){if(ar!=v){var F=k(ar);if(F.rowspan==1){var K=l.createElement("td");if(!tinymce.isIE){K.innerHTML='<br mce_bogus="1"/>'}K.colSpan=ar.colSpan;w.appendChild(K)}else{ar.rowSpan=F.rowspan+1}v=ar}}if(w.hasChildNodes()){var Y=ag(X,"TR");if(Y){Y.parentNode.insertBefore(w,Y)}else{G.appendChild(w)}}ak(0,1);break;case"mceTableDeleteRow":if(!X||!ar){return true}var ae=f(G);var p=am(ae,ar);if(ae.length==1&&G.nodeName=="TBODY"){W.dom.remove(W.dom.getParent(G,"table"));return true}var E=X.cells;var Y=ag(X,"TR");for(var ad=0;ad<E.length;ad++){if(E[ad].rowSpan>1){var K=E[ad].cloneNode(true);var F=k(E[ad]);K.rowSpan=F.rowspan-1;var al=Y.cells[ad];if(al==null){Y.appendChild(K)}else{Y.insertBefore(K,al)}}}var v=null;for(var ad=0;ar=e(ae,p.rowindex,ad);ad++){if(ar!=v){var F=k(ar);if(F.rowspan>1){ar.rowSpan=F.rowspan-1}else{X=ar.parentNode;if(X.parentNode){X._delete=true}}v=ar}}C(G);ak(0,-1);break;case"mceTableInsertColBefore":if(!X||!ar){return true}var ae=f(W.dom.getParent(G,"table"));var p=am(ae,ar);var v=null;for(var ab=0;ar=e(ae,ab,p.cellindex);ab++){if(ar!=v){var F=k(ar);if(F.colspan==1){var K=l.createElement(ar.nodeName);if(!tinymce.isIE){K.innerHTML='<br mce_bogus="1"/>'}K.rowSpan=ar.rowSpan;ar.parentNode.insertBefore(K,ar)}else{ar.colSpan++}v=ar}}ak();break;case"mceTableInsertColAfter":if(!X||!ar){return true}var ae=f(W.dom.getParent(G,"table"));var p=am(ae,ar);var v=null;for(var ab=0;ar=e(ae,ab,p.cellindex);ab++){if(ar!=v){var F=k(ar);if(F.colspan==1){var K=l.createElement(ar.nodeName);if(!tinymce.isIE){K.innerHTML='<br mce_bogus="1"/>'}K.rowSpan=ar.rowSpan;var al=ag(ar,"TD,TH");if(al==null){ar.parentNode.appendChild(K)}else{al.parentNode.insertBefore(K,al)}}else{ar.colSpan++}v=ar}}ak(1);break;case"mceTableDeleteCol":if(!X||!ar){return true}var ae=f(G);var p=am(ae,ar);var v=null;if((ae.length>1&&ae[0].length<=1)&&G.nodeName=="TBODY"){W.dom.remove(W.dom.getParent(G,"table"));return true}for(var ab=0;ar=e(ae,ab,p.cellindex);ab++){if(ar!=v){var F=k(ar);if(F.colspan>1){ar.colSpan=F.colspan-1}else{if(ar.parentNode){ar.parentNode.removeChild(ar)}}v=ar}}ak(-1);break;case"mceTableSplitCells":if(!X||!ar){return true}var m=k(ar);var D=m.colspan;var I=m.rowspan;if(D>1||I>1){ar.colSpan=1;for(var an=1;an<D;an++){var K=l.createElement("td");if(!tinymce.isIE){K.innerHTML='<br mce_bogus="1"/>'}X.insertBefore(K,ag(ar,"TD,TH"));if(I>1){q(K,X,I)}}q(ar,X,I)}G=W.dom.getParent(W.selection.getNode(),"table");break;case"mceTableMergeCells":var ap=[];var S=W.selection.getSel();var ae=f(G);if(tinymce.isIE||S.rangeCount==1){if(aa){var u=k(ar);W.windowManager.open({url:h+"/merge_cells.htm",width:240+parseInt(W.getLang("table.merge_cells_delta_width",0)),height:110+parseInt(W.getLang("table.merge_cells_delta_height",0)),inline:1},{action:"update",numcols:u.colspan,numrows:u.rowspan,plugin_url:h});return true}else{var V=parseInt(af.numrows);var d=parseInt(af.numcols);var p=am(ae,ar);if((""+V)=="NaN"){V=1}if((""+d)=="NaN"){d=1}var c=G.rows;for(var ab=p.rowindex;ab<ae.length;ab++){var ah=[];for(var ad=p.cellindex;ad<ae[ab].length;ad++){var g=e(ae,ab,ad);if(g&&!aq(ap,g)&&!aq(ah,g)){var O=am(ae,g);if(O.cellindex<p.cellindex+d&&O.rowindex<p.rowindex+V){ah[ah.length]=g}}}if(ah.length>0){ap[ap.length]=ah}var g=e(ae,p.rowindex,p.cellindex);b(av.dom.select("br",g),function(y,x){if(x>0&&av.dom.getAttrib("mce_bogus")){av.dom.remove(y)}})}}}else{var E=[];var S=W.selection.getSel();var Z=null;var ao=null;var A=-1,ax=-1,z,au;if(S.rangeCount<2){return true}for(var an=0;an<S.rangeCount;an++){var aj=S.getRangeAt(an);var ar=aj.startContainer.childNodes[aj.startOffset];if(!ar){break}if(ar.nodeName=="TD"||ar.nodeName=="TH"){E[E.length]=ar}}var c=G.rows;for(var ab=0;ab<c.length;ab++){var ah=[];for(var ad=0;ad<c[ab].cells.length;ad++){var g=c[ab].cells[ad];for(var an=0;an<E.length;an++){if(g==E[an]){ah[ah.length]=g}}}if(ah.length>0){ap[ap.length]=ah}}var ao=[];var Z=null;for(var ab=0;ab<ae.length;ab++){for(var ad=0;ad<ae[ab].length;ad++){ae[ab][ad]._selected=false;for(var an=0;an<E.length;an++){if(ae[ab][ad]==E[an]){if(A==-1){A=ad;ax=ab}z=ad;au=ab;ae[ab][ad]._selected=true}}}}for(var ab=ax;ab<=au;ab++){for(var ad=A;ad<=z;ad++){if(!ae[ab][ad]._selected){alert("Invalid selection for merge.");return true}}}}var t=1,r=1;var U=-1;for(var ab=0;ab<ap.length;ab++){var J=0;for(var ad=0;ad<ap[ab].length;ad++){var F=k(ap[ab][ad]);J+=F.colspan;if(U!=-1&&F.rowspan!=U){alert("Invalid selection for merge.");return true}U=F.rowspan}if(J>r){r=J}U=-1}var R=-1;for(var ad=0;ad<ap[0].length;ad++){var N=0;for(var ab=0;ab<ap.length;ab++){var F=k(ap[ab][ad]);N+=F.rowspan;if(R!=-1&&F.colspan!=R){alert("Invalid selection for merge.");return true}R=F.colspan}if(N>t){t=N}R=-1}ar=ap[0][0];ar.rowSpan=t;ar.colSpan=r;for(var ab=0;ab<ap.length;ab++){for(var ad=0;ad<ap[ab].length;ad++){var Q=ap[ab][ad].innerHTML;var L=Q.replace(/[ \t\r\n]/g,"");if(L!="<br/>"&&L!="<br>"&&L!='<br mce_bogus="1"/>'&&(ad+ab>0)){ar.innerHTML+=Q}if(ap[ab][ad]!=ar&&!ap[ab][ad]._deleted){var p=am(ae,ap[ab][ad]);var at=ap[ab][ad].parentNode;at.removeChild(ap[ab][ad]);ap[ab][ad]._deleted=true;if(!at.hasChildNodes()){at.parentNode.removeChild(at);var ac=null;for(var ad=0;cellElm=e(ae,p.rowindex,ad);ad++){if(cellElm!=ac&&cellElm.rowSpan>1){cellElm.rowSpan--}ac=cellElm}if(ar.rowSpan>1){ar.rowSpan--}}}}}b(av.dom.select("br",ar),function(y,x){if(x>0&&av.dom.getAttrib(y,"mce_bogus")){av.dom.remove(y)}});break}G=W.dom.getParent(W.selection.getNode(),"table");W.addVisual(G);W.nodeChanged()}return true}return false}});tinymce.PluginManager.add("table",tinymce.plugins.TablePlugin)})();
|
|
table-old/js/cell.js
DELETED
@@ -1,269 +0,0 @@
|
|
1 |
-
tinyMCEPopup.requireLangPack();
|
2 |
-
|
3 |
-
var ed;
|
4 |
-
|
5 |
-
function init() {
|
6 |
-
ed = tinyMCEPopup.editor;
|
7 |
-
tinyMCEPopup.resizeToInnerSize();
|
8 |
-
|
9 |
-
document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table');
|
10 |
-
document.getElementById('bordercolor_pickcontainer').innerHTML = getColorPickerHTML('bordercolor_pick','bordercolor');
|
11 |
-
document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor')
|
12 |
-
|
13 |
-
var inst = ed;
|
14 |
-
var tdElm = ed.dom.getParent(ed.selection.getNode(), "td,th");
|
15 |
-
var formObj = document.forms[0];
|
16 |
-
var st = ed.dom.parseStyle(ed.dom.getAttrib(tdElm, "style"));
|
17 |
-
|
18 |
-
// Get table cell data
|
19 |
-
var celltype = tdElm.nodeName.toLowerCase();
|
20 |
-
var align = ed.dom.getAttrib(tdElm, 'align');
|
21 |
-
var valign = ed.dom.getAttrib(tdElm, 'valign');
|
22 |
-
var width = trimSize(getStyle(tdElm, 'width', 'width'));
|
23 |
-
var height = trimSize(getStyle(tdElm, 'height', 'height'));
|
24 |
-
var bordercolor = convertRGBToHex(getStyle(tdElm, 'bordercolor', 'borderLeftColor'));
|
25 |
-
var bgcolor = convertRGBToHex(getStyle(tdElm, 'bgcolor', 'backgroundColor'));
|
26 |
-
var className = ed.dom.getAttrib(tdElm, 'class');
|
27 |
-
var backgroundimage = getStyle(tdElm, 'background', 'backgroundImage').replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");;
|
28 |
-
var id = ed.dom.getAttrib(tdElm, 'id');
|
29 |
-
var lang = ed.dom.getAttrib(tdElm, 'lang');
|
30 |
-
var dir = ed.dom.getAttrib(tdElm, 'dir');
|
31 |
-
var scope = ed.dom.getAttrib(tdElm, 'scope');
|
32 |
-
|
33 |
-
// Setup form
|
34 |
-
addClassesToList('class', 'table_cell_styles');
|
35 |
-
TinyMCE_EditableSelects.init();
|
36 |
-
|
37 |
-
formObj.bordercolor.value = bordercolor;
|
38 |
-
formObj.bgcolor.value = bgcolor;
|
39 |
-
formObj.backgroundimage.value = backgroundimage;
|
40 |
-
formObj.width.value = width;
|
41 |
-
formObj.height.value = height;
|
42 |
-
formObj.id.value = id;
|
43 |
-
formObj.lang.value = lang;
|
44 |
-
formObj.style.value = ed.dom.serializeStyle(st);
|
45 |
-
selectByValue(formObj, 'align', align);
|
46 |
-
selectByValue(formObj, 'valign', valign);
|
47 |
-
selectByValue(formObj, 'class', className, true, true);
|
48 |
-
selectByValue(formObj, 'celltype', celltype);
|
49 |
-
selectByValue(formObj, 'dir', dir);
|
50 |
-
selectByValue(formObj, 'scope', scope);
|
51 |
-
|
52 |
-
// Resize some elements
|
53 |
-
if (isVisible('backgroundimagebrowser'))
|
54 |
-
document.getElementById('backgroundimage').style.width = '180px';
|
55 |
-
|
56 |
-
updateColor('bordercolor_pick', 'bordercolor');
|
57 |
-
updateColor('bgcolor_pick', 'bgcolor');
|
58 |
-
}
|
59 |
-
|
60 |
-
function updateAction() {
|
61 |
-
var el, inst = ed, tdElm, trElm, tableElm, formObj = document.forms[0];
|
62 |
-
|
63 |
-
tinyMCEPopup.restoreSelection();
|
64 |
-
el = ed.selection.getNode();
|
65 |
-
tdElm = ed.dom.getParent(el, "td,th");
|
66 |
-
trElm = ed.dom.getParent(el, "tr");
|
67 |
-
tableElm = ed.dom.getParent(el, "table");
|
68 |
-
|
69 |
-
ed.execCommand('mceBeginUndoLevel');
|
70 |
-
|
71 |
-
switch (getSelectValue(formObj, 'action')) {
|
72 |
-
case "cell":
|
73 |
-
var celltype = getSelectValue(formObj, 'celltype');
|
74 |
-
var scope = getSelectValue(formObj, 'scope');
|
75 |
-
|
76 |
-
function doUpdate(s) {
|
77 |
-
if (s) {
|
78 |
-
updateCell(tdElm);
|
79 |
-
|
80 |
-
ed.addVisual();
|
81 |
-
ed.nodeChanged();
|
82 |
-
inst.execCommand('mceEndUndoLevel');
|
83 |
-
tinyMCEPopup.close();
|
84 |
-
}
|
85 |
-
};
|
86 |
-
|
87 |
-
if (ed.getParam("accessibility_warnings", 1)) {
|
88 |
-
if (celltype == "th" && scope == "")
|
89 |
-
tinyMCEPopup.confirm(ed.getLang('table_dlg.missing_scope', '', true), doUpdate);
|
90 |
-
else
|
91 |
-
doUpdate(1);
|
92 |
-
|
93 |
-
return;
|
94 |
-
}
|
95 |
-
|
96 |
-
updateCell(tdElm);
|
97 |
-
break;
|
98 |
-
|
99 |
-
case "row":
|
100 |
-
var cell = trElm.firstChild;
|
101 |
-
|
102 |
-
if (cell.nodeName != "TD" && cell.nodeName != "TH")
|
103 |
-
cell = nextCell(cell);
|
104 |
-
|
105 |
-
do {
|
106 |
-
cell = updateCell(cell, true);
|
107 |
-
} while ((cell = nextCell(cell)) != null);
|
108 |
-
|
109 |
-
break;
|
110 |
-
|
111 |
-
case "all":
|
112 |
-
var rows = tableElm.getElementsByTagName("tr");
|
113 |
-
|
114 |
-
for (var i=0; i<rows.length; i++) {
|
115 |
-
var cell = rows[i].firstChild;
|
116 |
-
|
117 |
-
if (cell.nodeName != "TD" && cell.nodeName != "TH")
|
118 |
-
cell = nextCell(cell);
|
119 |
-
|
120 |
-
do {
|
121 |
-
cell = updateCell(cell, true);
|
122 |
-
} while ((cell = nextCell(cell)) != null);
|
123 |
-
}
|
124 |
-
|
125 |
-
break;
|
126 |
-
}
|
127 |
-
|
128 |
-
ed.addVisual();
|
129 |
-
ed.nodeChanged();
|
130 |
-
inst.execCommand('mceEndUndoLevel');
|
131 |
-
tinyMCEPopup.close();
|
132 |
-
}
|
133 |
-
|
134 |
-
function nextCell(elm) {
|
135 |
-
while ((elm = elm.nextSibling) != null) {
|
136 |
-
if (elm.nodeName == "TD" || elm.nodeName == "TH")
|
137 |
-
return elm;
|
138 |
-
}
|
139 |
-
|
140 |
-
return null;
|
141 |
-
}
|
142 |
-
|
143 |
-
function updateCell(td, skip_id) {
|
144 |
-
var inst = ed;
|
145 |
-
var formObj = document.forms[0];
|
146 |
-
var curCellType = td.nodeName.toLowerCase();
|
147 |
-
var celltype = getSelectValue(formObj, 'celltype');
|
148 |
-
var doc = inst.getDoc();
|
149 |
-
var dom = ed.dom;
|
150 |
-
|
151 |
-
if (!skip_id)
|
152 |
-
td.setAttribute('id', formObj.id.value);
|
153 |
-
|
154 |
-
td.setAttribute('align', formObj.align.value);
|
155 |
-
td.setAttribute('vAlign', formObj.valign.value);
|
156 |
-
td.setAttribute('lang', formObj.lang.value);
|
157 |
-
td.setAttribute('dir', getSelectValue(formObj, 'dir'));
|
158 |
-
td.setAttribute('style', ed.dom.serializeStyle(ed.dom.parseStyle(formObj.style.value)));
|
159 |
-
td.setAttribute('scope', formObj.scope.value);
|
160 |
-
ed.dom.setAttrib(td, 'class', getSelectValue(formObj, 'class'));
|
161 |
-
|
162 |
-
// Clear deprecated attributes
|
163 |
-
ed.dom.setAttrib(td, 'width', '');
|
164 |
-
ed.dom.setAttrib(td, 'height', '');
|
165 |
-
ed.dom.setAttrib(td, 'bgColor', '');
|
166 |
-
ed.dom.setAttrib(td, 'borderColor', '');
|
167 |
-
ed.dom.setAttrib(td, 'background', '');
|
168 |
-
|
169 |
-
// Set styles
|
170 |
-
td.style.width = getCSSSize(formObj.width.value);
|
171 |
-
td.style.height = getCSSSize(formObj.height.value);
|
172 |
-
if (formObj.bordercolor.value != "") {
|
173 |
-
td.style.borderColor = formObj.bordercolor.value;
|
174 |
-
td.style.borderStyle = td.style.borderStyle == "" ? "solid" : td.style.borderStyle;
|
175 |
-
td.style.borderWidth = td.style.borderWidth == "" ? "1px" : td.style.borderWidth;
|
176 |
-
} else
|
177 |
-
td.style.borderColor = '';
|
178 |
-
|
179 |
-
td.style.backgroundColor = formObj.bgcolor.value;
|
180 |
-
|
181 |
-
if (formObj.backgroundimage.value != "")
|
182 |
-
td.style.backgroundImage = "url('" + formObj.backgroundimage.value + "')";
|
183 |
-
else
|
184 |
-
td.style.backgroundImage = '';
|
185 |
-
|
186 |
-
if (curCellType != celltype) {
|
187 |
-
// changing to a different node type
|
188 |
-
var newCell = doc.createElement(celltype);
|
189 |
-
|
190 |
-
for (var c=0; c<td.childNodes.length; c++)
|
191 |
-
newCell.appendChild(td.childNodes[c].cloneNode(1));
|
192 |
-
|
193 |
-
for (var a=0; a<td.attributes.length; a++)
|
194 |
-
ed.dom.setAttrib(newCell, td.attributes[a].name, ed.dom.getAttrib(td, td.attributes[a].name));
|
195 |
-
|
196 |
-
td.parentNode.replaceChild(newCell, td);
|
197 |
-
td = newCell;
|
198 |
-
}
|
199 |
-
|
200 |
-
dom.setAttrib(td, 'style', dom.serializeStyle(dom.parseStyle(td.style.cssText)));
|
201 |
-
|
202 |
-
return td;
|
203 |
-
}
|
204 |
-
|
205 |
-
function changedBackgroundImage() {
|
206 |
-
var formObj = document.forms[0];
|
207 |
-
var st = ed.dom.parseStyle(formObj.style.value);
|
208 |
-
|
209 |
-
st['background-image'] = "url('" + formObj.backgroundimage.value + "')";
|
210 |
-
|
211 |
-
formObj.style.value = ed.dom.serializeStyle(st);
|
212 |
-
}
|
213 |
-
|
214 |
-
function changedSize() {
|
215 |
-
var formObj = document.forms[0];
|
216 |
-
var st = ed.dom.parseStyle(formObj.style.value);
|
217 |
-
|
218 |
-
var width = formObj.width.value;
|
219 |
-
if (width != "")
|
220 |
-
st['width'] = getCSSSize(width);
|
221 |
-
else
|
222 |
-
st['width'] = "";
|
223 |
-
|
224 |
-
var height = formObj.height.value;
|
225 |
-
if (height != "")
|
226 |
-
st['height'] = getCSSSize(height);
|
227 |
-
else
|
228 |
-
st['height'] = "";
|
229 |
-
|
230 |
-
formObj.style.value = ed.dom.serializeStyle(st);
|
231 |
-
}
|
232 |
-
|
233 |
-
function changedColor() {
|
234 |
-
var formObj = document.forms[0];
|
235 |
-
var st = ed.dom.parseStyle(formObj.style.value);
|
236 |
-
|
237 |
-
st['background-color'] = formObj.bgcolor.value;
|
238 |
-
st['border-color'] = formObj.bordercolor.value;
|
239 |
-
|
240 |
-
formObj.style.value = ed.dom.serializeStyle(st);
|
241 |
-
}
|
242 |
-
|
243 |
-
function changedStyle() {
|
244 |
-
var formObj = document.forms[0];
|
245 |
-
var st = ed.dom.parseStyle(formObj.style.value);
|
246 |
-
|
247 |
-
if (st['background-image'])
|
248 |
-
formObj.backgroundimage.value = st['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
|
249 |
-
else
|
250 |
-
formObj.backgroundimage.value = '';
|
251 |
-
|
252 |
-
if (st['width'])
|
253 |
-
formObj.width.value = trimSize(st['width']);
|
254 |
-
|
255 |
-
if (st['height'])
|
256 |
-
formObj.height.value = trimSize(st['height']);
|
257 |
-
|
258 |
-
if (st['background-color']) {
|
259 |
-
formObj.bgcolor.value = st['background-color'];
|
260 |
-
updateColor('bgcolor_pick','bgcolor');
|
261 |
-
}
|
262 |
-
|
263 |
-
if (st['border-color']) {
|
264 |
-
formObj.bordercolor.value = st['border-color'];
|
265 |
-
updateColor('bordercolor_pick','bordercolor');
|
266 |
-
}
|
267 |
-
}
|
268 |
-
|
269 |
-
tinyMCEPopup.onInit.add(init);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
table-old/js/merge_cells.js
DELETED
@@ -1,29 +0,0 @@
|
|
1 |
-
tinyMCEPopup.requireLangPack();
|
2 |
-
|
3 |
-
function init() {
|
4 |
-
var f = document.forms[0], v;
|
5 |
-
|
6 |
-
tinyMCEPopup.resizeToInnerSize();
|
7 |
-
|
8 |
-
f.numcols.value = tinyMCEPopup.getWindowArg('numcols', 1);
|
9 |
-
f.numrows.value = tinyMCEPopup.getWindowArg('numrows', 1);
|
10 |
-
}
|
11 |
-
|
12 |
-
function mergeCells() {
|
13 |
-
var args = [], f = document.forms[0];
|
14 |
-
|
15 |
-
tinyMCEPopup.restoreSelection();
|
16 |
-
|
17 |
-
if (!AutoValidator.validate(f)) {
|
18 |
-
tinyMCEPopup.alert(tinyMCEPopup.getLang('invalid_data'));
|
19 |
-
return false;
|
20 |
-
}
|
21 |
-
|
22 |
-
args["numcols"] = f.numcols.value;
|
23 |
-
args["numrows"] = f.numrows.value;
|
24 |
-
|
25 |
-
tinyMCEPopup.execCommand("mceTableMergeCells", false, args);
|
26 |
-
tinyMCEPopup.close();
|
27 |
-
}
|
28 |
-
|
29 |
-
tinyMCEPopup.onInit.add(init);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
table-old/js/row.js
DELETED
@@ -1,212 +0,0 @@
|
|
1 |
-
tinyMCEPopup.requireLangPack();
|
2 |
-
|
3 |
-
function init() {
|
4 |
-
tinyMCEPopup.resizeToInnerSize();
|
5 |
-
|
6 |
-
document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table');
|
7 |
-
document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
|
8 |
-
|
9 |
-
var inst = tinyMCEPopup.editor;
|
10 |
-
var dom = inst.dom;
|
11 |
-
var trElm = dom.getParent(inst.selection.getNode(), "tr");
|
12 |
-
var formObj = document.forms[0];
|
13 |
-
var st = dom.parseStyle(dom.getAttrib(trElm, "style"));
|
14 |
-
|
15 |
-
// Get table row data
|
16 |
-
var rowtype = trElm.parentNode.nodeName.toLowerCase();
|
17 |
-
var align = dom.getAttrib(trElm, 'align');
|
18 |
-
var valign = dom.getAttrib(trElm, 'valign');
|
19 |
-
var height = trimSize(getStyle(trElm, 'height', 'height'));
|
20 |
-
var className = dom.getAttrib(trElm, 'class');
|
21 |
-
var bgcolor = convertRGBToHex(getStyle(trElm, 'bgcolor', 'backgroundColor'));
|
22 |
-
var backgroundimage = getStyle(trElm, 'background', 'backgroundImage').replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");;
|
23 |
-
var id = dom.getAttrib(trElm, 'id');
|
24 |
-
var lang = dom.getAttrib(trElm, 'lang');
|
25 |
-
var dir = dom.getAttrib(trElm, 'dir');
|
26 |
-
|
27 |
-
// Setup form
|
28 |
-
addClassesToList('class', 'table_row_styles');
|
29 |
-
TinyMCE_EditableSelects.init();
|
30 |
-
|
31 |
-
formObj.bgcolor.value = bgcolor;
|
32 |
-
formObj.backgroundimage.value = backgroundimage;
|
33 |
-
formObj.height.value = height;
|
34 |
-
formObj.id.value = id;
|
35 |
-
formObj.lang.value = lang;
|
36 |
-
formObj.style.value = dom.serializeStyle(st);
|
37 |
-
selectByValue(formObj, 'align', align);
|
38 |
-
selectByValue(formObj, 'valign', valign);
|
39 |
-
selectByValue(formObj, 'class', className, true, true);
|
40 |
-
selectByValue(formObj, 'rowtype', rowtype);
|
41 |
-
selectByValue(formObj, 'dir', dir);
|
42 |
-
|
43 |
-
// Resize some elements
|
44 |
-
if (isVisible('backgroundimagebrowser'))
|
45 |
-
document.getElementById('backgroundimage').style.width = '180px';
|
46 |
-
|
47 |
-
updateColor('bgcolor_pick', 'bgcolor');
|
48 |
-
}
|
49 |
-
|
50 |
-
function updateAction() {
|
51 |
-
var inst = tinyMCEPopup.editor, dom = inst.dom, trElm, tableElm, formObj = document.forms[0];
|
52 |
-
var action = getSelectValue(formObj, 'action');
|
53 |
-
|
54 |
-
tinyMCEPopup.restoreSelection();
|
55 |
-
trElm = dom.getParent(inst.selection.getNode(), "tr");
|
56 |
-
tableElm = dom.getParent(inst.selection.getNode(), "table");
|
57 |
-
|
58 |
-
inst.execCommand('mceBeginUndoLevel');
|
59 |
-
|
60 |
-
switch (action) {
|
61 |
-
case "row":
|
62 |
-
updateRow(trElm);
|
63 |
-
break;
|
64 |
-
|
65 |
-
case "all":
|
66 |
-
var rows = tableElm.getElementsByTagName("tr");
|
67 |
-
|
68 |
-
for (var i=0; i<rows.length; i++)
|
69 |
-
updateRow(rows[i], true);
|
70 |
-
|
71 |
-
break;
|
72 |
-
|
73 |
-
case "odd":
|
74 |
-
case "even":
|
75 |
-
var rows = tableElm.getElementsByTagName("tr");
|
76 |
-
|
77 |
-
for (var i=0; i<rows.length; i++) {
|
78 |
-
if ((i % 2 == 0 && action == "odd") || (i % 2 != 0 && action == "even"))
|
79 |
-
updateRow(rows[i], true, true);
|
80 |
-
}
|
81 |
-
|
82 |
-
break;
|
83 |
-
}
|
84 |
-
|
85 |
-
inst.addVisual();
|
86 |
-
inst.nodeChanged();
|
87 |
-
inst.execCommand('mceEndUndoLevel');
|
88 |
-
tinyMCEPopup.close();
|
89 |
-
}
|
90 |
-
|
91 |
-
function updateRow(tr_elm, skip_id, skip_parent) {
|
92 |
-
var inst = tinyMCEPopup.editor;
|
93 |
-
var formObj = document.forms[0];
|
94 |
-
var dom = inst.dom;
|
95 |
-
var curRowType = tr_elm.parentNode.nodeName.toLowerCase();
|
96 |
-
var rowtype = getSelectValue(formObj, 'rowtype');
|
97 |
-
var doc = inst.getDoc();
|
98 |
-
|
99 |
-
// Update row element
|
100 |
-
if (!skip_id)
|
101 |
-
tr_elm.setAttribute('id', formObj.id.value);
|
102 |
-
|
103 |
-
tr_elm.setAttribute('align', getSelectValue(formObj, 'align'));
|
104 |
-
tr_elm.setAttribute('vAlign', getSelectValue(formObj, 'valign'));
|
105 |
-
tr_elm.setAttribute('lang', formObj.lang.value);
|
106 |
-
tr_elm.setAttribute('dir', getSelectValue(formObj, 'dir'));
|
107 |
-
tr_elm.setAttribute('style', dom.serializeStyle(dom.parseStyle(formObj.style.value)));
|
108 |
-
dom.setAttrib(tr_elm, 'class', getSelectValue(formObj, 'class'));
|
109 |
-
|
110 |
-
// Clear deprecated attributes
|
111 |
-
tr_elm.setAttribute('background', '');
|
112 |
-
tr_elm.setAttribute('bgColor', '');
|
113 |
-
tr_elm.setAttribute('height', '');
|
114 |
-
|
115 |
-
// Set styles
|
116 |
-
tr_elm.style.height = getCSSSize(formObj.height.value);
|
117 |
-
tr_elm.style.backgroundColor = formObj.bgcolor.value;
|
118 |
-
|
119 |
-
if (formObj.backgroundimage.value != "")
|
120 |
-
tr_elm.style.backgroundImage = "url('" + formObj.backgroundimage.value + "')";
|
121 |
-
else
|
122 |
-
tr_elm.style.backgroundImage = '';
|
123 |
-
|
124 |
-
// Setup new rowtype
|
125 |
-
if (curRowType != rowtype && !skip_parent) {
|
126 |
-
// first, clone the node we are working on
|
127 |
-
var newRow = tr_elm.cloneNode(1);
|
128 |
-
|
129 |
-
// next, find the parent of its new destination (creating it if necessary)
|
130 |
-
var theTable = dom.getParent(tr_elm, "table");
|
131 |
-
var dest = rowtype;
|
132 |
-
var newParent = null;
|
133 |
-
for (var i = 0; i < theTable.childNodes.length; i++) {
|
134 |
-
if (theTable.childNodes[i].nodeName.toLowerCase() == dest)
|
135 |
-
newParent = theTable.childNodes[i];
|
136 |
-
}
|
137 |
-
|
138 |
-
if (newParent == null) {
|
139 |
-
newParent = doc.createElement(dest);
|
140 |
-
|
141 |
-
if (dest == "thead") {
|
142 |
-
if (theTable.firstChild.nodeName == 'CAPTION')
|
143 |
-
inst.dom.insertAfter(newParent, theTable.firstChild);
|
144 |
-
else
|
145 |
-
theTable.insertBefore(newParent, theTable.firstChild);
|
146 |
-
} else
|
147 |
-
theTable.appendChild(newParent);
|
148 |
-
}
|
149 |
-
|
150 |
-
// append the row to the new parent
|
151 |
-
newParent.appendChild(newRow);
|
152 |
-
|
153 |
-
// remove the original
|
154 |
-
tr_elm.parentNode.removeChild(tr_elm);
|
155 |
-
|
156 |
-
// set tr_elm to the new node
|
157 |
-
tr_elm = newRow;
|
158 |
-
}
|
159 |
-
|
160 |
-
dom.setAttrib(tr_elm, 'style', dom.serializeStyle(dom.parseStyle(tr_elm.style.cssText)));
|
161 |
-
}
|
162 |
-
|
163 |
-
function changedBackgroundImage() {
|
164 |
-
var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom;
|
165 |
-
var st = dom.parseStyle(formObj.style.value);
|
166 |
-
|
167 |
-
st['background-image'] = "url('" + formObj.backgroundimage.value + "')";
|
168 |
-
|
169 |
-
formObj.style.value = dom.serializeStyle(st);
|
170 |
-
}
|
171 |
-
|
172 |
-
function changedStyle() {
|
173 |
-
var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom;
|
174 |
-
var st = dom.parseStyle(formObj.style.value);
|
175 |
-
|
176 |
-
if (st['background-image'])
|
177 |
-
formObj.backgroundimage.value = st['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
|
178 |
-
else
|
179 |
-
formObj.backgroundimage.value = '';
|
180 |
-
|
181 |
-
if (st['height'])
|
182 |
-
formObj.height.value = trimSize(st['height']);
|
183 |
-
|
184 |
-
if (st['background-color']) {
|
185 |
-
formObj.bgcolor.value = st['background-color'];
|
186 |
-
updateColor('bgcolor_pick','bgcolor');
|
187 |
-
}
|
188 |
-
}
|
189 |
-
|
190 |
-
function changedSize() {
|
191 |
-
var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom;
|
192 |
-
var st = dom.parseStyle(formObj.style.value);
|
193 |
-
|
194 |
-
var height = formObj.height.value;
|
195 |
-
if (height != "")
|
196 |
-
st['height'] = getCSSSize(height);
|
197 |
-
else
|
198 |
-
st['height'] = "";
|
199 |
-
|
200 |
-
formObj.style.value = dom.serializeStyle(st);
|
201 |
-
}
|
202 |
-
|
203 |
-
function changedColor() {
|
204 |
-
var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom;
|
205 |
-
var st = dom.parseStyle(formObj.style.value);
|
206 |
-
|
207 |
-
st['background-color'] = formObj.bgcolor.value;
|
208 |
-
|
209 |
-
formObj.style.value = dom.serializeStyle(st);
|
210 |
-
}
|
211 |
-
|
212 |
-
tinyMCEPopup.onInit.add(init);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
table-old/js/table.js
DELETED
@@ -1,440 +0,0 @@
|
|
1 |
-
tinyMCEPopup.requireLangPack();
|
2 |
-
|
3 |
-
var action, orgTableWidth, orgTableHeight, dom = tinyMCEPopup.editor.dom;
|
4 |
-
|
5 |
-
function insertTable() {
|
6 |
-
var formObj = document.forms[0];
|
7 |
-
var inst = tinyMCEPopup.editor, dom = inst.dom;
|
8 |
-
var cols = 2, rows = 2, border = 0, cellpadding = -1, cellspacing = -1, align, width, height, className, caption, frame, rules;
|
9 |
-
var html = '', capEl, elm;
|
10 |
-
var cellLimit, rowLimit, colLimit;
|
11 |
-
|
12 |
-
tinyMCEPopup.restoreSelection();
|
13 |
-
|
14 |
-
if (!AutoValidator.validate(formObj)) {
|
15 |
-
tinyMCEPopup.alert(inst.getLang('invalid_data'));
|
16 |
-
return false;
|
17 |
-
}
|
18 |
-
|
19 |
-
elm = dom.getParent(inst.selection.getNode(), 'table');
|
20 |
-
|
21 |
-
// Get form data
|
22 |
-
cols = formObj.elements['cols'].value;
|
23 |
-
rows = formObj.elements['rows'].value;
|
24 |
-
border = formObj.elements['border'].value != "" ? formObj.elements['border'].value : 0;
|
25 |
-
cellpadding = formObj.elements['cellpadding'].value != "" ? formObj.elements['cellpadding'].value : "";
|
26 |
-
cellspacing = formObj.elements['cellspacing'].value != "" ? formObj.elements['cellspacing'].value : "";
|
27 |
-
align = getSelectValue(formObj, "align");
|
28 |
-
frame = getSelectValue(formObj, "tframe");
|
29 |
-
rules = getSelectValue(formObj, "rules");
|
30 |
-
width = formObj.elements['width'].value;
|
31 |
-
height = formObj.elements['height'].value;
|
32 |
-
bordercolor = formObj.elements['bordercolor'].value;
|
33 |
-
bgcolor = formObj.elements['bgcolor'].value;
|
34 |
-
className = getSelectValue(formObj, "class");
|
35 |
-
id = formObj.elements['id'].value;
|
36 |
-
summary = formObj.elements['summary'].value;
|
37 |
-
style = formObj.elements['style'].value;
|
38 |
-
dir = formObj.elements['dir'].value;
|
39 |
-
lang = formObj.elements['lang'].value;
|
40 |
-
background = formObj.elements['backgroundimage'].value;
|
41 |
-
caption = formObj.elements['caption'].checked;
|
42 |
-
|
43 |
-
cellLimit = tinyMCEPopup.getParam('table_cell_limit', false);
|
44 |
-
rowLimit = tinyMCEPopup.getParam('table_row_limit', false);
|
45 |
-
colLimit = tinyMCEPopup.getParam('table_col_limit', false);
|
46 |
-
|
47 |
-
// Validate table size
|
48 |
-
if (colLimit && cols > colLimit) {
|
49 |
-
tinyMCEPopup.alert(inst.getLang('table_dlg.col_limit').replace(/\{\$cols\}/g, colLimit));
|
50 |
-
return false;
|
51 |
-
} else if (rowLimit && rows > rowLimit) {
|
52 |
-
tinyMCEPopup.alert(inst.getLang('table_dlg.row_limit').replace(/\{\$rows\}/g, rowLimit));
|
53 |
-
return false;
|
54 |
-
} else if (cellLimit && cols * rows > cellLimit) {
|
55 |
-
tinyMCEPopup.alert(inst.getLang('table_dlg.cell_limit').replace(/\{\$cells\}/g, cellLimit));
|
56 |
-
return false;
|
57 |
-
}
|
58 |
-
|
59 |
-
// Update table
|
60 |
-
if (action == "update") {
|
61 |
-
inst.execCommand('mceBeginUndoLevel');
|
62 |
-
|
63 |
-
dom.setAttrib(elm, 'cellPadding', cellpadding, true);
|
64 |
-
dom.setAttrib(elm, 'cellSpacing', cellspacing, true);
|
65 |
-
dom.setAttrib(elm, 'border', border);
|
66 |
-
dom.setAttrib(elm, 'align', align);
|
67 |
-
dom.setAttrib(elm, 'frame', frame);
|
68 |
-
dom.setAttrib(elm, 'rules', rules);
|
69 |
-
dom.setAttrib(elm, 'class', className);
|
70 |
-
dom.setAttrib(elm, 'style', style);
|
71 |
-
dom.setAttrib(elm, 'id', id);
|
72 |
-
dom.setAttrib(elm, 'summary', summary);
|
73 |
-
dom.setAttrib(elm, 'dir', dir);
|
74 |
-
dom.setAttrib(elm, 'lang', lang);
|
75 |
-
|
76 |
-
capEl = inst.dom.select('caption', elm)[0];
|
77 |
-
|
78 |
-
if (capEl && !caption)
|
79 |
-
capEl.parentNode.removeChild(capEl);
|
80 |
-
|
81 |
-
if (!capEl && caption) {
|
82 |
-
capEl = elm.ownerDocument.createElement('caption');
|
83 |
-
|
84 |
-
if (!tinymce.isIE)
|
85 |
-
capEl.innerHTML = '<br mce_bogus="1"/>';
|
86 |
-
|
87 |
-
elm.insertBefore(capEl, elm.firstChild);
|
88 |
-
}
|
89 |
-
|
90 |
-
if (width && inst.settings.inline_styles) {
|
91 |
-
dom.setStyle(elm, 'width', width);
|
92 |
-
dom.setAttrib(elm, 'width', '');
|
93 |
-
} else {
|
94 |
-
dom.setAttrib(elm, 'width', width, true);
|
95 |
-
dom.setStyle(elm, 'width', '');
|
96 |
-
}
|
97 |
-
|
98 |
-
// Remove these since they are not valid XHTML
|
99 |
-
dom.setAttrib(elm, 'borderColor', '');
|
100 |
-
dom.setAttrib(elm, 'bgColor', '');
|
101 |
-
dom.setAttrib(elm, 'background', '');
|
102 |
-
|
103 |
-
if (height && inst.settings.inline_styles) {
|
104 |
-
dom.setStyle(elm, 'height', height);
|
105 |
-
dom.setAttrib(elm, 'height', '');
|
106 |
-
} else {
|
107 |
-
dom.setAttrib(elm, 'height', height, true);
|
108 |
-
dom.setStyle(elm, 'height', '');
|
109 |
-
}
|
110 |
-
|
111 |
-
if (background != '')
|
112 |
-
elm.style.backgroundImage = "url('" + background + "')";
|
113 |
-
else
|
114 |
-
elm.style.backgroundImage = '';
|
115 |
-
|
116 |
-
/* if (tinyMCEPopup.getParam("inline_styles")) {
|
117 |
-
if (width != '')
|
118 |
-
elm.style.width = getCSSSize(width);
|
119 |
-
}*/
|
120 |
-
|
121 |
-
if (bordercolor != "") {
|
122 |
-
elm.style.borderColor = bordercolor;
|
123 |
-
elm.style.borderStyle = elm.style.borderStyle == "" ? "solid" : elm.style.borderStyle;
|
124 |
-
elm.style.borderWidth = border == "" ? "1px" : border;
|
125 |
-
} else
|
126 |
-
elm.style.borderColor = '';
|
127 |
-
|
128 |
-
elm.style.backgroundColor = bgcolor;
|
129 |
-
elm.style.height = getCSSSize(height);
|
130 |
-
|
131 |
-
inst.addVisual();
|
132 |
-
|
133 |
-
// Fix for stange MSIE align bug
|
134 |
-
//elm.outerHTML = elm.outerHTML;
|
135 |
-
|
136 |
-
inst.nodeChanged();
|
137 |
-
inst.execCommand('mceEndUndoLevel');
|
138 |
-
|
139 |
-
// Repaint if dimensions changed
|
140 |
-
if (formObj.width.value != orgTableWidth || formObj.height.value != orgTableHeight)
|
141 |
-
inst.execCommand('mceRepaint');
|
142 |
-
|
143 |
-
tinyMCEPopup.close();
|
144 |
-
return true;
|
145 |
-
}
|
146 |
-
|
147 |
-
// Create new table
|
148 |
-
html += '<table';
|
149 |
-
|
150 |
-
html += makeAttrib('id', id);
|
151 |
-
html += makeAttrib('border', border);
|
152 |
-
html += makeAttrib('cellpadding', cellpadding);
|
153 |
-
html += makeAttrib('cellspacing', cellspacing);
|
154 |
-
|
155 |
-
if (width && inst.settings.inline_styles) {
|
156 |
-
if (style)
|
157 |
-
style += '; ';
|
158 |
-
|
159 |
-
// Force px
|
160 |
-
if (/^[0-9\.]+$/.test(width))
|
161 |
-
width += 'px';
|
162 |
-
|
163 |
-
style += 'width: ' + width;
|
164 |
-
} else
|
165 |
-
html += makeAttrib('width', width);
|
166 |
-
|
167 |
-
/* if (height) {
|
168 |
-
if (style)
|
169 |
-
style += '; ';
|
170 |
-
|
171 |
-
style += 'height: ' + height;
|
172 |
-
}*/
|
173 |
-
|
174 |
-
//html += makeAttrib('height', height);
|
175 |
-
//html += makeAttrib('bordercolor', bordercolor);
|
176 |
-
//html += makeAttrib('bgcolor', bgcolor);
|
177 |
-
html += makeAttrib('align', align);
|
178 |
-
html += makeAttrib('frame', frame);
|
179 |
-
html += makeAttrib('rules', rules);
|
180 |
-
html += makeAttrib('class', className);
|
181 |
-
html += makeAttrib('style', style);
|
182 |
-
html += makeAttrib('summary', summary);
|
183 |
-
html += makeAttrib('dir', dir);
|
184 |
-
html += makeAttrib('lang', lang);
|
185 |
-
html += '>';
|
186 |
-
|
187 |
-
if (caption) {
|
188 |
-
if (!tinymce.isIE)
|
189 |
-
html += '<caption><br mce_bogus="1"/></caption>';
|
190 |
-
else
|
191 |
-
html += '<caption></caption>';
|
192 |
-
}
|
193 |
-
|
194 |
-
for (var y=0; y<rows; y++) {
|
195 |
-
html += "<tr>";
|
196 |
-
|
197 |
-
for (var x=0; x<cols; x++) {
|
198 |
-
if (!tinymce.isIE)
|
199 |
-
html += '<td><br mce_bogus="1"/></td>';
|
200 |
-
else
|
201 |
-
html += '<td></td>';
|
202 |
-
}
|
203 |
-
|
204 |
-
html += "</tr>";
|
205 |
-
}
|
206 |
-
|
207 |
-
html += "</table>";
|
208 |
-
|
209 |
-
inst.execCommand('mceBeginUndoLevel');
|
210 |
-
|
211 |
-
// Move table
|
212 |
-
if (inst.settings.fix_table_elements) {
|
213 |
-
var bm = inst.selection.getBookmark(), patt = '';
|
214 |
-
|
215 |
-
inst.execCommand('mceInsertContent', false, '<br class="_mce_marker" />');
|
216 |
-
|
217 |
-
tinymce.each('h1,h2,h3,h4,h5,h6,p'.split(','), function(n) {
|
218 |
-
if (patt)
|
219 |
-
patt += ',';
|
220 |
-
|
221 |
-
patt += n + ' ._mce_marker';
|
222 |
-
});
|
223 |
-
|
224 |
-
tinymce.each(inst.dom.select(patt), function(n) {
|
225 |
-
inst.dom.split(inst.dom.getParent(n, 'h1,h2,h3,h4,h5,h6,p'), n);
|
226 |
-
});
|
227 |
-
|
228 |
-
dom.setOuterHTML(dom.select('._mce_marker')[0], html);
|
229 |
-
|
230 |
-
inst.selection.moveToBookmark(bm);
|
231 |
-
} else
|
232 |
-
inst.execCommand('mceInsertContent', false, html);
|
233 |
-
|
234 |
-
inst.addVisual();
|
235 |
-
inst.execCommand('mceEndUndoLevel');
|
236 |
-
|
237 |
-
tinyMCEPopup.close();
|
238 |
-
}
|
239 |
-
|
240 |
-
function makeAttrib(attrib, value) {
|
241 |
-
var formObj = document.forms[0];
|
242 |
-
var valueElm = formObj.elements[attrib];
|
243 |
-
|
244 |
-
if (typeof(value) == "undefined" || value == null) {
|
245 |
-
value = "";
|
246 |
-
|
247 |
-
if (valueElm)
|
248 |
-
value = valueElm.value;
|
249 |
-
}
|
250 |
-
|
251 |
-
if (value == "")
|
252 |
-
return "";
|
253 |
-
|
254 |
-
// XML encode it
|
255 |
-
value = value.replace(/&/g, '&');
|
256 |
-
value = value.replace(/\"/g, '"');
|
257 |
-
value = value.replace(/</g, '<');
|
258 |
-
value = value.replace(/>/g, '>');
|
259 |
-
|
260 |
-
return ' ' + attrib + '="' + value + '"';
|
261 |
-
}
|
262 |
-
|
263 |
-
function init() {
|
264 |
-
tinyMCEPopup.resizeToInnerSize();
|
265 |
-
|
266 |
-
document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table');
|
267 |
-
document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table');
|
268 |
-
document.getElementById('bordercolor_pickcontainer').innerHTML = getColorPickerHTML('bordercolor_pick','bordercolor');
|
269 |
-
document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
|
270 |
-
|
271 |
-
var cols = 2, rows = 2, border = tinyMCEPopup.getParam('table_default_border', '0'), cellpadding = tinyMCEPopup.getParam('table_default_cellpadding', ''), cellspacing = tinyMCEPopup.getParam('table_default_cellspacing', '');
|
272 |
-
var align = "", width = "", height = "", bordercolor = "", bgcolor = "", className = "";
|
273 |
-
var id = "", summary = "", style = "", dir = "", lang = "", background = "", bgcolor = "", bordercolor = "", rules = "", frame = "";
|
274 |
-
var inst = tinyMCEPopup.editor, dom = inst.dom;
|
275 |
-
var formObj = document.forms[0];
|
276 |
-
var elm = dom.getParent(inst.selection.getNode(), "table");
|
277 |
-
|
278 |
-
action = tinyMCEPopup.getWindowArg('action');
|
279 |
-
|
280 |
-
if (!action)
|
281 |
-
action = elm ? "update" : "insert";
|
282 |
-
|
283 |
-
if (elm && action != "insert") {
|
284 |
-
var rowsAr = elm.rows;
|
285 |
-
var cols = 0;
|
286 |
-
for (var i=0; i<rowsAr.length; i++)
|
287 |
-
if (rowsAr[i].cells.length > cols)
|
288 |
-
cols = rowsAr[i].cells.length;
|
289 |
-
|
290 |
-
cols = cols;
|
291 |
-
rows = rowsAr.length;
|
292 |
-
|
293 |
-
st = dom.parseStyle(dom.getAttrib(elm, "style"));
|
294 |
-
border = trimSize(getStyle(elm, 'border', 'borderWidth'));
|
295 |
-
cellpadding = dom.getAttrib(elm, 'cellpadding', "");
|
296 |
-
cellspacing = dom.getAttrib(elm, 'cellspacing', "");
|
297 |
-
width = trimSize(getStyle(elm, 'width', 'width'));
|
298 |
-
height = trimSize(getStyle(elm, 'height', 'height'));
|
299 |
-
bordercolor = convertRGBToHex(getStyle(elm, 'bordercolor', 'borderLeftColor'));
|
300 |
-
bgcolor = convertRGBToHex(getStyle(elm, 'bgcolor', 'backgroundColor'));
|
301 |
-
align = dom.getAttrib(elm, 'align', align);
|
302 |
-
frame = dom.getAttrib(elm, 'frame');
|
303 |
-
rules = dom.getAttrib(elm, 'rules');
|
304 |
-
className = tinymce.trim(dom.getAttrib(elm, 'class').replace(/mceItem.+/g, ''));
|
305 |
-
id = dom.getAttrib(elm, 'id');
|
306 |
-
summary = dom.getAttrib(elm, 'summary');
|
307 |
-
style = dom.serializeStyle(st);
|
308 |
-
dir = dom.getAttrib(elm, 'dir');
|
309 |
-
lang = dom.getAttrib(elm, 'lang');
|
310 |
-
background = getStyle(elm, 'background', 'backgroundImage').replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
|
311 |
-
formObj.caption.checked = elm.getElementsByTagName('caption').length > 0;
|
312 |
-
|
313 |
-
orgTableWidth = width;
|
314 |
-
orgTableHeight = height;
|
315 |
-
|
316 |
-
action = "update";
|
317 |
-
formObj.insert.value = inst.getLang('update');
|
318 |
-
}
|
319 |
-
|
320 |
-
addClassesToList('class', "table_styles");
|
321 |
-
TinyMCE_EditableSelects.init();
|
322 |
-
|
323 |
-
// Update form
|
324 |
-
selectByValue(formObj, 'align', align);
|
325 |
-
selectByValue(formObj, 'tframe', frame);
|
326 |
-
selectByValue(formObj, 'rules', rules);
|
327 |
-
selectByValue(formObj, 'class', className, true, true);
|
328 |
-
formObj.cols.value = cols;
|
329 |
-
formObj.rows.value = rows;
|
330 |
-
formObj.border.value = border;
|
331 |
-
formObj.cellpadding.value = cellpadding;
|
332 |
-
formObj.cellspacing.value = cellspacing;
|
333 |
-
formObj.width.value = width;
|
334 |
-
formObj.height.value = height;
|
335 |
-
formObj.bordercolor.value = bordercolor;
|
336 |
-
formObj.bgcolor.value = bgcolor;
|
337 |
-
formObj.id.value = id;
|
338 |
-
formObj.summary.value = summary;
|
339 |
-
formObj.style.value = style;
|
340 |
-
formObj.dir.value = dir;
|
341 |
-
formObj.lang.value = lang;
|
342 |
-
formObj.backgroundimage.value = background;
|
343 |
-
|
344 |
-
updateColor('bordercolor_pick', 'bordercolor');
|
345 |
-
updateColor('bgcolor_pick', 'bgcolor');
|
346 |
-
|
347 |
-
// Resize some elements
|
348 |
-
if (isVisible('backgroundimagebrowser'))
|
349 |
-
document.getElementById('backgroundimage').style.width = '180px';
|
350 |
-
|
351 |
-
// Disable some fields in update mode
|
352 |
-
if (action == "update") {
|
353 |
-
formObj.cols.disabled = true;
|
354 |
-
formObj.rows.disabled = true;
|
355 |
-
}
|
356 |
-
}
|
357 |
-
|
358 |
-
function changedSize() {
|
359 |
-
var formObj = document.forms[0];
|
360 |
-
var st = dom.parseStyle(formObj.style.value);
|
361 |
-
|
362 |
-
/* var width = formObj.width.value;
|
363 |
-
if (width != "")
|
364 |
-
st['width'] = tinyMCEPopup.getParam("inline_styles") ? getCSSSize(width) : "";
|
365 |
-
else
|
366 |
-
st['width'] = "";*/
|
367 |
-
|
368 |
-
var height = formObj.height.value;
|
369 |
-
if (height != "")
|
370 |
-
st['height'] = getCSSSize(height);
|
371 |
-
else
|
372 |
-
st['height'] = "";
|
373 |
-
|
374 |
-
formObj.style.value = dom.serializeStyle(st);
|
375 |
-
}
|
376 |
-
|
377 |
-
function changedBackgroundImage() {
|
378 |
-
var formObj = document.forms[0];
|
379 |
-
var st = dom.parseStyle(formObj.style.value);
|
380 |
-
|
381 |
-
st['background-image'] = "url('" + formObj.backgroundimage.value + "')";
|
382 |
-
|
383 |
-
formObj.style.value = dom.serializeStyle(st);
|
384 |
-
}
|
385 |
-
|
386 |
-
function changedBorder() {
|
387 |
-
var formObj = document.forms[0];
|
388 |
-
var st = dom.parseStyle(formObj.style.value);
|
389 |
-
|
390 |
-
// Update border width if the element has a color
|
391 |
-
if (formObj.border.value != "" && formObj.bordercolor.value != "")
|
392 |
-
st['border-width'] = formObj.border.value + "px";
|
393 |
-
|
394 |
-
formObj.style.value = dom.serializeStyle(st);
|
395 |
-
}
|
396 |
-
|
397 |
-
function changedColor() {
|
398 |
-
var formObj = document.forms[0];
|
399 |
-
var st = dom.parseStyle(formObj.style.value);
|
400 |
-
|
401 |
-
st['background-color'] = formObj.bgcolor.value;
|
402 |
-
|
403 |
-
if (formObj.bordercolor.value != "") {
|
404 |
-
st['border-color'] = formObj.bordercolor.value;
|
405 |
-
|
406 |
-
// Add border-width if it's missing
|
407 |
-
if (!st['border-width'])
|
408 |
-
st['border-width'] = formObj.border.value == "" ? "1px" : formObj.border.value + "px";
|
409 |
-
}
|
410 |
-
|
411 |
-
formObj.style.value = dom.serializeStyle(st);
|
412 |
-
}
|
413 |
-
|
414 |
-
function changedStyle() {
|
415 |
-
var formObj = document.forms[0];
|
416 |
-
var st = dom.parseStyle(formObj.style.value);
|
417 |
-
|
418 |
-
if (st['background-image'])
|
419 |
-
formObj.backgroundimage.value = st['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
|
420 |
-
else
|
421 |
-
formObj.backgroundimage.value = '';
|
422 |
-
|
423 |
-
if (st['width'])
|
424 |
-
formObj.width.value = trimSize(st['width']);
|
425 |
-
|
426 |
-
if (st['height'])
|
427 |
-
formObj.height.value = trimSize(st['height']);
|
428 |
-
|
429 |
-
if (st['background-color']) {
|
430 |
-
formObj.bgcolor.value = st['background-color'];
|
431 |
-
updateColor('bgcolor_pick','bgcolor');
|
432 |
-
}
|
433 |
-
|
434 |
-
if (st['border-color']) {
|
435 |
-
formObj.bordercolor.value = st['border-color'];
|
436 |
-
updateColor('bordercolor_pick','bordercolor');
|
437 |
-
}
|
438 |
-
}
|
439 |
-
|
440 |
-
tinyMCEPopup.onInit.add(init);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
table-old/langs/en_dlg.js
DELETED
@@ -1,74 +0,0 @@
|
|
1 |
-
tinyMCE.addI18n('en.table_dlg',{
|
2 |
-
general_tab:"General",
|
3 |
-
advanced_tab:"Advanced",
|
4 |
-
general_props:"General properties",
|
5 |
-
advanced_props:"Advanced properties",
|
6 |
-
rowtype:"Row in table part",
|
7 |
-
title:"Insert/Modify table",
|
8 |
-
width:"Width",
|
9 |
-
height:"Height",
|
10 |
-
cols:"Cols",
|
11 |
-
rows:"Rows",
|
12 |
-
cellspacing:"Cellspacing",
|
13 |
-
cellpadding:"Cellpadding",
|
14 |
-
border:"Border",
|
15 |
-
align:"Alignment",
|
16 |
-
align_default:"Default",
|
17 |
-
align_left:"Left",
|
18 |
-
align_right:"Right",
|
19 |
-
align_middle:"Center",
|
20 |
-
row_title:"Table row properties",
|
21 |
-
cell_title:"Table cell properties",
|
22 |
-
cell_type:"Cell type",
|
23 |
-
valign:"Vertical alignment",
|
24 |
-
align_top:"Top",
|
25 |
-
align_bottom:"Bottom",
|
26 |
-
bordercolor:"Border color",
|
27 |
-
bgcolor:"Background color",
|
28 |
-
merge_cells_title:"Merge table cells",
|
29 |
-
id:"Id",
|
30 |
-
style:"Style",
|
31 |
-
langdir:"Language direction",
|
32 |
-
langcode:"Language code",
|
33 |
-
mime:"Target MIME type",
|
34 |
-
ltr:"Left to right",
|
35 |
-
rtl:"Right to left",
|
36 |
-
bgimage:"Background image",
|
37 |
-
summary:"Summary",
|
38 |
-
td:"Data",
|
39 |
-
th:"Header",
|
40 |
-
cell_cell:"Update current cell",
|
41 |
-
cell_row:"Update all cells in row",
|
42 |
-
cell_all:"Update all cells in table",
|
43 |
-
row_row:"Update current row",
|
44 |
-
row_odd:"Update odd rows in table",
|
45 |
-
row_even:"Update even rows in table",
|
46 |
-
row_all:"Update all rows in table",
|
47 |
-
thead:"Table Head",
|
48 |
-
tbody:"Table Body",
|
49 |
-
tfoot:"Table Foot",
|
50 |
-
scope:"Scope",
|
51 |
-
rowgroup:"Row Group",
|
52 |
-
colgroup:"Col Group",
|
53 |
-
col_limit:"You've exceeded the maximum number of columns of {$cols}.",
|
54 |
-
row_limit:"You've exceeded the maximum number of rows of {$rows}.",
|
55 |
-
cell_limit:"You've exceeded the maximum number of cells of {$cells}.",
|
56 |
-
missing_scope:"Are you sure you want to continue without specifying a scope for this table header cell. Without it, it may be difficult for some users with disabilities to understand the content or data displayed of the table.",
|
57 |
-
caption:"Table caption",
|
58 |
-
frame:"Frame",
|
59 |
-
frame_none:"none",
|
60 |
-
frame_groups:"groups",
|
61 |
-
frame_rows:"rows",
|
62 |
-
frame_cols:"cols",
|
63 |
-
frame_all:"all",
|
64 |
-
rules:"Rules",
|
65 |
-
rules_void:"void",
|
66 |
-
rules_above:"above",
|
67 |
-
rules_below:"below",
|
68 |
-
rules_hsides:"hsides",
|
69 |
-
rules_lhs:"lhs",
|
70 |
-
rules_rhs:"rhs",
|
71 |
-
rules_vsides:"vsides",
|
72 |
-
rules_box:"box",
|
73 |
-
rules_border:"border"
|
74 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
table-old/merge_cells.htm
DELETED
@@ -1,37 +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.merge_cells_title}</title>
|
5 |
-
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
6 |
-
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/mctabs.js"></script>
|
7 |
-
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/validate.js"></script>
|
8 |
-
<script type="text/javascript" src="js/merge_cells.js"></script>
|
9 |
-
</head>
|
10 |
-
<body style="margin: 8px">
|
11 |
-
<form onsubmit="mergeCells();return false;" action="#">
|
12 |
-
<fieldset>
|
13 |
-
<legend>{#table_dlg.merge_cells_title}</legend>
|
14 |
-
<table border="0" cellpadding="0" cellspacing="3" width="100%">
|
15 |
-
<tr>
|
16 |
-
<td>{#table_dlg.cols}:</td>
|
17 |
-
<td align="right"><input type="text" name="numcols" value="" class="number min1 mceFocus" style="width: 30px" /></td>
|
18 |
-
</tr>
|
19 |
-
<tr>
|
20 |
-
<td>{#table_dlg.rows}:</td>
|
21 |
-
<td align="right"><input type="text" name="numrows" value="" class="number min1" style="width: 30px" /></td>
|
22 |
-
</tr>
|
23 |
-
</table>
|
24 |
-
</fieldset>
|
25 |
-
|
26 |
-
<div class="mceActionPanel">
|
27 |
-
<div style="float: left">
|
28 |
-
<input type="submit" id="insert" name="insert" value="{#update}" />
|
29 |
-
</div>
|
30 |
-
|
31 |
-
<div style="float: right">
|
32 |
-
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
33 |
-
</div>
|
34 |
-
</div>
|
35 |
-
</form>
|
36 |
-
</body>
|
37 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
table-old/row.htm
DELETED
@@ -1,160 +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.row_title}</title>
|
5 |
-
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
6 |
-
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/mctabs.js"></script>
|
7 |
-
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/form_utils.js"></script>
|
8 |
-
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/editable_selects.js"></script>
|
9 |
-
<script type="text/javascript" src="js/row.js"></script>
|
10 |
-
<link href="css/row.css" rel="stylesheet" type="text/css" />
|
11 |
-
</head>
|
12 |
-
<body id="tablerow" style="display: none">
|
13 |
-
<form onsubmit="updateAction();return false;" action="#">
|
14 |
-
<div class="tabs">
|
15 |
-
<ul>
|
16 |
-
<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#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>
|
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 border="0" cellpadding="4" cellspacing="0">
|
27 |
-
<tr>
|
28 |
-
<td><label for="rowtype">{#table_dlg.rowtype}</label></td>
|
29 |
-
<td class="col2">
|
30 |
-
<select id="rowtype" name="rowtype" class="mceFocus">
|
31 |
-
<option value="thead">{#table_dlg.thead}</option>
|
32 |
-
<option value="tbody">{#table_dlg.tbody}</option>
|
33 |
-
<option value="tfoot">{#table_dlg.tfoot}</option>
|
34 |
-
</select>
|
35 |
-
</td>
|
36 |
-
</tr>
|
37 |
-
|
38 |
-
<tr>
|
39 |
-
<td><label for="align">{#table_dlg.align}</label></td>
|
40 |
-
<td class="col2">
|
41 |
-
<select id="align" name="align">
|
42 |
-
<option value="">{#not_set}</option>
|
43 |
-
<option value="center">{#table_dlg.align_middle}</option>
|
44 |
-
<option value="left">{#table_dlg.align_left}</option>
|
45 |
-
<option value="right">{#table_dlg.align_right}</option>
|
46 |
-
</select>
|
47 |
-
</td>
|
48 |
-
</tr>
|
49 |
-
|
50 |
-
<tr>
|
51 |
-
<td><label for="valign">{#table_dlg.valign}</label></td>
|
52 |
-
<td class="col2">
|
53 |
-
<select id="valign" name="valign">
|
54 |
-
<option value="">{#not_set}</option>
|
55 |
-
<option value="top">{#table_dlg.align_top}</option>
|
56 |
-
<option value="middle">{#table_dlg.align_middle}</option>
|
57 |
-
<option value="bottom">{#table_dlg.align_bottom}</option>
|
58 |
-
</select>
|
59 |
-
</td>
|
60 |
-
</tr>
|
61 |
-
|
62 |
-
<tr id="styleSelectRow">
|
63 |
-
<td><label for="class">{#class_name}</label></td>
|
64 |
-
<td class="col2">
|
65 |
-
<select id="class" name="class" class="mceEditableSelect">
|
66 |
-
<option value="" selected="selected">{#not_set}</option>
|
67 |
-
</select>
|
68 |
-
</td>
|
69 |
-
</tr>
|
70 |
-
|
71 |
-
<tr>
|
72 |
-
<td><label for="height">{#table_dlg.height}</label></td>
|
73 |
-
<td class="col2"><input name="height" type="text" id="height" value="" size="4" maxlength="4" onchange="changedSize();" /></td>
|
74 |
-
</tr>
|
75 |
-
</table>
|
76 |
-
</fieldset>
|
77 |
-
</div>
|
78 |
-
|
79 |
-
<div id="advanced_panel" class="panel">
|
80 |
-
<fieldset>
|
81 |
-
<legend>{#table_dlg.advanced_props}</legend>
|
82 |
-
|
83 |
-
<table border="0" cellpadding="0" cellspacing="4">
|
84 |
-
<tr>
|
85 |
-
<td class="column1"><label for="id">{#table_dlg.id}</label></td>
|
86 |
-
<td><input id="id" name="id" type="text" value="" style="width: 200px" /></td>
|
87 |
-
</tr>
|
88 |
-
|
89 |
-
<tr>
|
90 |
-
<td><label for="style">{#table_dlg.style}</label></td>
|
91 |
-
<td><input type="text" id="style" name="style" value="" style="width: 200px;" onchange="changedStyle();" /></td>
|
92 |
-
</tr>
|
93 |
-
|
94 |
-
<tr>
|
95 |
-
<td class="column1"><label for="dir">{#table_dlg.langdir}</label></td>
|
96 |
-
<td>
|
97 |
-
<select id="dir" name="dir" style="width: 200px">
|
98 |
-
<option value="">{#not_set}</option>
|
99 |
-
<option value="ltr">{#table_dlg.ltr}</option>
|
100 |
-
<option value="rtl">{#table_dlg.rtl}</option>
|
101 |
-
</select>
|
102 |
-
</td>
|
103 |
-
</tr>
|
104 |
-
|
105 |
-
<tr>
|
106 |
-
<td class="column1"><label for="lang">{#table_dlg.langcode}</label></td>
|
107 |
-
<td>
|
108 |
-
<input id="lang" name="lang" type="text" value="" style="width: 200px" />
|
109 |
-
</td>
|
110 |
-
</tr>
|
111 |
-
|
112 |
-
<tr>
|
113 |
-
<td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td>
|
114 |
-
<td>
|
115 |
-
<table border="0" cellpadding="0" cellspacing="0">
|
116 |
-
<tr>
|
117 |
-
<td><input id="backgroundimage" name="backgroundimage" type="text" value="" style="width: 200px" onchange="changedBackgroundImage();" /></td>
|
118 |
-
<td id="backgroundimagebrowsercontainer"> </td>
|
119 |
-
</tr>
|
120 |
-
</table>
|
121 |
-
</td>
|
122 |
-
</tr>
|
123 |
-
|
124 |
-
<tr>
|
125 |
-
<td class="column1"><label for="bgcolor">{#table_dlg.bgcolor}</label></td>
|
126 |
-
<td>
|
127 |
-
<table border="0" cellpadding="0" cellspacing="0">
|
128 |
-
<tr>
|
129 |
-
<td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedColor();" /></td>
|
130 |
-
<td id="bgcolor_pickcontainer"> </td>
|
131 |
-
</tr>
|
132 |
-
</table>
|
133 |
-
</td>
|
134 |
-
</tr>
|
135 |
-
</table>
|
136 |
-
</fieldset>
|
137 |
-
</div>
|
138 |
-
</div>
|
139 |
-
|
140 |
-
<div class="mceActionPanel">
|
141 |
-
<div>
|
142 |
-
<select id="action" name="action">
|
143 |
-
<option value="row">{#table_dlg.row_row}</option>
|
144 |
-
<option value="odd">{#table_dlg.row_odd}</option>
|
145 |
-
<option value="even">{#table_dlg.row_even}</option>
|
146 |
-
<option value="all">{#table_dlg.row_all}</option>
|
147 |
-
</select>
|
148 |
-
</div>
|
149 |
-
|
150 |
-
<div style="float: left">
|
151 |
-
<div><input type="submit" id="insert" name="insert" value="{#update}" /></div>
|
152 |
-
</div>
|
153 |
-
|
154 |
-
<div style="float: right">
|
155 |
-
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
156 |
-
</div>
|
157 |
-
</div>
|
158 |
-
</form>
|
159 |
-
</body>
|
160 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
table-old/table.htm
DELETED
@@ -1,192 +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.title}</title>
|
5 |
-
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
6 |
-
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/mctabs.js"></script>
|
7 |
-
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/form_utils.js"></script>
|
8 |
-
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/validate.js"></script>
|
9 |
-
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/editable_selects.js"></script>
|
10 |
-
<script type="text/javascript" src="js/table.js"></script>
|
11 |
-
<link href="css/table.css" rel="stylesheet" type="text/css" />
|
12 |
-
</head>
|
13 |
-
<body id="table" style="display: none">
|
14 |
-
<form onsubmit="insertTable();return false;" action="#">
|
15 |
-
<div class="tabs">
|
16 |
-
<ul>
|
17 |
-
<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>
|
18 |
-
<li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#table_dlg.advanced_tab}</a></span></li>
|
19 |
-
</ul>
|
20 |
-
</div>
|
21 |
-
|
22 |
-
<div class="panel_wrapper">
|
23 |
-
<div id="general_panel" class="panel current">
|
24 |
-
<fieldset>
|
25 |
-
<legend>{#table_dlg.general_props}</legend>
|
26 |
-
<table border="0" cellpadding="4" cellspacing="0" width="100%">
|
27 |
-
<tr>
|
28 |
-
<td><label id="colslabel" for="cols">{#table_dlg.cols}</label></td>
|
29 |
-
<td><input id="cols" name="cols" type="text" value="" size="3" maxlength="3" class="required number min1 mceFocus" /></td>
|
30 |
-
<td><label id="rowslabel" for="rows">{#table_dlg.rows}</label></td>
|
31 |
-
<td><input id="rows" name="rows" type="text" value="" size="3" maxlength="3" class="required number min1" /></td>
|
32 |
-
</tr>
|
33 |
-
<tr>
|
34 |
-
<td><label id="cellpaddinglabel" for="cellpadding">{#table_dlg.cellpadding}</label></td>
|
35 |
-
<td><input id="cellpadding" name="cellpadding" type="text" value="" size="3" maxlength="3" class="number" /></td>
|
36 |
-
<td><label id="cellspacinglabel" for="cellspacing">{#table_dlg.cellspacing}</label></td>
|
37 |
-
<td><input id="cellspacing" name="cellspacing" type="text" value="" size="3" maxlength="3" class="number" /></td>
|
38 |
-
</tr>
|
39 |
-
<tr>
|
40 |
-
<td><label id="alignlabel" for="align">{#table_dlg.align}</label></td>
|
41 |
-
<td><select id="align" name="align">
|
42 |
-
<option value="">{#not_set}</option>
|
43 |
-
<option value="center">{#table_dlg.align_middle}</option>
|
44 |
-
<option value="left">{#table_dlg.align_left}</option>
|
45 |
-
<option value="right">{#table_dlg.align_right}</option>
|
46 |
-
</select></td>
|
47 |
-
<td><label id="borderlabel" for="border">{#table_dlg.border}</label></td>
|
48 |
-
<td><input id="border" name="border" type="text" value="" size="3" maxlength="3" onchange="changedBorder();" class="number" /></td>
|
49 |
-
</tr>
|
50 |
-
<tr id="width_row">
|
51 |
-
<td><label id="widthlabel" for="width">{#table_dlg.width}</label></td>
|
52 |
-
<td><input name="width" type="text" id="width" value="" size="4" maxlength="4" onchange="changedSize();" class="size" /></td>
|
53 |
-
<td><label id="heightlabel" for="height">{#table_dlg.height}</label></td>
|
54 |
-
<td><input name="height" type="text" id="height" value="" size="4" maxlength="4" onchange="changedSize();" class="size" /></td>
|
55 |
-
</tr>
|
56 |
-
<tr id="styleSelectRow">
|
57 |
-
<td><label id="classlabel" for="class">{#class_name}</label></td>
|
58 |
-
<td colspan="3">
|
59 |
-
<select id="class" name="class" class="mceEditableSelect">
|
60 |
-
<option value="" selected="selected">{#not_set}</option>
|
61 |
-
</select></td>
|
62 |
-
</tr>
|
63 |
-
<tr>
|
64 |
-
<td class="column1"><label for="caption">{#table_dlg.caption}</label></td>
|
65 |
-
<td><input id="caption" name="caption" type="checkbox" class="checkbox" value="true" /></td>
|
66 |
-
</tr>
|
67 |
-
</table>
|
68 |
-
</fieldset>
|
69 |
-
</div>
|
70 |
-
|
71 |
-
<div id="advanced_panel" class="panel">
|
72 |
-
<fieldset>
|
73 |
-
<legend>{#table_dlg.advanced_props}</legend>
|
74 |
-
|
75 |
-
<table border="0" cellpadding="0" cellspacing="4">
|
76 |
-
<tr>
|
77 |
-
<td class="column1"><label for="id">{#table_dlg.id}</label></td>
|
78 |
-
<td><input id="id" name="id" type="text" value="" class="advfield" /></td>
|
79 |
-
</tr>
|
80 |
-
|
81 |
-
<tr>
|
82 |
-
<td class="column1"><label for="summary">{#table_dlg.summary}</label></td>
|
83 |
-
<td><input id="summary" name="summary" type="text" value="" class="advfield" /></td>
|
84 |
-
</tr>
|
85 |
-
|
86 |
-
<tr>
|
87 |
-
<td><label for="style">{#table_dlg.style}</label></td>
|
88 |
-
<td><input type="text" id="style" name="style" value="" class="advfield" onchange="changedStyle();" /></td>
|
89 |
-
</tr>
|
90 |
-
|
91 |
-
<tr>
|
92 |
-
<td class="column1"><label id="langlabel" for="lang">{#table_dlg.langcode}</label></td>
|
93 |
-
<td>
|
94 |
-
<input id="lang" name="lang" type="text" value="" class="advfield" />
|
95 |
-
</td>
|
96 |
-
</tr>
|
97 |
-
|
98 |
-
<tr>
|
99 |
-
<td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td>
|
100 |
-
<td>
|
101 |
-
<table border="0" cellpadding="0" cellspacing="0">
|
102 |
-
<tr>
|
103 |
-
<td><input id="backgroundimage" name="backgroundimage" type="text" value="" class="advfield" onchange="changedBackgroundImage();" /></td>
|
104 |
-
<td id="backgroundimagebrowsercontainer"> </td>
|
105 |
-
</tr>
|
106 |
-
</table>
|
107 |
-
</td>
|
108 |
-
</tr>
|
109 |
-
|
110 |
-
<tr>
|
111 |
-
<td class="column1"><label for="tframe">{#table_dlg.frame}</label></td>
|
112 |
-
<td>
|
113 |
-
<select id="tframe" name="tframe" class="advfield">
|
114 |
-
<option value="">{#not_set}</option>
|
115 |
-
<option value="void">{#table_dlg.rules_void}</option>
|
116 |
-
<option value="above">{#table_dlg.rules_above}</option>
|
117 |
-
<option value="below">{#table_dlg.rules_below}</option>
|
118 |
-
<option value="hsides">{#table_dlg.rules_hsides}</option>
|
119 |
-
<option value="lhs">{#table_dlg.rules_lhs}</option>
|
120 |
-
<option value="rhs">{#table_dlg.rules_rhs}</option>
|
121 |
-
<option value="vsides">{#table_dlg.rules_vsides}</option>
|
122 |
-
<option value="box">{#table_dlg.rules_box}</option>
|
123 |
-
<option value="border">{#table_dlg.rules_border}</option>
|
124 |
-
</select>
|
125 |
-
</td>
|
126 |
-
</tr>
|
127 |
-
|
128 |
-
<tr>
|
129 |
-
<td class="column1"><label for="rules">{#table_dlg.rules}</label></td>
|
130 |
-
<td>
|
131 |
-
<select id="rules" name="rules" class="advfield">
|
132 |
-
<option value="">{#not_set}</option>
|
133 |
-
<option value="none">{#table_dlg.frame_none}</option>
|
134 |
-
<option value="groups">{#table_dlg.frame_groups}</option>
|
135 |
-
<option value="rows">{#table_dlg.frame_rows}</option>
|
136 |
-
<option value="cols">{#table_dlg.frame_cols}</option>
|
137 |
-
<option value="all">{#table_dlg.frame_all}</option>
|
138 |
-
</select>
|
139 |
-
</td>
|
140 |
-
</tr>
|
141 |
-
|
142 |
-
<tr>
|
143 |
-
<td class="column1"><label for="dir">{#table_dlg.langdir}</label></td>
|
144 |
-
<td>
|
145 |
-
<select id="dir" name="dir" class="advfield">
|
146 |
-
<option value="">{#not_set}</option>
|
147 |
-
<option value="ltr">{#table_dlg.ltr}</option>
|
148 |
-
<option value="rtl">{#table_dlg.rtl}</option>
|
149 |
-
</select>
|
150 |
-
</td>
|
151 |
-
</tr>
|
152 |
-
|
153 |
-
<tr>
|
154 |
-
<td class="column1"><label for="bordercolor">{#table_dlg.bordercolor}</label></td>
|
155 |
-
<td>
|
156 |
-
<table border="0" cellpadding="0" cellspacing="0">
|
157 |
-
<tr>
|
158 |
-
<td><input id="bordercolor" name="bordercolor" type="text" value="" size="9" onchange="updateColor('bordercolor_pick','bordercolor');changedColor();" /></td>
|
159 |
-
<td id="bordercolor_pickcontainer"> </td>
|
160 |
-
</tr>
|
161 |
-
</table>
|
162 |
-
</td>
|
163 |
-
</tr>
|
164 |
-
|
165 |
-
<tr>
|
166 |
-
<td class="column1"><label for="bgcolor">{#table_dlg.bgcolor}</label></td>
|
167 |
-
<td>
|
168 |
-
<table border="0" cellpadding="0" cellspacing="0">
|
169 |
-
<tr>
|
170 |
-
<td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedColor();" /></td>
|
171 |
-
<td id="bgcolor_pickcontainer"> </td>
|
172 |
-
</tr>
|
173 |
-
</table>
|
174 |
-
</td>
|
175 |
-
</tr>
|
176 |
-
</table>
|
177 |
-
</fieldset>
|
178 |
-
</div>
|
179 |
-
</div>
|
180 |
-
|
181 |
-
<div class="mceActionPanel">
|
182 |
-
<div style="float: left">
|
183 |
-
<input type="submit" id="insert" name="insert" value="{#insert}" />
|
184 |
-
</div>
|
185 |
-
|
186 |
-
<div style="float: right">
|
187 |
-
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
188 |
-
</div>
|
189 |
-
</div>
|
190 |
-
</form>
|
191 |
-
</body>
|
192 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
table/cell.htm
CHANGED
@@ -5,16 +5,17 @@
|
|
5 |
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
6 |
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/mctabs.js"></script>
|
7 |
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/form_utils.js"></script>
|
|
|
8 |
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/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">
|
13 |
<form onsubmit="updateAction();return false;" action="#">
|
14 |
<div class="tabs">
|
15 |
<ul>
|
16 |
-
<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#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>
|
18 |
</ul>
|
19 |
</div>
|
20 |
|
@@ -23,7 +24,7 @@
|
|
23 |
<fieldset>
|
24 |
<legend>{#table_dlg.general_props}</legend>
|
25 |
|
26 |
-
<table border="0" cellpadding="4" cellspacing="0">
|
27 |
<tr>
|
28 |
<td><label for="align">{#table_dlg.align}</label></td>
|
29 |
<td>
|
@@ -70,10 +71,10 @@
|
|
70 |
|
71 |
<tr>
|
72 |
<td><label for="width">{#table_dlg.width}</label></td>
|
73 |
-
<td><input id="width" name="width" type="text" value="" size="
|
74 |
|
75 |
<td><label for="height">{#table_dlg.height}</label></td>
|
76 |
-
<td><input id="height" name="height" type="text" value="" size="
|
77 |
</tr>
|
78 |
|
79 |
<tr id="styleSelectRow">
|
@@ -92,7 +93,7 @@
|
|
92 |
<fieldset>
|
93 |
<legend>{#table_dlg.advanced_props}</legend>
|
94 |
|
95 |
-
<table 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>
|
@@ -124,7 +125,7 @@
|
|
124 |
<tr>
|
125 |
<td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td>
|
126 |
<td>
|
127 |
-
<table 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>
|
@@ -133,10 +134,10 @@
|
|
133 |
</td>
|
134 |
</tr>
|
135 |
|
136 |
-
<tr>
|
137 |
-
<td class="column1"><label for="bordercolor">{#table_dlg.bordercolor}</label></td>
|
138 |
<td>
|
139 |
-
<table 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>
|
@@ -145,10 +146,10 @@
|
|
145 |
</td>
|
146 |
</tr>
|
147 |
|
148 |
-
<tr>
|
149 |
-
<td class="column1"><label for="bgcolor">{#table_dlg.bgcolor}</label></td>
|
150 |
<td>
|
151 |
-
<table 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>
|
@@ -166,6 +167,7 @@
|
|
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>
|
5 |
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
6 |
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/mctabs.js"></script>
|
7 |
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/form_utils.js"></script>
|
8 |
+
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/validate.js"></script>
|
9 |
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/editable_selects.js"></script>
|
10 |
<script type="text/javascript" src="js/cell.js"></script>
|
11 |
<link href="css/cell.css" rel="stylesheet" type="text/css" />
|
12 |
</head>
|
13 |
+
<body id="tablecell" style="display: none" role="application">
|
14 |
<form onsubmit="updateAction();return false;" action="#">
|
15 |
<div class="tabs">
|
16 |
<ul>
|
17 |
+
<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>
|
18 |
+
<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>
|
19 |
</ul>
|
20 |
</div>
|
21 |
|
24 |
<fieldset>
|
25 |
<legend>{#table_dlg.general_props}</legend>
|
26 |
|
27 |
+
<table role="presentation" border="0" cellpadding="4" cellspacing="0">
|
28 |
<tr>
|
29 |
<td><label for="align">{#table_dlg.align}</label></td>
|
30 |
<td>
|
71 |
|
72 |
<tr>
|
73 |
<td><label for="width">{#table_dlg.width}</label></td>
|
74 |
+
<td><input id="width" name="width" type="text" value="" size="7" maxlength="7" onchange="changedSize();" class="size" /></td>
|
75 |
|
76 |
<td><label for="height">{#table_dlg.height}</label></td>
|
77 |
+
<td><input id="height" name="height" type="text" value="" size="7" maxlength="7" onchange="changedSize();" class="size" /></td>
|
78 |
</tr>
|
79 |
|
80 |
<tr id="styleSelectRow">
|
93 |
<fieldset>
|
94 |
<legend>{#table_dlg.advanced_props}</legend>
|
95 |
|
96 |
+
<table role="presentation" border="0" cellpadding="0" cellspacing="4">
|
97 |
<tr>
|
98 |
<td class="column1"><label for="id">{#table_dlg.id}</label></td>
|
99 |
<td><input id="id" name="id" type="text" value="" style="width: 200px" /></td>
|
125 |
<tr>
|
126 |
<td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td>
|
127 |
<td>
|
128 |
+
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
129 |
<tr>
|
130 |
<td><input id="backgroundimage" name="backgroundimage" type="text" value="" style="width: 200px" onchange="changedBackgroundImage();" /></td>
|
131 |
<td id="backgroundimagebrowsercontainer"> </td>
|
134 |
</td>
|
135 |
</tr>
|
136 |
|
137 |
+
<tr role="group" aria-labelledby="bordercolor_label">
|
138 |
+
<td class="column1"><label id="bordercolor_label" for="bordercolor">{#table_dlg.bordercolor}</label></td>
|
139 |
<td>
|
140 |
+
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
141 |
<tr>
|
142 |
<td><input id="bordercolor" name="bordercolor" type="text" value="" size="9" onchange="updateColor('bordercolor_pick','bordercolor');changedColor();" /></td>
|
143 |
<td id="bordercolor_pickcontainer"> </td>
|
146 |
</td>
|
147 |
</tr>
|
148 |
|
149 |
+
<tr role="group" aria-labelledby="bgcolor_label">
|
150 |
+
<td class="column1"><label id="bgcolor_label" for="bgcolor">{#table_dlg.bgcolor}</label></td>
|
151 |
<td>
|
152 |
+
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
153 |
<tr>
|
154 |
<td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedColor();" /></td>
|
155 |
<td id="bgcolor_pickcontainer"> </td>
|
167 |
<select id="action" name="action">
|
168 |
<option value="cell">{#table_dlg.cell_cell}</option>
|
169 |
<option value="row">{#table_dlg.cell_row}</option>
|
170 |
+
<option value="col">{#table_dlg.cell_col}</option>
|
171 |
<option value="all">{#table_dlg.cell_all}</option>
|
172 |
</select>
|
173 |
</div>
|
table/editor_plugin.js
CHANGED
@@ -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(d){var e=d.each;function c(g,h){var j=h.ownerDocument,f=j.createRange(),k;f.setStartBefore(h);f.setEnd(g.endContainer,g.endOffset);k=j.createElement("body");k.appendChild(f.cloneContents());return k.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi,"-").replace(/<[^>]+>/g,"").length==0}function a(g,f){return parseInt(g.getAttribute(f)||1)}function b(H,G,K){var g,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;g=[];e(["thead","tbody","tfoot"],function(N){var O=G.select("> "+N+" tr",H);e(O,function(P,Q){Q+=M;e(G.select("> td, > th",P),function(W,R){var S,T,U,V;if(g[Q]){while(g[Q][R]){R++}}U=a(W,"rowspan");V=a(W,"colspan");for(T=Q;T<Q+U;T++){if(!g[T]){g[T]=[]}for(S=R;S<R+V;S++){g[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=g[O];if(N){return N[M]}}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=[];e(H.rows,function(N){e(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 f(M){var N;d.walk(M,function(P){var O;if(P.nodeType==3){e(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=d.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(!d.isIE){M.innerHTML='<br data-mce-bogus="1" />'}}return M}function q(){var M=G.createRng();e(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}e(G.select("thead,tbody,tfoot",H),function(N){if(N.rows.length==0){G.remove(N)}});t();row=g[Math.min(g.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=g[Q][S].elm.parentNode;for(M=1;M<=U;M++){P=G.getNext(P,"tr");if(P){for(N=S;N>=0;N--){T=g[Q+M][N].elm;if(T.parentNode==P){for(O=1;O<=R;O++){G.insertAfter(f(T),T)}break}}if(N==-1){for(O=1;O<=R;O++){P.insertBefore(f(P.cells[0]),P.cells[0])}}}}}function C(){e(g,function(M,N){e(M,function(P,O){var S,R,T,Q;if(j(P)){P=P.elm;S=a(P,"colspan");R=a(P,"rowspan");if(S>1||R>1){s(P,"rowSpan",1);s(P,"colSpan",1);for(Q=0;Q<S-1;Q++){G.insertAfter(f(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(!g[R]||!g[R][U]){continue}V=g[R][U].elm;if(V!=T){N=d.grep(V.childNodes);e(N,function(Z){T.appendChild(Z)});if(N.length){N=d.grep(T.childNodes);Q=0;e(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;e(g,function(W,X){e(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<g[0].length;R++){if(!g[M][R]){continue}S=g[M][R].elm;if(S!=P){if(!Q){O=a(S,"rowspan");if(O>1){s(S,"rowSpan",O+1);continue}}else{if(M>0&&g[M-1][R]){V=g[M-1][R].elm;O=a(V,"rowSpan");if(O>1){s(V,"rowSpan",O+1);continue}}}N=f(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 h(N){var O,M;e(g,function(P,Q){e(P,function(S,R){if(j(S)){O=R;if(N){return false}}});if(N){return !O}});e(g,function(S,T){var P,Q,R;if(!S[O]){return}P=S[O].elm;if(P!=M){R=a(P,"colspan");Q=a(P,"rowspan");if(R==1){if(!N){G.insertAfter(f(P),P);u(O,T,Q-1,R)}else{P.parentNode.insertBefore(f(P),P);u(O,T,Q-1,R)}}else{s(P,"colSpan",P.colSpan+1)}M=P}})}function n(){var M=[];e(g,function(N,O){e(N,function(Q,P){if(j(Q)&&d.inArray(M,P)===-1){e(g,function(T){var R=T[P].elm,S;S=a(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");e(Q.cells,function(S){var T=a(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]);e(g[R.y],function(S){var T;S=S.elm;if(S!=O){T=a(S,"rowSpan");if(T<=1){G.remove(S)}else{s(S,"rowSpan",T-1)}O=S}})}N=k();e(N.reverse(),function(O){M(O)});q()}function E(){var M=k();G.remove(M);q();return M}function J(){var M=k();e(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;e(g,function(S){var R;Q=0;e(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()}e(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(f(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;e(g,function(O,P){e(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;e(g,function(P,Q){e(P,function(S,R){var U,T;if(j(S)){S=g[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=g[y][P];if(!S.real){if(P-(S.colspan-1)<P){P-=S.colspan-1}}}for(x=P;x<=N;x++){S=g[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=g[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(g[y][x]){G.addClass(g[y][x].elm,"mceSelected")}}}}}d.extend(this,{deleteTable:r,split:C,merge:p,insertRow:l,insertCol:h,deleteCols:n,deleteRows:m,cutRows:E,copyRows:J,pasteRows:B,getPos:F,setStartCell:w,setEndCell:v})}d.create("tinymce.plugins.TablePlugin",{init:function(g,h){var f,m,j=true;function l(p){var o=g.selection,n=g.dom.getParent(p||o.getNode(),"table");if(n){return new b(n,g.dom,o)}}function k(){g.getBody().style.webkitUserSelect="";if(j){g.dom.removeClass(g.dom.select("td.mceSelected,th.mceSelected"),"mceSelected");j=false}}e([["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(n){g.addButton(n[0],{title:n[1],cmd:n[2],ui:n[3]})});if(!d.isIE){g.onClick.add(function(n,o){o=o.target;if(o.nodeName==="TABLE"){n.selection.select(o);n.nodeChanged()}})}g.onPreProcess.add(function(o,p){var n,q,r,t=o.dom,s;n=t.select("table",p.node);q=n.length;while(q--){r=n[q];t.setAttrib(r,"data-mce-style","");if((s=t.getAttrib(r,"width"))){t.setStyle(r,"width",s);t.setAttrib(r,"width","")}if((s=t.getAttrib(r,"height"))){t.setStyle(r,"height",s);t.setAttrib(r,"height","")}}});g.onNodeChange.add(function(q,o,s){var r;s=q.selection.getStart();r=q.dom.getParent(s,"td,th,caption");o.setActive("table",s.nodeName==="TABLE"||!!r);if(r&&r.nodeName==="CAPTION"){r=0}o.setDisabled("delete_table",!r);o.setDisabled("delete_col",!r);o.setDisabled("delete_table",!r);o.setDisabled("delete_row",!r);o.setDisabled("col_after",!r);o.setDisabled("col_before",!r);o.setDisabled("row_after",!r);o.setDisabled("row_before",!r);o.setDisabled("row_props",!r);o.setDisabled("cell_props",!r);o.setDisabled("split_cells",!r);o.setDisabled("merge_cells",!r)});g.onInit.add(function(r){var p,t,q=r.dom,u;f=r.windowManager;r.onMouseDown.add(function(w,z){if(z.button!=2){k();t=q.getParent(z.target,"td,th");p=q.getParent(t,"table")}});q.bind(r.getDoc(),"mouseover",function(C){var A,z,B=C.target;if(t&&(u||B!=t)&&(B.nodeName=="TD"||B.nodeName=="TH")){z=q.getParent(B,"table");if(z==p){if(!u){u=l(z);u.setStartCell(t);r.getBody().style.webkitUserSelect="none"}u.setEndCell(B);j=true}A=r.selection.getSel();try{if(A.removeAllRanges){A.removeAllRanges()}else{A.empty()}}catch(w){}C.preventDefault()}});r.onMouseUp.add(function(F,G){var z,B=F.selection,H,I=B.getSel(),w,C,A,E;if(t){if(u){F.getBody().style.webkitUserSelect=""}function D(J,L){var K=new d.dom.TreeWalker(J,J);do{if(J.nodeType==3&&d.trim(J.nodeValue).length!=0){if(L){z.setStart(J,0)}else{z.setEnd(J,J.nodeValue.length)}return}if(J.nodeName=="BR"){if(L){z.setStartBefore(J)}else{z.setEndBefore(J)}return}}while(J=(L?K.next():K.prev()))}H=q.select("td.mceSelected,th.mceSelected");if(H.length>0){z=q.createRng();C=H[0];E=H[H.length-1];z.setStartBefore(C);z.setEndAfter(C);D(C,1);w=new d.dom.TreeWalker(C,q.getParent(H[0],"table"));do{if(C.nodeName=="TD"||C.nodeName=="TH"){if(!q.hasClass(C,"mceSelected")){break}A=C}}while(C=w.next());D(A);B.setRng(z)}F.nodeChanged();t=u=p=null}});r.onKeyUp.add(function(w,z){k()});r.onKeyDown.add(function(w,z){n(w)});r.onMouseDown.add(function(w,z){if(z.button!=2){n(w)}});function o(D,z,A,F){var B=3,G=D.dom.getParent(z.startContainer,"TABLE"),C,w,E;if(G){C=G.parentNode}w=z.startContainer.nodeType==B&&z.startOffset==0&&z.endOffset==0&&F&&(A.nodeName=="TR"||A==C);E=(A.nodeName=="TD"||A.nodeName=="TH")&&!F;return w||E}function n(A){if(!d.isWebKit){return}var z=A.selection.getRng();var C=A.selection.getNode();var B=A.dom.getParent(z.startContainer,"TD");if(!o(A,z,C,B)){return}if(!B){B=C}var w=B.lastChild;while(w.lastChild){w=w.lastChild}z.setEnd(w,w.nodeValue.length);A.selection.setRng(z)}r.plugins.table.fixTableCellSelection=n;if(r&&r.plugins.contextmenu){r.plugins.contextmenu.onContextMenu.add(function(A,w,C){var D,B=r.selection,z=B.getNode()||r.getBody();if(r.dom.getParent(C,"td")||r.dom.getParent(C,"th")||r.dom.select("td.mceSelected,th.mceSelected").length){w.removeAll();if(z.nodeName=="A"&&!r.dom.getAttrib(z,"name")){w.add({title:"advanced.link_desc",icon:"link",cmd:r.plugins.advlink?"mceAdvLink":"mceLink",ui:true});w.add({title:"advanced.unlink_desc",icon:"unlink",cmd:"UnLink"});w.addSeparator()}if(z.nodeName=="IMG"&&z.className.indexOf("mceItem")==-1){w.add({title:"advanced.image_desc",icon:"image",cmd:r.plugins.advimage?"mceAdvImage":"mceImage",ui:true});w.addSeparator()}w.add({title:"table.desc",icon:"table",cmd:"mceInsertTable",value:{action:"insert"}});w.add({title:"table.props_desc",icon:"table_props",cmd:"mceInsertTable"});w.add({title:"table.del",icon:"delete_table",cmd:"mceTableDelete"});w.addSeparator();D=w.addMenu({title:"table.cell"});D.add({title:"table.cell_desc",icon:"cell_props",cmd:"mceTableCellProps"});D.add({title:"table.split_cells_desc",icon:"split_cells",cmd:"mceTableSplitCells"});D.add({title:"table.merge_cells_desc",icon:"merge_cells",cmd:"mceTableMergeCells"});D=w.addMenu({title:"table.row"});D.add({title:"table.row_desc",icon:"row_props",cmd:"mceTableRowProps"});D.add({title:"table.row_before_desc",icon:"row_before",cmd:"mceTableInsertRowBefore"});D.add({title:"table.row_after_desc",icon:"row_after",cmd:"mceTableInsertRowAfter"});D.add({title:"table.delete_row_desc",icon:"delete_row",cmd:"mceTableDeleteRow"});D.addSeparator();D.add({title:"table.cut_row_desc",icon:"cut",cmd:"mceTableCutRow"});D.add({title:"table.copy_row_desc",icon:"copy",cmd:"mceTableCopyRow"});D.add({title:"table.paste_row_before_desc",icon:"paste",cmd:"mceTablePasteRowBefore"}).setDisabled(!m);D.add({title:"table.paste_row_after_desc",icon:"paste",cmd:"mceTablePasteRowAfter"}).setDisabled(!m);D=w.addMenu({title:"table.col"});D.add({title:"table.col_before_desc",icon:"col_before",cmd:"mceTableInsertColBefore"});D.add({title:"table.col_after_desc",icon:"col_after",cmd:"mceTableInsertColAfter"});D.add({title:"table.delete_col_desc",icon:"delete_col",cmd:"mceTableDeleteCol"})}else{w.add({title:"table.desc",icon:"table",cmd:"mceInsertTable"})}})}if(d.isWebKit){function v(B,M){function F(Q){B.selection.setCursorLocation(Q,0)}function H(R,Q){return R.keyCode==z?Q.previousSibling:Q.nextSibling}function G(R,S){var Q=H(R,S);return Q!==null&&Q.tagName==="TR"?Q:null}function C(Q,R){return Q.dom.getParent(R,"table")}function O(Q){var R=C(B,Q);return H(M,R)}function A(Q){return Q.keyCode==z||Q.keyCode==I}function D(Q){var S=Q.selection.getNode();var R=Q.dom.getParent(S,"tr");return R!==null}function N(R){var Q=0;var S=R;while(S.previousSibling){S=S.previousSibling;Q=Q+a(S,"colspan")}return Q}function E(S,Q){var T=0;var R=0;e(S.children,function(U,V){T=T+a(U,"colspan");R=V;if(T>Q){return false}});return R}function w(S,T,V){var U=N(S.dom.getParent(T,"td,th"));var R=E(V,U);var Q=V.childNodes[R];F(Q)}function L(R,T){var Q=O(R);if(Q!==null){F(Q);return d.dom.Event.cancel(T)}else{var S=T.keyCode==z?R.firstChild:R.lastChild;F(S);return true}}var z=38;var I=40;if(A(M)&&D(B)){var J=B.selection.getNode();var P=B.dom.getParent(J,"tr");var K=G(M,P);if(K==null){return L(P,M)}else{w(B,J,K);d.dom.Event.cancel(M);return true}}}r.onKeyDown.add(v)}if(!d.isIE){function s(){var w;for(w=r.getBody().lastChild;w&&w.nodeType==3&&!w.nodeValue.length;w=w.previousSibling){}if(w&&w.nodeName=="TABLE"){r.dom.add(r.getBody(),"p",null,'<br mce_bogus="1" />')}}if(d.isGecko){r.onKeyDown.add(function(z,B){var w,A,C=z.dom;if(B.keyCode==37||B.keyCode==38){w=z.selection.getRng();A=C.getParent(w.startContainer,"table");if(A&&z.getBody().firstChild==A){if(c(w,A)){w=C.createRng();w.setStartBefore(A);w.setEndBefore(A);z.selection.setRng(w);B.preventDefault()}}}})}r.onKeyUp.add(s);r.onSetContent.add(s);r.onVisualAid.add(s);r.onPreProcess.add(function(w,A){var z=A.node.lastChild;if(z&&z.childNodes.length==1&&z.firstChild.nodeName=="BR"){w.dom.remove(z)}});s();r.startContent=r.getContent({format:"raw"})}});e({mceTableSplitCells:function(n){n.split()},mceTableMergeCells:function(o){var p,q,n;n=g.dom.getParent(g.selection.getNode(),"th,td");if(n){p=n.rowSpan;q=n.colSpan}if(!g.dom.select("td.mceSelected,th.mceSelected").length){f.open({url:h+"/merge_cells.htm",width:240+parseInt(g.getLang("table.merge_cells_delta_width",0)),height:110+parseInt(g.getLang("table.merge_cells_delta_height",0)),inline:1},{rows:p,cols:q,onaction:function(r){o.merge(n,r.cols,r.rows)},plugin_url:h})}else{o.merge()}},mceTableInsertRowBefore:function(n){n.insertRow(true)},mceTableInsertRowAfter:function(n){n.insertRow()},mceTableInsertColBefore:function(n){n.insertCol(true)},mceTableInsertColAfter:function(n){n.insertCol()},mceTableDeleteCol:function(n){n.deleteCols()},mceTableDeleteRow:function(n){n.deleteRows()},mceTableCutRow:function(n){m=n.cutRows()},mceTableCopyRow:function(n){m=n.copyRows()},mceTablePasteRowBefore:function(n){n.pasteRows(m,true)},mceTablePasteRowAfter:function(n){n.pasteRows(m)},mceTableDelete:function(n){n.deleteTable()}},function(o,n){g.addCommand(n,function(){var p=l();if(p){o(p);g.execCommand("mceRepaint");k()}})});e({mceInsertTable:function(n){f.open({url:h+"/table.htm",width:400+parseInt(g.getLang("table.table_delta_width",0)),height:320+parseInt(g.getLang("table.table_delta_height",0)),inline:1},{plugin_url:h,action:n?n.action:0})},mceTableRowProps:function(){f.open({url:h+"/row.htm",width:400+parseInt(g.getLang("table.rowprops_delta_width",0)),height:295+parseInt(g.getLang("table.rowprops_delta_height",0)),inline:1},{plugin_url:h})},mceTableCellProps:function(){f.open({url:h+"/cell.htm",width:400+parseInt(g.getLang("table.cellprops_delta_width",0)),height:295+parseInt(g.getLang("table.cellprops_delta_height",0)),inline:1},{plugin_url:h})}},function(o,n){g.addCommand(n,function(p,q){o(q)})})}});d.PluginManager.add("table",d.plugins.TablePlugin)})(tinymce);
|
table/editor_plugin_src.js
ADDED
@@ -0,0 +1,1364 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
function getSpanVal(td, name) {
|
29 |
+
return parseInt(td.getAttribute(name) || 1);
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Table Grid class.
|
34 |
+
*/
|
35 |
+
function TableGrid(table, dom, selection) {
|
36 |
+
var grid, startPos, endPos, selectedCell;
|
37 |
+
|
38 |
+
buildGrid();
|
39 |
+
selectedCell = dom.getParent(selection.getStart(), 'th,td');
|
40 |
+
if (selectedCell) {
|
41 |
+
startPos = getPos(selectedCell);
|
42 |
+
endPos = findEndPos();
|
43 |
+
selectedCell = getCell(startPos.x, startPos.y);
|
44 |
+
}
|
45 |
+
|
46 |
+
function cloneNode(node, children) {
|
47 |
+
node = node.cloneNode(children);
|
48 |
+
node.removeAttribute('id');
|
49 |
+
|
50 |
+
return node;
|
51 |
+
}
|
52 |
+
|
53 |
+
function buildGrid() {
|
54 |
+
var startY = 0;
|
55 |
+
|
56 |
+
grid = [];
|
57 |
+
|
58 |
+
each(['thead', 'tbody', 'tfoot'], function(part) {
|
59 |
+
var rows = dom.select('> ' + part + ' tr', table);
|
60 |
+
|
61 |
+
each(rows, function(tr, y) {
|
62 |
+
y += startY;
|
63 |
+
|
64 |
+
each(dom.select('> td, > th', tr), function(td, x) {
|
65 |
+
var x2, y2, rowspan, colspan;
|
66 |
+
|
67 |
+
// Skip over existing cells produced by rowspan
|
68 |
+
if (grid[y]) {
|
69 |
+
while (grid[y][x])
|
70 |
+
x++;
|
71 |
+
}
|
72 |
+
|
73 |
+
// Get col/rowspan from cell
|
74 |
+
rowspan = getSpanVal(td, 'rowspan');
|
75 |
+
colspan = getSpanVal(td, 'colspan');
|
76 |
+
|
77 |
+
// Fill out rowspan/colspan right and down
|
78 |
+
for (y2 = y; y2 < y + rowspan; y2++) {
|
79 |
+
if (!grid[y2])
|
80 |
+
grid[y2] = [];
|
81 |
+
|
82 |
+
for (x2 = x; x2 < x + colspan; x2++) {
|
83 |
+
grid[y2][x2] = {
|
84 |
+
part : part,
|
85 |
+
real : y2 == y && x2 == x,
|
86 |
+
elm : td,
|
87 |
+
rowspan : rowspan,
|
88 |
+
colspan : colspan
|
89 |
+
};
|
90 |
+
}
|
91 |
+
}
|
92 |
+
});
|
93 |
+
});
|
94 |
+
|
95 |
+
startY += rows.length;
|
96 |
+
});
|
97 |
+
};
|
98 |
+
|
99 |
+
function getCell(x, y) {
|
100 |
+
var row;
|
101 |
+
|
102 |
+
row = grid[y];
|
103 |
+
if (row)
|
104 |
+
return row[x];
|
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, hasCellSelection = true; // Might be selected cells on reload
|
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 |
+
|
768 |
+
if (hasCellSelection) {
|
769 |
+
ed.dom.removeClass(ed.dom.select('td.mceSelected,th.mceSelected'), 'mceSelected');
|
770 |
+
hasCellSelection = false;
|
771 |
+
}
|
772 |
+
};
|
773 |
+
|
774 |
+
// Register buttons
|
775 |
+
each([
|
776 |
+
['table', 'table.desc', 'mceInsertTable', true],
|
777 |
+
['delete_table', 'table.del', 'mceTableDelete'],
|
778 |
+
['delete_col', 'table.delete_col_desc', 'mceTableDeleteCol'],
|
779 |
+
['delete_row', 'table.delete_row_desc', 'mceTableDeleteRow'],
|
780 |
+
['col_after', 'table.col_after_desc', 'mceTableInsertColAfter'],
|
781 |
+
['col_before', 'table.col_before_desc', 'mceTableInsertColBefore'],
|
782 |
+
['row_after', 'table.row_after_desc', 'mceTableInsertRowAfter'],
|
783 |
+
['row_before', 'table.row_before_desc', 'mceTableInsertRowBefore'],
|
784 |
+
['row_props', 'table.row_desc', 'mceTableRowProps', true],
|
785 |
+
['cell_props', 'table.cell_desc', 'mceTableCellProps', true],
|
786 |
+
['split_cells', 'table.split_cells_desc', 'mceTableSplitCells', true],
|
787 |
+
['merge_cells', 'table.merge_cells_desc', 'mceTableMergeCells', true]
|
788 |
+
], function(c) {
|
789 |
+
ed.addButton(c[0], {title : c[1], cmd : c[2], ui : c[3]});
|
790 |
+
});
|
791 |
+
|
792 |
+
// Select whole table is a table border is clicked
|
793 |
+
if (!tinymce.isIE) {
|
794 |
+
ed.onClick.add(function(ed, e) {
|
795 |
+
e = e.target;
|
796 |
+
|
797 |
+
if (e.nodeName === 'TABLE') {
|
798 |
+
ed.selection.select(e);
|
799 |
+
ed.nodeChanged();
|
800 |
+
}
|
801 |
+
});
|
802 |
+
}
|
803 |
+
|
804 |
+
ed.onPreProcess.add(function(ed, args) {
|
805 |
+
var nodes, i, node, dom = ed.dom, value;
|
806 |
+
|
807 |
+
nodes = dom.select('table', args.node);
|
808 |
+
i = nodes.length;
|
809 |
+
while (i--) {
|
810 |
+
node = nodes[i];
|
811 |
+
dom.setAttrib(node, 'data-mce-style', '');
|
812 |
+
|
813 |
+
if ((value = dom.getAttrib(node, 'width'))) {
|
814 |
+
dom.setStyle(node, 'width', value);
|
815 |
+
dom.setAttrib(node, 'width', '');
|
816 |
+
}
|
817 |
+
|
818 |
+
if ((value = dom.getAttrib(node, 'height'))) {
|
819 |
+
dom.setStyle(node, 'height', value);
|
820 |
+
dom.setAttrib(node, 'height', '');
|
821 |
+
}
|
822 |
+
}
|
823 |
+
});
|
824 |
+
|
825 |
+
// Handle node change updates
|
826 |
+
ed.onNodeChange.add(function(ed, cm, n) {
|
827 |
+
var p;
|
828 |
+
|
829 |
+
n = ed.selection.getStart();
|
830 |
+
p = ed.dom.getParent(n, 'td,th,caption');
|
831 |
+
cm.setActive('table', n.nodeName === 'TABLE' || !!p);
|
832 |
+
|
833 |
+
// Disable table tools if we are in caption
|
834 |
+
if (p && p.nodeName === 'CAPTION')
|
835 |
+
p = 0;
|
836 |
+
|
837 |
+
cm.setDisabled('delete_table', !p);
|
838 |
+
cm.setDisabled('delete_col', !p);
|
839 |
+
cm.setDisabled('delete_table', !p);
|
840 |
+
cm.setDisabled('delete_row', !p);
|
841 |
+
cm.setDisabled('col_after', !p);
|
842 |
+
cm.setDisabled('col_before', !p);
|
843 |
+
cm.setDisabled('row_after', !p);
|
844 |
+
cm.setDisabled('row_before', !p);
|
845 |
+
cm.setDisabled('row_props', !p);
|
846 |
+
cm.setDisabled('cell_props', !p);
|
847 |
+
cm.setDisabled('split_cells', !p);
|
848 |
+
cm.setDisabled('merge_cells', !p);
|
849 |
+
});
|
850 |
+
|
851 |
+
ed.onInit.add(function(ed) {
|
852 |
+
var startTable, startCell, dom = ed.dom, tableGrid;
|
853 |
+
|
854 |
+
winMan = ed.windowManager;
|
855 |
+
|
856 |
+
// Add cell selection logic
|
857 |
+
ed.onMouseDown.add(function(ed, e) {
|
858 |
+
if (e.button != 2) {
|
859 |
+
cleanup();
|
860 |
+
|
861 |
+
startCell = dom.getParent(e.target, 'td,th');
|
862 |
+
startTable = dom.getParent(startCell, 'table');
|
863 |
+
}
|
864 |
+
});
|
865 |
+
|
866 |
+
dom.bind(ed.getDoc(), 'mouseover', function(e) {
|
867 |
+
var sel, table, target = e.target;
|
868 |
+
|
869 |
+
if (startCell && (tableGrid || target != startCell) && (target.nodeName == 'TD' || target.nodeName == 'TH')) {
|
870 |
+
table = dom.getParent(target, 'table');
|
871 |
+
if (table == startTable) {
|
872 |
+
if (!tableGrid) {
|
873 |
+
tableGrid = createTableGrid(table);
|
874 |
+
tableGrid.setStartCell(startCell);
|
875 |
+
|
876 |
+
ed.getBody().style.webkitUserSelect = 'none';
|
877 |
+
}
|
878 |
+
|
879 |
+
tableGrid.setEndCell(target);
|
880 |
+
hasCellSelection = true;
|
881 |
+
}
|
882 |
+
|
883 |
+
// Remove current selection
|
884 |
+
sel = ed.selection.getSel();
|
885 |
+
|
886 |
+
try {
|
887 |
+
if (sel.removeAllRanges)
|
888 |
+
sel.removeAllRanges();
|
889 |
+
else
|
890 |
+
sel.empty();
|
891 |
+
} catch (ex) {
|
892 |
+
// IE9 might throw errors here
|
893 |
+
}
|
894 |
+
|
895 |
+
e.preventDefault();
|
896 |
+
}
|
897 |
+
});
|
898 |
+
|
899 |
+
ed.onMouseUp.add(function(ed, e) {
|
900 |
+
var rng, sel = ed.selection, selectedCells, nativeSel = sel.getSel(), walker, node, lastNode, endNode;
|
901 |
+
|
902 |
+
// Move selection to startCell
|
903 |
+
if (startCell) {
|
904 |
+
if (tableGrid)
|
905 |
+
ed.getBody().style.webkitUserSelect = '';
|
906 |
+
|
907 |
+
function setPoint(node, start) {
|
908 |
+
var walker = new tinymce.dom.TreeWalker(node, node);
|
909 |
+
|
910 |
+
do {
|
911 |
+
// Text node
|
912 |
+
if (node.nodeType == 3 && tinymce.trim(node.nodeValue).length != 0) {
|
913 |
+
if (start)
|
914 |
+
rng.setStart(node, 0);
|
915 |
+
else
|
916 |
+
rng.setEnd(node, node.nodeValue.length);
|
917 |
+
|
918 |
+
return;
|
919 |
+
}
|
920 |
+
|
921 |
+
// BR element
|
922 |
+
if (node.nodeName == 'BR') {
|
923 |
+
if (start)
|
924 |
+
rng.setStartBefore(node);
|
925 |
+
else
|
926 |
+
rng.setEndBefore(node);
|
927 |
+
|
928 |
+
return;
|
929 |
+
}
|
930 |
+
} while (node = (start ? walker.next() : walker.prev()));
|
931 |
+
}
|
932 |
+
|
933 |
+
// Try to expand text selection as much as we can only Gecko supports cell selection
|
934 |
+
selectedCells = dom.select('td.mceSelected,th.mceSelected');
|
935 |
+
if (selectedCells.length > 0) {
|
936 |
+
rng = dom.createRng();
|
937 |
+
node = selectedCells[0];
|
938 |
+
endNode = selectedCells[selectedCells.length - 1];
|
939 |
+
rng.setStartBefore(node);
|
940 |
+
rng.setEndAfter(node);
|
941 |
+
|
942 |
+
setPoint(node, 1);
|
943 |
+
walker = new tinymce.dom.TreeWalker(node, dom.getParent(selectedCells[0], 'table'));
|
944 |
+
|
945 |
+
do {
|
946 |
+
if (node.nodeName == 'TD' || node.nodeName == 'TH') {
|
947 |
+
if (!dom.hasClass(node, 'mceSelected'))
|
948 |
+
break;
|
949 |
+
|
950 |
+
lastNode = node;
|
951 |
+
}
|
952 |
+
} while (node = walker.next());
|
953 |
+
|
954 |
+
setPoint(lastNode);
|
955 |
+
|
956 |
+
sel.setRng(rng);
|
957 |
+
}
|
958 |
+
|
959 |
+
ed.nodeChanged();
|
960 |
+
startCell = tableGrid = startTable = null;
|
961 |
+
}
|
962 |
+
});
|
963 |
+
|
964 |
+
ed.onKeyUp.add(function(ed, e) {
|
965 |
+
cleanup();
|
966 |
+
});
|
967 |
+
|
968 |
+
ed.onKeyDown.add(function (ed, e) {
|
969 |
+
fixTableCellSelection(ed);
|
970 |
+
});
|
971 |
+
|
972 |
+
ed.onMouseDown.add(function (ed, e) {
|
973 |
+
if (e.button != 2) {
|
974 |
+
fixTableCellSelection(ed);
|
975 |
+
}
|
976 |
+
});
|
977 |
+
function tableCellSelected(ed, rng, n, currentCell) {
|
978 |
+
// The decision of when a table cell is selected is somewhat involved. The fact that this code is
|
979 |
+
// required is actually a pointer to the root cause of this bug. A cell is selected when the start
|
980 |
+
// and end offsets are 0, the start container is a text, and the selection node is either a TR (most cases)
|
981 |
+
// or the parent of the table (in the case of the selection containing the last cell of a table).
|
982 |
+
var TEXT_NODE = 3, table = ed.dom.getParent(rng.startContainer, 'TABLE'),
|
983 |
+
tableParent, allOfCellSelected, tableCellSelection;
|
984 |
+
if (table)
|
985 |
+
tableParent = table.parentNode;
|
986 |
+
allOfCellSelected =rng.startContainer.nodeType == TEXT_NODE &&
|
987 |
+
rng.startOffset == 0 &&
|
988 |
+
rng.endOffset == 0 &&
|
989 |
+
currentCell &&
|
990 |
+
(n.nodeName=="TR" || n==tableParent);
|
991 |
+
tableCellSelection = (n.nodeName=="TD"||n.nodeName=="TH")&& !currentCell;
|
992 |
+
return allOfCellSelected || tableCellSelection;
|
993 |
+
// return false;
|
994 |
+
}
|
995 |
+
|
996 |
+
// this nasty hack is here to work around some WebKit selection bugs.
|
997 |
+
function fixTableCellSelection(ed) {
|
998 |
+
if (!tinymce.isWebKit)
|
999 |
+
return;
|
1000 |
+
|
1001 |
+
var rng = ed.selection.getRng();
|
1002 |
+
var n = ed.selection.getNode();
|
1003 |
+
var currentCell = ed.dom.getParent(rng.startContainer, 'TD');
|
1004 |
+
|
1005 |
+
if (!tableCellSelected(ed, rng, n, currentCell))
|
1006 |
+
return;
|
1007 |
+
if (!currentCell) {
|
1008 |
+
currentCell=n;
|
1009 |
+
}
|
1010 |
+
|
1011 |
+
// Get the very last node inside the table cell
|
1012 |
+
var end = currentCell.lastChild;
|
1013 |
+
while (end.lastChild)
|
1014 |
+
end = end.lastChild;
|
1015 |
+
|
1016 |
+
// Select the entire table cell. Nothing outside of the table cell should be selected.
|
1017 |
+
rng.setEnd(end, end.nodeValue.length);
|
1018 |
+
ed.selection.setRng(rng);
|
1019 |
+
}
|
1020 |
+
ed.plugins.table.fixTableCellSelection=fixTableCellSelection;
|
1021 |
+
|
1022 |
+
// Add context menu
|
1023 |
+
if (ed && ed.plugins.contextmenu) {
|
1024 |
+
ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) {
|
1025 |
+
var sm, se = ed.selection, el = se.getNode() || ed.getBody();
|
1026 |
+
|
1027 |
+
if (ed.dom.getParent(e, 'td') || ed.dom.getParent(e, 'th') || ed.dom.select('td.mceSelected,th.mceSelected').length) {
|
1028 |
+
m.removeAll();
|
1029 |
+
|
1030 |
+
if (el.nodeName == 'A' && !ed.dom.getAttrib(el, 'name')) {
|
1031 |
+
m.add({title : 'advanced.link_desc', icon : 'link', cmd : ed.plugins.advlink ? 'mceAdvLink' : 'mceLink', ui : true});
|
1032 |
+
m.add({title : 'advanced.unlink_desc', icon : 'unlink', cmd : 'UnLink'});
|
1033 |
+
m.addSeparator();
|
1034 |
+
}
|
1035 |
+
|
1036 |
+
if (el.nodeName == 'IMG' && el.className.indexOf('mceItem') == -1) {
|
1037 |
+
m.add({title : 'advanced.image_desc', icon : 'image', cmd : ed.plugins.advimage ? 'mceAdvImage' : 'mceImage', ui : true});
|
1038 |
+
m.addSeparator();
|
1039 |
+
}
|
1040 |
+
|
1041 |
+
m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', value : {action : 'insert'}});
|
1042 |
+
m.add({title : 'table.props_desc', icon : 'table_props', cmd : 'mceInsertTable'});
|
1043 |
+
m.add({title : 'table.del', icon : 'delete_table', cmd : 'mceTableDelete'});
|
1044 |
+
m.addSeparator();
|
1045 |
+
|
1046 |
+
// Cell menu
|
1047 |
+
sm = m.addMenu({title : 'table.cell'});
|
1048 |
+
sm.add({title : 'table.cell_desc', icon : 'cell_props', cmd : 'mceTableCellProps'});
|
1049 |
+
sm.add({title : 'table.split_cells_desc', icon : 'split_cells', cmd : 'mceTableSplitCells'});
|
1050 |
+
sm.add({title : 'table.merge_cells_desc', icon : 'merge_cells', cmd : 'mceTableMergeCells'});
|
1051 |
+
|
1052 |
+
// Row menu
|
1053 |
+
sm = m.addMenu({title : 'table.row'});
|
1054 |
+
sm.add({title : 'table.row_desc', icon : 'row_props', cmd : 'mceTableRowProps'});
|
1055 |
+
sm.add({title : 'table.row_before_desc', icon : 'row_before', cmd : 'mceTableInsertRowBefore'});
|
1056 |
+
sm.add({title : 'table.row_after_desc', icon : 'row_after', cmd : 'mceTableInsertRowAfter'});
|
1057 |
+
sm.add({title : 'table.delete_row_desc', icon : 'delete_row', cmd : 'mceTableDeleteRow'});
|
1058 |
+
sm.addSeparator();
|
1059 |
+
sm.add({title : 'table.cut_row_desc', icon : 'cut', cmd : 'mceTableCutRow'});
|
1060 |
+
sm.add({title : 'table.copy_row_desc', icon : 'copy', cmd : 'mceTableCopyRow'});
|
1061 |
+
sm.add({title : 'table.paste_row_before_desc', icon : 'paste', cmd : 'mceTablePasteRowBefore'}).setDisabled(!clipboardRows);
|
1062 |
+
sm.add({title : 'table.paste_row_after_desc', icon : 'paste', cmd : 'mceTablePasteRowAfter'}).setDisabled(!clipboardRows);
|
1063 |
+
|
1064 |
+
// Column menu
|
1065 |
+
sm = m.addMenu({title : 'table.col'});
|
1066 |
+
sm.add({title : 'table.col_before_desc', icon : 'col_before', cmd : 'mceTableInsertColBefore'});
|
1067 |
+
sm.add({title : 'table.col_after_desc', icon : 'col_after', cmd : 'mceTableInsertColAfter'});
|
1068 |
+
sm.add({title : 'table.delete_col_desc', icon : 'delete_col', cmd : 'mceTableDeleteCol'});
|
1069 |
+
} else
|
1070 |
+
m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable'});
|
1071 |
+
});
|
1072 |
+
}
|
1073 |
+
|
1074 |
+
// Fix to allow navigating up and down in a table in WebKit browsers.
|
1075 |
+
if (tinymce.isWebKit) {
|
1076 |
+
function moveSelection(ed, e) {
|
1077 |
+
|
1078 |
+
function moveCursorToStartOfElement(n) {
|
1079 |
+
ed.selection.setCursorLocation(n, 0);
|
1080 |
+
}
|
1081 |
+
|
1082 |
+
function getSibling(event, element) {
|
1083 |
+
return event.keyCode == UP_ARROW ? element.previousSibling : element.nextSibling;
|
1084 |
+
}
|
1085 |
+
|
1086 |
+
function getNextRow(e, row) {
|
1087 |
+
var sibling = getSibling(e, row);
|
1088 |
+
return sibling !== null && sibling.tagName === 'TR' ? sibling : null;
|
1089 |
+
}
|
1090 |
+
|
1091 |
+
function getTable(ed, currentRow) {
|
1092 |
+
return ed.dom.getParent(currentRow, 'table');
|
1093 |
+
}
|
1094 |
+
|
1095 |
+
function getTableSibling(currentRow) {
|
1096 |
+
var table = getTable(ed, currentRow);
|
1097 |
+
return getSibling(e, table);
|
1098 |
+
}
|
1099 |
+
|
1100 |
+
function isVerticalMovement(event) {
|
1101 |
+
return event.keyCode == UP_ARROW || event.keyCode == DOWN_ARROW;
|
1102 |
+
}
|
1103 |
+
|
1104 |
+
function isInTable(ed) {
|
1105 |
+
var node = ed.selection.getNode();
|
1106 |
+
var currentRow = ed.dom.getParent(node, 'tr');
|
1107 |
+
return currentRow !== null;
|
1108 |
+
}
|
1109 |
+
|
1110 |
+
function columnIndex(column) {
|
1111 |
+
var colIndex = 0;
|
1112 |
+
var c = column;
|
1113 |
+
while (c.previousSibling) {
|
1114 |
+
c = c.previousSibling;
|
1115 |
+
colIndex = colIndex + getSpanVal(c, "colspan");
|
1116 |
+
}
|
1117 |
+
return colIndex;
|
1118 |
+
}
|
1119 |
+
|
1120 |
+
function findColumn(rowElement, columnIndex) {
|
1121 |
+
var c = 0;
|
1122 |
+
var r = 0;
|
1123 |
+
each(rowElement.children, function(cell, i) {
|
1124 |
+
c = c + getSpanVal(cell, "colspan");
|
1125 |
+
r = i;
|
1126 |
+
if (c > columnIndex)
|
1127 |
+
return false;
|
1128 |
+
});
|
1129 |
+
return r;
|
1130 |
+
}
|
1131 |
+
|
1132 |
+
function moveCursorToRow(ed, node, row) {
|
1133 |
+
var srcColumnIndex = columnIndex(ed.dom.getParent(node, 'td,th'));
|
1134 |
+
var tgtColumnIndex = findColumn(row, srcColumnIndex)
|
1135 |
+
var tgtNode = row.childNodes[tgtColumnIndex];
|
1136 |
+
moveCursorToStartOfElement(tgtNode);
|
1137 |
+
}
|
1138 |
+
|
1139 |
+
function escapeTable(currentRow, e) {
|
1140 |
+
var tableSiblingElement = getTableSibling(currentRow);
|
1141 |
+
if (tableSiblingElement !== null) {
|
1142 |
+
moveCursorToStartOfElement(tableSiblingElement);
|
1143 |
+
return tinymce.dom.Event.cancel(e);
|
1144 |
+
} else {
|
1145 |
+
var element = e.keyCode == UP_ARROW ? currentRow.firstChild : currentRow.lastChild;
|
1146 |
+
// rely on default behaviour to escape table after we are in the last cell of the last row
|
1147 |
+
moveCursorToStartOfElement(element);
|
1148 |
+
return true;
|
1149 |
+
}
|
1150 |
+
}
|
1151 |
+
|
1152 |
+
var UP_ARROW = 38;
|
1153 |
+
var DOWN_ARROW = 40;
|
1154 |
+
|
1155 |
+
if (isVerticalMovement(e) && isInTable(ed)) {
|
1156 |
+
var node = ed.selection.getNode();
|
1157 |
+
var currentRow = ed.dom.getParent(node, 'tr');
|
1158 |
+
var nextRow = getNextRow(e, currentRow);
|
1159 |
+
|
1160 |
+
// If we're at the first or last row in the table, we should move the caret outside of the table
|
1161 |
+
if (nextRow == null) {
|
1162 |
+
return escapeTable(currentRow, e);
|
1163 |
+
} else {
|
1164 |
+
moveCursorToRow(ed, node, nextRow);
|
1165 |
+
tinymce.dom.Event.cancel(e);
|
1166 |
+
return true;
|
1167 |
+
}
|
1168 |
+
}
|
1169 |
+
}
|
1170 |
+
|
1171 |
+
ed.onKeyDown.add(moveSelection);
|
1172 |
+
}
|
1173 |
+
|
1174 |
+
// Fixes an issue on Gecko where it's impossible to place the caret behind a table
|
1175 |
+
// This fix will force a paragraph element after the table but only when the forced_root_block setting is enabled
|
1176 |
+
if (!tinymce.isIE) {
|
1177 |
+
function fixTableCaretPos() {
|
1178 |
+
var last;
|
1179 |
+
|
1180 |
+
// Skip empty text nodes form the end
|
1181 |
+
for (last = ed.getBody().lastChild; last && last.nodeType == 3 && !last.nodeValue.length; last = last.previousSibling) ;
|
1182 |
+
|
1183 |
+
if (last && last.nodeName == 'TABLE')
|
1184 |
+
ed.dom.add(ed.getBody(), 'p', null, '<br mce_bogus="1" />');
|
1185 |
+
};
|
1186 |
+
|
1187 |
+
// Fixes an bug where it's impossible to place the caret before a table in Gecko
|
1188 |
+
// this fix solves it by detecting when the caret is at the beginning of such a table
|
1189 |
+
// and then manually moves the caret infront of the table
|
1190 |
+
if (tinymce.isGecko) {
|
1191 |
+
ed.onKeyDown.add(function(ed, e) {
|
1192 |
+
var rng, table, dom = ed.dom;
|
1193 |
+
|
1194 |
+
// On gecko it's not possible to place the caret before a table
|
1195 |
+
if (e.keyCode == 37 || e.keyCode == 38) {
|
1196 |
+
rng = ed.selection.getRng();
|
1197 |
+
table = dom.getParent(rng.startContainer, 'table');
|
1198 |
+
|
1199 |
+
if (table && ed.getBody().firstChild == table) {
|
1200 |
+
if (isAtStart(rng, table)) {
|
1201 |
+
rng = dom.createRng();
|
1202 |
+
|
1203 |
+
rng.setStartBefore(table);
|
1204 |
+
rng.setEndBefore(table);
|
1205 |
+
|
1206 |
+
ed.selection.setRng(rng);
|
1207 |
+
|
1208 |
+
e.preventDefault();
|
1209 |
+
}
|
1210 |
+
}
|
1211 |
+
}
|
1212 |
+
});
|
1213 |
+
}
|
1214 |
+
|
1215 |
+
ed.onKeyUp.add(fixTableCaretPos);
|
1216 |
+
ed.onSetContent.add(fixTableCaretPos);
|
1217 |
+
ed.onVisualAid.add(fixTableCaretPos);
|
1218 |
+
|
1219 |
+
ed.onPreProcess.add(function(ed, o) {
|
1220 |
+
var last = o.node.lastChild;
|
1221 |
+
|
1222 |
+
if (last && last.childNodes.length == 1 && last.firstChild.nodeName == 'BR')
|
1223 |
+
ed.dom.remove(last);
|
1224 |
+
});
|
1225 |
+
|
1226 |
+
fixTableCaretPos();
|
1227 |
+
ed.startContent = ed.getContent({format : 'raw'});
|
1228 |
+
}
|
1229 |
+
});
|
1230 |
+
|
1231 |
+
// Register action commands
|
1232 |
+
each({
|
1233 |
+
mceTableSplitCells : function(grid) {
|
1234 |
+
grid.split();
|
1235 |
+
},
|
1236 |
+
|
1237 |
+
mceTableMergeCells : function(grid) {
|
1238 |
+
var rowSpan, colSpan, cell;
|
1239 |
+
|
1240 |
+
cell = ed.dom.getParent(ed.selection.getNode(), 'th,td');
|
1241 |
+
if (cell) {
|
1242 |
+
rowSpan = cell.rowSpan;
|
1243 |
+
colSpan = cell.colSpan;
|
1244 |
+
}
|
1245 |
+
|
1246 |
+
if (!ed.dom.select('td.mceSelected,th.mceSelected').length) {
|
1247 |
+
winMan.open({
|
1248 |
+
url : url + '/merge_cells.htm',
|
1249 |
+
width : 240 + parseInt(ed.getLang('table.merge_cells_delta_width', 0)),
|
1250 |
+
height : 110 + parseInt(ed.getLang('table.merge_cells_delta_height', 0)),
|
1251 |
+
inline : 1
|
1252 |
+
}, {
|
1253 |
+
rows : rowSpan,
|
1254 |
+
cols : colSpan,
|
1255 |
+
onaction : function(data) {
|
1256 |
+
grid.merge(cell, data.cols, data.rows);
|
1257 |
+
},
|
1258 |
+
plugin_url : url
|
1259 |
+
});
|
1260 |
+
} else
|
1261 |
+
grid.merge();
|
1262 |
+
},
|
1263 |
+
|
1264 |
+
mceTableInsertRowBefore : function(grid) {
|
1265 |
+
grid.insertRow(true);
|
1266 |
+
},
|
1267 |
+
|
1268 |
+
mceTableInsertRowAfter : function(grid) {
|
1269 |
+
grid.insertRow();
|
1270 |
+
},
|
1271 |
+
|
1272 |
+
mceTableInsertColBefore : function(grid) {
|
1273 |
+
grid.insertCol(true);
|
1274 |
+
},
|
1275 |
+
|
1276 |
+
mceTableInsertColAfter : function(grid) {
|
1277 |
+
grid.insertCol();
|
1278 |
+
},
|
1279 |
+
|
1280 |
+
mceTableDeleteCol : function(grid) {
|
1281 |
+
grid.deleteCols();
|
1282 |
+
},
|
1283 |
+
|
1284 |
+
mceTableDeleteRow : function(grid) {
|
1285 |
+
grid.deleteRows();
|
1286 |
+
},
|
1287 |
+
|
1288 |
+
mceTableCutRow : function(grid) {
|
1289 |
+
clipboardRows = grid.cutRows();
|
1290 |
+
},
|
1291 |
+
|
1292 |
+
mceTableCopyRow : function(grid) {
|
1293 |
+
clipboardRows = grid.copyRows();
|
1294 |
+
},
|
1295 |
+
|
1296 |
+
mceTablePasteRowBefore : function(grid) {
|
1297 |
+
grid.pasteRows(clipboardRows, true);
|
1298 |
+
},
|
1299 |
+
|
1300 |
+
mceTablePasteRowAfter : function(grid) {
|
1301 |
+
grid.pasteRows(clipboardRows);
|
1302 |
+
},
|
1303 |
+
|
1304 |
+
mceTableDelete : function(grid) {
|
1305 |
+
grid.deleteTable();
|
1306 |
+
}
|
1307 |
+
}, function(func, name) {
|
1308 |
+
ed.addCommand(name, function() {
|
1309 |
+
var grid = createTableGrid();
|
1310 |
+
|
1311 |
+
if (grid) {
|
1312 |
+
func(grid);
|
1313 |
+
ed.execCommand('mceRepaint');
|
1314 |
+
cleanup();
|
1315 |
+
}
|
1316 |
+
});
|
1317 |
+
});
|
1318 |
+
|
1319 |
+
// Register dialog commands
|
1320 |
+
each({
|
1321 |
+
mceInsertTable : function(val) {
|
1322 |
+
winMan.open({
|
1323 |
+
url : url + '/table.htm',
|
1324 |
+
width : 400 + parseInt(ed.getLang('table.table_delta_width', 0)),
|
1325 |
+
height : 320 + parseInt(ed.getLang('table.table_delta_height', 0)),
|
1326 |
+
inline : 1
|
1327 |
+
}, {
|
1328 |
+
plugin_url : url,
|
1329 |
+
action : val ? val.action : 0
|
1330 |
+
});
|
1331 |
+
},
|
1332 |
+
|
1333 |
+
mceTableRowProps : function() {
|
1334 |
+
winMan.open({
|
1335 |
+
url : url + '/row.htm',
|
1336 |
+
width : 400 + parseInt(ed.getLang('table.rowprops_delta_width', 0)),
|
1337 |
+
height : 295 + parseInt(ed.getLang('table.rowprops_delta_height', 0)),
|
1338 |
+
inline : 1
|
1339 |
+
}, {
|
1340 |
+
plugin_url : url
|
1341 |
+
});
|
1342 |
+
},
|
1343 |
+
|
1344 |
+
mceTableCellProps : function() {
|
1345 |
+
winMan.open({
|
1346 |
+
url : url + '/cell.htm',
|
1347 |
+
width : 400 + parseInt(ed.getLang('table.cellprops_delta_width', 0)),
|
1348 |
+
height : 295 + parseInt(ed.getLang('table.cellprops_delta_height', 0)),
|
1349 |
+
inline : 1
|
1350 |
+
}, {
|
1351 |
+
plugin_url : url
|
1352 |
+
});
|
1353 |
+
}
|
1354 |
+
}, function(func, name) {
|
1355 |
+
ed.addCommand(name, function(ui, val) {
|
1356 |
+
func(val);
|
1357 |
+
});
|
1358 |
+
});
|
1359 |
+
}
|
1360 |
+
});
|
1361 |
+
|
1362 |
+
// Register plugin
|
1363 |
+
tinymce.PluginManager.add('table', tinymce.plugins.TablePlugin);
|
1364 |
+
})(tinymce);
|
table/js/cell.js
CHANGED
@@ -63,6 +63,11 @@ function init() {
|
|
63 |
function updateAction() {
|
64 |
var el, inst = ed, tdElm, trElm, tableElm, formObj = document.forms[0];
|
65 |
|
|
|
|
|
|
|
|
|
|
|
66 |
tinyMCEPopup.restoreSelection();
|
67 |
el = ed.selection.getStart();
|
68 |
tdElm = ed.dom.getParent(el, "td,th");
|
@@ -83,8 +88,6 @@ function updateAction() {
|
|
83 |
return;
|
84 |
}
|
85 |
|
86 |
-
ed.execCommand('mceBeginUndoLevel');
|
87 |
-
|
88 |
switch (getSelectValue(formObj, 'action')) {
|
89 |
case "cell":
|
90 |
var celltype = getSelectValue(formObj, 'celltype');
|
@@ -125,6 +128,36 @@ function updateAction() {
|
|
125 |
|
126 |
break;
|
127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
case "all":
|
129 |
var rows = tableElm.getElementsByTagName("tr");
|
130 |
|
@@ -166,15 +199,15 @@ function updateCell(td, skip_id) {
|
|
166 |
var dom = ed.dom;
|
167 |
|
168 |
if (!skip_id)
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
|
179 |
// Clear deprecated attributes
|
180 |
ed.dom.setAttrib(td, 'width', '');
|
63 |
function updateAction() {
|
64 |
var el, inst = ed, tdElm, trElm, tableElm, formObj = document.forms[0];
|
65 |
|
66 |
+
if (!AutoValidator.validate(formObj)) {
|
67 |
+
tinyMCEPopup.alert(AutoValidator.getErrorMessages(formObj).join('. ') + '.');
|
68 |
+
return false;
|
69 |
+
}
|
70 |
+
|
71 |
tinyMCEPopup.restoreSelection();
|
72 |
el = ed.selection.getStart();
|
73 |
tdElm = ed.dom.getParent(el, "td,th");
|
88 |
return;
|
89 |
}
|
90 |
|
|
|
|
|
91 |
switch (getSelectValue(formObj, 'action')) {
|
92 |
case "cell":
|
93 |
var celltype = getSelectValue(formObj, 'celltype');
|
128 |
|
129 |
break;
|
130 |
|
131 |
+
case "col":
|
132 |
+
var curr, col = 0, cell = trElm.firstChild, rows = tableElm.getElementsByTagName("tr");
|
133 |
+
|
134 |
+
if (cell.nodeName != "TD" && cell.nodeName != "TH")
|
135 |
+
cell = nextCell(cell);
|
136 |
+
|
137 |
+
do {
|
138 |
+
if (cell == tdElm)
|
139 |
+
break;
|
140 |
+
col += cell.getAttribute("colspan");
|
141 |
+
} while ((cell = nextCell(cell)) != null);
|
142 |
+
|
143 |
+
for (var i=0; i<rows.length; i++) {
|
144 |
+
cell = rows[i].firstChild;
|
145 |
+
|
146 |
+
if (cell.nodeName != "TD" && cell.nodeName != "TH")
|
147 |
+
cell = nextCell(cell);
|
148 |
+
|
149 |
+
curr = 0;
|
150 |
+
do {
|
151 |
+
if (curr == col) {
|
152 |
+
cell = updateCell(cell, true);
|
153 |
+
break;
|
154 |
+
}
|
155 |
+
curr += cell.getAttribute("colspan");
|
156 |
+
} while ((cell = nextCell(cell)) != null);
|
157 |
+
}
|
158 |
+
|
159 |
+
break;
|
160 |
+
|
161 |
case "all":
|
162 |
var rows = tableElm.getElementsByTagName("tr");
|
163 |
|
199 |
var dom = ed.dom;
|
200 |
|
201 |
if (!skip_id)
|
202 |
+
dom.setAttrib(td, 'id', formObj.id.value);
|
203 |
+
|
204 |
+
dom.setAttrib(td, 'align', formObj.align.value);
|
205 |
+
dom.setAttrib(td, 'vAlign', formObj.valign.value);
|
206 |
+
dom.setAttrib(td, 'lang', formObj.lang.value);
|
207 |
+
dom.setAttrib(td, 'dir', getSelectValue(formObj, 'dir'));
|
208 |
+
dom.setAttrib(td, 'style', ed.dom.serializeStyle(ed.dom.parseStyle(formObj.style.value)));
|
209 |
+
dom.setAttrib(td, 'scope', formObj.scope.value);
|
210 |
+
dom.setAttrib(td, 'class', getSelectValue(formObj, 'class'));
|
211 |
|
212 |
// Clear deprecated attributes
|
213 |
ed.dom.setAttrib(td, 'width', '');
|
table/js/row.js
CHANGED
@@ -56,6 +56,11 @@ function updateAction() {
|
|
56 |
var inst = tinyMCEPopup.editor, dom = inst.dom, trElm, tableElm, formObj = document.forms[0];
|
57 |
var action = getSelectValue(formObj, 'action');
|
58 |
|
|
|
|
|
|
|
|
|
|
|
59 |
tinyMCEPopup.restoreSelection();
|
60 |
trElm = dom.getParent(inst.selection.getStart(), "tr");
|
61 |
tableElm = dom.getParent(inst.selection.getStart(), "table");
|
@@ -80,8 +85,6 @@ function updateAction() {
|
|
80 |
return;
|
81 |
}
|
82 |
|
83 |
-
inst.execCommand('mceBeginUndoLevel');
|
84 |
-
|
85 |
switch (action) {
|
86 |
case "row":
|
87 |
updateRow(trElm);
|
@@ -123,19 +126,19 @@ function updateRow(tr_elm, skip_id, skip_parent) {
|
|
123 |
|
124 |
// Update row element
|
125 |
if (!skip_id)
|
126 |
-
|
127 |
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
dom.setAttrib(tr_elm, 'class', getSelectValue(formObj, 'class'));
|
134 |
|
135 |
// Clear deprecated attributes
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
|
140 |
// Set styles
|
141 |
tr_elm.style.height = getCSSSize(formObj.height.value);
|
@@ -163,13 +166,10 @@ function updateRow(tr_elm, skip_id, skip_parent) {
|
|
163 |
if (newParent == null) {
|
164 |
newParent = doc.createElement(dest);
|
165 |
|
166 |
-
if (
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
theTable.insertBefore(newParent, theTable.firstChild);
|
171 |
-
} else
|
172 |
-
theTable.appendChild(newParent);
|
173 |
}
|
174 |
|
175 |
// append the row to the new parent
|
56 |
var inst = tinyMCEPopup.editor, dom = inst.dom, trElm, tableElm, formObj = document.forms[0];
|
57 |
var action = getSelectValue(formObj, 'action');
|
58 |
|
59 |
+
if (!AutoValidator.validate(formObj)) {
|
60 |
+
tinyMCEPopup.alert(AutoValidator.getErrorMessages(formObj).join('. ') + '.');
|
61 |
+
return false;
|
62 |
+
}
|
63 |
+
|
64 |
tinyMCEPopup.restoreSelection();
|
65 |
trElm = dom.getParent(inst.selection.getStart(), "tr");
|
66 |
tableElm = dom.getParent(inst.selection.getStart(), "table");
|
85 |
return;
|
86 |
}
|
87 |
|
|
|
|
|
88 |
switch (action) {
|
89 |
case "row":
|
90 |
updateRow(trElm);
|
126 |
|
127 |
// Update row element
|
128 |
if (!skip_id)
|
129 |
+
dom.setAttrib(tr_elm, 'id', formObj.id.value);
|
130 |
|
131 |
+
dom.setAttrib(tr_elm, 'align', getSelectValue(formObj, 'align'));
|
132 |
+
dom.setAttrib(tr_elm, 'vAlign', getSelectValue(formObj, 'valign'));
|
133 |
+
dom.setAttrib(tr_elm, 'lang', formObj.lang.value);
|
134 |
+
dom.setAttrib(tr_elm, 'dir', getSelectValue(formObj, 'dir'));
|
135 |
+
dom.setAttrib(tr_elm, 'style', dom.serializeStyle(dom.parseStyle(formObj.style.value)));
|
136 |
dom.setAttrib(tr_elm, 'class', getSelectValue(formObj, 'class'));
|
137 |
|
138 |
// Clear deprecated attributes
|
139 |
+
dom.setAttrib(tr_elm, 'background', '');
|
140 |
+
dom.setAttrib(tr_elm, 'bgColor', '');
|
141 |
+
dom.setAttrib(tr_elm, 'height', '');
|
142 |
|
143 |
// Set styles
|
144 |
tr_elm.style.height = getCSSSize(formObj.height.value);
|
166 |
if (newParent == null) {
|
167 |
newParent = doc.createElement(dest);
|
168 |
|
169 |
+
if (theTable.firstChild.nodeName == 'CAPTION')
|
170 |
+
inst.dom.insertAfter(newParent, theTable.firstChild);
|
171 |
+
else
|
172 |
+
theTable.insertBefore(newParent, theTable.firstChild);
|
|
|
|
|
|
|
173 |
}
|
174 |
|
175 |
// append the row to the new parent
|
table/js/table.js
CHANGED
@@ -12,7 +12,7 @@ function insertTable() {
|
|
12 |
tinyMCEPopup.restoreSelection();
|
13 |
|
14 |
if (!AutoValidator.validate(formObj)) {
|
15 |
-
tinyMCEPopup.alert(
|
16 |
return false;
|
17 |
}
|
18 |
|
@@ -21,7 +21,7 @@ function insertTable() {
|
|
21 |
// Get form data
|
22 |
cols = formObj.elements['cols'].value;
|
23 |
rows = formObj.elements['rows'].value;
|
24 |
-
border = formObj.elements['border'].value != "" ? formObj.elements['border'].value
|
25 |
cellpadding = formObj.elements['cellpadding'].value != "" ? formObj.elements['cellpadding'].value : "";
|
26 |
cellspacing = formObj.elements['cellspacing'].value != "" ? formObj.elements['cellspacing'].value : "";
|
27 |
align = getSelectValue(formObj, "align");
|
@@ -58,8 +58,6 @@ function insertTable() {
|
|
58 |
|
59 |
// Update table
|
60 |
if (action == "update") {
|
61 |
-
inst.execCommand('mceBeginUndoLevel');
|
62 |
-
|
63 |
dom.setAttrib(elm, 'cellPadding', cellpadding, true);
|
64 |
dom.setAttrib(elm, 'cellSpacing', cellspacing, true);
|
65 |
dom.setAttrib(elm, 'border', border);
|
@@ -82,7 +80,7 @@ function insertTable() {
|
|
82 |
capEl = elm.ownerDocument.createElement('caption');
|
83 |
|
84 |
if (!tinymce.isIE)
|
85 |
-
capEl.innerHTML = '<br
|
86 |
|
87 |
elm.insertBefore(capEl, elm.firstChild);
|
88 |
}
|
@@ -151,7 +149,7 @@ function insertTable() {
|
|
151 |
html += makeAttrib('border', border);
|
152 |
html += makeAttrib('cellpadding', cellpadding);
|
153 |
html += makeAttrib('cellspacing', cellspacing);
|
154 |
-
html += makeAttrib('
|
155 |
|
156 |
if (width && inst.settings.inline_styles) {
|
157 |
if (style)
|
@@ -187,7 +185,7 @@ function insertTable() {
|
|
187 |
|
188 |
if (caption) {
|
189 |
if (!tinymce.isIE)
|
190 |
-
html += '<caption><br
|
191 |
else
|
192 |
html += '<caption></caption>';
|
193 |
}
|
@@ -197,7 +195,7 @@ function insertTable() {
|
|
197 |
|
198 |
for (var x=0; x<cols; x++) {
|
199 |
if (!tinymce.isIE)
|
200 |
-
html += '<td><br
|
201 |
else
|
202 |
html += '<td></td>';
|
203 |
}
|
@@ -207,8 +205,6 @@ function insertTable() {
|
|
207 |
|
208 |
html += "</table>";
|
209 |
|
210 |
-
inst.execCommand('mceBeginUndoLevel');
|
211 |
-
|
212 |
// Move table
|
213 |
if (inst.settings.fix_table_elements) {
|
214 |
var patt = '';
|
@@ -231,7 +227,7 @@ function insertTable() {
|
|
231 |
} else
|
232 |
inst.execCommand('mceInsertContent', false, html);
|
233 |
|
234 |
-
tinymce.each(dom.select('table[
|
235 |
var td = dom.select('td', node);
|
236 |
|
237 |
try {
|
@@ -242,7 +238,7 @@ function insertTable() {
|
|
242 |
// Ignore
|
243 |
}
|
244 |
|
245 |
-
dom.setAttrib(node, '
|
246 |
});
|
247 |
|
248 |
inst.addVisual();
|
12 |
tinyMCEPopup.restoreSelection();
|
13 |
|
14 |
if (!AutoValidator.validate(formObj)) {
|
15 |
+
tinyMCEPopup.alert(AutoValidator.getErrorMessages(formObj).join('. ') + '.');
|
16 |
return false;
|
17 |
}
|
18 |
|
21 |
// Get form data
|
22 |
cols = formObj.elements['cols'].value;
|
23 |
rows = formObj.elements['rows'].value;
|
24 |
+
border = formObj.elements['border'].value != "" ? formObj.elements['border'].value : 0;
|
25 |
cellpadding = formObj.elements['cellpadding'].value != "" ? formObj.elements['cellpadding'].value : "";
|
26 |
cellspacing = formObj.elements['cellspacing'].value != "" ? formObj.elements['cellspacing'].value : "";
|
27 |
align = getSelectValue(formObj, "align");
|
58 |
|
59 |
// Update table
|
60 |
if (action == "update") {
|
|
|
|
|
61 |
dom.setAttrib(elm, 'cellPadding', cellpadding, true);
|
62 |
dom.setAttrib(elm, 'cellSpacing', cellspacing, true);
|
63 |
dom.setAttrib(elm, 'border', border);
|
80 |
capEl = elm.ownerDocument.createElement('caption');
|
81 |
|
82 |
if (!tinymce.isIE)
|
83 |
+
capEl.innerHTML = '<br data-mce-bogus="1"/>';
|
84 |
|
85 |
elm.insertBefore(capEl, elm.firstChild);
|
86 |
}
|
149 |
html += makeAttrib('border', border);
|
150 |
html += makeAttrib('cellpadding', cellpadding);
|
151 |
html += makeAttrib('cellspacing', cellspacing);
|
152 |
+
html += makeAttrib('data-mce-new', '1');
|
153 |
|
154 |
if (width && inst.settings.inline_styles) {
|
155 |
if (style)
|
185 |
|
186 |
if (caption) {
|
187 |
if (!tinymce.isIE)
|
188 |
+
html += '<caption><br data-mce-bogus="1"/></caption>';
|
189 |
else
|
190 |
html += '<caption></caption>';
|
191 |
}
|
195 |
|
196 |
for (var x=0; x<cols; x++) {
|
197 |
if (!tinymce.isIE)
|
198 |
+
html += '<td><br data-mce-bogus="1"/></td>';
|
199 |
else
|
200 |
html += '<td></td>';
|
201 |
}
|
205 |
|
206 |
html += "</table>";
|
207 |
|
|
|
|
|
208 |
// Move table
|
209 |
if (inst.settings.fix_table_elements) {
|
210 |
var patt = '';
|
227 |
} else
|
228 |
inst.execCommand('mceInsertContent', false, html);
|
229 |
|
230 |
+
tinymce.each(dom.select('table[data-mce-new]'), function(node) {
|
231 |
var td = dom.select('td', node);
|
232 |
|
233 |
try {
|
238 |
// Ignore
|
239 |
}
|
240 |
|
241 |
+
dom.setAttrib(node, 'data-mce-new', '');
|
242 |
});
|
243 |
|
244 |
inst.addVisual();
|
table/langs/en_dlg.js
CHANGED
@@ -1,74 +1 @@
|
|
1 |
-
tinyMCE.addI18n('en.table_dlg',{
|
2 |
-
general_tab:"General",
|
3 |
-
advanced_tab:"Advanced",
|
4 |
-
general_props:"General properties",
|
5 |
-
advanced_props:"Advanced properties",
|
6 |
-
rowtype:"Row in table part",
|
7 |
-
title:"Insert/Modify table",
|
8 |
-
width:"Width",
|
9 |
-
height:"Height",
|
10 |
-
cols:"Cols",
|
11 |
-
rows:"Rows",
|
12 |
-
cellspacing:"Cellspacing",
|
13 |
-
cellpadding:"Cellpadding",
|
14 |
-
border:"Border",
|
15 |
-
align:"Alignment",
|
16 |
-
align_default:"Default",
|
17 |
-
align_left:"Left",
|
18 |
-
align_right:"Right",
|
19 |
-
align_middle:"Center",
|
20 |
-
row_title:"Table row properties",
|
21 |
-
cell_title:"Table cell properties",
|
22 |
-
cell_type:"Cell type",
|
23 |
-
valign:"Vertical alignment",
|
24 |
-
align_top:"Top",
|
25 |
-
align_bottom:"Bottom",
|
26 |
-
bordercolor:"Border color",
|
27 |
-
bgcolor:"Background color",
|
28 |
-
merge_cells_title:"Merge table cells",
|
29 |
-
id:"Id",
|
30 |
-
style:"Style",
|
31 |
-
langdir:"Language direction",
|
32 |
-
langcode:"Language code",
|
33 |
-
mime:"Target MIME type",
|
34 |
-
ltr:"Left to right",
|
35 |
-
rtl:"Right to left",
|
36 |
-
bgimage:"Background image",
|
37 |
-
summary:"Summary",
|
38 |
-
td:"Data",
|
39 |
-
th:"Header",
|
40 |
-
cell_cell:"Update current cell",
|
41 |
-
cell_row:"Update all cells in row",
|
42 |
-
cell_all:"Update all cells in table",
|
43 |
-
row_row:"Update current row",
|
44 |
-
row_odd:"Update odd rows in table",
|
45 |
-
row_even:"Update even rows in table",
|
46 |
-
row_all:"Update all rows in table",
|
47 |
-
thead:"Table Head",
|
48 |
-
tbody:"Table Body",
|
49 |
-
tfoot:"Table Foot",
|
50 |
-
scope:"Scope",
|
51 |
-
rowgroup:"Row Group",
|
52 |
-
colgroup:"Col Group",
|
53 |
-
col_limit:"You've exceeded the maximum number of columns of {$cols}.",
|
54 |
-
row_limit:"You've exceeded the maximum number of rows of {$rows}.",
|
55 |
-
cell_limit:"You've exceeded the maximum number of cells of {$cells}.",
|
56 |
-
missing_scope:"Are you sure you want to continue without specifying a scope for this table header cell. Without it, it may be difficult for some users with disabilities to understand the content or data displayed of the table.",
|
57 |
-
caption:"Table caption",
|
58 |
-
frame:"Frame",
|
59 |
-
frame_none:"none",
|
60 |
-
frame_groups:"groups",
|
61 |
-
frame_rows:"rows",
|
62 |
-
frame_cols:"cols",
|
63 |
-
frame_all:"all",
|
64 |
-
rules:"Rules",
|
65 |
-
rules_void:"void",
|
66 |
-
rules_above:"above",
|
67 |
-
rules_below:"below",
|
68 |
-
rules_hsides:"hsides",
|
69 |
-
rules_lhs:"lhs",
|
70 |
-
rules_rhs:"rhs",
|
71 |
-
rules_vsides:"vsides",
|
72 |
-
rules_box:"box",
|
73 |
-
rules_border:"border"
|
74 |
-
});
|
1 |
+
tinyMCE.addI18n('en.table_dlg',{"rules_border":"border","rules_box":"box","rules_vsides":"vsides","rules_rhs":"rhs","rules_lhs":"lhs","rules_hsides":"hsides","rules_below":"below","rules_above":"above","rules_void":"void",rules:"Rules","frame_all":"all","frame_cols":"cols","frame_rows":"rows","frame_groups":"groups","frame_none":"none",frame:"Frame",caption:"Table Caption","missing_scope":"Are you sure you want to continue without specifying a scope for this table header cell. Without it, it may be difficult for some users with disabilities to understand the content or data displayed of the table.","cell_limit":"You\'ve exceeded the maximum number of cells of {$cells}.","row_limit":"You\'ve exceeded the maximum number of rows of {$rows}.","col_limit":"You\'ve exceeded the maximum number of columns of {$cols}.",colgroup:"Col Group",rowgroup:"Row Group",scope:"Scope",tfoot:"Footer",tbody:"Body",thead:"Header","row_all":"Update All Rows in Table","row_even":"Update Even Rows in Table","row_odd":"Update Odd Rows in Table","row_row":"Update Current Row","cell_all":"Update All Cells in Table","cell_row":"Update All Cells in Row","cell_cell":"Update Current Cell",th:"Header",td:"Data",summary:"Summary",bgimage:"Background Image",rtl:"Right to Left",ltr:"Left to Right",mime:"Target MIME Type",langcode:"Language Code",langdir:"Language Direction",style:"Style",id:"ID","merge_cells_title":"Merge Table Cells",bgcolor:"Background Color",bordercolor:"Border Color","align_bottom":"Bottom","align_top":"Top",valign:"Vertical Alignment","cell_type":"Cell Type","cell_title":"Table Cell Properties","row_title":"Table Row Properties","align_middle":"Center","align_right":"Right","align_left":"Left","align_default":"Default",align:"Alignment",border:"Border",cellpadding:"Cell Padding",cellspacing:"Cell Spacing",rows:"Rows",cols:"Columns",height:"Height",width:"Width",title:"Insert/Edit Table",rowtype:"Row Type","advanced_props":"Advanced Properties","general_props":"General Properties","advanced_tab":"Advanced","general_tab":"General","cell_col":"Update all cells in column"});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
table/merge_cells.htm
CHANGED
@@ -7,20 +7,20 @@
|
|
7 |
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/validate.js"></script>
|
8 |
<script type="text/javascript" src="js/merge_cells.js"></script>
|
9 |
</head>
|
10 |
-
<body style="margin: 8px">
|
11 |
<form onsubmit="MergeCellsDialog.merge();return false;" action="#">
|
12 |
<fieldset>
|
13 |
<legend>{#table_dlg.merge_cells_title}</legend>
|
14 |
-
|
15 |
-
|
16 |
-
<td>{#table_dlg.cols}
|
17 |
-
<td align="right"><input type="text" name="numcols" value="" class="number min1 mceFocus" style="width: 30px" /></td>
|
18 |
-
|
19 |
-
|
20 |
-
<td>{#table_dlg.rows}
|
21 |
-
<td align="right"><input type="text" name="numrows" value="" class="number min1" style="width: 30px" /></td>
|
22 |
-
|
23 |
-
|
24 |
</fieldset>
|
25 |
|
26 |
<div class="mceActionPanel">
|
7 |
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/validate.js"></script>
|
8 |
<script type="text/javascript" src="js/merge_cells.js"></script>
|
9 |
</head>
|
10 |
+
<body style="margin: 8px" role="application">
|
11 |
<form onsubmit="MergeCellsDialog.merge();return false;" action="#">
|
12 |
<fieldset>
|
13 |
<legend>{#table_dlg.merge_cells_title}</legend>
|
14 |
+
<table role="presentation" border="0" cellpadding="0" cellspacing="3" width="100%">
|
15 |
+
<tr>
|
16 |
+
<td><label for="numcols">{#table_dlg.cols}</label>:</td>
|
17 |
+
<td align="right"><input type="text" id="numcols" name="numcols" value="" class="number min1 mceFocus" style="width: 30px" aria-required="true" /></td>
|
18 |
+
</tr>
|
19 |
+
<tr>
|
20 |
+
<td><label for="numrows">{#table_dlg.rows}</label>:</td>
|
21 |
+
<td align="right"><input type="text" id="numrows" name="numrows" value="" class="number min1" style="width: 30px" aria-required="true" /></td>
|
22 |
+
</tr>
|
23 |
+
</table>
|
24 |
</fieldset>
|
25 |
|
26 |
<div class="mceActionPanel">
|
table/row.htm
CHANGED
@@ -5,16 +5,17 @@
|
|
5 |
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
6 |
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/mctabs.js"></script>
|
7 |
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/form_utils.js"></script>
|
|
|
8 |
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/editable_selects.js"></script>
|
9 |
<script type="text/javascript" src="js/row.js"></script>
|
10 |
<link href="css/row.css" rel="stylesheet" type="text/css" />
|
11 |
</head>
|
12 |
-
<body id="tablerow" style="display: none">
|
13 |
<form onsubmit="updateAction();return false;" action="#">
|
14 |
<div class="tabs">
|
15 |
<ul>
|
16 |
-
<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#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>
|
18 |
</ul>
|
19 |
</div>
|
20 |
|
@@ -23,7 +24,7 @@
|
|
23 |
<fieldset>
|
24 |
<legend>{#table_dlg.general_props}</legend>
|
25 |
|
26 |
-
<table border="0" cellpadding="4" cellspacing="0">
|
27 |
<tr>
|
28 |
<td><label for="rowtype">{#table_dlg.rowtype}</label></td>
|
29 |
<td class="col2">
|
@@ -70,7 +71,7 @@
|
|
70 |
|
71 |
<tr>
|
72 |
<td><label for="height">{#table_dlg.height}</label></td>
|
73 |
-
<td class="col2"><input name="height" type="text" id="height" value="" size="
|
74 |
</tr>
|
75 |
</table>
|
76 |
</fieldset>
|
@@ -80,7 +81,7 @@
|
|
80 |
<fieldset>
|
81 |
<legend>{#table_dlg.advanced_props}</legend>
|
82 |
|
83 |
-
<table border="0" cellpadding="0" cellspacing="4">
|
84 |
<tr>
|
85 |
<td class="column1"><label for="id">{#table_dlg.id}</label></td>
|
86 |
<td><input id="id" name="id" type="text" value="" style="width: 200px" /></td>
|
@@ -112,7 +113,7 @@
|
|
112 |
<tr>
|
113 |
<td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td>
|
114 |
<td>
|
115 |
-
<table border="0" cellpadding="0" cellspacing="0">
|
116 |
<tr>
|
117 |
<td><input id="backgroundimage" name="backgroundimage" type="text" value="" style="width: 200px" onchange="changedBackgroundImage();" /></td>
|
118 |
<td id="backgroundimagebrowsercontainer"> </td>
|
@@ -122,14 +123,16 @@
|
|
122 |
</tr>
|
123 |
|
124 |
<tr>
|
125 |
-
<td class="column1"><label for="bgcolor">{#table_dlg.bgcolor}</label></td>
|
126 |
<td>
|
127 |
-
<
|
|
|
128 |
<tr>
|
129 |
<td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedColor();" /></td>
|
130 |
<td id="bgcolor_pickcontainer"> </td>
|
131 |
</tr>
|
132 |
</table>
|
|
|
133 |
</td>
|
134 |
</tr>
|
135 |
</table>
|
5 |
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
6 |
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/mctabs.js"></script>
|
7 |
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/form_utils.js"></script>
|
8 |
+
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/validate.js"></script>
|
9 |
<script type="text/javascript" src="../../../../wp-includes/js/tinymce/utils/editable_selects.js"></script>
|
10 |
<script type="text/javascript" src="js/row.js"></script>
|
11 |
<link href="css/row.css" rel="stylesheet" type="text/css" />
|
12 |
</head>
|
13 |
+
<body id="tablerow" style="display: none" role="application">
|
14 |
<form onsubmit="updateAction();return false;" action="#">
|
15 |
<div class="tabs">
|
16 |
<ul>
|
17 |
+
<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>
|
18 |
+
<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>
|
19 |
</ul>
|
20 |
</div>
|
21 |
|
24 |
<fieldset>
|
25 |
<legend>{#table_dlg.general_props}</legend>
|
26 |
|
27 |
+
<table role="presentation" border="0" cellpadding="4" cellspacing="0">
|
28 |
<tr>
|
29 |
<td><label for="rowtype">{#table_dlg.rowtype}</label></td>
|
30 |
<td class="col2">
|
71 |
|
72 |
<tr>
|
73 |
<td><label for="height">{#table_dlg.height}</label></td>
|
74 |
+
<td class="col2"><input name="height" type="text" id="height" value="" size="7" maxlength="7" onchange="changedSize();" class="size" /></td>
|
75 |
</tr>
|
76 |
</table>
|
77 |
</fieldset>
|
81 |
<fieldset>
|
82 |
<legend>{#table_dlg.advanced_props}</legend>
|
83 |
|
84 |
+
<table role="presentation" border="0" cellpadding="0" cellspacing="4">
|
85 |
<tr>
|
86 |
<td class="column1"><label for="id">{#table_dlg.id}</label></td>
|
87 |
<td><input id="id" name="id" type="text" value="" style="width: 200px" /></td>
|
113 |
<tr>
|
114 |
<td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td>
|
115 |
<td>
|
116 |
+
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
117 |
<tr>
|
118 |
<td><input id="backgroundimage" name="backgroundimage" type="text" value="" style="width: 200px" onchange="changedBackgroundImage();" /></td>
|
119 |
<td id="backgroundimagebrowsercontainer"> </td>
|
123 |
</tr>
|
124 |
|
125 |
<tr>
|
126 |
+
<td class="column1"><label for="bgcolor" id="bgcolor_label">{#table_dlg.bgcolor}</label></td>
|
127 |
<td>
|
128 |
+
<span role="group" aria-labelledby="bgcolor_label">
|
129 |
+
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
130 |
<tr>
|
131 |
<td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedColor();" /></td>
|
132 |
<td id="bgcolor_pickcontainer"> </td>
|
133 |
</tr>
|
134 |
</table>
|
135 |
+
</span>
|
136 |
</td>
|
137 |
</tr>
|
138 |
</table>
|
table/table.htm
CHANGED
@@ -10,12 +10,13 @@
|
|
10 |
<script type="text/javascript" src="js/table.js"></script>
|
11 |
<link href="css/table.css" rel="stylesheet" type="text/css" />
|
12 |
</head>
|
13 |
-
<body id="table" style="display: none">
|
|
|
14 |
<form onsubmit="insertTable();return false;" action="#">
|
15 |
<div class="tabs">
|
16 |
<ul>
|
17 |
-
<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>
|
18 |
-
<li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#table_dlg.advanced_tab}</a></span></li>
|
19 |
</ul>
|
20 |
</div>
|
21 |
|
@@ -23,48 +24,48 @@
|
|
23 |
<div id="general_panel" class="panel current">
|
24 |
<fieldset>
|
25 |
<legend>{#table_dlg.general_props}</legend>
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
</fieldset>
|
69 |
</div>
|
70 |
|
@@ -72,7 +73,7 @@
|
|
72 |
<fieldset>
|
73 |
<legend>{#table_dlg.advanced_props}</legend>
|
74 |
|
75 |
-
<table border="0" cellpadding="0" cellspacing="4">
|
76 |
<tr>
|
77 |
<td class="column1"><label for="id">{#table_dlg.id}</label></td>
|
78 |
<td><input id="id" name="id" type="text" value="" class="advfield" /></td>
|
@@ -98,7 +99,7 @@
|
|
98 |
<tr>
|
99 |
<td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td>
|
100 |
<td>
|
101 |
-
<table border="0" cellpadding="0" cellspacing="0">
|
102 |
<tr>
|
103 |
<td><input id="backgroundimage" name="backgroundimage" type="text" value="" class="advfield" onchange="changedBackgroundImage();" /></td>
|
104 |
<td id="backgroundimagebrowsercontainer"> </td>
|
@@ -150,10 +151,10 @@
|
|
150 |
</td>
|
151 |
</tr>
|
152 |
|
153 |
-
<tr>
|
154 |
-
<td class="column1"><label for="bordercolor">{#table_dlg.bordercolor}</label></td>
|
155 |
<td>
|
156 |
-
<table border="0" cellpadding="0" cellspacing="0">
|
157 |
<tr>
|
158 |
<td><input id="bordercolor" name="bordercolor" type="text" value="" size="9" onchange="updateColor('bordercolor_pick','bordercolor');changedColor();" /></td>
|
159 |
<td id="bordercolor_pickcontainer"> </td>
|
@@ -162,10 +163,10 @@
|
|
162 |
</td>
|
163 |
</tr>
|
164 |
|
165 |
-
<tr>
|
166 |
-
<td class="column1"><label for="bgcolor">{#table_dlg.bgcolor}</label></td>
|
167 |
<td>
|
168 |
-
<table border="0" cellpadding="0" cellspacing="0">
|
169 |
<tr>
|
170 |
<td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedColor();" /></td>
|
171 |
<td id="bgcolor_pickcontainer"> </td>
|
10 |
<script type="text/javascript" src="js/table.js"></script>
|
11 |
<link href="css/table.css" rel="stylesheet" type="text/css" />
|
12 |
</head>
|
13 |
+
<body id="table" style="display: none" role="application" aria-labelledby="app_title">
|
14 |
+
<span style="display:none;" id="app_title">{#table_dlg.title}</span>
|
15 |
<form onsubmit="insertTable();return false;" action="#">
|
16 |
<div class="tabs">
|
17 |
<ul>
|
18 |
+
<li id="general_tab" aria-controls="general_panel" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#table_dlg.general_tab}</a></span></li>
|
19 |
+
<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>
|
20 |
</ul>
|
21 |
</div>
|
22 |
|
24 |
<div id="general_panel" class="panel current">
|
25 |
<fieldset>
|
26 |
<legend>{#table_dlg.general_props}</legend>
|
27 |
+
<table role="presentation" border="0" cellpadding="4" cellspacing="0" width="100%">
|
28 |
+
<tr>
|
29 |
+
<td><label id="colslabel" for="cols">{#table_dlg.cols}</label></td>
|
30 |
+
<td><input id="cols" name="cols" type="text" value="" size="3" maxlength="3" class="required number min1 mceFocus" aria-required="true" /></td>
|
31 |
+
<td><label id="rowslabel" for="rows">{#table_dlg.rows}</label></td>
|
32 |
+
<td><input id="rows" name="rows" type="text" value="" size="3" maxlength="3" class="required number min1" aria-required="true" /></td>
|
33 |
+
</tr>
|
34 |
+
<tr>
|
35 |
+
<td><label id="cellpaddinglabel" for="cellpadding">{#table_dlg.cellpadding}</label></td>
|
36 |
+
<td><input id="cellpadding" name="cellpadding" type="text" value="" size="3" maxlength="3" class="number" /></td>
|
37 |
+
<td><label id="cellspacinglabel" for="cellspacing">{#table_dlg.cellspacing}</label></td>
|
38 |
+
<td><input id="cellspacing" name="cellspacing" type="text" value="" size="3" maxlength="3" class="number" /></td>
|
39 |
+
</tr>
|
40 |
+
<tr>
|
41 |
+
<td><label id="alignlabel" for="align">{#table_dlg.align}</label></td>
|
42 |
+
<td><select id="align" name="align">
|
43 |
+
<option value="">{#not_set}</option>
|
44 |
+
<option value="center">{#table_dlg.align_middle}</option>
|
45 |
+
<option value="left">{#table_dlg.align_left}</option>
|
46 |
+
<option value="right">{#table_dlg.align_right}</option>
|
47 |
+
</select></td>
|
48 |
+
<td><label id="borderlabel" for="border">{#table_dlg.border}</label></td>
|
49 |
+
<td><input id="border" name="border" type="text" value="" size="3" maxlength="3" onchange="changedBorder();" class="number" /></td>
|
50 |
+
</tr>
|
51 |
+
<tr id="width_row">
|
52 |
+
<td><label id="widthlabel" for="width">{#table_dlg.width}</label></td>
|
53 |
+
<td><input name="width" type="text" id="width" value="" size="7" maxlength="7" onchange="changedSize();" class="size" /></td>
|
54 |
+
<td><label id="heightlabel" for="height">{#table_dlg.height}</label></td>
|
55 |
+
<td><input name="height" type="text" id="height" value="" size="7" maxlength="7" onchange="changedSize();" class="size" /></td>
|
56 |
+
</tr>
|
57 |
+
<tr id="styleSelectRow" >
|
58 |
+
<td><label id="classlabel" for="class">{#class_name}</label></td>
|
59 |
+
<td colspan="3" >
|
60 |
+
<select id="class" name="class" class="mceEditableSelect">
|
61 |
+
<option value="" selected="selected">{#not_set}</option>
|
62 |
+
</select></td>
|
63 |
+
</tr>
|
64 |
+
<tr>
|
65 |
+
<td class="column1" ><label for="caption">{#table_dlg.caption}</label></td>
|
66 |
+
<td><input id="caption" name="caption" type="checkbox" class="checkbox" value="true" /></td>
|
67 |
+
</tr>
|
68 |
+
</table>
|
69 |
</fieldset>
|
70 |
</div>
|
71 |
|
73 |
<fieldset>
|
74 |
<legend>{#table_dlg.advanced_props}</legend>
|
75 |
|
76 |
+
<table role="presentation" border="0" cellpadding="0" cellspacing="4">
|
77 |
<tr>
|
78 |
<td class="column1"><label for="id">{#table_dlg.id}</label></td>
|
79 |
<td><input id="id" name="id" type="text" value="" class="advfield" /></td>
|
99 |
<tr>
|
100 |
<td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td>
|
101 |
<td>
|
102 |
+
<table role="presentation" aria-labelledby="backgroundimage_label" border="0" cellpadding="0" cellspacing="0">
|
103 |
<tr>
|
104 |
<td><input id="backgroundimage" name="backgroundimage" type="text" value="" class="advfield" onchange="changedBackgroundImage();" /></td>
|
105 |
<td id="backgroundimagebrowsercontainer"> </td>
|
151 |
</td>
|
152 |
</tr>
|
153 |
|
154 |
+
<tr role="group" aria-labelledby="bordercolor_label">
|
155 |
+
<td class="column1"><label id="bordercolor_label" for="bordercolor">{#table_dlg.bordercolor}</label></td>
|
156 |
<td>
|
157 |
+
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
158 |
<tr>
|
159 |
<td><input id="bordercolor" name="bordercolor" type="text" value="" size="9" onchange="updateColor('bordercolor_pick','bordercolor');changedColor();" /></td>
|
160 |
<td id="bordercolor_pickcontainer"> </td>
|
163 |
</td>
|
164 |
</tr>
|
165 |
|
166 |
+
<tr role="group" aria-labelledby="bgcolor_label">
|
167 |
+
<td class="column1"><label id="bgcolor_label" for="bgcolor">{#table_dlg.bgcolor}</label></td>
|
168 |
<td>
|
169 |
+
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
170 |
<tr>
|
171 |
<td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedColor();" /></td>
|
172 |
<td id="bgcolor_pickcontainer"> </td>
|