summaryrefslogtreecommitdiff
path: root/program/js/tiny_mce/plugins/table
diff options
context:
space:
mode:
authorsvncommit <devs@roundcube.net>2008-04-15 21:22:00 +0000
committersvncommit <devs@roundcube.net>2008-04-15 21:22:00 +0000
commitd9344fc349e8c5765898c90bf5061e56cd21c8a0 (patch)
treea5916f5f3f88df8d6336b43dde8cdbb49cb47bdc /program/js/tiny_mce/plugins/table
parentd7a411f099596cbc8e749e1f0802ac2bb2c6289e (diff)
HTML editing fixes, upgrade to TinyMCE v3.0.6
Diffstat (limited to 'program/js/tiny_mce/plugins/table')
-rw-r--r--program/js/tiny_mce/plugins/table/cell.htm102
-rw-r--r--program/js/tiny_mce/plugins/table/css/cell.css32
-rw-r--r--program/js/tiny_mce/plugins/table/css/row.css50
-rw-r--r--program/js/tiny_mce/plugins/table/css/table.css26
-rw-r--r--program/js/tiny_mce/plugins/table/editor_plugin.js2
-rw-r--r--program/js/tiny_mce/plugins/table/editor_plugin_src.js1679
-rw-r--r--program/js/tiny_mce/plugins/table/images/buttons.gifbin1787 -> 0 bytes
-rw-r--r--program/js/tiny_mce/plugins/table/images/table.gifbin287 -> 0 bytes
-rw-r--r--program/js/tiny_mce/plugins/table/images/table_cell_props.gifbin189 -> 0 bytes
-rw-r--r--program/js/tiny_mce/plugins/table/images/table_delete.gifbin372 -> 0 bytes
-rw-r--r--program/js/tiny_mce/plugins/table/images/table_delete_col.gifbin153 -> 0 bytes
-rw-r--r--program/js/tiny_mce/plugins/table/images/table_delete_row.gifbin160 -> 0 bytes
-rw-r--r--program/js/tiny_mce/plugins/table/images/table_insert_col_after.gifbin165 -> 0 bytes
-rw-r--r--program/js/tiny_mce/plugins/table/images/table_insert_col_before.gifbin165 -> 0 bytes
-rw-r--r--program/js/tiny_mce/plugins/table/images/table_insert_row_after.gifbin163 -> 0 bytes
-rw-r--r--program/js/tiny_mce/plugins/table/images/table_insert_row_before.gifbin159 -> 0 bytes
-rw-r--r--program/js/tiny_mce/plugins/table/images/table_merge_cells.gifbin198 -> 0 bytes
-rw-r--r--program/js/tiny_mce/plugins/table/images/table_row_props.gifbin187 -> 0 bytes
-rw-r--r--program/js/tiny_mce/plugins/table/images/table_split_cells.gifbin210 -> 0 bytes
-rw-r--r--program/js/tiny_mce/plugins/table/js/cell.js (renamed from program/js/tiny_mce/plugins/table/jscripts/cell.js)94
-rw-r--r--program/js/tiny_mce/plugins/table/js/merge_cells.js29
-rw-r--r--program/js/tiny_mce/plugins/table/js/row.js (renamed from program/js/tiny_mce/plugins/table/jscripts/row.js)86
-rw-r--r--program/js/tiny_mce/plugins/table/js/table.js (renamed from program/js/tiny_mce/plugins/table/jscripts/table.js)216
-rw-r--r--program/js/tiny_mce/plugins/table/jscripts/merge_cells.js24
-rw-r--r--program/js/tiny_mce/plugins/table/langs/en.js79
-rw-r--r--program/js/tiny_mce/plugins/table/langs/en_dlg.js74
-rw-r--r--program/js/tiny_mce/plugins/table/merge_cells.htm28
-rw-r--r--program/js/tiny_mce/plugins/table/readme.txt1
-rw-r--r--program/js/tiny_mce/plugins/table/row.htm90
-rw-r--r--program/js/tiny_mce/plugins/table/table.htm131
30 files changed, 1422 insertions, 1321 deletions
diff --git a/program/js/tiny_mce/plugins/table/cell.htm b/program/js/tiny_mce/plugins/table/cell.htm
index 7171d4faa..60264db8e 100644
--- a/program/js/tiny_mce/plugins/table/cell.htm
+++ b/program/js/tiny_mce/plugins/table/cell.htm
@@ -1,85 +1,87 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
- <title>{$lang_table_cell_title}</title>
- <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
- <script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
- <script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
- <script language="javascript" type="text/javascript" src="jscripts/cell.js"></script>
+ <title>{#table_dlg.cell_title}</title>
+ <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+ <script type="text/javascript" src="../../utils/mctabs.js"></script>
+ <script type="text/javascript" src="../../utils/form_utils.js"></script>
+ <script type="text/javascript" src="../../utils/editable_selects.js"></script>
+ <script type="text/javascript" src="js/cell.js"></script>
<link href="css/cell.css" rel="stylesheet" type="text/css" />
<base target="_self" />
</head>
-<body id="tablecell" onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
+<body id="tablecell" style="display: none">
<form onsubmit="updateAction();return false;" action="#">
<div class="tabs">
<ul>
- <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_table_general_tab}</a></span></li>
- <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{$lang_table_advanced_tab}</a></span></li>
+ <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>
+ <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#table_dlg.advanced_tab}</a></span></li>
</ul>
</div>
<div class="panel_wrapper">
<div id="general_panel" class="panel current">
<fieldset>
- <legend>{$lang_table_general_props}</legend>
+ <legend>{#table_dlg.general_props}</legend>
<table border="0" cellpadding="4" cellspacing="0">
<tr>
- <td><label for="align">{$lang_table_align}</label></td>
+ <td><label for="align">{#table_dlg.align}</label></td>
<td>
- <select id="align" name="align">
- <option value="">{$lang_not_set}</option>
- <option value="center">{$lang_table_align_middle}</option>
- <option value="left">{$lang_table_align_left}</option>
- <option value="right">{$lang_table_align_right}</option>
+ <select id="align" name="align" class="mceFocus">
+ <option value="">{#not_set}</option>
+ <option value="center">{#table_dlg.align_middle}</option>
+ <option value="left">{#table_dlg.align_left}</option>
+ <option value="right">{#table_dlg.align_right}</option>
</select>
</td>
- <td><label for="celltype">{$lang_table_cell_type}</label></td>
+ <td><label for="celltype">{#table_dlg.cell_type}</label></td>
<td>
<select id="celltype" name="celltype">
- <option value="td">{$lang_table_td}</option>
- <option value="th">{$lang_table_th}</option>
+ <option value="td">{#table_dlg.td}</option>
+ <option value="th">{#table_dlg.th}</option>
</select>
</td>
</tr>
<tr>
- <td><label for="valign">{$lang_table_valign}</label></td>
+ <td><label for="valign">{#table_dlg.valign}</label></td>
<td>
<select id="valign" name="valign">
- <option value="">{$lang_not_set}</option>
- <option value="top">{$lang_table_align_top}</option>
- <option value="middle">{$lang_table_align_middle}</option>
- <option value="bottom">{$lang_table_align_bottom}</option>
+ <option value="">{#not_set}</option>
+ <option value="top">{#table_dlg.align_top}</option>
+ <option value="middle">{#table_dlg.align_middle}</option>
+ <option value="bottom">{#table_dlg.align_bottom}</option>
</select>
</td>
- <td><label for="scope">{$lang_table_scope}</label></td>
+ <td><label for="scope">{#table_dlg.scope}</label></td>
<td>
<select id="scope" name="scope">
- <option value="">{$lang_not_set}</option>
- <option value="col">{$lang_table_col}</option>
- <option value="row">{$lang_table_row}</option>
- <option value="rowgroup">{$lang_table_rowgroup}</option>
- <option value="colgroup">{$lang_table_colgroup}</option>
+ <option value="">{#not_set}</option>
+ <option value="col">{#table.col}</option>
+ <option value="row">{#table.row}</option>
+ <option value="rowgroup">{#table_dlg.rowgroup}</option>
+ <option value="colgroup">{#table_dlg.colgroup}</option>
</select>
</td>
</tr>
<tr>
- <td><label for="width">{$lang_table_width}</label></td>
+ <td><label for="width">{#table_dlg.width}</label></td>
<td><input id="width" name="width" type="text" value="" size="4" maxlength="4" onchange="changedSize();" /></td>
- <td><label for="height">{$lang_table_height}</label></td>
+ <td><label for="height">{#table_dlg.height}</label></td>
<td><input id="height" name="height" type="text" value="" size="4" maxlength="4" onchange="changedSize();" /></td>
</tr>
<tr id="styleSelectRow">
- <td><label for="class">{$lang_class_name}</label></td>
+ <td><label for="class">{#class_name}</label></td>
<td colspan="3">
- <select id="class" name="class">
- <option value="" selected="selected">{$lang_not_set}</option>
+ <select id="class" name="class" class="mceEditableSelect">
+ <option value="" selected="selected">{#not_set}</option>
</select>
</td>
</tr>
@@ -89,39 +91,39 @@
<div id="advanced_panel" class="panel">
<fieldset>
- <legend>{$lang_table_advanced_props}</legend>
+ <legend>{#table_dlg.advanced_props}</legend>
<table border="0" cellpadding="0" cellspacing="4">
<tr>
- <td class="column1"><label for="id">{$lang_table_id}</label></td>
+ <td class="column1"><label for="id">{#table_dlg.id}</label></td>
<td><input id="id" name="id" type="text" value="" style="width: 200px" /></td>
</tr>
<tr>
- <td><label for="style">{$lang_table_style}</label></td>
+ <td><label for="style">{#table_dlg.style}</label></td>
<td><input type="text" id="style" name="style" value="" style="width: 200px;" onchange="changedStyle();" /></td>
</tr>
<tr>
- <td class="column1"><label for="dir">{$lang_table_langdir}</label></td>
+ <td class="column1"><label for="dir">{#table_dlg.langdir}</label></td>
<td>
<select id="dir" name="dir" style="width: 200px">
- <option value="">{$lang_not_set}</option>
- <option value="ltr">{$lang_table_ltr}</option>
- <option value="rtl">{$lang_table_rtl}</option>
+ <option value="">{#not_set}</option>
+ <option value="ltr">{#table_dlg.ltr}</option>
+ <option value="rtl">{#table_dlg.rtl}</option>
</select>
</td>
</tr>
<tr>
- <td class="column1"><label for="lang">{$lang_table_langcode}</label></td>
+ <td class="column1"><label for="lang">{#table_dlg.langcode}</label></td>
<td>
<input id="lang" name="lang" type="text" value="" style="width: 200px" />
</td>
</tr>
<tr>
- <td class="column1"><label for="backgroundimage">{$lang_table_bgimage}</label></td>
+ <td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
@@ -133,7 +135,7 @@
</tr>
<tr>
- <td class="column1"><label for="bordercolor">{$lang_table_bordercolor}</label></td>
+ <td class="column1"><label for="bordercolor">{#table_dlg.bordercolor}</label></td>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
@@ -145,7 +147,7 @@
</tr>
<tr>
- <td class="column1"><label for="bgcolor">{$lang_table_bgcolor}</label></td>
+ <td class="column1"><label for="bgcolor">{#table_dlg.bgcolor}</label></td>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
@@ -163,18 +165,18 @@
<div class="mceActionPanel">
<div>
<select id="action" name="action">
- <option value="cell">{$lang_table_cell_cell}</option>
- <option value="row">{$lang_table_cell_row}</option>
- <option value="all">{$lang_table_cell_all}</option>
+ <option value="cell">{#table_dlg.cell_cell}</option>
+ <option value="row">{#table_dlg.cell_row}</option>
+ <option value="all">{#table_dlg.cell_all}</option>
</select>
</div>
<div style="float: left">
- <div><input type="button" id="insert" name="insert" value="{$lang_update}" onclick="updateAction();" /></div>
+ <div><input type="submit" id="insert" name="insert" value="{#update}" /></div>
</div>
<div style="float: right">
- <input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
</div>
</form>
diff --git a/program/js/tiny_mce/plugins/table/css/cell.css b/program/js/tiny_mce/plugins/table/css/cell.css
index a47cc1a1e..a067ecdfe 100644
--- a/program/js/tiny_mce/plugins/table/css/cell.css
+++ b/program/js/tiny_mce/plugins/table/css/cell.css
@@ -1,17 +1,17 @@
-/* CSS file for cell dialog in the table plugin */
-
-.panel_wrapper div.current {
- height: 200px;
-}
-
-.advfield {
- width: 200px;
-}
-
-#action {
- margin-bottom: 3px;
-}
-
-#class {
- width: 150px;
+/* CSS file for cell dialog in the table plugin */
+
+.panel_wrapper div.current {
+ height: 200px;
+}
+
+.advfield {
+ width: 200px;
+}
+
+#action {
+ margin-bottom: 3px;
+}
+
+#class {
+ width: 150px;
} \ No newline at end of file
diff --git a/program/js/tiny_mce/plugins/table/css/row.css b/program/js/tiny_mce/plugins/table/css/row.css
index 0e397db3e..1f7755daf 100644
--- a/program/js/tiny_mce/plugins/table/css/row.css
+++ b/program/js/tiny_mce/plugins/table/css/row.css
@@ -1,25 +1,25 @@
-/* CSS file for row dialog in the table plugin */
-
-.panel_wrapper div.current {
- height: 200px;
-}
-
-.advfield {
- width: 200px;
-}
-
-#action {
- margin-bottom: 3px;
-}
-
-#rowtype,#align,#valign,#class,#height {
- width: 150px;
-}
-
-#height {
- width: 50px;
-}
-
-.col2 {
- padding-left: 20px;
-}
+/* CSS file for row dialog in the table plugin */
+
+.panel_wrapper div.current {
+ height: 200px;
+}
+
+.advfield {
+ width: 200px;
+}
+
+#action {
+ margin-bottom: 3px;
+}
+
+#rowtype,#align,#valign,#class,#height {
+ width: 150px;
+}
+
+#height {
+ width: 50px;
+}
+
+.col2 {
+ padding-left: 20px;
+}
diff --git a/program/js/tiny_mce/plugins/table/css/table.css b/program/js/tiny_mce/plugins/table/css/table.css
index 82bb548ca..d11c3f69c 100644
--- a/program/js/tiny_mce/plugins/table/css/table.css
+++ b/program/js/tiny_mce/plugins/table/css/table.css
@@ -1,13 +1,13 @@
-/* CSS file for table dialog in the table plugin */
-
-.panel_wrapper div.current {
- height: 220px;
-}
-
-.advfield {
- width: 200px;
-}
-
-#class {
- width: 150px;
-}
+/* CSS file for table dialog in the table plugin */
+
+.panel_wrapper div.current {
+ height: 245px;
+}
+
+.advfield {
+ width: 200px;
+}
+
+#class {
+ width: 150px;
+}
diff --git a/program/js/tiny_mce/plugins/table/editor_plugin.js b/program/js/tiny_mce/plugins/table/editor_plugin.js
index 2f308f868..0bf51b9d3 100644
--- a/program/js/tiny_mce/plugins/table/editor_plugin.js
+++ b/program/js/tiny_mce/plugins/table/editor_plugin.js
@@ -1 +1 @@
-tinyMCE.importPluginLanguagePack('table');var TinyMCE_TablePlugin={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}},initInstance:function(inst){if(tinyMCE.isGecko){var doc=inst.getDoc();tinyMCE.addEvent(doc,"mouseup",TinyMCE_TablePlugin._mouseDownHandler)}inst.tableRowClipboard=null},getControlHTML:function(control_name){var controls=new Array(['table','table.gif','lang_table_desc','mceInsertTable',true],['delete_table','table_delete.gif','lang_table_del','mceTableDelete'],['delete_col','table_delete_col.gif','lang_table_delete_col_desc','mceTableDeleteCol'],['delete_row','table_delete_row.gif','lang_table_delete_row_desc','mceTableDeleteRow'],['col_after','table_insert_col_after.gif','lang_table_col_after_desc','mceTableInsertColAfter'],['col_before','table_insert_col_before.gif','lang_table_col_before_desc','mceTableInsertColBefore'],['row_after','table_insert_row_after.gif','lang_table_row_after_desc','mceTableInsertRowAfter'],['row_before','table_insert_row_before.gif','lang_table_row_before_desc','mceTableInsertRowBefore'],['row_props','table_row_props.gif','lang_table_row_desc','mceTableRowProps',true],['cell_props','table_cell_props.gif','lang_table_cell_desc','mceTableCellProps',true],['split_cells','table_split_cells.gif','lang_table_split_cells_desc','mceTableSplitCells',true],['merge_cells','table_merge_cells.gif','lang_table_merge_cells_desc','mceTableMergeCells',true]);for(var i=0;i<controls.length;i++){var but=controls[i];var cmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+but[3]+'\', '+(but.length>4?but[4]:false)+(but.length>5?', \''+but[5]+'\'':'')+');return false;';if(but[0]==control_name)return tinyMCE.getButtonHTML(control_name,but[2],'{$pluginurl}/images/'+but[1],but[3],(but.length>4?but[4]:false))}if(control_name=="tablecontrols"){var html="";html+=tinyMCE.getControlHTML("table");html+=tinyMCE.getControlHTML("separator");html+=tinyMCE.getControlHTML("row_props");html+=tinyMCE.getControlHTML("cell_props");html+=tinyMCE.getControlHTML("separator");html+=tinyMCE.getControlHTML("row_before");html+=tinyMCE.getControlHTML("row_after");html+=tinyMCE.getControlHTML("delete_row");html+=tinyMCE.getControlHTML("separator");html+=tinyMCE.getControlHTML("col_before");html+=tinyMCE.getControlHTML("col_after");html+=tinyMCE.getControlHTML("delete_col");html+=tinyMCE.getControlHTML("separator");html+=tinyMCE.getControlHTML("split_cells");html+=tinyMCE.getControlHTML("merge_cells");return html}return""},execCommand:function(editor_id,element,command,user_interface,value){switch(command){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":var inst=tinyMCE.getInstanceById(editor_id);inst.execCommand('mceBeginUndoLevel');TinyMCE_TablePlugin._doExecCommand(editor_id,element,command,user_interface,value);inst.execCommand('mceEndUndoLevel');return true}return false},handleNodeChange:function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection){var colspan="1",rowspan="1",tdElm;var inst=tinyMCE.getInstanceById(editor_id);tinyMCE.switchClass(editor_id+'_table','mceButtonNormal');tinyMCE.switchClass(editor_id+'_delete_table','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_row_props','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_cell_props','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_row_before','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_row_after','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_delete_row','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_col_before','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_col_after','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_delete_col','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_split_cells','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_merge_cells','mceButtonDisabled');if(tdElm=tinyMCE.getParentElement(node,"td,th")){tinyMCE.switchClass(editor_id+'_cell_props','mceButtonSelected');tinyMCE.switchClass(editor_id+'_delete_table','mceButtonNormal');tinyMCE.switchClass(editor_id+'_row_before','mceButtonNormal');tinyMCE.switchClass(editor_id+'_row_after','mceButtonNormal');tinyMCE.switchClass(editor_id+'_delete_row','mceButtonNormal');tinyMCE.switchClass(editor_id+'_col_before','mceButtonNormal');tinyMCE.switchClass(editor_id+'_col_after','mceButtonNormal');tinyMCE.switchClass(editor_id+'_delete_col','mceButtonNormal');colspan=tinyMCE.getAttrib(tdElm,"colspan");rowspan=tinyMCE.getAttrib(tdElm,"rowspan");colspan=colspan==""?"1":colspan;rowspan=rowspan==""?"1":rowspan;if(colspan!="1"||rowspan!="1")tinyMCE.switchClass(editor_id+'_split_cells','mceButtonNormal')}if(tinyMCE.getParentElement(node,"tr"))tinyMCE.switchClass(editor_id+'_row_props','mceButtonSelected');if(tinyMCE.getParentElement(node,"table")){tinyMCE.switchClass(editor_id+'_table','mceButtonSelected');tinyMCE.switchClass(editor_id+'_merge_cells','mceButtonNormal')}},_mouseDownHandler:function(e){var elm=tinyMCE.isMSIE?event.srcElement:e.target;var focusElm=tinyMCE.selectedInstance.getFocusElement();if(elm.nodeName=="BODY"&&(focusElm.nodeName=="TD"||focusElm.nodeName=="TH"||(focusElm.parentNode&&focusElm.parentNode.nodeName=="TD")||(focusElm.parentNode&&focusElm.parentNode.nodeName=="TH"))){window.setTimeout(function(){var tableElm=tinyMCE.getParentElement(focusElm,"table");tinyMCE.handleVisualAid(tableElm,true,tinyMCE.settings['visual'],tinyMCE.selectedInstance)},10)}},_doExecCommand:function(editor_id,element,command,user_interface,value){var inst=tinyMCE.getInstanceById(editor_id);var focusElm=inst.getFocusElement();var trElm=tinyMCE.getParentElement(focusElm,"tr");var tdElm=tinyMCE.getParentElement(focusElm,"td,th");var tableElm=tinyMCE.getParentElement(focusElm,"table");var doc=inst.contentWindow.document;var tableBorder=tableElm?tableElm.getAttribute("border"):"";if(trElm&&tdElm==null)tdElm=trElm.cells[0];function inArray(ar,v){for(var i=0;i<ar.length;i++){if(ar[i].length>0&&inArray(ar[i],v))return true;if(ar[i]==v)return true}return false}function makeTD(){var newTD=doc.createElement("td");newTD.innerHTML="&nbsp;"}function getColRowSpan(td){var colspan=tinyMCE.getAttrib(td,"colspan");var rowspan=tinyMCE.getAttrib(td,"rowspan");colspan=colspan==""?1:parseInt(colspan);rowspan=rowspan==""?1:parseInt(rowspan);return{colspan:colspan,rowspan:rowspan}}function getCellPos(grid,td){var x,y;for(y=0;y<grid.length;y++){for(x=0;x<grid[y].length;x++){if(grid[y][x]==td)return{cellindex:x,rowindex:y}}}return null}function getCell(grid,row,col){if(grid[row]&&grid[row][col])return grid[row][col];return null}function getTableGrid(table){var grid=new Array(),rows=table.rows,x,y,td,sd,xstart,x2,y2;for(y=0;y<rows.length;y++){for(x=0;x<rows[y].cells.length;x++){td=rows[y].cells[x];sd=getColRowSpan(td);for(xstart=x;grid[y]&&grid[y][xstart];xstart++);for(y2=y;y2<y+sd['rowspan'];y2++){if(!grid[y2])grid[y2]=new Array();for(x2=xstart;x2<xstart+sd['colspan'];x2++)grid[y2][x2]=td}}}return grid}function trimRow(table,tr,td,new_tr){var grid=getTableGrid(table),cpos=getCellPos(grid,td);var cells,lastElm;if(new_tr.cells.length!=tr.childNodes.length){cells=tr.childNodes;lastElm=null;for(var x=0;td=getCell(grid,cpos.rowindex,x);x++){var remove=true;var sd=getColRowSpan(td);if(inArray(cells,td)){new_tr.childNodes[x]._delete=true}else if((lastElm==null||td!=lastElm)&&sd.colspan>1){for(var i=x;i<x+td.colSpan;i++)new_tr.childNodes[i]._delete=true}if((lastElm==null||td!=lastElm)&&sd.rowspan>1)td.rowSpan=sd.rowspan+1;lastElm=td}deleteMarked(tableElm)}}function prevElm(node,name){while((node=node.previousSibling)!=null){if(node.nodeName==name)return node}return null}function nextElm(node,names){var namesAr=names.split(',');while((node=node.nextSibling)!=null){for(var i=0;i<namesAr.length;i++){if(node.nodeName.toLowerCase()==namesAr[i].toLowerCase())return node}}return null}function deleteMarked(tbl){if(tbl.rows==0)return;var tr=tbl.rows[0];do{var next=nextElm(tr,"TR");if(tr._delete){tr.parentNode.removeChild(tr);continue}var td=tr.cells[0];if(td.cells>1){do{var nexttd=nextElm(td,"TD,TH");if(td._delete)td.parentNode.removeChild(td)}while((td=nexttd)!=null)}}while((tr=next)!=null)}function addRows(td_elm,tr_elm,rowspan){td_elm.rowSpan=1;var trNext=nextElm(tr_elm,"TR");for(var i=1;i<rowspan&&trNext;i++){var newTD=doc.createElement("td");newTD.innerHTML="&nbsp;";if(tinyMCE.isMSIE)trNext.insertBefore(newTD,trNext.cells(td_elm.cellIndex));else trNext.insertBefore(newTD,trNext.cells[td_elm.cellIndex]);trNext=nextElm(trNext,"TR")}}function copyRow(doc,table,tr){var grid=getTableGrid(table);var newTR=tr.cloneNode(false);var cpos=getCellPos(grid,tr.cells[0]);var lastCell=null;var tableBorder=tinyMCE.getAttrib(table,"border");var tdElm=null;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){var newTD=null;if(lastCell!=tdElm){for(var i=0;i<tr.cells.length;i++){if(tdElm==tr.cells[i]){newTD=tdElm.cloneNode(true);break}}}if(newTD==null){newTD=doc.createElement("td");newTD.innerHTML="&nbsp;"}newTD.colSpan=1;newTD.rowSpan=1;newTR.appendChild(newTD);lastCell=tdElm}return newTR}switch(command){case"mceTableRowProps":if(trElm==null)return true;if(user_interface){var template=new Array();template['file']='../../plugins/table/row.htm';template['width']=380;template['height']=295;template['width']+=tinyMCE.getLang('lang_table_rowprops_delta_width',0);template['height']+=tinyMCE.getLang('lang_table_rowprops_delta_height',0);tinyMCE.openWindow(template,{editor_id:inst.editorId,inline:"yes"})}return true;case"mceTableCellProps":if(tdElm==null)return true;if(user_interface){var template=new Array();template['file']='../../plugins/table/cell.htm';template['width']=380;template['height']=295;template['width']+=tinyMCE.getLang('lang_table_cellprops_delta_width',0);template['height']+=tinyMCE.getLang('lang_table_cellprops_delta_height',0);tinyMCE.openWindow(template,{editor_id:inst.editorId,inline:"yes"})}return true;case"mceInsertTable":if(user_interface){var template=new Array();template['file']='../../plugins/table/table.htm';template['width']=380;template['height']=295;template['width']+=tinyMCE.getLang('lang_table_table_delta_width',0);template['height']+=tinyMCE.getLang('lang_table_table_delta_height',0);tinyMCE.openWindow(template,{editor_id:inst.editorId,inline:"yes",action:value})}return true;case"mceTableDelete":var table=tinyMCE.getParentElement(inst.getFocusElement(),"table");if(table){table.parentNode.removeChild(table);inst.repaint()}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(!tableElm)return true;if(trElm&&tableElm!=trElm.parentNode)tableElm=trElm.parentNode;if(tableElm&&trElm){switch(command){case"mceTableCutRow":if(!trElm||!tdElm)return true;inst.tableRowClipboard=copyRow(doc,tableElm,trElm);inst.execCommand("mceTableDeleteRow");break;case"mceTableCopyRow":if(!trElm||!tdElm)return true;inst.tableRowClipboard=copyRow(doc,tableElm,trElm);break;case"mceTablePasteRowBefore":if(!trElm||!tdElm)return true;var newTR=inst.tableRowClipboard.cloneNode(true);var prevTR=prevElm(trElm,"TR");if(prevTR!=null)trimRow(tableElm,prevTR,prevTR.cells[0],newTR);trElm.parentNode.insertBefore(newTR,trElm);break;case"mceTablePasteRowAfter":if(!trElm||!tdElm)return true;var nextTR=nextElm(trElm,"TR");var newTR=inst.tableRowClipboard.cloneNode(true);trimRow(tableElm,trElm,tdElm,newTR);if(nextTR==null)trElm.parentNode.appendChild(newTR);else nextTR.parentNode.insertBefore(newTR,nextTR);break;case"mceTableInsertRowBefore":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var newTR=doc.createElement("tr");var lastTDElm=null;cpos.rowindex--;if(cpos.rowindex<0)cpos.rowindex=0;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['rowspan']==1){var newTD=doc.createElement("td");newTD.innerHTML="&nbsp;";newTD.colSpan=tdElm.colSpan;newTR.appendChild(newTD)}else tdElm.rowSpan=sd['rowspan']+1;lastTDElm=tdElm}}trElm.parentNode.insertBefore(newTR,trElm);grid=getTableGrid(tableElm);inst.selection.selectNode(getCell(grid,cpos.rowindex+1,cpos.cellindex),tinyMCE.isGecko,true);break;case"mceTableInsertRowAfter":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var newTR=doc.createElement("tr");var lastTDElm=null;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['rowspan']==1){var newTD=doc.createElement("td");newTD.innerHTML="&nbsp;";newTD.colSpan=tdElm.colSpan;newTR.appendChild(newTD)}else tdElm.rowSpan=sd['rowspan']+1;lastTDElm=tdElm}}if(newTR.hasChildNodes()){var nextTR=nextElm(trElm,"TR");if(nextTR)nextTR.parentNode.insertBefore(newTR,nextTR);else tableElm.appendChild(newTR)}grid=getTableGrid(tableElm);inst.selection.selectNode(getCell(grid,cpos.rowindex,cpos.cellindex),tinyMCE.isGecko,true);break;case"mceTableDeleteRow":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);if(grid.length==1){tableElm=tinyMCE.getParentElement(tableElm,"table");tableElm.parentNode.removeChild(tableElm);return true}var cells=trElm.cells;var nextTR=nextElm(trElm,"TR");for(var x=0;x<cells.length;x++){if(cells[x].rowSpan>1){var newTD=cells[x].cloneNode(true);var sd=getColRowSpan(cells[x]);newTD.rowSpan=sd.rowspan-1;var nextTD=nextTR.cells[x];if(nextTD==null)nextTR.appendChild(newTD);else nextTR.insertBefore(newTD,nextTD)}}var lastTDElm=null;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd.rowspan>1){tdElm.rowSpan=sd.rowspan-1}else{trElm=tdElm.parentNode;if(trElm.parentNode)trElm._delete=true}lastTDElm=tdElm}}deleteMarked(tableElm);cpos.rowindex--;if(cpos.rowindex<0)cpos.rowindex=0;grid=getTableGrid(tableElm);inst.selection.selectNode(getCell(grid,cpos.rowindex,0),tinyMCE.isGecko,true);break;case"mceTableInsertColBefore":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var lastTDElm=null;for(var y=0;tdElm=getCell(grid,y,cpos.cellindex);y++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['colspan']==1){var newTD=doc.createElement(tdElm.nodeName);newTD.innerHTML="&nbsp;";newTD.rowSpan=tdElm.rowSpan;tdElm.parentNode.insertBefore(newTD,tdElm)}else tdElm.colSpan++;lastTDElm=tdElm}}grid=getTableGrid(tableElm);inst.selection.selectNode(getCell(grid,cpos.rowindex,cpos.cellindex+1),tinyMCE.isGecko,true);break;case"mceTableInsertColAfter":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var lastTDElm=null;for(var y=0;tdElm=getCell(grid,y,cpos.cellindex);y++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['colspan']==1){var newTD=doc.createElement(tdElm.nodeName);newTD.innerHTML="&nbsp;";newTD.rowSpan=tdElm.rowSpan;var nextTD=nextElm(tdElm,"TD,TH");if(nextTD==null)tdElm.parentNode.appendChild(newTD);else nextTD.parentNode.insertBefore(newTD,nextTD)}else tdElm.colSpan++;lastTDElm=tdElm}}grid=getTableGrid(tableElm);inst.selection.selectNode(getCell(grid,cpos.rowindex,cpos.cellindex),tinyMCE.isGecko,true);break;case"mceTableDeleteCol":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var lastTDElm=null;if(grid.length>1&&grid[0].length<=1){tableElm=tinyMCE.getParentElement(tableElm,"table");tableElm.parentNode.removeChild(tableElm);return true}for(var y=0;tdElm=getCell(grid,y,cpos.cellindex);y++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['colspan']>1)tdElm.colSpan=sd['colspan']-1;else{if(tdElm.parentNode)tdElm.parentNode.removeChild(tdElm)}lastTDElm=tdElm}}cpos.cellindex--;if(cpos.cellindex<0)cpos.cellindex=0;grid=getTableGrid(tableElm);inst.selection.selectNode(getCell(grid,cpos.rowindex,0),tinyMCE.isGecko,true);break;case"mceTableSplitCells":if(!trElm||!tdElm)return true;var spandata=getColRowSpan(tdElm);var colspan=spandata["colspan"];var rowspan=spandata["rowspan"];if(colspan>1||rowspan>1){tdElm.colSpan=1;for(var i=1;i<colspan;i++){var newTD=doc.createElement("td");newTD.innerHTML="&nbsp;";trElm.insertBefore(newTD,nextElm(tdElm,"TD,TH"));if(rowspan>1)addRows(newTD,trElm,rowspan)}addRows(tdElm,trElm,rowspan)}tableElm=tinyMCE.getParentElement(inst.getFocusElement(),"table");break;case"mceTableMergeCells":var rows=new Array();var sel=inst.getSel();var grid=getTableGrid(tableElm);if(tinyMCE.isMSIE||sel.rangeCount==1){if(user_interface){var template=new Array();var sp=getColRowSpan(tdElm);template['file']='../../plugins/table/merge_cells.htm';template['width']=250;template['height']=105+(tinyMCE.isNS7?25:0);template['width']+=tinyMCE.getLang('lang_table_merge_cells_delta_width',0);template['height']+=tinyMCE.getLang('lang_table_merge_cells_delta_height',0);tinyMCE.openWindow(template,{editor_id:inst.editorId,inline:"yes",action:"update",numcols:sp.colspan,numrows:sp.rowspan});return true}else{var numRows=parseInt(value['numrows']);var numCols=parseInt(value['numcols']);var cpos=getCellPos(grid,tdElm);if((""+numRows)=="NaN")numRows=1;if((""+numCols)=="NaN")numCols=1;var tRows=tableElm.rows;for(var y=cpos.rowindex;y<grid.length;y++){var rowCells=new Array();for(var x=cpos.cellindex;x<grid[y].length;x++){var td=getCell(grid,y,x);if(td&&!inArray(rows,td)&&!inArray(rowCells,td)){var cp=getCellPos(grid,td);if(cp.cellindex<cpos.cellindex+numCols&&cp.rowindex<cpos.rowindex+numRows)rowCells[rowCells.length]=td}}if(rowCells.length>0)rows[rows.length]=rowCells}}}else{var cells=new Array();var sel=inst.getSel();var lastTR=null;var curRow=null;var x1=-1,y1=-1,x2,y2;if(sel.rangeCount<2)return true;for(var i=0;i<sel.rangeCount;i++){var rng=sel.getRangeAt(i);var tdElm=rng.startContainer.childNodes[rng.startOffset];if(!tdElm)break;if(tdElm.nodeName=="TD")cells[cells.length]=tdElm}var tRows=tableElm.rows;for(var y=0;y<tRows.length;y++){var rowCells=new Array();for(var x=0;x<tRows[y].cells.length;x++){var td=tRows[y].cells[x];for(var i=0;i<cells.length;i++){if(td==cells[i]){rowCells[rowCells.length]=td}}}if(rowCells.length>0)rows[rows.length]=rowCells}var curRow=new Array();var lastTR=null;for(var y=0;y<grid.length;y++){for(var x=0;x<grid[y].length;x++){grid[y][x]._selected=false;for(var i=0;i<cells.length;i++){if(grid[y][x]==cells[i]){if(x1==-1){x1=x;y1=y}x2=x;y2=y;grid[y][x]._selected=true}}}}for(var y=y1;y<=y2;y++){for(var x=x1;x<=x2;x++){if(!grid[y][x]._selected){alert("Invalid selection for merge.");return true}}}}var rowSpan=1,colSpan=1;var lastRowSpan=-1;for(var y=0;y<rows.length;y++){var rowColSpan=0;for(var x=0;x<rows[y].length;x++){var sd=getColRowSpan(rows[y][x]);rowColSpan+=sd['colspan'];if(lastRowSpan!=-1&&sd['rowspan']!=lastRowSpan){alert("Invalid selection for merge.");return true}lastRowSpan=sd['rowspan']}if(rowColSpan>colSpan)colSpan=rowColSpan;lastRowSpan=-1}var lastColSpan=-1;for(var x=0;x<rows[0].length;x++){var colRowSpan=0;for(var y=0;y<rows.length;y++){var sd=getColRowSpan(rows[y][x]);colRowSpan+=sd['rowspan'];if(lastColSpan!=-1&&sd['colspan']!=lastColSpan){alert("Invalid selection for merge.");return true}lastColSpan=sd['colspan']}if(colRowSpan>rowSpan)rowSpan=colRowSpan;lastColSpan=-1}tdElm=rows[0][0];tdElm.rowSpan=rowSpan;tdElm.colSpan=colSpan;for(var y=0;y<rows.length;y++){for(var x=0;x<rows[y].length;x++){var html=rows[y][x].innerHTML;var chk=tinyMCE.regexpReplace(html,"[ \t\r\n]","");if(chk!="<br/>"&&chk!="<br>"&&chk!="&nbsp;"&&(x+y>0))tdElm.innerHTML+=html;if(rows[y][x]!=tdElm&&!rows[y][x]._deleted){var cpos=getCellPos(grid,rows[y][x]);var tr=rows[y][x].parentNode;tr.removeChild(rows[y][x]);rows[y][x]._deleted=true;if(!tr.hasChildNodes()){tr.parentNode.removeChild(tr);var lastCell=null;for(var x=0;cellElm=getCell(grid,cpos.rowindex,x);x++){if(cellElm!=lastCell&&cellElm.rowSpan>1)cellElm.rowSpan--;lastCell=cellElm}if(tdElm.rowSpan>1)tdElm.rowSpan--}}}}break}tableElm=tinyMCE.getParentElement(inst.getFocusElement(),"table");tinyMCE.handleVisualAid(tableElm,true,tinyMCE.settings['visual'],tinyMCE.selectedInstance);tinyMCE.triggerNodeChange();inst.repaint()}return true}return false}};tinyMCE.addPlugin("table",TinyMCE_TablePlugin); \ No newline at end of file
+(function(){var each=tinymce.each;tinymce.create('tinymce.plugins.TablePlugin',{init:function(ed,url){var t=this;t.editor=ed;t.url=url;each([['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(c){ed.addButton(c[0],{title:c[1],cmd:c[2],ui:c[3]});});ed.onInit.add(function(){if(ed&&ed.plugins.contextmenu){ed.plugins.contextmenu.onContextMenu.add(function(th,m,e){var sm,se=ed.selection,el=se.getNode()||ed.getBody();if(ed.dom.getParent(e,'td')||ed.dom.getParent(e,'th')){m.removeAll();if(el.nodeName=='A'&&!ed.dom.getAttrib(el,'name')){m.add({title:'advanced.link_desc',icon:'link',cmd:ed.plugins.advlink?'mceAdvLink':'mceLink',ui:true});m.add({title:'advanced.unlink_desc',icon:'unlink',cmd:'UnLink'});m.addSeparator();}if(el.nodeName=='IMG'&&el.className.indexOf('mceItem')==-1){m.add({title:'advanced.image_desc',icon:'image',cmd:ed.plugins.advimage?'mceAdvImage':'mceImage',ui:true});m.addSeparator();}m.add({title:'table.desc',icon:'table',cmd:'mceInsertTable',ui:true,value:{action:'insert'}});m.add({title:'table.props_desc',icon:'table_props',cmd:'mceInsertTable',ui:true});m.add({title:'table.del',icon:'delete_table',cmd:'mceTableDelete',ui:true});m.addSeparator();sm=m.addMenu({title:'table.cell'});sm.add({title:'table.cell_desc',icon:'cell_props',cmd:'mceTableCellProps',ui:true});sm.add({title:'table.split_cells_desc',icon:'split_cells',cmd:'mceTableSplitCells',ui:true});sm.add({title:'table.merge_cells_desc',icon:'merge_cells',cmd:'mceTableMergeCells',ui:true});sm=m.addMenu({title:'table.row'});sm.add({title:'table.row_desc',icon:'row_props',cmd:'mceTableRowProps',ui:true});sm.add({title:'table.row_before_desc',icon:'row_before',cmd:'mceTableInsertRowBefore'});sm.add({title:'table.row_after_desc',icon:'row_after',cmd:'mceTableInsertRowAfter'});sm.add({title:'table.delete_row_desc',icon:'delete_row',cmd:'mceTableDeleteRow'});sm.addSeparator();sm.add({title:'table.cut_row_desc',icon:'cut',cmd:'mceTableCutRow'});sm.add({title:'table.copy_row_desc',icon:'copy',cmd:'mceTableCopyRow'});sm.add({title:'table.paste_row_before_desc',icon:'paste',cmd:'mceTablePasteRowBefore'});sm.add({title:'table.paste_row_after_desc',icon:'paste',cmd:'mceTablePasteRowAfter'});sm=m.addMenu({title:'table.col'});sm.add({title:'table.col_before_desc',icon:'col_before',cmd:'mceTableInsertColBefore'});sm.add({title:'table.col_after_desc',icon:'col_after',cmd:'mceTableInsertColAfter'});sm.add({title:'table.delete_col_desc',icon:'delete_col',cmd:'mceTableDeleteCol'});}else m.add({title:'table.desc',icon:'table',cmd:'mceInsertTable',ui:true});});}});ed.onKeyDown.add(function(ed,e){if(e.keyCode==9&&ed.dom.getParent(ed.selection.getNode(),'TABLE'))ed.undoManager.add();});ed.onNodeChange.add(function(ed,cm,n){var p=ed.dom.getParent(n,'td,th,caption');cm.setActive('table',!!p);if(p&&p.nodeName==='CAPTION')p=null;cm.setDisabled('delete_table',!p);cm.setDisabled('delete_col',!p);cm.setDisabled('delete_table',!p);cm.setDisabled('delete_row',!p);cm.setDisabled('col_after',!p);cm.setDisabled('col_before',!p);cm.setDisabled('row_after',!p);cm.setDisabled('row_before',!p);cm.setDisabled('row_props',!p);cm.setDisabled('cell_props',!p);cm.setDisabled('split_cells',!p||(parseInt(ed.dom.getAttrib(p,'colspan','1'))<2&&parseInt(ed.dom.getAttrib(p,'rowspan','1'))<2));cm.setDisabled('merge_cells',!p);});if(!tinymce.isIE){ed.onBeforeSetContent.add(function(ed,o){if(o.initial)o.content=o.content.replace(/<(td|th)([^>]+|)>\s*<\/(td|th)>/g,tinymce.isOpera?'<$1$2>&nbsp;</$1>':'<$1$2><br mce_bogus="1" /></$1>');});}},execCommand:function(cmd,ui,val){var ed=this.editor,b;switch(cmd){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":ed.execCommand('mceBeginUndoLevel');this._doExecCommand(cmd,ui,val);ed.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(command,user_interface,value){var inst=this.editor,ed=inst,url=this.url;var focusElm=inst.selection.getNode();var trElm=inst.dom.getParent(focusElm,"tr");var tdElm=inst.dom.getParent(focusElm,"td,th");var tableElm=inst.dom.getParent(focusElm,"table");var doc=inst.contentWindow.document;var tableBorder=tableElm?tableElm.getAttribute("border"):"";if(trElm&&tdElm==null)tdElm=trElm.cells[0];function inArray(ar,v){for(var i=0;i<ar.length;i++){if(ar[i].length>0&&inArray(ar[i],v))return true;if(ar[i]==v)return true;}return false;}function select(dx,dy){var td;grid=getTableGrid(tableElm);dx=dx||0;dy=dy||0;dx=Math.max(cpos.cellindex+dx,0);dy=Math.max(cpos.rowindex+dy,0);inst.execCommand('mceRepaint');td=getCell(grid,dy,dx);if(td){inst.selection.select(td.firstChild||td);inst.selection.collapse(1);}};function makeTD(){var newTD=doc.createElement("td");if(!tinymce.isIE)newTD.innerHTML='<br mce_bogus="1"/>';}function getColRowSpan(td){var colspan=inst.dom.getAttrib(td,"colspan");var rowspan=inst.dom.getAttrib(td,"rowspan");colspan=colspan==""?1:parseInt(colspan);rowspan=rowspan==""?1:parseInt(rowspan);return{colspan:colspan,rowspan:rowspan};}function getCellPos(grid,td){var x,y;for(y=0;y<grid.length;y++){for(x=0;x<grid[y].length;x++){if(grid[y][x]==td)return{cellindex:x,rowindex:y};}}return null;}function getCell(grid,row,col){if(grid[row]&&grid[row][col])return grid[row][col];return null;}function getTableGrid(table){var grid=[],rows=table.rows,x,y,td,sd,xstart,x2,y2;for(y=0;y<rows.length;y++){for(x=0;x<rows[y].cells.length;x++){td=rows[y].cells[x];sd=getColRowSpan(td);for(xstart=x;grid[y]&&grid[y][xstart];xstart++);for(y2=y;y2<y+sd['rowspan'];y2++){if(!grid[y2])grid[y2]=[];for(x2=xstart;x2<xstart+sd['colspan'];x2++)grid[y2][x2]=td;}}}return grid;}function trimRow(table,tr,td,new_tr){var grid=getTableGrid(table),cpos=getCellPos(grid,td);var cells,lastElm;if(new_tr.cells.length!=tr.childNodes.length){cells=tr.childNodes;lastElm=null;for(var x=0;td=getCell(grid,cpos.rowindex,x);x++){var remove=true;var sd=getColRowSpan(td);if(inArray(cells,td)){new_tr.childNodes[x]._delete=true;}else if((lastElm==null||td!=lastElm)&&sd.colspan>1){for(var i=x;i<x+td.colSpan;i++)new_tr.childNodes[i]._delete=true;}if((lastElm==null||td!=lastElm)&&sd.rowspan>1)td.rowSpan=sd.rowspan+1;lastElm=td;}deleteMarked(tableElm);}}function prevElm(node,name){while((node=node.previousSibling)!=null){if(node.nodeName==name)return node;}return null;}function nextElm(node,names){var namesAr=names.split(',');while((node=node.nextSibling)!=null){for(var i=0;i<namesAr.length;i++){if(node.nodeName.toLowerCase()==namesAr[i].toLowerCase())return node;}}return null;}function deleteMarked(tbl){if(tbl.rows==0)return;var tr=tbl.rows[0];do{var next=nextElm(tr,"TR");if(tr._delete){tr.parentNode.removeChild(tr);continue;}var td=tr.cells[0];if(td.cells>1){do{var nexttd=nextElm(td,"TD,TH");if(td._delete)td.parentNode.removeChild(td);}while((td=nexttd)!=null);}}while((tr=next)!=null);}function addRows(td_elm,tr_elm,rowspan){td_elm.rowSpan=1;var trNext=nextElm(tr_elm,"TR");for(var i=1;i<rowspan&&trNext;i++){var newTD=doc.createElement("td");if(!tinymce.isIE)newTD.innerHTML='<br mce_bogus="1"/>';if(tinymce.isIE)trNext.insertBefore(newTD,trNext.cells(td_elm.cellIndex));else trNext.insertBefore(newTD,trNext.cells[td_elm.cellIndex]);trNext=nextElm(trNext,"TR");}}function copyRow(doc,table,tr){var grid=getTableGrid(table);var newTR=tr.cloneNode(false);var cpos=getCellPos(grid,tr.cells[0]);var lastCell=null;var tableBorder=inst.dom.getAttrib(table,"border");var tdElm=null;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){var newTD=null;if(lastCell!=tdElm){for(var i=0;i<tr.cells.length;i++){if(tdElm==tr.cells[i]){newTD=tdElm.cloneNode(true);break;}}}if(newTD==null){newTD=doc.createElement("td");if(!tinymce.isIE)newTD.innerHTML='<br mce_bogus="1"/>';}newTD.colSpan=1;newTD.rowSpan=1;newTR.appendChild(newTD);lastCell=tdElm;}return newTR;}switch(command){case"mceTableRowProps":if(trElm==null)return true;if(user_interface){inst.windowManager.open({url:url+'/row.htm',width:400+parseInt(inst.getLang('table.rowprops_delta_width',0)),height:295+parseInt(inst.getLang('table.rowprops_delta_height',0)),inline:1},{plugin_url:url});}return true;case"mceTableCellProps":if(tdElm==null)return true;if(user_interface){inst.windowManager.open({url:url+'/cell.htm',width:400+parseInt(inst.getLang('table.cellprops_delta_width',0)),height:295+parseInt(inst.getLang('table.cellprops_delta_height',0)),inline:1},{plugin_url:url});}return true;case"mceInsertTable":if(user_interface){inst.windowManager.open({url:url+'/table.htm',width:400+parseInt(inst.getLang('table.table_delta_width',0)),height:320+parseInt(inst.getLang('table.table_delta_height',0)),inline:1},{plugin_url:url,action:value?value.action:0});}return true;case"mceTableDelete":var table=inst.dom.getParent(inst.selection.getNode(),"table");if(table){table.parentNode.removeChild(table);inst.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(!tableElm)return true;if(trElm&&tableElm!=trElm.parentNode)tableElm=trElm.parentNode;if(tableElm&&trElm){switch(command){case"mceTableCutRow":if(!trElm||!tdElm)return true;inst.tableRowClipboard=copyRow(doc,tableElm,trElm);inst.execCommand("mceTableDeleteRow");break;case"mceTableCopyRow":if(!trElm||!tdElm)return true;inst.tableRowClipboard=copyRow(doc,tableElm,trElm);break;case"mceTablePasteRowBefore":if(!trElm||!tdElm)return true;var newTR=inst.tableRowClipboard.cloneNode(true);var prevTR=prevElm(trElm,"TR");if(prevTR!=null)trimRow(tableElm,prevTR,prevTR.cells[0],newTR);trElm.parentNode.insertBefore(newTR,trElm);break;case"mceTablePasteRowAfter":if(!trElm||!tdElm)return true;var nextTR=nextElm(trElm,"TR");var newTR=inst.tableRowClipboard.cloneNode(true);trimRow(tableElm,trElm,tdElm,newTR);if(nextTR==null)trElm.parentNode.appendChild(newTR);else nextTR.parentNode.insertBefore(newTR,nextTR);break;case"mceTableInsertRowBefore":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var newTR=doc.createElement("tr");var lastTDElm=null;cpos.rowindex--;if(cpos.rowindex<0)cpos.rowindex=0;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['rowspan']==1){var newTD=doc.createElement("td");if(!tinymce.isIE)newTD.innerHTML='<br mce_bogus="1"/>';newTD.colSpan=tdElm.colSpan;newTR.appendChild(newTD);}else tdElm.rowSpan=sd['rowspan']+1;lastTDElm=tdElm;}}trElm.parentNode.insertBefore(newTR,trElm);select(0,1);break;case"mceTableInsertRowAfter":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var newTR=doc.createElement("tr");var lastTDElm=null;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['rowspan']==1){var newTD=doc.createElement("td");if(!tinymce.isIE)newTD.innerHTML='<br mce_bogus="1"/>';newTD.colSpan=tdElm.colSpan;newTR.appendChild(newTD);}else tdElm.rowSpan=sd['rowspan']+1;lastTDElm=tdElm;}}if(newTR.hasChildNodes()){var nextTR=nextElm(trElm,"TR");if(nextTR)nextTR.parentNode.insertBefore(newTR,nextTR);else tableElm.appendChild(newTR);}select(0,1);break;case"mceTableDeleteRow":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);if(grid.length==1){inst.dom.remove(inst.dom.getParent(tableElm,"table"));return true;}var cells=trElm.cells;var nextTR=nextElm(trElm,"TR");for(var x=0;x<cells.length;x++){if(cells[x].rowSpan>1){var newTD=cells[x].cloneNode(true);var sd=getColRowSpan(cells[x]);newTD.rowSpan=sd.rowspan-1;var nextTD=nextTR.cells[x];if(nextTD==null)nextTR.appendChild(newTD);else nextTR.insertBefore(newTD,nextTD);}}var lastTDElm=null;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd.rowspan>1){tdElm.rowSpan=sd.rowspan-1;}else{trElm=tdElm.parentNode;if(trElm.parentNode)trElm._delete=true;}lastTDElm=tdElm;}}deleteMarked(tableElm);select(0,-1);break;case"mceTableInsertColBefore":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var lastTDElm=null;for(var y=0;tdElm=getCell(grid,y,cpos.cellindex);y++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['colspan']==1){var newTD=doc.createElement(tdElm.nodeName);if(!tinymce.isIE)newTD.innerHTML='<br mce_bogus="1"/>';newTD.rowSpan=tdElm.rowSpan;tdElm.parentNode.insertBefore(newTD,tdElm);}else tdElm.colSpan++;lastTDElm=tdElm;}}select();break;case"mceTableInsertColAfter":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var lastTDElm=null;for(var y=0;tdElm=getCell(grid,y,cpos.cellindex);y++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['colspan']==1){var newTD=doc.createElement(tdElm.nodeName);if(!tinymce.isIE)newTD.innerHTML='<br mce_bogus="1"/>';newTD.rowSpan=tdElm.rowSpan;var nextTD=nextElm(tdElm,"TD,TH");if(nextTD==null)tdElm.parentNode.appendChild(newTD);else nextTD.parentNode.insertBefore(newTD,nextTD);}else tdElm.colSpan++;lastTDElm=tdElm;}}select(1);break;case"mceTableDeleteCol":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var lastTDElm=null;if(grid.length>1&&grid[0].length<=1){inst.dom.remove(inst.dom.getParent(tableElm,"table"));return true;}for(var y=0;tdElm=getCell(grid,y,cpos.cellindex);y++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['colspan']>1)tdElm.colSpan=sd['colspan']-1;else{if(tdElm.parentNode)tdElm.parentNode.removeChild(tdElm);}lastTDElm=tdElm;}}select(-1);break;case"mceTableSplitCells":if(!trElm||!tdElm)return true;var spandata=getColRowSpan(tdElm);var colspan=spandata["colspan"];var rowspan=spandata["rowspan"];if(colspan>1||rowspan>1){tdElm.colSpan=1;for(var i=1;i<colspan;i++){var newTD=doc.createElement("td");if(!tinymce.isIE)newTD.innerHTML='<br mce_bogus="1"/>';trElm.insertBefore(newTD,nextElm(tdElm,"TD,TH"));if(rowspan>1)addRows(newTD,trElm,rowspan);}addRows(tdElm,trElm,rowspan);}tableElm=inst.dom.getParent(inst.selection.getNode(),"table");break;case"mceTableMergeCells":var rows=[];var sel=inst.selection.getSel();var grid=getTableGrid(tableElm);if(tinymce.isIE||sel.rangeCount==1){if(user_interface){var sp=getColRowSpan(tdElm);inst.windowManager.open({url:url+'/merge_cells.htm',width:240+parseInt(inst.getLang('table.merge_cells_delta_width',0)),height:110+parseInt(inst.getLang('table.merge_cells_delta_height',0)),inline:1},{action:"update",numcols:sp.colspan,numrows:sp.rowspan,plugin_url:url});return true;}else{var numRows=parseInt(value['numrows']);var numCols=parseInt(value['numcols']);var cpos=getCellPos(grid,tdElm);if((""+numRows)=="NaN")numRows=1;if((""+numCols)=="NaN")numCols=1;var tRows=tableElm.rows;for(var y=cpos.rowindex;y<grid.length;y++){var rowCells=[];for(var x=cpos.cellindex;x<grid[y].length;x++){var td=getCell(grid,y,x);if(td&&!inArray(rows,td)&&!inArray(rowCells,td)){var cp=getCellPos(grid,td);if(cp.cellindex<cpos.cellindex+numCols&&cp.rowindex<cpos.rowindex+numRows)rowCells[rowCells.length]=td;}}if(rowCells.length>0)rows[rows.length]=rowCells;var td=getCell(grid,cpos.rowindex,cpos.cellindex);each(ed.dom.select('br',td),function(e,i){if(i>0&&ed.dom.getAttrib('mce_bogus'))ed.dom.remove(e);});}}}else{var cells=[];var sel=inst.selection.getSel();var lastTR=null;var curRow=null;var x1=-1,y1=-1,x2,y2;if(sel.rangeCount<2)return true;for(var i=0;i<sel.rangeCount;i++){var rng=sel.getRangeAt(i);var tdElm=rng.startContainer.childNodes[rng.startOffset];if(!tdElm)break;if(tdElm.nodeName=="TD")cells[cells.length]=tdElm;}var tRows=tableElm.rows;for(var y=0;y<tRows.length;y++){var rowCells=[];for(var x=0;x<tRows[y].cells.length;x++){var td=tRows[y].cells[x];for(var i=0;i<cells.length;i++){if(td==cells[i]){rowCells[rowCells.length]=td;}}}if(rowCells.length>0)rows[rows.length]=rowCells;}var curRow=[];var lastTR=null;for(var y=0;y<grid.length;y++){for(var x=0;x<grid[y].length;x++){grid[y][x]._selected=false;for(var i=0;i<cells.length;i++){if(grid[y][x]==cells[i]){if(x1==-1){x1=x;y1=y;}x2=x;y2=y;grid[y][x]._selected=true;}}}}for(var y=y1;y<=y2;y++){for(var x=x1;x<=x2;x++){if(!grid[y][x]._selected){alert("Invalid selection for merge.");return true;}}}}var rowSpan=1,colSpan=1;var lastRowSpan=-1;for(var y=0;y<rows.length;y++){var rowColSpan=0;for(var x=0;x<rows[y].length;x++){var sd=getColRowSpan(rows[y][x]);rowColSpan+=sd['colspan'];if(lastRowSpan!=-1&&sd['rowspan']!=lastRowSpan){alert("Invalid selection for merge.");return true;}lastRowSpan=sd['rowspan'];}if(rowColSpan>colSpan)colSpan=rowColSpan;lastRowSpan=-1;}var lastColSpan=-1;for(var x=0;x<rows[0].length;x++){var colRowSpan=0;for(var y=0;y<rows.length;y++){var sd=getColRowSpan(rows[y][x]);colRowSpan+=sd['rowspan'];if(lastColSpan!=-1&&sd['colspan']!=lastColSpan){alert("Invalid selection for merge.");return true;}lastColSpan=sd['colspan'];}if(colRowSpan>rowSpan)rowSpan=colRowSpan;lastColSpan=-1;}tdElm=rows[0][0];tdElm.rowSpan=rowSpan;tdElm.colSpan=colSpan;for(var y=0;y<rows.length;y++){for(var x=0;x<rows[y].length;x++){var html=rows[y][x].innerHTML;var chk=html.replace(/[ \t\r\n]/g,"");if(chk!="<br/>"&&chk!="<br>"&&chk!='<br mce_bogus="1"/>'&&(x+y>0))tdElm.innerHTML+=html;if(rows[y][x]!=tdElm&&!rows[y][x]._deleted){var cpos=getCellPos(grid,rows[y][x]);var tr=rows[y][x].parentNode;tr.removeChild(rows[y][x]);rows[y][x]._deleted=true;if(!tr.hasChildNodes()){tr.parentNode.removeChild(tr);var lastCell=null;for(var x=0;cellElm=getCell(grid,cpos.rowindex,x);x++){if(cellElm!=lastCell&&cellElm.rowSpan>1)cellElm.rowSpan--;lastCell=cellElm;}if(tdElm.rowSpan>1)tdElm.rowSpan--;}}}}each(ed.dom.select('br',tdElm),function(e,i){if(i>0&&ed.dom.getAttrib(e,'mce_bogus'))ed.dom.remove(e);});break;}tableElm=inst.dom.getParent(inst.selection.getNode(),"table");inst.addVisual(tableElm);inst.nodeChanged();}return true;}return false;}});tinymce.PluginManager.add('table',tinymce.plugins.TablePlugin);})(); \ No newline at end of file
diff --git a/program/js/tiny_mce/plugins/table/editor_plugin_src.js b/program/js/tiny_mce/plugins/table/editor_plugin_src.js
index 75aaa4dec..0baafb1f6 100644
--- a/program/js/tiny_mce/plugins/table/editor_plugin_src.js
+++ b/program/js/tiny_mce/plugins/table/editor_plugin_src.js
@@ -1,879 +1,913 @@
/**
- * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
+ * $Id: editor_plugin_src.js 768 2008-04-04 13:52:49Z spocke $
*
* @author Moxiecode
- * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
+ * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
*/
-/* Import plugin specific language pack */
-tinyMCE.importPluginLanguagePack('table');
-
-var TinyMCE_TablePlugin = {
- 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
- };
- },
-
- initInstance : function(inst) {
- if (tinyMCE.isGecko) {
- var doc = inst.getDoc();
- tinyMCE.addEvent(doc, "mouseup", TinyMCE_TablePlugin._mouseDownHandler);
- }
+(function() {
+ var each = tinymce.each;
+
+ tinymce.create('tinymce.plugins.TablePlugin', {
+ init : function(ed, url) {
+ var t = this;
+
+ t.editor = ed;
+ t.url = url;
+
+ // Register buttons
+ each([
+ ['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(c) {
+ ed.addButton(c[0], {title : c[1], cmd : c[2], ui : c[3]});
+ });
+
+ ed.onInit.add(function() {
+ if (ed && ed.plugins.contextmenu) {
+ ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) {
+ var sm, se = ed.selection, el = se.getNode() || ed.getBody();
+
+ if (ed.dom.getParent(e, 'td') || ed.dom.getParent(e, 'th')) {
+ m.removeAll();
+
+ if (el.nodeName == 'A' && !ed.dom.getAttrib(el, 'name')) {
+ m.add({title : 'advanced.link_desc', icon : 'link', cmd : ed.plugins.advlink ? 'mceAdvLink' : 'mceLink', ui : true});
+ m.add({title : 'advanced.unlink_desc', icon : 'unlink', cmd : 'UnLink'});
+ m.addSeparator();
+ }
- inst.tableRowClipboard = null;
- },
-
- /**
- * Returns the HTML contents of the table control.
- */
- getControlHTML : function(control_name) {
- var controls = new Array(
- ['table', 'table.gif', 'lang_table_desc', 'mceInsertTable', true],
- ['delete_table', 'table_delete.gif', 'lang_table_del', 'mceTableDelete'],
- ['delete_col', 'table_delete_col.gif', 'lang_table_delete_col_desc', 'mceTableDeleteCol'],
- ['delete_row', 'table_delete_row.gif', 'lang_table_delete_row_desc', 'mceTableDeleteRow'],
- ['col_after', 'table_insert_col_after.gif', 'lang_table_col_after_desc', 'mceTableInsertColAfter'],
- ['col_before', 'table_insert_col_before.gif', 'lang_table_col_before_desc', 'mceTableInsertColBefore'],
- ['row_after', 'table_insert_row_after.gif', 'lang_table_row_after_desc', 'mceTableInsertRowAfter'],
- ['row_before', 'table_insert_row_before.gif', 'lang_table_row_before_desc', 'mceTableInsertRowBefore'],
- ['row_props', 'table_row_props.gif', 'lang_table_row_desc', 'mceTableRowProps', true],
- ['cell_props', 'table_cell_props.gif', 'lang_table_cell_desc', 'mceTableCellProps', true],
- ['split_cells', 'table_split_cells.gif', 'lang_table_split_cells_desc', 'mceTableSplitCells', true],
- ['merge_cells', 'table_merge_cells.gif', 'lang_table_merge_cells_desc', 'mceTableMergeCells', true]);
-
- // Render table control
- for (var i=0; i<controls.length; i++) {
- var but = controls[i];
- var cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + but[3] + '\', ' + (but.length > 4 ? but[4] : false) + (but.length > 5 ? ', \'' + but[5] + '\'' : '') + ');return false;';
-
- if (but[0] == control_name)
- return tinyMCE.getButtonHTML(control_name, but[2], '{$pluginurl}/images/'+ but[1], but[3], (but.length > 4 ? but[4] : false));
- }
+ if (el.nodeName == 'IMG' && el.className.indexOf('mceItem') == -1) {
+ m.add({title : 'advanced.image_desc', icon : 'image', cmd : ed.plugins.advimage ? 'mceAdvImage' : 'mceImage', ui : true});
+ m.addSeparator();
+ }
- // Special tablecontrols
- if (control_name == "tablecontrols") {
- var html = "";
-
- html += tinyMCE.getControlHTML("table");
- html += tinyMCE.getControlHTML("separator");
- html += tinyMCE.getControlHTML("row_props");
- html += tinyMCE.getControlHTML("cell_props");
- html += tinyMCE.getControlHTML("separator");
- html += tinyMCE.getControlHTML("row_before");
- html += tinyMCE.getControlHTML("row_after");
- html += tinyMCE.getControlHTML("delete_row");
- html += tinyMCE.getControlHTML("separator");
- html += tinyMCE.getControlHTML("col_before");
- html += tinyMCE.getControlHTML("col_after");
- html += tinyMCE.getControlHTML("delete_col");
- html += tinyMCE.getControlHTML("separator");
- html += tinyMCE.getControlHTML("split_cells");
- html += tinyMCE.getControlHTML("merge_cells");
-
- return html;
- }
+ m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', ui : true, value : {action : 'insert'}});
+ m.add({title : 'table.props_desc', icon : 'table_props', cmd : 'mceInsertTable', ui : true});
+ m.add({title : 'table.del', icon : 'delete_table', cmd : 'mceTableDelete', ui : true});
+ m.addSeparator();
+
+ // Cell menu
+ sm = m.addMenu({title : 'table.cell'});
+ sm.add({title : 'table.cell_desc', icon : 'cell_props', cmd : 'mceTableCellProps', ui : true});
+ sm.add({title : 'table.split_cells_desc', icon : 'split_cells', cmd : 'mceTableSplitCells', ui : true});
+ sm.add({title : 'table.merge_cells_desc', icon : 'merge_cells', cmd : 'mceTableMergeCells', ui : true});
+
+ // Row menu
+ sm = m.addMenu({title : 'table.row'});
+ sm.add({title : 'table.row_desc', icon : 'row_props', cmd : 'mceTableRowProps', ui : true});
+ sm.add({title : 'table.row_before_desc', icon : 'row_before', cmd : 'mceTableInsertRowBefore'});
+ sm.add({title : 'table.row_after_desc', icon : 'row_after', cmd : 'mceTableInsertRowAfter'});
+ sm.add({title : 'table.delete_row_desc', icon : 'delete_row', cmd : 'mceTableDeleteRow'});
+ sm.addSeparator();
+ sm.add({title : 'table.cut_row_desc', icon : 'cut', cmd : 'mceTableCutRow'});
+ sm.add({title : 'table.copy_row_desc', icon : 'copy', cmd : 'mceTableCopyRow'});
+ sm.add({title : 'table.paste_row_before_desc', icon : 'paste', cmd : 'mceTablePasteRowBefore'});
+ sm.add({title : 'table.paste_row_after_desc', icon : 'paste', cmd : 'mceTablePasteRowAfter'});
+
+ // Column menu
+ sm = m.addMenu({title : 'table.col'});
+ sm.add({title : 'table.col_before_desc', icon : 'col_before', cmd : 'mceTableInsertColBefore'});
+ sm.add({title : 'table.col_after_desc', icon : 'col_after', cmd : 'mceTableInsertColAfter'});
+ sm.add({title : 'table.delete_col_desc', icon : 'delete_col', cmd : 'mceTableDeleteCol'});
+ } else
+ m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', ui : true});
+ });
+ }
+ });
+
+ // Add undo level when new rows are created using the tab key
+ ed.onKeyDown.add(function(ed, e) {
+ if (e.keyCode == 9 && ed.dom.getParent(ed.selection.getNode(), 'TABLE'))
+ ed.undoManager.add();
+ });
+
+ ed.onNodeChange.add(function(ed, cm, n) {
+ var p = ed.dom.getParent(n, 'td,th,caption');
+
+ cm.setActive('table', !!p);
+ if (p && p.nodeName === 'CAPTION')
+ p = null;
+
+ cm.setDisabled('delete_table', !p);
+ cm.setDisabled('delete_col', !p);
+ cm.setDisabled('delete_table', !p);
+ cm.setDisabled('delete_row', !p);
+ cm.setDisabled('col_after', !p);
+ cm.setDisabled('col_before', !p);
+ cm.setDisabled('row_after', !p);
+ cm.setDisabled('row_before', !p);
+ cm.setDisabled('row_props', !p);
+ cm.setDisabled('cell_props', !p);
+ cm.setDisabled('split_cells', !p || (parseInt(ed.dom.getAttrib(p, 'colspan', '1')) < 2 && parseInt(ed.dom.getAttrib(p, 'rowspan', '1')) < 2));
+ cm.setDisabled('merge_cells', !p);
+ });
+
+ // Padd empty table cells
+ if (!tinymce.isIE) {
+ ed.onBeforeSetContent.add(function(ed, o) {
+ if (o.initial)
+ o.content = o.content.replace(/<(td|th)([^>]+|)>\s*<\/(td|th)>/g, tinymce.isOpera ? '<$1$2>&nbsp;</$1>' : '<$1$2><br mce_bogus="1" /></$1>');
+ });
+ }
+ },
+
+ execCommand : function(cmd, ui, val) {
+ var ed = this.editor, b;
+
+ // Is table command
+ switch (cmd) {
+ 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":
+ ed.execCommand('mceBeginUndoLevel');
+ this._doExecCommand(cmd, ui, val);
+ ed.execCommand('mceEndUndoLevel');
- return "";
- },
-
- /**
- * Executes the table commands.
- */
- execCommand : function(editor_id, element, command, user_interface, value) {
- // Is table command
- switch (command) {
- 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":
- var inst = tinyMCE.getInstanceById(editor_id);
-
- inst.execCommand('mceBeginUndoLevel');
- TinyMCE_TablePlugin._doExecCommand(editor_id, element, command, user_interface, value);
- inst.execCommand('mceEndUndoLevel');
+ return true;
+ }
- return true;
- }
+ // Pass to next handler in chain
+ 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
+ };
+ },
+
+ // Private plugin internal methods
+
+ /**
+ * Executes the table commands.
+ */
+ _doExecCommand : function(command, user_interface, value) {
+ var inst = this.editor, ed = inst, url = this.url;
+ var focusElm = inst.selection.getNode();
+ var trElm = inst.dom.getParent(focusElm, "tr");
+ var tdElm = inst.dom.getParent(focusElm, "td,th");
+ var tableElm = inst.dom.getParent(focusElm, "table");
+ var doc = inst.contentWindow.document;
+ var tableBorder = tableElm ? tableElm.getAttribute("border") : "";
+
+ // Get first TD if no TD found
+ if (trElm && tdElm == null)
+ tdElm = trElm.cells[0];
+
+ function inArray(ar, v) {
+ for (var i=0; i<ar.length; i++) {
+ // Is array
+ if (ar[i].length > 0 && inArray(ar[i], v))
+ return true;
+
+ // Found value
+ if (ar[i] == v)
+ return true;
+ }
- // Pass to next handler in chain
- return false;
- },
-
- handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
- var colspan = "1", rowspan = "1", tdElm;
-
- var inst = tinyMCE.getInstanceById(editor_id);
-
- // Reset table controls
- tinyMCE.switchClass(editor_id + '_table', 'mceButtonNormal');
- tinyMCE.switchClass(editor_id + '_delete_table', 'mceButtonDisabled');
- tinyMCE.switchClass(editor_id + '_row_props', 'mceButtonDisabled');
- tinyMCE.switchClass(editor_id + '_cell_props', 'mceButtonDisabled');
- tinyMCE.switchClass(editor_id + '_row_before', 'mceButtonDisabled');
- tinyMCE.switchClass(editor_id + '_row_after', 'mceButtonDisabled');
- tinyMCE.switchClass(editor_id + '_delete_row', 'mceButtonDisabled');
- tinyMCE.switchClass(editor_id + '_col_before', 'mceButtonDisabled');
- tinyMCE.switchClass(editor_id + '_col_after', 'mceButtonDisabled');
- tinyMCE.switchClass(editor_id + '_delete_col', 'mceButtonDisabled');
- tinyMCE.switchClass(editor_id + '_split_cells', 'mceButtonDisabled');
- tinyMCE.switchClass(editor_id + '_merge_cells', 'mceButtonDisabled');
-
- // Within a td element
- if (tdElm = tinyMCE.getParentElement(node, "td,th")) {
- tinyMCE.switchClass(editor_id + '_cell_props', 'mceButtonSelected');
- tinyMCE.switchClass(editor_id + '_delete_table', 'mceButtonNormal');
- tinyMCE.switchClass(editor_id + '_row_before', 'mceButtonNormal');
- tinyMCE.switchClass(editor_id + '_row_after', 'mceButtonNormal');
- tinyMCE.switchClass(editor_id + '_delete_row', 'mceButtonNormal');
- tinyMCE.switchClass(editor_id + '_col_before', 'mceButtonNormal');
- tinyMCE.switchClass(editor_id + '_col_after', 'mceButtonNormal');
- tinyMCE.switchClass(editor_id + '_delete_col', 'mceButtonNormal');
-
- colspan = tinyMCE.getAttrib(tdElm, "colspan");
- rowspan = tinyMCE.getAttrib(tdElm, "rowspan");
-
- colspan = colspan == "" ? "1" : colspan;
- rowspan = rowspan == "" ? "1" : rowspan;
-
- if (colspan != "1" || rowspan != "1")
- tinyMCE.switchClass(editor_id + '_split_cells', 'mceButtonNormal');
- }
+ return false;
+ }
- // Within a tr element
- if (tinyMCE.getParentElement(node, "tr"))
- tinyMCE.switchClass(editor_id + '_row_props', 'mceButtonSelected');
+ function select(dx, dy) {
+ var td;
- // Within table
- if (tinyMCE.getParentElement(node, "table")) {
- tinyMCE.switchClass(editor_id + '_table', 'mceButtonSelected');
- tinyMCE.switchClass(editor_id + '_merge_cells', 'mceButtonNormal');
- }
- },
+ grid = getTableGrid(tableElm);
+ dx = dx || 0;
+ dy = dy || 0;
+ dx = Math.max(cpos.cellindex + dx, 0);
+ dy = Math.max(cpos.rowindex + dy, 0);
- // Private plugin internal methods
+ // Recalculate grid and select
+ inst.execCommand('mceRepaint');
+ td = getCell(grid, dy, dx);
- _mouseDownHandler : function(e) {
- var elm = tinyMCE.isMSIE ? event.srcElement : e.target;
- var focusElm = tinyMCE.selectedInstance.getFocusElement();
+ if (td) {
+ inst.selection.select(td.firstChild || td);
+ inst.selection.collapse(1);
+ }
+ };
- // If press on special Mozilla create TD/TR thingie
- if (elm.nodeName == "BODY" && (focusElm.nodeName == "TD" || focusElm.nodeName == "TH" || (focusElm.parentNode && focusElm.parentNode.nodeName == "TD") ||(focusElm.parentNode && focusElm.parentNode.nodeName == "TH") )) {
- window.setTimeout(function() {
- var tableElm = tinyMCE.getParentElement(focusElm, "table");
- tinyMCE.handleVisualAid(tableElm, true, tinyMCE.settings['visual'], tinyMCE.selectedInstance);
- }, 10);
- }
- },
-
- /**
- * Executes the table commands.
- */
- _doExecCommand : function(editor_id, element, command, user_interface, value) {
- var inst = tinyMCE.getInstanceById(editor_id);
- var focusElm = inst.getFocusElement();
- var trElm = tinyMCE.getParentElement(focusElm, "tr");
- var tdElm = tinyMCE.getParentElement(focusElm, "td,th");
- var tableElm = tinyMCE.getParentElement(focusElm, "table");
- var doc = inst.contentWindow.document;
- var tableBorder = tableElm ? tableElm.getAttribute("border") : "";
-
- // Get first TD if no TD found
- if (trElm && tdElm == null)
- tdElm = trElm.cells[0];
-
- // ------- Inner functions ---------
- function inArray(ar, v) {
- for (var i=0; i<ar.length; i++) {
- // Is array
- if (ar[i].length > 0 && inArray(ar[i], v))
- return true;
+ function makeTD() {
+ var newTD = doc.createElement("td");
- // Found value
- if (ar[i] == v)
- return true;
+ if (!tinymce.isIE)
+ newTD.innerHTML = '<br mce_bogus="1"/>';
}
- return false;
- }
-
- function makeTD() {
- var newTD = doc.createElement("td");
- newTD.innerHTML = "&nbsp;";
- }
-
- function getColRowSpan(td) {
- var colspan = tinyMCE.getAttrib(td, "colspan");
- var rowspan = tinyMCE.getAttrib(td, "rowspan");
+ function getColRowSpan(td) {
+ var colspan = inst.dom.getAttrib(td, "colspan");
+ var rowspan = inst.dom.getAttrib(td, "rowspan");
- colspan = colspan == "" ? 1 : parseInt(colspan);
- rowspan = rowspan == "" ? 1 : parseInt(rowspan);
+ colspan = colspan == "" ? 1 : parseInt(colspan);
+ rowspan = rowspan == "" ? 1 : parseInt(rowspan);
- return {colspan : colspan, rowspan : rowspan};
- }
+ return {colspan : colspan, rowspan : rowspan};
+ }
- function getCellPos(grid, td) {
- var x, y;
+ function getCellPos(grid, td) {
+ var x, y;
- for (y=0; y<grid.length; y++) {
- for (x=0; x<grid[y].length; x++) {
- if (grid[y][x] == td)
- return {cellindex : x, rowindex : y};
+ for (y=0; y<grid.length; y++) {
+ for (x=0; x<grid[y].length; x++) {
+ if (grid[y][x] == td)
+ return {cellindex : x, rowindex : y};
+ }
}
- }
- return null;
- }
+ return null;
+ }
- function getCell(grid, row, col) {
- if (grid[row] && grid[row][col])
- return grid[row][col];
+ function getCell(grid, row, col) {
+ if (grid[row] && grid[row][col])
+ return grid[row][col];
- return null;
- }
+ return null;
+ }
- function getTableGrid(table) {
- var grid = new Array(), rows = table.rows, x, y, td, sd, xstart, x2, y2;
+ function getTableGrid(table) {
+ var grid = [], rows = table.rows, x, y, td, sd, xstart, x2, y2;
- for (y=0; y<rows.length; y++) {
- for (x=0; x<rows[y].cells.length; x++) {
- td = rows[y].cells[x];
- sd = getColRowSpan(td);
+ for (y=0; y<rows.length; y++) {
+ for (x=0; x<rows[y].cells.length; x++) {
+ td = rows[y].cells[x];
+ sd = getColRowSpan(td);
- // All ready filled
- for (xstart = x; grid[y] && grid[y][xstart]; xstart++) ;
+ // All ready filled
+ for (xstart = x; grid[y] && grid[y][xstart]; xstart++) ;
- // Fill box
- for (y2=y; y2<y+sd['rowspan']; y2++) {
- if (!grid[y2])
- grid[y2] = new Array();
+ // Fill box
+ for (y2=y; y2<y+sd['rowspan']; y2++) {
+ if (!grid[y2])
+ grid[y2] = [];
- for (x2=xstart; x2<xstart+sd['colspan']; x2++)
- grid[y2][x2] = td;
+ for (x2=xstart; x2<xstart+sd['colspan']; x2++)
+ grid[y2][x2] = td;
+ }
}
}
+
+ return grid;
}
- return grid;
- }
+ function trimRow(table, tr, td, new_tr) {
+ var grid = getTableGrid(table), cpos = getCellPos(grid, td);
+ var cells, lastElm;
+
+ // Time to crop away some
+ if (new_tr.cells.length != tr.childNodes.length) {
+ cells = tr.childNodes;
+ lastElm = null;
+
+ for (var x=0; td = getCell(grid, cpos.rowindex, x); x++) {
+ var remove = true;
+ var sd = getColRowSpan(td);
+
+ // Remove due to rowspan
+ if (inArray(cells, td)) {
+ new_tr.childNodes[x]._delete = true;
+ } else if ((lastElm == null || td != lastElm) && sd.colspan > 1) { // Remove due to colspan
+ for (var i=x; i<x+td.colSpan; i++)
+ new_tr.childNodes[i]._delete = true;
+ }
- function trimRow(table, tr, td, new_tr) {
- var grid = getTableGrid(table), cpos = getCellPos(grid, td);
- var cells, lastElm;
-
- // Time to crop away some
- if (new_tr.cells.length != tr.childNodes.length) {
- cells = tr.childNodes;
- lastElm = null;
-
- for (var x=0; td = getCell(grid, cpos.rowindex, x); x++) {
- var remove = true;
- var sd = getColRowSpan(td);
-
- // Remove due to rowspan
- if (inArray(cells, td)) {
- new_tr.childNodes[x]._delete = true;
- } else if ((lastElm == null || td != lastElm) && sd.colspan > 1) { // Remove due to colspan
- for (var i=x; i<x+td.colSpan; i++)
- new_tr.childNodes[i]._delete = true;
- }
+ if ((lastElm == null || td != lastElm) && sd.rowspan > 1)
+ td.rowSpan = sd.rowspan + 1;
- if ((lastElm == null || td != lastElm) && sd.rowspan > 1)
- td.rowSpan = sd.rowspan + 1;
+ lastElm = td;
+ }
- lastElm = td;
+ deleteMarked(tableElm);
}
-
- deleteMarked(tableElm);
}
- }
- function prevElm(node, name) {
- while ((node = node.previousSibling) != null) {
- if (node.nodeName == name)
- return node;
- }
+ function prevElm(node, name) {
+ while ((node = node.previousSibling) != null) {
+ if (node.nodeName == name)
+ return node;
+ }
- return null;
- }
+ return null;
+ }
- function nextElm(node, names) {
- var namesAr = names.split(',');
+ function nextElm(node, names) {
+ var namesAr = names.split(',');
- while ((node = node.nextSibling) != null) {
- for (var i=0; i<namesAr.length; i++) {
- if (node.nodeName.toLowerCase() == namesAr[i].toLowerCase() )
- return node;
+ while ((node = node.nextSibling) != null) {
+ for (var i=0; i<namesAr.length; i++) {
+ if (node.nodeName.toLowerCase() == namesAr[i].toLowerCase() )
+ return node;
+ }
}
+
+ return null;
}
- return null;
- }
+ function deleteMarked(tbl) {
+ if (tbl.rows == 0)
+ return;
- function deleteMarked(tbl) {
- if (tbl.rows == 0)
- return;
+ var tr = tbl.rows[0];
+ do {
+ var next = nextElm(tr, "TR");
- var tr = tbl.rows[0];
- do {
- var next = nextElm(tr, "TR");
+ // Delete row
+ if (tr._delete) {
+ tr.parentNode.removeChild(tr);
+ continue;
+ }
- // Delete row
- if (tr._delete) {
- tr.parentNode.removeChild(tr);
- continue;
- }
+ // Delete cells
+ var td = tr.cells[0];
+ if (td.cells > 1) {
+ do {
+ var nexttd = nextElm(td, "TD,TH");
- // Delete cells
- var td = tr.cells[0];
- if (td.cells > 1) {
- do {
- var nexttd = nextElm(td, "TD,TH");
+ if (td._delete)
+ td.parentNode.removeChild(td);
+ } while ((td = nexttd) != null);
+ }
+ } while ((tr = next) != null);
+ }
- if (td._delete)
- td.parentNode.removeChild(td);
- } while ((td = nexttd) != null);
- }
- } while ((tr = next) != null);
- }
+ function addRows(td_elm, tr_elm, rowspan) {
+ // Add rows
+ td_elm.rowSpan = 1;
+ var trNext = nextElm(tr_elm, "TR");
+ for (var i=1; i<rowspan && trNext; i++) {
+ var newTD = doc.createElement("td");
- function addRows(td_elm, tr_elm, rowspan) {
- // Add rows
- td_elm.rowSpan = 1;
- var trNext = nextElm(tr_elm, "TR");
- for (var i=1; i<rowspan && trNext; i++) {
- var newTD = doc.createElement("td");
- newTD.innerHTML = "&nbsp;";
+ if (!tinymce.isIE)
+ newTD.innerHTML = '<br mce_bogus="1"/>';
- if (tinyMCE.isMSIE)
- trNext.insertBefore(newTD, trNext.cells(td_elm.cellIndex));
- else
- trNext.insertBefore(newTD, trNext.cells[td_elm.cellIndex]);
+ if (tinymce.isIE)
+ trNext.insertBefore(newTD, trNext.cells(td_elm.cellIndex));
+ else
+ trNext.insertBefore(newTD, trNext.cells[td_elm.cellIndex]);
- trNext = nextElm(trNext, "TR");
+ trNext = nextElm(trNext, "TR");
+ }
}
- }
- function copyRow(doc, table, tr) {
- var grid = getTableGrid(table);
- var newTR = tr.cloneNode(false);
- var cpos = getCellPos(grid, tr.cells[0]);
- var lastCell = null;
- var tableBorder = tinyMCE.getAttrib(table, "border");
- var tdElm = null;
-
- for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
- var newTD = null;
-
- if (lastCell != tdElm) {
- for (var i=0; i<tr.cells.length; i++) {
- if (tdElm == tr.cells[i]) {
- newTD = tdElm.cloneNode(true);
- break;
+ function copyRow(doc, table, tr) {
+ var grid = getTableGrid(table);
+ var newTR = tr.cloneNode(false);
+ var cpos = getCellPos(grid, tr.cells[0]);
+ var lastCell = null;
+ var tableBorder = inst.dom.getAttrib(table, "border");
+ var tdElm = null;
+
+ for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
+ var newTD = null;
+
+ if (lastCell != tdElm) {
+ for (var i=0; i<tr.cells.length; i++) {
+ if (tdElm == tr.cells[i]) {
+ newTD = tdElm.cloneNode(true);
+ break;
+ }
}
}
- }
- if (newTD == null) {
- newTD = doc.createElement("td");
- newTD.innerHTML = "&nbsp;";
- }
+ if (newTD == null) {
+ newTD = doc.createElement("td");
- // Reset col/row span
- newTD.colSpan = 1;
- newTD.rowSpan = 1;
-
- newTR.appendChild(newTD);
-
- lastCell = tdElm;
- }
-
- return newTR;
- }
+ if (!tinymce.isIE)
+ newTD.innerHTML = '<br mce_bogus="1"/>';
+ }
- // ---- Commands -----
+ // Reset col/row span
+ newTD.colSpan = 1;
+ newTD.rowSpan = 1;
- // Handle commands
- switch (command) {
- case "mceTableRowProps":
- if (trElm == null)
- return true;
+ newTR.appendChild(newTD);
- if (user_interface) {
- // Setup template
- var template = new Array();
+ lastCell = tdElm;
+ }
- template['file'] = '../../plugins/table/row.htm';
- template['width'] = 380;
- template['height'] = 295;
+ return newTR;
+ }
- // Language specific width and height addons
- template['width'] += tinyMCE.getLang('lang_table_rowprops_delta_width', 0);
- template['height'] += tinyMCE.getLang('lang_table_rowprops_delta_height', 0);
+ // ---- Commands -----
+
+ // Handle commands
+ switch (command) {
+ case "mceTableRowProps":
+ if (trElm == null)
+ return true;
+
+ if (user_interface) {
+ inst.windowManager.open({
+ url : url + '/row.htm',
+ width : 400 + parseInt(inst.getLang('table.rowprops_delta_width', 0)),
+ height : 295 + parseInt(inst.getLang('table.rowprops_delta_height', 0)),
+ inline : 1
+ }, {
+ plugin_url : url
+ });
+ }
- // Open window
- tinyMCE.openWindow(template, {editor_id : inst.editorId, inline : "yes"});
- }
+ return true;
- return true;
+ case "mceTableCellProps":
+ if (tdElm == null)
+ return true;
+
+ if (user_interface) {
+ inst.windowManager.open({
+ url : url + '/cell.htm',
+ width : 400 + parseInt(inst.getLang('table.cellprops_delta_width', 0)),
+ height : 295 + parseInt(inst.getLang('table.cellprops_delta_height', 0)),
+ inline : 1
+ }, {
+ plugin_url : url
+ });
+ }
- case "mceTableCellProps":
- if (tdElm == null)
return true;
- if (user_interface) {
- // Setup template
- var template = new Array();
+ case "mceInsertTable":
+ if (user_interface) {
+ inst.windowManager.open({
+ url : url + '/table.htm',
+ width : 400 + parseInt(inst.getLang('table.table_delta_width', 0)),
+ height : 320 + parseInt(inst.getLang('table.table_delta_height', 0)),
+ inline : 1
+ }, {
+ plugin_url : url,
+ action : value ? value.action : 0
+ });
+ }
- template['file'] = '../../plugins/table/cell.htm';
- template['width'] = 380;
- template['height'] = 295;
+ return true;
- // Language specific width and height addons
- template['width'] += tinyMCE.getLang('lang_table_cellprops_delta_width', 0);
- template['height'] += tinyMCE.getLang('lang_table_cellprops_delta_height', 0);
+ case "mceTableDelete":
+ var table = inst.dom.getParent(inst.selection.getNode(), "table");
+ if (table) {
+ table.parentNode.removeChild(table);
+ inst.execCommand('mceRepaint');
+ }
+ return true;
- // Open window
- tinyMCE.openWindow(template, {editor_id : inst.editorId, inline : "yes"});
- }
+ case "mceTableSplitCells":
+ case "mceTableMergeCells":
+ case "mceTableInsertRowBefore":
+ case "mceTableInsertRowAfter":
+ case "mceTableDeleteRow":
+ case "mceTableInsertColBefore":
+ case "mceTableInsertColAfter":
+ case "mceTableDeleteCol":
+ case "mceTableCutRow":
+ case "mceTableCopyRow":
+ case "mceTablePasteRowBefore":
+ case "mceTablePasteRowAfter":
+ // No table just return (invalid command)
+ if (!tableElm)
+ return true;
+
+ // Table has a tbody use that reference
+ // Changed logic by ApTest 2005.07.12 (www.aptest.com)
+ // Now lookk at the focused element and take its parentNode. That will be a tbody or a table.
+ if (trElm && tableElm != trElm.parentNode)
+ tableElm = trElm.parentNode;
+
+ if (tableElm && trElm) {
+ switch (command) {
+ case "mceTableCutRow":
+ if (!trElm || !tdElm)
+ return true;
- return true;
+ inst.tableRowClipboard = copyRow(doc, tableElm, trElm);
+ inst.execCommand("mceTableDeleteRow");
+ break;
- case "mceInsertTable":
- if (user_interface) {
- // Setup template
- var template = new Array();
+ case "mceTableCopyRow":
+ if (!trElm || !tdElm)
+ return true;
- template['file'] = '../../plugins/table/table.htm';
- template['width'] = 380;
- template['height'] = 295;
+ inst.tableRowClipboard = copyRow(doc, tableElm, trElm);
+ break;
- // Language specific width and height addons
- template['width'] += tinyMCE.getLang('lang_table_table_delta_width', 0);
- template['height'] += tinyMCE.getLang('lang_table_table_delta_height', 0);
+ case "mceTablePasteRowBefore":
+ if (!trElm || !tdElm)
+ return true;
- // Open window
- tinyMCE.openWindow(template, {editor_id : inst.editorId, inline : "yes", action : value});
- }
+ var newTR = inst.tableRowClipboard.cloneNode(true);
- return true;
+ var prevTR = prevElm(trElm, "TR");
+ if (prevTR != null)
+ trimRow(tableElm, prevTR, prevTR.cells[0], newTR);
- case "mceTableDelete":
- var table = tinyMCE.getParentElement(inst.getFocusElement(), "table");
- if (table) {
- table.parentNode.removeChild(table);
- inst.repaint();
- }
- return true;
+ trElm.parentNode.insertBefore(newTR, trElm);
+ break;
- case "mceTableSplitCells":
- case "mceTableMergeCells":
- case "mceTableInsertRowBefore":
- case "mceTableInsertRowAfter":
- case "mceTableDeleteRow":
- case "mceTableInsertColBefore":
- case "mceTableInsertColAfter":
- case "mceTableDeleteCol":
- case "mceTableCutRow":
- case "mceTableCopyRow":
- case "mceTablePasteRowBefore":
- case "mceTablePasteRowAfter":
- // No table just return (invalid command)
- if (!tableElm)
- return true;
+ case "mceTablePasteRowAfter":
+ if (!trElm || !tdElm)
+ return true;
+
+ var nextTR = nextElm(trElm, "TR");
+ var newTR = inst.tableRowClipboard.cloneNode(true);
- // Table has a tbody use that reference
- // Changed logic by ApTest 2005.07.12 (www.aptest.com)
- // Now lookk at the focused element and take its parentNode. That will be a tbody or a table.
- if (trElm && tableElm != trElm.parentNode)
- tableElm = trElm.parentNode;
+ trimRow(tableElm, trElm, tdElm, newTR);
- if (tableElm && trElm) {
- switch (command) {
- case "mceTableCutRow":
- if (!trElm || !tdElm)
- return true;
+ if (nextTR == null)
+ trElm.parentNode.appendChild(newTR);
+ else
+ nextTR.parentNode.insertBefore(newTR, nextTR);
- inst.tableRowClipboard = copyRow(doc, tableElm, trElm);
- inst.execCommand("mceTableDeleteRow");
- break;
+ break;
- case "mceTableCopyRow":
- if (!trElm || !tdElm)
- return true;
+ case "mceTableInsertRowBefore":
+ if (!trElm || !tdElm)
+ return true;
- inst.tableRowClipboard = copyRow(doc, tableElm, trElm);
- break;
+ var grid = getTableGrid(tableElm);
+ var cpos = getCellPos(grid, tdElm);
+ var newTR = doc.createElement("tr");
+ var lastTDElm = null;
- case "mceTablePasteRowBefore":
- if (!trElm || !tdElm)
- return true;
+ cpos.rowindex--;
+ if (cpos.rowindex < 0)
+ cpos.rowindex = 0;
- var newTR = inst.tableRowClipboard.cloneNode(true);
+ // Create cells
+ for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
+ if (tdElm != lastTDElm) {
+ var sd = getColRowSpan(tdElm);
- var prevTR = prevElm(trElm, "TR");
- if (prevTR != null)
- trimRow(tableElm, prevTR, prevTR.cells[0], newTR);
+ if (sd['rowspan'] == 1) {
+ var newTD = doc.createElement("td");
- trElm.parentNode.insertBefore(newTR, trElm);
- break;
+ if (!tinymce.isIE)
+ newTD.innerHTML = '<br mce_bogus="1"/>';
- case "mceTablePasteRowAfter":
- if (!trElm || !tdElm)
- return true;
-
- var nextTR = nextElm(trElm, "TR");
- var newTR = inst.tableRowClipboard.cloneNode(true);
+ newTD.colSpan = tdElm.colSpan;
- trimRow(tableElm, trElm, tdElm, newTR);
+ newTR.appendChild(newTD);
+ } else
+ tdElm.rowSpan = sd['rowspan'] + 1;
- if (nextTR == null)
- trElm.parentNode.appendChild(newTR);
- else
- nextTR.parentNode.insertBefore(newTR, nextTR);
+ lastTDElm = tdElm;
+ }
+ }
+ trElm.parentNode.insertBefore(newTR, trElm);
+ select(0, 1);
break;
- case "mceTableInsertRowBefore":
- if (!trElm || !tdElm)
- return true;
+ case "mceTableInsertRowAfter":
+ if (!trElm || !tdElm)
+ return true;
- var grid = getTableGrid(tableElm);
- var cpos = getCellPos(grid, tdElm);
- var newTR = doc.createElement("tr");
- var lastTDElm = null;
+ var grid = getTableGrid(tableElm);
+ var cpos = getCellPos(grid, tdElm);
+ var newTR = doc.createElement("tr");
+ var lastTDElm = null;
- cpos.rowindex--;
- if (cpos.rowindex < 0)
- cpos.rowindex = 0;
+ // Create cells
+ for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
+ if (tdElm != lastTDElm) {
+ var sd = getColRowSpan(tdElm);
- // Create cells
- for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
- if (tdElm != lastTDElm) {
- var sd = getColRowSpan(tdElm);
+ if (sd['rowspan'] == 1) {
+ var newTD = doc.createElement("td");
- if (sd['rowspan'] == 1) {
- var newTD = doc.createElement("td");
+ if (!tinymce.isIE)
+ newTD.innerHTML = '<br mce_bogus="1"/>';
- newTD.innerHTML = "&nbsp;";
- newTD.colSpan = tdElm.colSpan;
+ newTD.colSpan = tdElm.colSpan;
- newTR.appendChild(newTD);
- } else
- tdElm.rowSpan = sd['rowspan'] + 1;
+ newTR.appendChild(newTD);
+ } else
+ tdElm.rowSpan = sd['rowspan'] + 1;
- lastTDElm = tdElm;
+ lastTDElm = tdElm;
+ }
}
- }
- trElm.parentNode.insertBefore(newTR, trElm);
+ if (newTR.hasChildNodes()) {
+ var nextTR = nextElm(trElm, "TR");
+ if (nextTR)
+ nextTR.parentNode.insertBefore(newTR, nextTR);
+ else
+ tableElm.appendChild(newTR);
+ }
- grid = getTableGrid(tableElm);
- inst.selection.selectNode(getCell(grid, cpos.rowindex + 1, cpos.cellindex), tinyMCE.isGecko, true); // Only collape on gecko
- break;
+ select(0, 1);
+ break;
- case "mceTableInsertRowAfter":
- if (!trElm || !tdElm)
- return true;
+ case "mceTableDeleteRow":
+ if (!trElm || !tdElm)
+ return true;
- var grid = getTableGrid(tableElm);
- var cpos = getCellPos(grid, tdElm);
- var newTR = doc.createElement("tr");
- var lastTDElm = null;
+ var grid = getTableGrid(tableElm);
+ var cpos = getCellPos(grid, tdElm);
- // Create cells
- for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
- if (tdElm != lastTDElm) {
- var sd = getColRowSpan(tdElm);
+ // Only one row, remove whole table
+ if (grid.length == 1) {
+ inst.dom.remove(inst.dom.getParent(tableElm, "table"));
+ return true;
+ }
- if (sd['rowspan'] == 1) {
- var newTD = doc.createElement("td");
+ // Move down row spanned cells
+ var cells = trElm.cells;
+ var nextTR = nextElm(trElm, "TR");
+ for (var x=0; x<cells.length; x++) {
+ if (cells[x].rowSpan > 1) {
+ var newTD = cells[x].cloneNode(true);
+ var sd = getColRowSpan(cells[x]);
- newTD.innerHTML = "&nbsp;";
- newTD.colSpan = tdElm.colSpan;
+ newTD.rowSpan = sd.rowspan - 1;
- newTR.appendChild(newTD);
- } else
- tdElm.rowSpan = sd['rowspan'] + 1;
+ var nextTD = nextTR.cells[x];
- lastTDElm = tdElm;
+ if (nextTD == null)
+ nextTR.appendChild(newTD);
+ else
+ nextTR.insertBefore(newTD, nextTD);
+ }
}
- }
- if (newTR.hasChildNodes()) {
- var nextTR = nextElm(trElm, "TR");
- if (nextTR)
- nextTR.parentNode.insertBefore(newTR, nextTR);
- else
- tableElm.appendChild(newTR);
- }
+ // Delete cells
+ var lastTDElm = null;
+ for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
+ if (tdElm != lastTDElm) {
+ var sd = getColRowSpan(tdElm);
- grid = getTableGrid(tableElm);
- inst.selection.selectNode(getCell(grid, cpos.rowindex, cpos.cellindex), tinyMCE.isGecko, true); // Only collape on gecko
- break;
+ if (sd.rowspan > 1) {
+ tdElm.rowSpan = sd.rowspan - 1;
+ } else {
+ trElm = tdElm.parentNode;
- case "mceTableDeleteRow":
- if (!trElm || !tdElm)
- return true;
+ if (trElm.parentNode)
+ trElm._delete = true;
+ }
- var grid = getTableGrid(tableElm);
- var cpos = getCellPos(grid, tdElm);
+ lastTDElm = tdElm;
+ }
+ }
- // Only one row, remove whole table
- if (grid.length == 1) {
- tableElm = tinyMCE.getParentElement(tableElm, "table"); // Look for table instead of tbody
- tableElm.parentNode.removeChild(tableElm);
- return true;
- }
+ deleteMarked(tableElm);
- // Move down row spanned cells
- var cells = trElm.cells;
- var nextTR = nextElm(trElm, "TR");
- for (var x=0; x<cells.length; x++) {
- if (cells[x].rowSpan > 1) {
- var newTD = cells[x].cloneNode(true);
- var sd = getColRowSpan(cells[x]);
+ select(0, -1);
+ break;
- newTD.rowSpan = sd.rowspan - 1;
+ case "mceTableInsertColBefore":
+ if (!trElm || !tdElm)
+ return true;
- var nextTD = nextTR.cells[x];
+ var grid = getTableGrid(tableElm);
+ var cpos = getCellPos(grid, tdElm);
+ var lastTDElm = null;
- if (nextTD == null)
- nextTR.appendChild(newTD);
- else
- nextTR.insertBefore(newTD, nextTD);
- }
- }
+ for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) {
+ if (tdElm != lastTDElm) {
+ var sd = getColRowSpan(tdElm);
- // Delete cells
- var lastTDElm = null;
- for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
- if (tdElm != lastTDElm) {
- var sd = getColRowSpan(tdElm);
+ if (sd['colspan'] == 1) {
+ var newTD = doc.createElement(tdElm.nodeName);
- if (sd.rowspan > 1) {
- tdElm.rowSpan = sd.rowspan - 1;
- } else {
- trElm = tdElm.parentNode;
+ if (!tinymce.isIE)
+ newTD.innerHTML = '<br mce_bogus="1"/>';
- if (trElm.parentNode)
- trElm._delete = true;
- }
+ newTD.rowSpan = tdElm.rowSpan;
- lastTDElm = tdElm;
- }
- }
+ tdElm.parentNode.insertBefore(newTD, tdElm);
+ } else
+ tdElm.colSpan++;
- deleteMarked(tableElm);
+ lastTDElm = tdElm;
+ }
+ }
- cpos.rowindex--;
- if (cpos.rowindex < 0)
- cpos.rowindex = 0;
+ select();
+ break;
- // Recalculate grid and select
- grid = getTableGrid(tableElm);
- inst.selection.selectNode(getCell(grid, cpos.rowindex, 0), tinyMCE.isGecko, true); // Only collape on gecko
- break;
+ case "mceTableInsertColAfter":
+ if (!trElm || !tdElm)
+ return true;
- case "mceTableInsertColBefore":
- if (!trElm || !tdElm)
- return true;
+ var grid = getTableGrid(tableElm);
+ var cpos = getCellPos(grid, tdElm);
+ var lastTDElm = null;
- var grid = getTableGrid(tableElm);
- var cpos = getCellPos(grid, tdElm);
- var lastTDElm = null;
+ for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) {
+ if (tdElm != lastTDElm) {
+ var sd = getColRowSpan(tdElm);
- for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) {
- if (tdElm != lastTDElm) {
- var sd = getColRowSpan(tdElm);
+ if (sd['colspan'] == 1) {
+ var newTD = doc.createElement(tdElm.nodeName);
- if (sd['colspan'] == 1) {
- var newTD = doc.createElement(tdElm.nodeName);
+ if (!tinymce.isIE)
+ newTD.innerHTML = '<br mce_bogus="1"/>';
- newTD.innerHTML = "&nbsp;";
- newTD.rowSpan = tdElm.rowSpan;
+ newTD.rowSpan = tdElm.rowSpan;
- tdElm.parentNode.insertBefore(newTD, tdElm);
- } else
- tdElm.colSpan++;
+ var nextTD = nextElm(tdElm, "TD,TH");
+ if (nextTD == null)
+ tdElm.parentNode.appendChild(newTD);
+ else
+ nextTD.parentNode.insertBefore(newTD, nextTD);
+ } else
+ tdElm.colSpan++;
- lastTDElm = tdElm;
+ lastTDElm = tdElm;
+ }
}
- }
-
- grid = getTableGrid(tableElm);
- inst.selection.selectNode(getCell(grid, cpos.rowindex, cpos.cellindex + 1), tinyMCE.isGecko, true); // Only collape on gecko
- break;
- case "mceTableInsertColAfter":
- if (!trElm || !tdElm)
- return true;
+ select(1);
+ break;
- var grid = getTableGrid(tableElm);
- var cpos = getCellPos(grid, tdElm);
- var lastTDElm = null;
+ case "mceTableDeleteCol":
+ if (!trElm || !tdElm)
+ return true;
- for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) {
- if (tdElm != lastTDElm) {
- var sd = getColRowSpan(tdElm);
+ var grid = getTableGrid(tableElm);
+ var cpos = getCellPos(grid, tdElm);
+ var lastTDElm = null;
- if (sd['colspan'] == 1) {
- var newTD = doc.createElement(tdElm.nodeName);
+ // Only one col, remove whole table
+ if (grid.length > 1 && grid[0].length <= 1) {
+ inst.dom.remove(inst.dom.getParent(tableElm, "table"));
+ return true;
+ }
- newTD.innerHTML = "&nbsp;";
- newTD.rowSpan = tdElm.rowSpan;
+ // Delete cells
+ for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) {
+ if (tdElm != lastTDElm) {
+ var sd = getColRowSpan(tdElm);
- var nextTD = nextElm(tdElm, "TD,TH");
- if (nextTD == null)
- tdElm.parentNode.appendChild(newTD);
- else
- nextTD.parentNode.insertBefore(newTD, nextTD);
- } else
- tdElm.colSpan++;
+ if (sd['colspan'] > 1)
+ tdElm.colSpan = sd['colspan'] - 1;
+ else {
+ if (tdElm.parentNode)
+ tdElm.parentNode.removeChild(tdElm);
+ }
- lastTDElm = tdElm;
+ lastTDElm = tdElm;
+ }
}
- }
- grid = getTableGrid(tableElm);
- inst.selection.selectNode(getCell(grid, cpos.rowindex, cpos.cellindex), tinyMCE.isGecko, true); // Only collape on gecko
- break;
+ select(-1);
+ break;
- case "mceTableDeleteCol":
+ case "mceTableSplitCells":
if (!trElm || !tdElm)
return true;
- var grid = getTableGrid(tableElm);
- var cpos = getCellPos(grid, tdElm);
- var lastTDElm = null;
+ var spandata = getColRowSpan(tdElm);
- // Only one col, remove whole table
- if (grid.length > 1 && grid[0].length <= 1) {
- tableElm = tinyMCE.getParentElement(tableElm, "table"); // Look for table instead of tbody
- tableElm.parentNode.removeChild(tableElm);
- return true;
- }
+ var colspan = spandata["colspan"];
+ var rowspan = spandata["rowspan"];
- // Delete cells
- for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) {
- if (tdElm != lastTDElm) {
- var sd = getColRowSpan(tdElm);
+ // Needs splitting
+ if (colspan > 1 || rowspan > 1) {
+ // Generate cols
+ tdElm.colSpan = 1;
+ for (var i=1; i<colspan; i++) {
+ var newTD = doc.createElement("td");
- if (sd['colspan'] > 1)
- tdElm.colSpan = sd['colspan'] - 1;
- else {
- if (tdElm.parentNode)
- tdElm.parentNode.removeChild(tdElm);
- }
+ if (!tinymce.isIE)
+ newTD.innerHTML = '<br mce_bogus="1"/>';
- lastTDElm = tdElm;
- }
- }
-
- cpos.cellindex--;
- if (cpos.cellindex < 0)
- cpos.cellindex = 0;
-
- // Recalculate grid and select
- grid = getTableGrid(tableElm);
- inst.selection.selectNode(getCell(grid, cpos.rowindex, 0), tinyMCE.isGecko, true); // Only collape on gecko
- break;
+ trElm.insertBefore(newTD, nextElm(tdElm, "TD,TH"));
- case "mceTableSplitCells":
- if (!trElm || !tdElm)
- return true;
+ if (rowspan > 1)
+ addRows(newTD, trElm, rowspan);
+ }
- var spandata = getColRowSpan(tdElm);
+ addRows(tdElm, trElm, rowspan);
+ }
- var colspan = spandata["colspan"];
- var rowspan = spandata["rowspan"];
+ // Apply visual aids
+ tableElm = inst.dom.getParent(inst.selection.getNode(), "table");
+ break;
- // Needs splitting
- if (colspan > 1 || rowspan > 1) {
- // Generate cols
- tdElm.colSpan = 1;
- for (var i=1; i<colspan; i++) {
- var newTD = doc.createElement("td");
+ case "mceTableMergeCells":
+ var rows = [];
+ var sel = inst.selection.getSel();
+ var grid = getTableGrid(tableElm);
- newTD.innerHTML = "&nbsp;";
+ if (tinymce.isIE || sel.rangeCount == 1) {
+ if (user_interface) {
+ // Setup template
+ var sp = getColRowSpan(tdElm);
+
+ inst.windowManager.open({
+ url : url + '/merge_cells.htm',
+ width : 240 + parseInt(inst.getLang('table.merge_cells_delta_width', 0)),
+ height : 110 + parseInt(inst.getLang('table.merge_cells_delta_height', 0)),
+ inline : 1
+ }, {
+ action : "update",
+ numcols : sp.colspan,
+ numrows : sp.rowspan,
+ plugin_url : url
+ });
- trElm.insertBefore(newTD, nextElm(tdElm, "TD,TH"));
+ return true;
+ } else {
+ var numRows = parseInt(value['numrows']);
+ var numCols = parseInt(value['numcols']);
+ var cpos = getCellPos(grid, tdElm);
- if (rowspan > 1)
- addRows(newTD, trElm, rowspan);
- }
+ if (("" + numRows) == "NaN")
+ numRows = 1;
- addRows(tdElm, trElm, rowspan);
- }
+ if (("" + numCols) == "NaN")
+ numCols = 1;
- // Apply visual aids
- tableElm = tinyMCE.getParentElement(inst.getFocusElement(), "table");
- break;
+ // Get rows and cells
+ var tRows = tableElm.rows;
+ for (var y=cpos.rowindex; y<grid.length; y++) {
+ var rowCells = [];
- case "mceTableMergeCells":
- var rows = new Array();
- var sel = inst.getSel();
- var grid = getTableGrid(tableElm);
+ for (var x=cpos.cellindex; x<grid[y].length; x++) {
+ var td = getCell(grid, y, x);
- if (tinyMCE.isMSIE || sel.rangeCount == 1) {
- if (user_interface) {
- // Setup template
- var template = new Array();
- var sp = getColRowSpan(tdElm);
+ if (td && !inArray(rows, td) && !inArray(rowCells, td)) {
+ var cp = getCellPos(grid, td);
- template['file'] = '../../plugins/table/merge_cells.htm';
- template['width'] = 250;
- template['height'] = 105 + (tinyMCE.isNS7 ? 25 : 0);
+ // Within range
+ if (cp.cellindex < cpos.cellindex+numCols && cp.rowindex < cpos.rowindex+numRows)
+ rowCells[rowCells.length] = td;
+ }
+ }
- // Language specific width and height addons
- template['width'] += tinyMCE.getLang('lang_table_merge_cells_delta_width', 0);
- template['height'] += tinyMCE.getLang('lang_table_merge_cells_delta_height', 0);
+ if (rowCells.length > 0)
+ rows[rows.length] = rowCells;
- // Open window
- tinyMCE.openWindow(template, {editor_id : inst.editorId, inline : "yes", action : "update", numcols : sp.colspan, numrows : sp.rowspan});
+ var td = getCell(grid, cpos.rowindex, cpos.cellindex);
+ each(ed.dom.select('br', td), function(e, i) {
+ if (i > 0 && ed.dom.getAttrib('mce_bogus'))
+ ed.dom.remove(e);
+ });
+ }
- return true;
+ //return true;
+ }
} else {
- var numRows = parseInt(value['numrows']);
- var numCols = parseInt(value['numcols']);
- var cpos = getCellPos(grid, tdElm);
+ var cells = [];
+ var sel = inst.selection.getSel();
+ var lastTR = null;
+ var curRow = null;
+ var x1 = -1, y1 = -1, x2, y2;
+
+ // Only one cell selected, whats the point?
+ if (sel.rangeCount < 2)
+ return true;
+
+ // Get all selected cells
+ for (var i=0; i<sel.rangeCount; i++) {
+ var rng = sel.getRangeAt(i);
+ var tdElm = rng.startContainer.childNodes[rng.startOffset];
- if (("" + numRows) == "NaN")
- numRows = 1;
+ if (!tdElm)
+ break;
- if (("" + numCols) == "NaN")
- numCols = 1;
+ if (tdElm.nodeName == "TD")
+ cells[cells.length] = tdElm;
+ }
// Get rows and cells
var tRows = tableElm.rows;
- for (var y=cpos.rowindex; y<grid.length; y++) {
- var rowCells = new Array();
-
- for (var x=cpos.cellindex; x<grid[y].length; x++) {
- var td = getCell(grid, y, x);
+ for (var y=0; y<tRows.length; y++) {
+ var rowCells = [];
- if (td && !inArray(rows, td) && !inArray(rowCells, td)) {
- var cp = getCellPos(grid, td);
+ for (var x=0; x<tRows[y].cells.length; x++) {
+ var td = tRows[y].cells[x];
- // Within range
- if (cp.cellindex < cpos.cellindex+numCols && cp.rowindex < cpos.rowindex+numRows)
+ for (var i=0; i<cells.length; i++) {
+ if (td == cells[i]) {
rowCells[rowCells.length] = td;
+ }
}
}
@@ -881,193 +915,156 @@ var TinyMCE_TablePlugin = {
rows[rows.length] = rowCells;
}
- //return true;
- }
- } else {
- var cells = new Array();
- var sel = inst.getSel();
- var lastTR = null;
- var curRow = null;
- var x1 = -1, y1 = -1, x2, y2;
-
- // Only one cell selected, whats the point?
- if (sel.rangeCount < 2)
- return true;
-
- // Get all selected cells
- for (var i=0; i<sel.rangeCount; i++) {
- var rng = sel.getRangeAt(i);
- var tdElm = rng.startContainer.childNodes[rng.startOffset];
-
- if (!tdElm)
- break;
-
- if (tdElm.nodeName == "TD")
- cells[cells.length] = tdElm;
- }
-
- // Get rows and cells
- var tRows = tableElm.rows;
- for (var y=0; y<tRows.length; y++) {
- var rowCells = new Array();
-
- for (var x=0; x<tRows[y].cells.length; x++) {
- var td = tRows[y].cells[x];
-
- for (var i=0; i<cells.length; i++) {
- if (td == cells[i]) {
- rowCells[rowCells.length] = td;
+ // Find selected cells in grid and box
+ var curRow = [];
+ var lastTR = null;
+ for (var y=0; y<grid.length; y++) {
+ for (var x=0; x<grid[y].length; x++) {
+ grid[y][x]._selected = false;
+
+ for (var i=0; i<cells.length; i++) {
+ if (grid[y][x] == cells[i]) {
+ // Get start pos
+ if (x1 == -1) {
+ x1 = x;
+ y1 = y;
+ }
+
+ // Get end pos
+ x2 = x;
+ y2 = y;
+
+ grid[y][x]._selected = true;
+ }
}
}
}
- if (rowCells.length > 0)
- rows[rows.length] = rowCells;
- }
-
- // Find selected cells in grid and box
- var curRow = new Array();
- var lastTR = null;
- for (var y=0; y<grid.length; y++) {
- for (var x=0; x<grid[y].length; x++) {
- grid[y][x]._selected = false;
-
- for (var i=0; i<cells.length; i++) {
- if (grid[y][x] == cells[i]) {
- // Get start pos
- if (x1 == -1) {
- x1 = x;
- y1 = y;
- }
-
- // Get end pos
- x2 = x;
- y2 = y;
-
- grid[y][x]._selected = true;
+ // Is there gaps, if so deny
+ for (var y=y1; y<=y2; y++) {
+ for (var x=x1; x<=x2; x++) {
+ if (!grid[y][x]._selected) {
+ alert("Invalid selection for merge.");
+ return true;
}
}
}
}
- // Is there gaps, if so deny
- for (var y=y1; y<=y2; y++) {
- for (var x=x1; x<=x2; x++) {
- if (!grid[y][x]._selected) {
- alert("Invalid selection for merge.");
- return true;
- }
- }
- }
- }
+ // Validate selection and get total rowspan and colspan
+ var rowSpan = 1, colSpan = 1;
- // Validate selection and get total rowspan and colspan
- var rowSpan = 1, colSpan = 1;
+ // Validate horizontal and get total colspan
+ var lastRowSpan = -1;
+ for (var y=0; y<rows.length; y++) {
+ var rowColSpan = 0;
- // Validate horizontal and get total colspan
- var lastRowSpan = -1;
- for (var y=0; y<rows.length; y++) {
- var rowColSpan = 0;
+ for (var x=0; x<rows[y].length; x++) {
+ var sd = getColRowSpan(rows[y][x]);
- for (var x=0; x<rows[y].length; x++) {
- var sd = getColRowSpan(rows[y][x]);
+ rowColSpan += sd['colspan'];
- rowColSpan += sd['colspan'];
+ if (lastRowSpan != -1 && sd['rowspan'] != lastRowSpan) {
+ alert("Invalid selection for merge.");
+ return true;
+ }
- if (lastRowSpan != -1 && sd['rowspan'] != lastRowSpan) {
- alert("Invalid selection for merge.");
- return true;
+ lastRowSpan = sd['rowspan'];
}
- lastRowSpan = sd['rowspan'];
- }
+ if (rowColSpan > colSpan)
+ colSpan = rowColSpan;
- if (rowColSpan > colSpan)
- colSpan = rowColSpan;
+ lastRowSpan = -1;
+ }
- lastRowSpan = -1;
- }
+ // Validate vertical and get total rowspan
+ var lastColSpan = -1;
+ for (var x=0; x<rows[0].length; x++) {
+ var colRowSpan = 0;
- // Validate vertical and get total rowspan
- var lastColSpan = -1;
- for (var x=0; x<rows[0].length; x++) {
- var colRowSpan = 0;
+ for (var y=0; y<rows.length; y++) {
+ var sd = getColRowSpan(rows[y][x]);
- for (var y=0; y<rows.length; y++) {
- var sd = getColRowSpan(rows[y][x]);
+ colRowSpan += sd['rowspan'];
- colRowSpan += sd['rowspan'];
+ if (lastColSpan != -1 && sd['colspan'] != lastColSpan) {
+ alert("Invalid selection for merge.");
+ return true;
+ }
- if (lastColSpan != -1 && sd['colspan'] != lastColSpan) {
- alert("Invalid selection for merge.");
- return true;
+ lastColSpan = sd['colspan'];
}
- lastColSpan = sd['colspan'];
- }
+ if (colRowSpan > rowSpan)
+ rowSpan = colRowSpan;
- if (colRowSpan > rowSpan)
- rowSpan = colRowSpan;
+ lastColSpan = -1;
+ }
- lastColSpan = -1;
- }
+ // Setup td
+ tdElm = rows[0][0];
+ tdElm.rowSpan = rowSpan;
+ tdElm.colSpan = colSpan;
- // Setup td
- tdElm = rows[0][0];
- tdElm.rowSpan = rowSpan;
- tdElm.colSpan = colSpan;
+ // Merge cells
+ for (var y=0; y<rows.length; y++) {
+ for (var x=0; x<rows[y].length; x++) {
+ var html = rows[y][x].innerHTML;
+ var chk = html.replace(/[ \t\r\n]/g, "");
- // Merge cells
- for (var y=0; y<rows.length; y++) {
- for (var x=0; x<rows[y].length; x++) {
- var html = rows[y][x].innerHTML;
- var chk = tinyMCE.regexpReplace(html, "[ \t\r\n]", "");
+ if (chk != "<br/>" && chk != "<br>" && chk != '<br mce_bogus="1"/>' && (x+y > 0))
+ tdElm.innerHTML += html;
- if (chk != "<br/>" && chk != "<br>" && chk != "&nbsp;" && (x+y > 0))
- tdElm.innerHTML += html;
+ // Not current cell
+ if (rows[y][x] != tdElm && !rows[y][x]._deleted) {
+ var cpos = getCellPos(grid, rows[y][x]);
+ var tr = rows[y][x].parentNode;
- // Not current cell
- if (rows[y][x] != tdElm && !rows[y][x]._deleted) {
- var cpos = getCellPos(grid, rows[y][x]);
- var tr = rows[y][x].parentNode;
+ tr.removeChild(rows[y][x]);
+ rows[y][x]._deleted = true;
- tr.removeChild(rows[y][x]);
- rows[y][x]._deleted = true;
+ // Empty TR, remove it
+ if (!tr.hasChildNodes()) {
+ tr.parentNode.removeChild(tr);
- // Empty TR, remove it
- if (!tr.hasChildNodes()) {
- tr.parentNode.removeChild(tr);
+ var lastCell = null;
+ for (var x=0; cellElm = getCell(grid, cpos.rowindex, x); x++) {
+ if (cellElm != lastCell && cellElm.rowSpan > 1)
+ cellElm.rowSpan--;
- var lastCell = null;
- for (var x=0; cellElm = getCell(grid, cpos.rowindex, x); x++) {
- if (cellElm != lastCell && cellElm.rowSpan > 1)
- cellElm.rowSpan--;
+ lastCell = cellElm;
+ }
- lastCell = cellElm;
+ if (tdElm.rowSpan > 1)
+ tdElm.rowSpan--;
}
-
- if (tdElm.rowSpan > 1)
- tdElm.rowSpan--;
}
}
}
+
+ // Remove all but one bogus br
+ each(ed.dom.select('br', tdElm), function(e, i) {
+ if (i > 0 && ed.dom.getAttrib(e, 'mce_bogus'))
+ ed.dom.remove(e);
+ });
+
+ break;
}
- break;
+ tableElm = inst.dom.getParent(inst.selection.getNode(), "table");
+ inst.addVisual(tableElm);
+ inst.nodeChanged();
}
- tableElm = tinyMCE.getParentElement(inst.getFocusElement(), "table");
- tinyMCE.handleVisualAid(tableElm, true, tinyMCE.settings['visual'], tinyMCE.selectedInstance);
- tinyMCE.triggerNodeChange();
- inst.repaint();
- }
+ return true;
+ }
- return true;
+ // Pass to next handler in chain
+ return false;
}
+ });
- // Pass to next handler in chain
- return false;
- }
-};
-
-tinyMCE.addPlugin("table", TinyMCE_TablePlugin);
+ // Register plugin
+ tinymce.PluginManager.add('table', tinymce.plugins.TablePlugin);
+})(); \ No newline at end of file
diff --git a/program/js/tiny_mce/plugins/table/images/buttons.gif b/program/js/tiny_mce/plugins/table/images/buttons.gif
deleted file mode 100644
index 56a7396b8..000000000
--- a/program/js/tiny_mce/plugins/table/images/buttons.gif
+++ /dev/null
Binary files differ
diff --git a/program/js/tiny_mce/plugins/table/images/table.gif b/program/js/tiny_mce/plugins/table/images/table.gif
deleted file mode 100644
index 2911830c3..000000000
--- a/program/js/tiny_mce/plugins/table/images/table.gif
+++ /dev/null
Binary files differ
diff --git a/program/js/tiny_mce/plugins/table/images/table_cell_props.gif b/program/js/tiny_mce/plugins/table/images/table_cell_props.gif
deleted file mode 100644
index bee7ed652..000000000
--- a/program/js/tiny_mce/plugins/table/images/table_cell_props.gif
+++ /dev/null
Binary files differ
diff --git a/program/js/tiny_mce/plugins/table/images/table_delete.gif b/program/js/tiny_mce/plugins/table/images/table_delete.gif
deleted file mode 100644
index 2a00e6ad6..000000000
--- a/program/js/tiny_mce/plugins/table/images/table_delete.gif
+++ /dev/null
Binary files differ
diff --git a/program/js/tiny_mce/plugins/table/images/table_delete_col.gif b/program/js/tiny_mce/plugins/table/images/table_delete_col.gif
deleted file mode 100644
index 260aa04ca..000000000
--- a/program/js/tiny_mce/plugins/table/images/table_delete_col.gif
+++ /dev/null
Binary files differ
diff --git a/program/js/tiny_mce/plugins/table/images/table_delete_row.gif b/program/js/tiny_mce/plugins/table/images/table_delete_row.gif
deleted file mode 100644
index 2fb5f2bab..000000000
--- a/program/js/tiny_mce/plugins/table/images/table_delete_row.gif
+++ /dev/null
Binary files differ
diff --git a/program/js/tiny_mce/plugins/table/images/table_insert_col_after.gif b/program/js/tiny_mce/plugins/table/images/table_insert_col_after.gif
deleted file mode 100644
index 85058080c..000000000
--- a/program/js/tiny_mce/plugins/table/images/table_insert_col_after.gif
+++ /dev/null
Binary files differ
diff --git a/program/js/tiny_mce/plugins/table/images/table_insert_col_before.gif b/program/js/tiny_mce/plugins/table/images/table_insert_col_before.gif
deleted file mode 100644
index b669d4fa6..000000000
--- a/program/js/tiny_mce/plugins/table/images/table_insert_col_before.gif
+++ /dev/null
Binary files differ
diff --git a/program/js/tiny_mce/plugins/table/images/table_insert_row_after.gif b/program/js/tiny_mce/plugins/table/images/table_insert_row_after.gif
deleted file mode 100644
index b9c144661..000000000
--- a/program/js/tiny_mce/plugins/table/images/table_insert_row_after.gif
+++ /dev/null
Binary files differ
diff --git a/program/js/tiny_mce/plugins/table/images/table_insert_row_before.gif b/program/js/tiny_mce/plugins/table/images/table_insert_row_before.gif
deleted file mode 100644
index 157d37365..000000000
--- a/program/js/tiny_mce/plugins/table/images/table_insert_row_before.gif
+++ /dev/null
Binary files differ
diff --git a/program/js/tiny_mce/plugins/table/images/table_merge_cells.gif b/program/js/tiny_mce/plugins/table/images/table_merge_cells.gif
deleted file mode 100644
index 6834e611e..000000000
--- a/program/js/tiny_mce/plugins/table/images/table_merge_cells.gif
+++ /dev/null
Binary files differ
diff --git a/program/js/tiny_mce/plugins/table/images/table_row_props.gif b/program/js/tiny_mce/plugins/table/images/table_row_props.gif
deleted file mode 100644
index e5c7cc37a..000000000
--- a/program/js/tiny_mce/plugins/table/images/table_row_props.gif
+++ /dev/null
Binary files differ
diff --git a/program/js/tiny_mce/plugins/table/images/table_split_cells.gif b/program/js/tiny_mce/plugins/table/images/table_split_cells.gif
deleted file mode 100644
index 8ccb1b5f8..000000000
--- a/program/js/tiny_mce/plugins/table/images/table_split_cells.gif
+++ /dev/null
Binary files differ
diff --git a/program/js/tiny_mce/plugins/table/jscripts/cell.js b/program/js/tiny_mce/plugins/table/js/cell.js
index 436eaad17..7d7f977fa 100644
--- a/program/js/tiny_mce/plugins/table/jscripts/cell.js
+++ b/program/js/tiny_mce/plugins/table/js/cell.js
@@ -1,32 +1,39 @@
+tinyMCEPopup.requireLangPack();
+
+var ed;
+
function init() {
+ ed = tinyMCEPopup.editor;
tinyMCEPopup.resizeToInnerSize();
document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table');
document.getElementById('bordercolor_pickcontainer').innerHTML = getColorPickerHTML('bordercolor_pick','bordercolor');
document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor')
- var inst = tinyMCE.selectedInstance;
- var tdElm = tinyMCE.getParentElement(inst.getFocusElement(), "td,th");
+ var inst = ed;
+ var tdElm = ed.dom.getParent(ed.selection.getNode(), "td,th");
var formObj = document.forms[0];
- var st = tinyMCE.parseStyle(tinyMCE.getAttrib(tdElm, "style"));
+ var st = ed.dom.parseStyle(ed.dom.getAttrib(tdElm, "style"));
// Get table cell data
var celltype = tdElm.nodeName.toLowerCase();
- var align = tinyMCE.getAttrib(tdElm, 'align');
- var valign = tinyMCE.getAttrib(tdElm, 'valign');
+ var align = ed.dom.getAttrib(tdElm, 'align');
+ var valign = ed.dom.getAttrib(tdElm, 'valign');
var width = trimSize(getStyle(tdElm, 'width', 'width'));
var height = trimSize(getStyle(tdElm, 'height', 'height'));
var bordercolor = convertRGBToHex(getStyle(tdElm, 'bordercolor', 'borderLeftColor'));
var bgcolor = convertRGBToHex(getStyle(tdElm, 'bgcolor', 'backgroundColor'));
- var className = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(tdElm, 'class'), false);
+ var className = ed.dom.getAttrib(tdElm, 'class');
var backgroundimage = getStyle(tdElm, 'background', 'backgroundImage').replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");;
- var id = tinyMCE.getAttrib(tdElm, 'id');
- var lang = tinyMCE.getAttrib(tdElm, 'lang');
- var dir = tinyMCE.getAttrib(tdElm, 'dir');
- var scope = tinyMCE.getAttrib(tdElm, 'scope');
+ var id = ed.dom.getAttrib(tdElm, 'id');
+ var lang = ed.dom.getAttrib(tdElm, 'lang');
+ var dir = ed.dom.getAttrib(tdElm, 'dir');
+ var scope = ed.dom.getAttrib(tdElm, 'scope');
// Setup form
addClassesToList('class', 'table_cell_styles');
+ TinyMCE_EditableSelects.init();
+
formObj.bordercolor.value = bordercolor;
formObj.bgcolor.value = bgcolor;
formObj.backgroundimage.value = backgroundimage;
@@ -34,10 +41,10 @@ function init() {
formObj.height.value = height;
formObj.id.value = id;
formObj.lang.value = lang;
- formObj.style.value = tinyMCE.serializeStyle(st);
+ formObj.style.value = ed.dom.serializeStyle(st);
selectByValue(formObj, 'align', align);
selectByValue(formObj, 'valign', valign);
- selectByValue(formObj, 'class', className);
+ selectByValue(formObj, 'class', className, true, true);
selectByValue(formObj, 'celltype', celltype);
selectByValue(formObj, 'dir', dir);
selectByValue(formObj, 'scope', scope);
@@ -51,24 +58,24 @@ function init() {
}
function updateAction() {
- tinyMCEPopup.restoreSelection();
+ var el, inst = ed, tdElm, trElm, tableElm, formObj = document.forms[0];
- var inst = tinyMCE.selectedInstance;
- var tdElm = tinyMCE.getParentElement(inst.getFocusElement(), "td,th");
- var trElm = tinyMCE.getParentElement(inst.getFocusElement(), "tr");
- var tableElm = tinyMCE.getParentElement(inst.getFocusElement(), "table");
- var formObj = document.forms[0];
+ tinyMCEPopup.restoreSelection();
+ el = ed.selection.getNode();
+ tdElm = ed.dom.getParent(el, "td,th");
+ trElm = ed.dom.getParent(el, "tr");
+ tableElm = ed.dom.getParent(el, "table");
- inst.execCommand('mceBeginUndoLevel');
+ ed.execCommand('mceBeginUndoLevel');
switch (getSelectValue(formObj, 'action')) {
case "cell":
var celltype = getSelectValue(formObj, 'celltype');
var scope = getSelectValue(formObj, 'scope');
- if (tinyMCE.getParam("accessibility_warnings")) {
+ if (ed.getParam("accessibility_warnings")) {
if (celltype == "th" && scope == "")
- var answer = confirm(tinyMCE.getLang('lang_table_missing_scope', '', true));
+ var answer = confirm(ed.getLang('table_dlg.missing_scope', '', true));
else
var answer = true;
@@ -108,8 +115,8 @@ function updateAction() {
break;
}
- tinyMCE.handleVisualAid(inst.getBody(), true, inst.visualAid, inst);
- tinyMCE.triggerNodeChange();
+ ed.addVisual();
+ ed.nodeChanged();
inst.execCommand('mceEndUndoLevel');
tinyMCEPopup.close();
}
@@ -124,11 +131,12 @@ function nextCell(elm) {
}
function updateCell(td, skip_id) {
- var inst = tinyMCE.selectedInstance;
+ var inst = ed;
var formObj = document.forms[0];
var curCellType = td.nodeName.toLowerCase();
var celltype = getSelectValue(formObj, 'celltype');
var doc = inst.getDoc();
+ var dom = ed.dom;
if (!skip_id)
td.setAttribute('id', formObj.id.value);
@@ -137,16 +145,16 @@ function updateCell(td, skip_id) {
td.setAttribute('vAlign', formObj.valign.value);
td.setAttribute('lang', formObj.lang.value);
td.setAttribute('dir', getSelectValue(formObj, 'dir'));
- td.setAttribute('style', tinyMCE.serializeStyle(tinyMCE.parseStyle(formObj.style.value)));
+ td.setAttribute('style', ed.dom.serializeStyle(ed.dom.parseStyle(formObj.style.value)));
td.setAttribute('scope', formObj.scope.value);
- tinyMCE.setAttrib(td, 'class', getSelectValue(formObj, 'class'));
+ ed.dom.setAttrib(td, 'class', getSelectValue(formObj, 'class'));
// Clear deprecated attributes
- tinyMCE.setAttrib(td, 'width', '');
- tinyMCE.setAttrib(td, 'height', '');
- tinyMCE.setAttrib(td, 'bgColor', '');
- tinyMCE.setAttrib(td, 'borderColor', '');
- tinyMCE.setAttrib(td, 'background', '');
+ ed.dom.setAttrib(td, 'width', '');
+ ed.dom.setAttrib(td, 'height', '');
+ ed.dom.setAttrib(td, 'bgColor', '');
+ ed.dom.setAttrib(td, 'borderColor', '');
+ ed.dom.setAttrib(td, 'background', '');
// Set styles
td.style.width = getCSSSize(formObj.width.value);
@@ -172,30 +180,30 @@ function updateCell(td, skip_id) {
for (var c=0; c<td.childNodes.length; c++)
newCell.appendChild(td.childNodes[c].cloneNode(1));
- for (var a=0; a<td.attributes.length; a++) {
- var attr = td.attributes[a];
- newCell.setAttribute(attr.name, attr.value);
- }
+ for (var a=0; a<td.attributes.length; a++)
+ ed.dom.setAttrib(newCell, td.attributes[a].name, ed.dom.getAttrib(td, td.attributes[a].name));
td.parentNode.replaceChild(newCell, td);
td = newCell;
}
+ dom.setAttrib(td, 'style', dom.serializeStyle(dom.parseStyle(td.style.cssText)));
+
return td;
}
function changedBackgroundImage() {
var formObj = document.forms[0];
- var st = tinyMCE.parseStyle(formObj.style.value);
+ var st = ed.dom.parseStyle(formObj.style.value);
st['background-image'] = "url('" + formObj.backgroundimage.value + "')";
- formObj.style.value = tinyMCE.serializeStyle(st);
+ formObj.style.value = ed.dom.serializeStyle(st);
}
function changedSize() {
var formObj = document.forms[0];
- var st = tinyMCE.parseStyle(formObj.style.value);
+ var st = ed.dom.parseStyle(formObj.style.value);
var width = formObj.width.value;
if (width != "")
@@ -209,22 +217,22 @@ function changedSize() {
else
st['height'] = "";
- formObj.style.value = tinyMCE.serializeStyle(st);
+ formObj.style.value = ed.dom.serializeStyle(st);
}
function changedColor() {
var formObj = document.forms[0];
- var st = tinyMCE.parseStyle(formObj.style.value);
+ var st = ed.dom.parseStyle(formObj.style.value);
st['background-color'] = formObj.bgcolor.value;
st['border-color'] = formObj.bordercolor.value;
- formObj.style.value = tinyMCE.serializeStyle(st);
+ formObj.style.value = ed.dom.serializeStyle(st);
}
function changedStyle() {
var formObj = document.forms[0];
- var st = tinyMCE.parseStyle(formObj.style.value);
+ var st = ed.dom.parseStyle(formObj.style.value);
if (st['background-image'])
formObj.backgroundimage.value = st['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
@@ -247,3 +255,5 @@ function changedStyle() {
updateColor('bordercolor_pick','bordercolor');
}
}
+
+tinyMCEPopup.onInit.add(init);
diff --git a/program/js/tiny_mce/plugins/table/js/merge_cells.js b/program/js/tiny_mce/plugins/table/js/merge_cells.js
new file mode 100644
index 000000000..4fd026b11
--- /dev/null
+++ b/program/js/tiny_mce/plugins/table/js/merge_cells.js
@@ -0,0 +1,29 @@
+tinyMCEPopup.requireLangPack();
+
+function init() {
+ var f = document.forms[0], v;
+
+ tinyMCEPopup.resizeToInnerSize();
+
+ f.numcols.value = tinyMCEPopup.getWindowArg('numcols', 1);
+ f.numrows.value = tinyMCEPopup.getWindowArg('numcols', 1);
+}
+
+function mergeCells() {
+ var args = [], f = document.forms[0];
+
+ tinyMCEPopup.restoreSelection();
+
+ if (!AutoValidator.validate(f)) {
+ alert(tinyMCEPopup.getLang('invalid_data'));
+ return false;
+ }
+
+ args["numcols"] = f.numcols.value;
+ args["numrows"] = f.numrows.value;
+
+ tinyMCEPopup.execCommand("mceTableMergeCells", false, args);
+ tinyMCEPopup.close();
+}
+
+tinyMCEPopup.onInit.add(init);
diff --git a/program/js/tiny_mce/plugins/table/jscripts/row.js b/program/js/tiny_mce/plugins/table/js/row.js
index 395ddf028..d25f635f6 100644
--- a/program/js/tiny_mce/plugins/table/jscripts/row.js
+++ b/program/js/tiny_mce/plugins/table/js/row.js
@@ -1,37 +1,42 @@
+tinyMCEPopup.requireLangPack();
+
function init() {
tinyMCEPopup.resizeToInnerSize();
document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table');
document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
- var inst = tinyMCE.selectedInstance;
- var trElm = tinyMCE.getParentElement(inst.getFocusElement(), "tr");
+ var inst = tinyMCEPopup.editor;
+ var dom = inst.dom;
+ var trElm = dom.getParent(inst.selection.getNode(), "tr");
var formObj = document.forms[0];
- var st = tinyMCE.parseStyle(tinyMCE.getAttrib(trElm, "style"));
+ var st = dom.parseStyle(dom.getAttrib(trElm, "style"));
// Get table row data
var rowtype = trElm.parentNode.nodeName.toLowerCase();
- var align = tinyMCE.getAttrib(trElm, 'align');
- var valign = tinyMCE.getAttrib(trElm, 'valign');
+ var align = dom.getAttrib(trElm, 'align');
+ var valign = dom.getAttrib(trElm, 'valign');
var height = trimSize(getStyle(trElm, 'height', 'height'));
- var className = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(trElm, 'class'), false);
+ var className = dom.getAttrib(trElm, 'class');
var bgcolor = convertRGBToHex(getStyle(trElm, 'bgcolor', 'backgroundColor'));
var backgroundimage = getStyle(trElm, 'background', 'backgroundImage').replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");;
- var id = tinyMCE.getAttrib(trElm, 'id');
- var lang = tinyMCE.getAttrib(trElm, 'lang');
- var dir = tinyMCE.getAttrib(trElm, 'dir');
+ var id = dom.getAttrib(trElm, 'id');
+ var lang = dom.getAttrib(trElm, 'lang');
+ var dir = dom.getAttrib(trElm, 'dir');
// Setup form
addClassesToList('class', 'table_row_styles');
+ TinyMCE_EditableSelects.init();
+
formObj.bgcolor.value = bgcolor;
formObj.backgroundimage.value = backgroundimage;
formObj.height.value = height;
formObj.id.value = id;
formObj.lang.value = lang;
- formObj.style.value = tinyMCE.serializeStyle(st);
+ formObj.style.value = dom.serializeStyle(st);
selectByValue(formObj, 'align', align);
selectByValue(formObj, 'valign', valign);
- selectByValue(formObj, 'class', className);
+ selectByValue(formObj, 'class', className, true, true);
selectByValue(formObj, 'rowtype', rowtype);
selectByValue(formObj, 'dir', dir);
@@ -43,14 +48,13 @@ function init() {
}
function updateAction() {
- tinyMCEPopup.restoreSelection();
-
- var inst = tinyMCE.selectedInstance;
- var trElm = tinyMCE.getParentElement(inst.getFocusElement(), "tr");
- var tableElm = tinyMCE.getParentElement(inst.getFocusElement(), "table");
- var formObj = document.forms[0];
+ var inst = tinyMCEPopup.editor, dom = inst.dom, trElm, tableElm, formObj = document.forms[0];
var action = getSelectValue(formObj, 'action');
+ tinyMCEPopup.restoreSelection();
+ trElm = dom.getParent(inst.selection.getNode(), "tr");
+ tableElm = dom.getParent(inst.selection.getNode(), "table");
+
inst.execCommand('mceBeginUndoLevel');
switch (action) {
@@ -78,15 +82,16 @@ function updateAction() {
break;
}
- tinyMCE.handleVisualAid(inst.getBody(), true, inst.visualAid, inst);
- tinyMCE.triggerNodeChange();
+ inst.addVisual();
+ inst.nodeChanged();
inst.execCommand('mceEndUndoLevel');
tinyMCEPopup.close();
}
function updateRow(tr_elm, skip_id, skip_parent) {
- var inst = tinyMCE.selectedInstance;
+ var inst = tinyMCEPopup.editor;
var formObj = document.forms[0];
+ var dom = inst.dom;
var curRowType = tr_elm.parentNode.nodeName.toLowerCase();
var rowtype = getSelectValue(formObj, 'rowtype');
var doc = inst.getDoc();
@@ -99,8 +104,8 @@ function updateRow(tr_elm, skip_id, skip_parent) {
tr_elm.setAttribute('vAlign', getSelectValue(formObj, 'valign'));
tr_elm.setAttribute('lang', formObj.lang.value);
tr_elm.setAttribute('dir', getSelectValue(formObj, 'dir'));
- tr_elm.setAttribute('style', tinyMCE.serializeStyle(tinyMCE.parseStyle(formObj.style.value)));
- tinyMCE.setAttrib(tr_elm, 'class', getSelectValue(formObj, 'class'));
+ tr_elm.setAttribute('style', dom.serializeStyle(dom.parseStyle(formObj.style.value)));
+ dom.setAttrib(tr_elm, 'class', getSelectValue(formObj, 'class'));
// Clear deprecated attributes
tr_elm.setAttribute('background', '');
@@ -122,7 +127,7 @@ function updateRow(tr_elm, skip_id, skip_parent) {
var newRow = tr_elm.cloneNode(1);
// next, find the parent of its new destination (creating it if necessary)
- var theTable = tinyMCE.getParentElement(tr_elm, "table");
+ var theTable = dom.getParent(tr_elm, "table");
var dest = rowtype;
var newParent = null;
for (var i = 0; i < theTable.childNodes.length; i++) {
@@ -133,9 +138,12 @@ function updateRow(tr_elm, skip_id, skip_parent) {
if (newParent == null) {
newParent = doc.createElement(dest);
- if (dest == "thead")
- theTable.insertBefore(newParent, theTable.firstChild);
- else
+ if (dest == "thead") {
+ if (theTable.firstChild.nodeName == 'CAPTION')
+ inst.dom.insertAfter(newParent, theTable.firstChild);
+ else
+ theTable.insertBefore(newParent, theTable.firstChild);
+ } else
theTable.appendChild(newParent);
}
@@ -148,20 +156,22 @@ function updateRow(tr_elm, skip_id, skip_parent) {
// set tr_elm to the new node
tr_elm = newRow;
}
+
+ dom.setAttrib(tr_elm, 'style', dom.serializeStyle(dom.parseStyle(tr_elm.style.cssText)));
}
function changedBackgroundImage() {
- var formObj = document.forms[0];
- var st = tinyMCE.parseStyle(formObj.style.value);
+ var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom;
+ var st = dom.parseStyle(formObj.style.value);
st['background-image'] = "url('" + formObj.backgroundimage.value + "')";
- formObj.style.value = tinyMCE.serializeStyle(st);
+ formObj.style.value = dom.serializeStyle(st);
}
function changedStyle() {
- var formObj = document.forms[0];
- var st = tinyMCE.parseStyle(formObj.style.value);
+ var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom;
+ var st = dom.parseStyle(formObj.style.value);
if (st['background-image'])
formObj.backgroundimage.value = st['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
@@ -178,8 +188,8 @@ function changedStyle() {
}
function changedSize() {
- var formObj = document.forms[0];
- var st = tinyMCE.parseStyle(formObj.style.value);
+ var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom;
+ var st = dom.parseStyle(formObj.style.value);
var height = formObj.height.value;
if (height != "")
@@ -187,14 +197,16 @@ function changedSize() {
else
st['height'] = "";
- formObj.style.value = tinyMCE.serializeStyle(st);
+ formObj.style.value = dom.serializeStyle(st);
}
function changedColor() {
- var formObj = document.forms[0];
- var st = tinyMCE.parseStyle(formObj.style.value);
+ var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom;
+ var st = dom.parseStyle(formObj.style.value);
st['background-color'] = formObj.bgcolor.value;
- formObj.style.value = tinyMCE.serializeStyle(st);
+ formObj.style.value = dom.serializeStyle(st);
}
+
+tinyMCEPopup.onInit.add(init);
diff --git a/program/js/tiny_mce/plugins/table/jscripts/table.js b/program/js/tiny_mce/plugins/table/js/table.js
index 4a0ee3b47..768c26e27 100644
--- a/program/js/tiny_mce/plugins/table/jscripts/table.js
+++ b/program/js/tiny_mce/plugins/table/js/table.js
@@ -1,19 +1,22 @@
-var action, orgTableWidth, orgTableHeight;
+tinyMCEPopup.requireLangPack();
+
+var action, orgTableWidth, orgTableHeight, dom = tinyMCEPopup.editor.dom;
function insertTable() {
var formObj = document.forms[0];
- var inst = tinyMCE.selectedInstance;
- var cols = 2, rows = 2, border = 0, cellpadding = -1, cellspacing = -1, align, width, height, className, caption;
- var html = '', capEl;
- var elm = tinyMCE.tableElm;
+ var inst = tinyMCEPopup.editor, dom = inst.dom;
+ var cols = 2, rows = 2, border = 0, cellpadding = -1, cellspacing = -1, align, width, height, className, caption, frame, rules;
+ var html = '', capEl, elm;
var cellLimit, rowLimit, colLimit;
+ tinyMCEPopup.restoreSelection();
+
if (!AutoValidator.validate(formObj)) {
- alert(tinyMCE.getLang('lang_invalid_data'));
+ alert(inst.getLang('invalid_data'));
return false;
}
- tinyMCEPopup.restoreSelection();
+ elm = dom.getParent(inst.selection.getNode(), 'table');
// Get form data
cols = formObj.elements['cols'].value;
@@ -22,6 +25,8 @@ function insertTable() {
cellpadding = formObj.elements['cellpadding'].value != "" ? formObj.elements['cellpadding'].value : "";
cellspacing = formObj.elements['cellspacing'].value != "" ? formObj.elements['cellspacing'].value : "";
align = formObj.elements['align'].options[formObj.elements['align'].selectedIndex].value;
+ frame = formObj.elements['frame'].options[formObj.elements['frame'].selectedIndex].value;
+ rules = formObj.elements['rules'].options[formObj.elements['rules'].selectedIndex].value;
width = formObj.elements['width'].value;
height = formObj.elements['height'].value;
bordercolor = formObj.elements['bordercolor'].value;
@@ -35,19 +40,19 @@ function insertTable() {
background = formObj.elements['backgroundimage'].value;
caption = formObj.elements['caption'].checked;
- cellLimit = tinyMCE.getParam('table_cell_limit', false);
- rowLimit = tinyMCE.getParam('table_row_limit', false);
- colLimit = tinyMCE.getParam('table_col_limit', false);
+ cellLimit = tinyMCEPopup.getParam('table_cell_limit', false);
+ rowLimit = tinyMCEPopup.getParam('table_row_limit', false);
+ colLimit = tinyMCEPopup.getParam('table_col_limit', false);
// Validate table size
if (colLimit && cols > colLimit) {
- alert(tinyMCE.getLang('lang_table_col_limit', '', true, {cols : colLimit}));
+ alert(inst.getLang('table_col_limit', '', true, {cols : colLimit}));
return false;
} else if (rowLimit && rows > rowLimit) {
- alert(tinyMCE.getLang('lang_table_row_limit', '', true, {rows : rowLimit}));
+ alert(inst.getLang('table_row_limit', '', true, {rows : rowLimit}));
return false;
} else if (cellLimit && cols * rows > cellLimit) {
- alert(tinyMCE.getLang('lang_table_cell_limit', '', true, {cells : cellLimit}));
+ alert(inst.getLang('table_cell_limit', '', true, {cells : cellLimit}));
return false;
}
@@ -55,50 +60,60 @@ function insertTable() {
if (action == "update") {
inst.execCommand('mceBeginUndoLevel');
- tinyMCE.setAttrib(elm, 'cellPadding', cellpadding, true);
- tinyMCE.setAttrib(elm, 'cellSpacing', cellspacing, true);
- tinyMCE.setAttrib(elm, 'border', border, true);
- tinyMCE.setAttrib(elm, 'align', align);
- tinyMCE.setAttrib(elm, 'class', className);
- tinyMCE.setAttrib(elm, 'style', style);
- tinyMCE.setAttrib(elm, 'id', id);
- tinyMCE.setAttrib(elm, 'summary', summary);
- tinyMCE.setAttrib(elm, 'dir', dir);
- tinyMCE.setAttrib(elm, 'lang', lang);
-
- capEl = elm.getElementsByTagName('caption')[0];
+ dom.setAttrib(elm, 'cellPadding', cellpadding, true);
+ dom.setAttrib(elm, 'cellSpacing', cellspacing, true);
+ dom.setAttrib(elm, 'border', border);
+ dom.setAttrib(elm, 'align', align);
+ dom.setAttrib(elm, 'frame', frame);
+ dom.setAttrib(elm, 'rules', rules);
+ dom.setAttrib(elm, 'class', className);
+ dom.setAttrib(elm, 'style', style);
+ dom.setAttrib(elm, 'id', id);
+ dom.setAttrib(elm, 'summary', summary);
+ dom.setAttrib(elm, 'dir', dir);
+ dom.setAttrib(elm, 'lang', lang);
+
+ capEl = inst.dom.select('caption', elm)[0];
if (capEl && !caption)
capEl.parentNode.removeChild(capEl);
if (!capEl && caption) {
capEl = elm.ownerDocument.createElement('caption');
- capEl.innerHTML = '&nbsp;';
+
+ if (!tinymce.isIE)
+ capEl.innerHTML = '<br mce_bogus="1"/>';
+
elm.insertBefore(capEl, elm.firstChild);
}
- // Not inline styles
- if (!tinyMCE.getParam("inline_styles"))
- tinyMCE.setAttrib(elm, 'width', width, true);
+ if (width && /(pt|em|cm)$/.test(width)) {
+ dom.setStyle(elm, 'width', width);
+ dom.setAttrib(elm, 'width', '');
+ } else {
+ dom.setAttrib(elm, 'width', width, true);
+ dom.setStyle(elm, 'width', '');
+ }
// Remove these since they are not valid XHTML
- tinyMCE.setAttrib(elm, 'borderColor', '');
- tinyMCE.setAttrib(elm, 'bgColor', '');
- tinyMCE.setAttrib(elm, 'background', '');
- tinyMCE.setAttrib(elm, 'height', '');
+ dom.setAttrib(elm, 'borderColor', '');
+ dom.setAttrib(elm, 'bgColor', '');
+ dom.setAttrib(elm, 'background', '');
+
+ if (height) {
+ dom.setStyle(elm, 'height', height);
+ dom.setAttrib(elm, 'height', '');
+ }
if (background != '')
elm.style.backgroundImage = "url('" + background + "')";
else
elm.style.backgroundImage = '';
- if (tinyMCE.getParam("inline_styles"))
- elm.style.borderWidth = border + "px";
-
- if (tinyMCE.getParam("inline_styles")) {
+/* if (tinyMCEPopup.getParam("inline_styles")) {
if (width != '')
elm.style.width = getCSSSize(width);
- }
+ }*/
if (bordercolor != "") {
elm.style.borderColor = bordercolor;
@@ -110,18 +125,17 @@ function insertTable() {
elm.style.backgroundColor = bgcolor;
elm.style.height = getCSSSize(height);
- tinyMCE.handleVisualAid(tinyMCE.tableElm, false, inst.visualAid, inst);
+ inst.addVisual();
// Fix for stange MSIE align bug
- tinyMCE.tableElm.outerHTML = tinyMCE.tableElm.outerHTML;
+ //elm.outerHTML = elm.outerHTML;
- tinyMCE.handleVisualAid(inst.getBody(), true, inst.visualAid, inst);
- tinyMCE.triggerNodeChange();
+ inst.nodeChanged();
inst.execCommand('mceEndUndoLevel');
// Repaint if dimensions changed
if (formObj.width.value != orgTableWidth || formObj.height.value != orgTableHeight)
- inst.repaint();
+ inst.execCommand('mceRepaint');
tinyMCEPopup.close();
return true;
@@ -134,26 +148,51 @@ function insertTable() {
html += makeAttrib('border', border);
html += makeAttrib('cellpadding', cellpadding);
html += makeAttrib('cellspacing', cellspacing);
- html += makeAttrib('width', width);
+
+ if (width && /(pt|em|cm)$/.test(width)) {
+ if (style)
+ style += '; ';
+
+ style += 'width: ' + width;
+ } else
+ html += makeAttrib('width', width);
+
+/* if (height) {
+ if (style)
+ style += '; ';
+
+ style += 'height: ' + height;
+ }*/
+
//html += makeAttrib('height', height);
//html += makeAttrib('bordercolor', bordercolor);
//html += makeAttrib('bgcolor', bgcolor);
html += makeAttrib('align', align);
- html += makeAttrib('class', tinyMCE.getVisualAidClass(className, border == 0));
+ html += makeAttrib('frame', frame);
+ html += makeAttrib('rules', rules);
+ html += makeAttrib('class', className);
html += makeAttrib('style', style);
html += makeAttrib('summary', summary);
html += makeAttrib('dir', dir);
html += makeAttrib('lang', lang);
html += '>';
- if (caption)
- html += '<caption>&nbsp;</caption>';
+ if (caption) {
+ if (!tinymce.isIE)
+ html += '<caption><br mce_bogus="1"/></caption>';
+ else
+ html += '<caption></caption>';
+ }
for (var y=0; y<rows; y++) {
html += "<tr>";
- for (var x=0; x<cols; x++)
- html += '<td>&nbsp;</td>';
+ for (var x=0; x<cols; x++) {
+ if (!tinymce.isIE)
+ html += '<td><br mce_bogus="1"/></td>';
+ else
+ html += '<td></td>';
+ }
html += "</tr>";
}
@@ -162,7 +201,7 @@ function insertTable() {
inst.execCommand('mceBeginUndoLevel');
inst.execCommand('mceInsertContent', false, html);
- tinyMCE.handleVisualAid(inst.getBody(), true, tinyMCE.settings['visual']);
+ inst.addVisual();
inst.execCommand('mceEndUndoLevel');
tinyMCEPopup.close();
@@ -199,20 +238,20 @@ function init() {
document.getElementById('bordercolor_pickcontainer').innerHTML = getColorPickerHTML('bordercolor_pick','bordercolor');
document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
- var cols = 2, rows = 2, border = tinyMCE.getParam('table_default_border', '0'), cellpadding = tinyMCE.getParam('table_default_cellpadding', ''), cellspacing = tinyMCE.getParam('table_default_cellspacing', '');
+ var cols = 2, rows = 2, border = tinyMCEPopup.getParam('table_default_border', '0'), cellpadding = tinyMCEPopup.getParam('table_default_cellpadding', ''), cellspacing = tinyMCEPopup.getParam('table_default_cellspacing', '');
var align = "", width = "", height = "", bordercolor = "", bgcolor = "", className = "";
- var id = "", summary = "", style = "", dir = "", lang = "", background = "", bgcolor = "", bordercolor = "";
- var inst = tinyMCE.selectedInstance;
+ var id = "", summary = "", style = "", dir = "", lang = "", background = "", bgcolor = "", bordercolor = "", rules, frame;
+ var inst = tinyMCEPopup.editor, dom = inst.dom;
var formObj = document.forms[0];
- var elm = tinyMCE.getParentElement(inst.getFocusElement(), "table");
+ var elm = dom.getParent(inst.selection.getNode(), "table");
- tinyMCE.tableElm = elm;
- action = tinyMCE.getWindowArg('action');
- if (action == null)
- action = tinyMCE.tableElm ? "update" : "insert";
+ action = tinyMCEPopup.getWindowArg('action');
- if (tinyMCE.tableElm && action != "insert") {
- var rowsAr = tinyMCE.tableElm.rows;
+ if (!action)
+ action = elm ? "update" : "insert";
+
+ if (elm && action != "insert") {
+ var rowsAr = elm.rows;
var cols = 0;
for (var i=0; i<rowsAr.length; i++)
if (rowsAr[i].cells.length > cols)
@@ -221,35 +260,41 @@ function init() {
cols = cols;
rows = rowsAr.length;
- st = tinyMCE.parseStyle(tinyMCE.getAttrib(tinyMCE.tableElm, "style"));
+ st = dom.parseStyle(dom.getAttrib(elm, "style"));
border = trimSize(getStyle(elm, 'border', 'borderWidth'));
- cellpadding = tinyMCE.getAttrib(tinyMCE.tableElm, 'cellpadding', "");
- cellspacing = tinyMCE.getAttrib(tinyMCE.tableElm, 'cellspacing', "");
+ cellpadding = dom.getAttrib(elm, 'cellpadding', "");
+ cellspacing = dom.getAttrib(elm, 'cellspacing', "");
width = trimSize(getStyle(elm, 'width', 'width'));
height = trimSize(getStyle(elm, 'height', 'height'));
bordercolor = convertRGBToHex(getStyle(elm, 'bordercolor', 'borderLeftColor'));
bgcolor = convertRGBToHex(getStyle(elm, 'bgcolor', 'backgroundColor'));
- align = tinyMCE.getAttrib(tinyMCE.tableElm, 'align', align);
- className = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(tinyMCE.tableElm, 'class'), false);
- id = tinyMCE.getAttrib(tinyMCE.tableElm, 'id');
- summary = tinyMCE.getAttrib(tinyMCE.tableElm, 'summary');
- style = tinyMCE.serializeStyle(st);
- dir = tinyMCE.getAttrib(tinyMCE.tableElm, 'dir');
- lang = tinyMCE.getAttrib(tinyMCE.tableElm, 'lang');
+ align = dom.getAttrib(elm, 'align', align);
+ frame = dom.getAttrib(elm, 'frame');
+ rules = dom.getAttrib(elm, 'rules');
+ className = tinymce.trim(dom.getAttrib(elm, 'class').replace(/mceItem.+/g, ''));
+ id = dom.getAttrib(elm, 'id');
+ summary = dom.getAttrib(elm, 'summary');
+ style = dom.serializeStyle(st);
+ dir = dom.getAttrib(elm, 'dir');
+ lang = dom.getAttrib(elm, 'lang');
background = getStyle(elm, 'background', 'backgroundImage').replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
- formObj.caption.checked = tinyMCE.tableElm.getElementsByTagName('caption').length > 0;
+ formObj.caption.checked = elm.getElementsByTagName('caption').length > 0;
orgTableWidth = width;
orgTableHeight = height;
action = "update";
+ formObj.insert.value = inst.getLang('update');
}
addClassesToList('class', "table_styles");
+ TinyMCE_EditableSelects.init();
// Update form
selectByValue(formObj, 'align', align);
- selectByValue(formObj, 'class', className);
+ selectByValue(formObj, 'frame', frame);
+ selectByValue(formObj, 'rules', rules);
+ selectByValue(formObj, 'class', className, true, true);
formObj.cols.value = cols;
formObj.rows.value = rows;
formObj.border.value = border;
@@ -265,7 +310,6 @@ function init() {
formObj.dir.value = dir;
formObj.lang.value = lang;
formObj.backgroundimage.value = background;
- formObj.insert.value = tinyMCE.getLang('lang_' + action, 'Insert', true);
updateColor('bordercolor_pick', 'bordercolor');
updateColor('bgcolor_pick', 'bgcolor');
@@ -283,13 +327,13 @@ function init() {
function changedSize() {
var formObj = document.forms[0];
- var st = tinyMCE.parseStyle(formObj.style.value);
+ var st = dom.parseStyle(formObj.style.value);
- var width = formObj.width.value;
+/* var width = formObj.width.value;
if (width != "")
- st['width'] = tinyMCE.getParam("inline_styles") ? getCSSSize(width) : "";
+ st['width'] = tinyMCEPopup.getParam("inline_styles") ? getCSSSize(width) : "";
else
- st['width'] = "";
+ st['width'] = "";*/
var height = formObj.height.value;
if (height != "")
@@ -297,32 +341,32 @@ function changedSize() {
else
st['height'] = "";
- formObj.style.value = tinyMCE.serializeStyle(st);
+ formObj.style.value = dom.serializeStyle(st);
}
function changedBackgroundImage() {
var formObj = document.forms[0];
- var st = tinyMCE.parseStyle(formObj.style.value);
+ var st = dom.parseStyle(formObj.style.value);
st['background-image'] = "url('" + formObj.backgroundimage.value + "')";
- formObj.style.value = tinyMCE.serializeStyle(st);
+ formObj.style.value = dom.serializeStyle(st);
}
function changedBorder() {
var formObj = document.forms[0];
- var st = tinyMCE.parseStyle(formObj.style.value);
+ var st = dom.parseStyle(formObj.style.value);
// Update border width if the element has a color
if (formObj.border.value != "" && formObj.bordercolor.value != "")
st['border-width'] = formObj.border.value + "px";
- formObj.style.value = tinyMCE.serializeStyle(st);
+ formObj.style.value = dom.serializeStyle(st);
}
function changedColor() {
var formObj = document.forms[0];
- var st = tinyMCE.parseStyle(formObj.style.value);
+ var st = dom.parseStyle(formObj.style.value);
st['background-color'] = formObj.bgcolor.value;
@@ -334,12 +378,12 @@ function changedColor() {
st['border-width'] = formObj.border.value == "" ? "1px" : formObj.border.value + "px";
}
- formObj.style.value = tinyMCE.serializeStyle(st);
+ formObj.style.value = dom.serializeStyle(st);
}
function changedStyle() {
var formObj = document.forms[0];
- var st = tinyMCE.parseStyle(formObj.style.value);
+ var st = dom.parseStyle(formObj.style.value);
if (st['background-image'])
formObj.backgroundimage.value = st['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
@@ -362,3 +406,5 @@ function changedStyle() {
updateColor('bordercolor_pick','bordercolor');
}
}
+
+tinyMCEPopup.onInit.add(init);
diff --git a/program/js/tiny_mce/plugins/table/jscripts/merge_cells.js b/program/js/tiny_mce/plugins/table/jscripts/merge_cells.js
deleted file mode 100644
index 06cbb275d..000000000
--- a/program/js/tiny_mce/plugins/table/jscripts/merge_cells.js
+++ /dev/null
@@ -1,24 +0,0 @@
-function init() {
- tinyMCEPopup.resizeToInnerSize();
-
- var formObj = document.forms[0];
-
- formObj.numcols.value = tinyMCE.getWindowArg('numcols', 1);
- formObj.numrows.value = tinyMCE.getWindowArg('numrows', 1);
-}
-
-function mergeCells() {
- var args = new Array();
- var formObj = document.forms[0];
-
- if (!AutoValidator.validate(formObj)) {
- alert(tinyMCE.getLang('lang_invalid_data'));
- return false;
- }
-
- args["numcols"] = formObj.numcols.value;
- args["numrows"] = formObj.numrows.value;
-
- tinyMCEPopup.execCommand("mceTableMergeCells", false, args);
- tinyMCEPopup.close();
-}
diff --git a/program/js/tiny_mce/plugins/table/langs/en.js b/program/js/tiny_mce/plugins/table/langs/en.js
deleted file mode 100644
index e2fbba2e5..000000000
--- a/program/js/tiny_mce/plugins/table/langs/en.js
+++ /dev/null
@@ -1,79 +0,0 @@
-// UK lang variables
-
-tinyMCE.addToLang('table',{
-general_tab : 'General',
-advanced_tab : 'Advanced',
-general_props : 'General properties',
-advanced_props : 'Advanced properties',
-desc : 'Inserts a new table',
-row_before_desc : 'Insert row before',
-row_after_desc : 'Insert row after',
-delete_row_desc : 'Delete row',
-col_before_desc : 'Insert column before',
-col_after_desc : 'Insert column after',
-delete_col_desc : 'Remove column',
-rowtype : 'Row in table part',
-title : 'Insert/Modify table',
-width : 'Width',
-height : 'Height',
-cols : 'Columns',
-rows : 'Rows',
-cellspacing : 'Cellspacing',
-cellpadding : 'Cellpadding',
-border : 'Border',
-align : 'Alignment',
-align_default : 'Default',
-align_left : 'Left',
-align_right : 'Right',
-align_middle : 'Center',
-row_title : 'Table row properties',
-cell_title : 'Table cell properties',
-cell_type : 'Cell type',
-row_desc : 'Table row properties',
-cell_desc : 'Table cell properties',
-valign : 'Vertical alignment',
-align_top : 'Top',
-align_bottom : 'Bottom',
-props_desc : 'Table properties',
-bordercolor : 'Border color',
-bgcolor : 'Background color',
-merge_cells_title : 'Merge table cells',
-split_cells_desc : 'Split merged table cells',
-merge_cells_desc : 'Merge table cells',
-cut_row_desc : 'Cut table row',
-copy_row_desc : 'Copy table row',
-paste_row_before_desc : 'Paste table row before',
-paste_row_after_desc : 'Paste table row after',
-id : 'Id',
-style: 'Style',
-langdir : 'Language direction',
-langcode : 'Language code',
-mime : 'Target MIME type',
-ltr : 'Left to right',
-rtl : 'Right to left',
-bgimage : 'Background image',
-summary : 'Summary',
-td : "Data",
-th : "Header",
-cell_cell : 'Update current cell',
-cell_row : 'Update all cells in row',
-cell_all : 'Update all cells in table',
-row_row : 'Update current row',
-row_odd : 'Update odd rows in table',
-row_even : 'Update even rows in table',
-row_all : 'Update all rows in table',
-thead : 'Table Head',
-tbody : 'Table Body',
-tfoot : 'Table Foot',
-del : 'Delete table',
-scope : 'Scope',
-row : 'Row',
-col : 'Col',
-rowgroup : 'Row Group',
-colgroup : 'Col Group',
-col_limit : 'You\'ve exceeded the maximum number of columns of {$cols}.',
-row_limit : 'You\'ve exceeded the maximum number of rows of {$rows}.',
-cell_limit : 'You\'ve exceeded the maximum number of cells of {$cells}.',
-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.',
-caption : 'Table caption'
-});
diff --git a/program/js/tiny_mce/plugins/table/langs/en_dlg.js b/program/js/tiny_mce/plugins/table/langs/en_dlg.js
new file mode 100644
index 000000000..000332a35
--- /dev/null
+++ b/program/js/tiny_mce/plugins/table/langs/en_dlg.js
@@ -0,0 +1,74 @@
+tinyMCE.addI18n('en.table_dlg',{
+general_tab:"General",
+advanced_tab:"Advanced",
+general_props:"General properties",
+advanced_props:"Advanced properties",
+rowtype:"Row in table part",
+title:"Insert/Modify table",
+width:"Width",
+height:"Height",
+cols:"Cols",
+rows:"Rows",
+cellspacing:"Cellspacing",
+cellpadding:"Cellpadding",
+border:"Border",
+align:"Alignment",
+align_default:"Default",
+align_left:"Left",
+align_right:"Right",
+align_middle:"Center",
+row_title:"Table row properties",
+cell_title:"Table cell properties",
+cell_type:"Cell type",
+valign:"Vertical alignment",
+align_top:"Top",
+align_bottom:"Bottom",
+bordercolor:"Border color",
+bgcolor:"Background color",
+merge_cells_title:"Merge table cells",
+id:"Id",
+style:"Style",
+langdir:"Language direction",
+langcode:"Language code",
+mime:"Target MIME type",
+ltr:"Left to right",
+rtl:"Right to left",
+bgimage:"Background image",
+summary:"Summary",
+td:"Data",
+th:"Header",
+cell_cell:"Update current cell",
+cell_row:"Update all cells in row",
+cell_all:"Update all cells in table",
+row_row:"Update current row",
+row_odd:"Update odd rows in table",
+row_even:"Update even rows in table",
+row_all:"Update all rows in table",
+thead:"Table Head",
+tbody:"Table Body",
+tfoot:"Table Foot",
+scope:"Scope",
+rowgroup:"Row Group",
+colgroup:"Col Group",
+col_limit:"You've exceeded the maximum number of columns of {$cols}.",
+row_limit:"You've exceeded the maximum number of rows of {$rows}.",
+cell_limit:"You've exceeded the maximum number of cells of {$cells}.",
+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.",
+caption:"Table caption",
+frame:"Frame",
+frame_none:"none",
+frame_groups:"groups",
+frame_rows:"rows",
+frame_cols:"cols",
+frame_all:"all",
+rules:"Rules",
+rules_void:"void",
+rules_above:"above",
+rules_below:"below",
+rules_hsides:"hsides",
+rules_lhs:"lhs",
+rules_rhs:"rhs",
+rules_vsides:"vsides",
+rules_box:"box",
+rules_border:"border"
+}); \ No newline at end of file
diff --git a/program/js/tiny_mce/plugins/table/merge_cells.htm b/program/js/tiny_mce/plugins/table/merge_cells.htm
index 10896bf9e..9d34a886b 100644
--- a/program/js/tiny_mce/plugins/table/merge_cells.htm
+++ b/program/js/tiny_mce/plugins/table/merge_cells.htm
@@ -1,24 +1,24 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
- <title>{$lang_table_merge_cells_title}</title>
- <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
- <script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
- <script language="javascript" type="text/javascript" src="../../utils/validate.js"></script>
- <script language="javascript" type="text/javascript" src="jscripts/merge_cells.js"></script>
+ <title>{#table_dlg.merge_cells_title}</title>
+ <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+ <script type="text/javascript" src="../../utils/mctabs.js"></script>
+ <script type="text/javascript" src="../../utils/validate.js"></script>
+ <script type="text/javascript" src="js/merge_cells.js"></script>
<base target="_self" />
</head>
-<body onload="tinyMCEPopup.executeOnLoad('init();');" style="margin: 8px" style="display: none">
-<form onsubmit="insertTable();return false;" action="#">
+<body style="margin: 8px" style="display: none">
+<form onsubmit="mergeCells();return false;" action="#">
<fieldset>
- <legend>{$lang_table_merge_cells_title}</legend>
+ <legend>{#table_dlg.merge_cells_title}</legend>
<table border="0" cellpadding="0" cellspacing="3" width="100%">
<tr>
- <td>{$lang_table_cols}:</td>
- <td align="right"><input type="text" name="numcols" value="" class="number min1" style="width: 30px" /></td>
- <td>
+ <td>{#table_dlg.cols}:</td>
+ <td align="right"><input type="text" name="numcols" value="" class="number min1 mceFocus" style="width: 30px" /></td>
</tr>
<tr>
- <td>{$lang_table_rows}:</td>
+ <td>{#table_dlg.rows}:</td>
<td align="right"><input type="text" name="numrows" value="" class="number min1" style="width: 30px" /></td>
</tr>
</table>
@@ -26,11 +26,11 @@
<div class="mceActionPanel">
<div style="float: left">
- <input type="button" id="insert" name="insert" value="{$lang_update}" onclick="mergeCells();" />
+ <input type="submit" id="insert" name="insert" value="{#update}" />
</div>
<div style="float: right">
- <input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
</div>
</form>
diff --git a/program/js/tiny_mce/plugins/table/readme.txt b/program/js/tiny_mce/plugins/table/readme.txt
deleted file mode 100644
index 4fdb78aec..000000000
--- a/program/js/tiny_mce/plugins/table/readme.txt
+++ /dev/null
@@ -1 +0,0 @@
-Check the TinyMCE documentation for details on this plugin.
diff --git a/program/js/tiny_mce/plugins/table/row.htm b/program/js/tiny_mce/plugins/table/row.htm
index 64f2afcb5..fe75bf607 100644
--- a/program/js/tiny_mce/plugins/table/row.htm
+++ b/program/js/tiny_mce/plugins/table/row.htm
@@ -1,74 +1,76 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
- <title>{$lang_table_row_title}</title>
- <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
- <script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
- <script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
- <script language="javascript" type="text/javascript" src="jscripts/row.js"></script>
+ <title>{#table_dlg.row_title}</title>
+ <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+ <script type="text/javascript" src="../../utils/mctabs.js"></script>
+ <script type="text/javascript" src="../../utils/form_utils.js"></script>
+ <script type="text/javascript" src="../../utils/editable_selects.js"></script>
+ <script type="text/javascript" src="js/row.js"></script>
<link href="css/row.css" rel="stylesheet" type="text/css" />
<base target="_self" />
</head>
-<body id="tablerow" onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
+<body id="tablerow" style="display: none">
<form onsubmit="updateAction();return false;">
<div class="tabs">
<ul>
- <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_table_general_tab}</a></span></li>
- <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{$lang_table_advanced_tab}</a></span></li>
+ <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>
+ <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#table_dlg.advanced_tab}</a></span></li>
</ul>
</div>
<div class="panel_wrapper">
<div id="general_panel" class="panel current">
<fieldset>
- <legend>{$lang_table_general_props}</legend>
+ <legend>{#table_dlg.general_props}</legend>
<table border="0" cellpadding="4" cellspacing="0">
<tr>
- <td><label for="rowtype">{$lang_table_rowtype}</label></td>
+ <td><label for="rowtype">{#table_dlg.rowtype}</label></td>
<td class="col2">
- <select id="rowtype" name="rowtype">
- <option value="thead">{$lang_table_thead}</option>
- <option value="tbody">{$lang_table_tbody}</option>
- <option value="tfoot">{$lang_table_tfoot}</option>
+ <select id="rowtype" name="rowtype" class="mceFocus">
+ <option value="thead">{#table_dlg.thead}</option>
+ <option value="tbody">{#table_dlg.tbody}</option>
+ <option value="tfoot">{#table_dlg.tfoot}</option>
</select>
</td>
</tr>
<tr>
- <td><label for="align">{$lang_table_align}</label></td>
+ <td><label for="align">{#table_dlg.align}</label></td>
<td class="col2">
<select id="align" name="align">
- <option value="">{$lang_not_set}</option>
- <option value="center">{$lang_table_align_middle}</option>
- <option value="left">{$lang_table_align_left}</option>
- <option value="right">{$lang_table_align_right}</option>
+ <option value="">{#not_set}</option>
+ <option value="center">{#table_dlg.align_middle}</option>
+ <option value="left">{#table_dlg.align_left}</option>
+ <option value="right">{#table_dlg.align_right}</option>
</select>
</td>
</tr>
<tr>
- <td><label for="valign">{$lang_table_valign}</label></td>
+ <td><label for="valign">{#table_dlg.valign}</label></td>
<td class="col2">
<select id="valign" name="valign">
- <option value="">{$lang_not_set}</option>
- <option value="top">{$lang_table_align_top}</option>
- <option value="middle">{$lang_table_align_middle}</option>
- <option value="bottom">{$lang_table_align_bottom}</option>
+ <option value="">{#not_set}</option>
+ <option value="top">{#table_dlg.align_top}</option>
+ <option value="middle">{#table_dlg.align_middle}</option>
+ <option value="bottom">{#table_dlg.align_bottom}</option>
</select>
</td>
</tr>
<tr id="styleSelectRow">
- <td><label for="class">{$lang_class_name}</label></td>
+ <td><label for="class">{#class_name}</label></td>
<td class="col2">
- <select id="class" name="class">
- <option value="" selected="selected">{$lang_not_set}</option>
+ <select id="class" name="class" class="mceEditableSelect">
+ <option value="" selected="selected">{#not_set}</option>
</select>
</td>
</tr>
<tr>
- <td><label for="height">{$lang_table_height}</label></td>
+ <td><label for="height">{#table_dlg.height}</label></td>
<td class="col2"><input name="height" type="text" id="height" value="" size="4" maxlength="4" onchange="changedSize();" /></td>
</tr>
</table>
@@ -77,39 +79,39 @@
<div id="advanced_panel" class="panel">
<fieldset>
- <legend>{$lang_table_advanced_props}</legend>
+ <legend>{#table_dlg.advanced_props}</legend>
<table border="0" cellpadding="0" cellspacing="4">
<tr>
- <td class="column1"><label for="id">{$lang_table_id}</label></td>
+ <td class="column1"><label for="id">{#table_dlg.id}</label></td>
<td><input id="id" name="id" type="text" value="" style="width: 200px" /></td>
</tr>
<tr>
- <td><label for="style">{$lang_table_style}</label></td>
+ <td><label for="style">{#table_dlg.style}</label></td>
<td><input type="text" id="style" name="style" value="" style="width: 200px;" onchange="changedStyle();" /></td>
</tr>
<tr>
- <td class="column1"><label for="dir">{$lang_table_langdir}</label></td>
+ <td class="column1"><label for="dir">{#table_dlg.langdir}</label></td>
<td>
<select id="dir" name="dir" style="width: 200px">
- <option value="">{$lang_not_set}</option>
- <option value="ltr">{$lang_table_ltr}</option>
- <option value="rtl">{$lang_table_rtl}</option>
+ <option value="">{#not_set}</option>
+ <option value="ltr">{#table_dlg.ltr}</option>
+ <option value="rtl">{#table_dlg.rtl}</option>
</select>
</td>
</tr>
<tr>
- <td class="column1"><label for="lang">{$lang_table_langcode}</label></td>
+ <td class="column1"><label for="lang">{#table_dlg.langcode}</label></td>
<td>
<input id="lang" name="lang" type="text" value="" style="width: 200px" />
</td>
</tr>
<tr>
- <td class="column1"><label for="backgroundimage">{$lang_table_bgimage}</label></td>
+ <td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
@@ -121,7 +123,7 @@
</tr>
<tr>
- <td class="column1"><label for="bgcolor">{$lang_table_bgcolor}</label></td>
+ <td class="column1"><label for="bgcolor">{#table_dlg.bgcolor}</label></td>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
@@ -139,19 +141,19 @@
<div class="mceActionPanel">
<div>
<select id="action" name="action">
- <option value="row">{$lang_table_row_row}</option>
- <option value="odd">{$lang_table_row_odd}</option>
- <option value="even">{$lang_table_row_even}</option>
- <option value="all">{$lang_table_row_all}</option>
+ <option value="row">{#table_dlg.row_row}</option>
+ <option value="odd">{#table_dlg.row_odd}</option>
+ <option value="even">{#table_dlg.row_even}</option>
+ <option value="all">{#table_dlg.row_all}</option>
</select>
</div>
<div style="float: left">
- <div><input type="button" id="insert" name="insert" value="{$lang_update}" onclick="updateAction();" /></div>
+ <div><input type="submit" id="insert" name="insert" value="{#update}" /></div>
</div>
<div style="float: right">
- <input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
</div>
</form>
diff --git a/program/js/tiny_mce/plugins/table/table.htm b/program/js/tiny_mce/plugins/table/table.htm
index f48418733..7d5b908f4 100644
--- a/program/js/tiny_mce/plugins/table/table.htm
+++ b/program/js/tiny_mce/plugins/table/table.htm
@@ -1,67 +1,68 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
- <title>{$lang_table_title}</title>
- <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
- <script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
- <script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
- <script language="javascript" type="text/javascript" src="../../utils/validate.js"></script>
- <script language="javascript" type="text/javascript" src="jscripts/table.js"></script>
+ <title>{#table_dlg.title}</title>
+ <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+ <script type="text/javascript" src="../../utils/mctabs.js"></script>
+ <script type="text/javascript" src="../../utils/form_utils.js"></script>
+ <script type="text/javascript" src="../../utils/validate.js"></script>
+ <script type="text/javascript" src="../../utils/editable_selects.js"></script>
+ <script type="text/javascript" src="js/table.js"></script>
<link href="css/table.css" rel="stylesheet" type="text/css" />
<base target="_self" />
</head>
-<body id="table" onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
+<body id="table" style="display: none">
<form onsubmit="insertTable();return false;" action="#">
<div class="tabs">
<ul>
- <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_table_general_tab}</a></span></li>
- <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{$lang_table_advanced_tab}</a></span></li>
+ <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>
+ <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#table_dlg.advanced_tab}</a></span></li>
</ul>
</div>
<div class="panel_wrapper">
<div id="general_panel" class="panel current">
<fieldset>
- <legend>{$lang_table_general_props}</legend>
-
+ <legend>{#table_dlg.general_props}</legend>
<table border="0" cellpadding="4" cellspacing="0" width="100%">
<tr>
- <td><label id="colslabel" for="cols">{$lang_table_cols}</label></td>
- <td><input id="cols" name="cols" type="text" value="" size="3" maxlength="3" class="required number min1" /></td>
- <td><label id="rowslabel" for="rows">{$lang_table_rows}</label></td>
+ <td><label id="colslabel" for="cols">{#table_dlg.cols}</label></td>
+ <td><input id="cols" name="cols" type="text" value="" size="3" maxlength="3" class="required number min1 mceFocus" /></td>
+ <td><label id="rowslabel" for="rows">{#table_dlg.rows}</label></td>
<td><input id="rows" name="rows" type="text" value="" size="3" maxlength="3" class="required number min1" /></td>
</tr>
<tr>
- <td><label id="cellpaddinglabel" for="cellpadding">{$lang_table_cellpadding}</label></td>
+ <td><label id="cellpaddinglabel" for="cellpadding">{#table_dlg.cellpadding}</label></td>
<td><input id="cellpadding" name="cellpadding" type="text" value="" size="3" maxlength="3" class="number" /></td>
- <td><label id="cellspacinglabel" for="cellspacing">{$lang_table_cellspacing}</label></td>
+ <td><label id="cellspacinglabel" for="cellspacing">{#table_dlg.cellspacing}</label></td>
<td><input id="cellspacing" name="cellspacing" type="text" value="" size="3" maxlength="3" class="number" /></td>
</tr>
<tr>
- <td><label id="alignlabel" for="align">{$lang_table_align}</label></td>
+ <td><label id="alignlabel" for="align">{#table_dlg.align}</label></td>
<td><select id="align" name="align">
- <option value="">{$lang_not_set}</option>
- <option value="center">{$lang_table_align_middle}</option>
- <option value="left">{$lang_table_align_left}</option>
- <option value="right">{$lang_table_align_right}</option>
+ <option value="">{#not_set}</option>
+ <option value="center">{#table_dlg.align_middle}</option>
+ <option value="left">{#table_dlg.align_left}</option>
+ <option value="right">{#table_dlg.align_right}</option>
</select></td>
- <td><label id="borderlabel" for="border">{$lang_table_border}</label></td>
+ <td><label id="borderlabel" for="border">{#table_dlg.border}</label></td>
<td><input id="border" name="border" type="text" value="" size="3" maxlength="3" onchange="changedBorder();" class="number" /></td>
</tr>
<tr id="width_row">
- <td><label id="widthlabel" for="width">{$lang_table_width}</label></td>
+ <td><label id="widthlabel" for="width">{#table_dlg.width}</label></td>
<td><input name="width" type="text" id="width" value="" size="4" maxlength="4" onchange="changedSize();" class="size" /></td>
- <td><label id="heightlabel" for="height">{$lang_table_height}</label></td>
+ <td><label id="heightlabel" for="height">{#table_dlg.height}</label></td>
<td><input name="height" type="text" id="height" value="" size="4" maxlength="4" onchange="changedSize();" class="size" /></td>
</tr>
<tr id="styleSelectRow">
- <td><label id="classlabel" for="class">{$lang_class_name}</label></td>
+ <td><label id="classlabel" for="class">{#class_name}</label></td>
<td colspan="3">
- <select id="class" name="class">
- <option value="" selected>{$lang_not_set}</option>
+ <select id="class" name="class" class="mceEditableSelect">
+ <option value="" selected>{#not_set}</option>
</select></td>
</tr>
<tr>
- <td class="column1"><label for="caption">{$lang_table_caption}</label></td>
+ <td class="column1"><label for="caption">{#table_dlg.caption}</label></td>
<td><input id="caption" name="caption" type="checkbox" class="checkbox" value="true" /></td>
</tr>
</table>
@@ -70,44 +71,33 @@
<div id="advanced_panel" class="panel">
<fieldset>
- <legend>{$lang_table_advanced_props}</legend>
+ <legend>{#table_dlg.advanced_props}</legend>
<table border="0" cellpadding="0" cellspacing="4">
<tr>
- <td class="column1"><label for="id">{$lang_table_id}</label></td>
+ <td class="column1"><label for="id">{#table_dlg.id}</label></td>
<td><input id="id" name="id" type="text" value="" class="advfield" /></td>
</tr>
<tr>
- <td class="column1"><label for="summary">{$lang_table_summary}</label></td>
+ <td class="column1"><label for="summary">{#table_dlg.summary}</label></td>
<td><input id="summary" name="summary" type="text" value="" class="advfield" /></td>
</tr>
<tr>
- <td><label for="style">{$lang_table_style}</label></td>
+ <td><label for="style">{#table_dlg.style}</label></td>
<td><input type="text" id="style" name="style" value="" class="advfield" onchange="changedStyle();" /></td>
</tr>
<tr>
- <td class="column1"><label for="dir">{$lang_table_langdir}</label></td>
- <td>
- <select id="dir" name="dir" class="advfield">
- <option value="">{$lang_not_set}</option>
- <option value="ltr">{$lang_table_ltr}</option>
- <option value="rtl">{$lang_table_rtl}</option>
- </select>
- </td>
- </tr>
-
- <tr>
- <td class="column1"><label id="langlabel" for="lang">{$lang_table_langcode}</label></td>
+ <td class="column1"><label id="langlabel" for="lang">{#table_dlg.langcode}</label></td>
<td>
<input id="lang" name="lang" type="text" value="" class="advfield" />
</td>
</tr>
<tr>
- <td class="column1"><label for="backgroundimage">{$lang_table_bgimage}</label></td>
+ <td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
@@ -119,7 +109,50 @@
</tr>
<tr>
- <td class="column1"><label for="bordercolor">{$lang_table_bordercolor}</label></td>
+ <td class="column1"><label for="frame">{#table_dlg.frame}</label></td>
+ <td>
+ <select id="frame" name="frame" class="advfield">
+ <option value="">{#not_set}</option>
+ <option value="none">{#table_dlg.frame_none}</option>
+ <option value="groups">{#table_dlg.frame_groups}</option>
+ <option value="rows">{#table_dlg.frame_rows}</option>
+ <option value="cols">{#table_dlg.frame_cols}</option>
+ <option value="all">{#table_dlg.frame_all}</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="column1"><label for="rules">{#table_dlg.rules}</label></td>
+ <td>
+ <select id="rules" name="rules" class="advfield">
+ <option value="">{#not_set}</option>
+ <option value="void">{#table_dlg.rules_void}</option>
+ <option value="above">{#table_dlg.rules_above}</option>
+ <option value="below">{#table_dlg.rules_below}</option>
+ <option value="hsides">{#table_dlg.rules_hsides}</option>
+ <option value="lhs">{#table_dlg.rules_lhs}</option>
+ <option value="rhs">{#table_dlg.rules_rhs}</option>
+ <option value="vsides">{#table_dlg.rules_vsides}</option>
+ <option value="box">{#table_dlg.rules_box}</option>
+ <option value="border">{#table_dlg.rules_border}</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="column1"><label for="dir">{#table_dlg.langdir}</label></td>
+ <td>
+ <select id="dir" name="dir" class="advfield">
+ <option value="">{#not_set}</option>
+ <option value="ltr">{#table_dlg.ltr}</option>
+ <option value="rtl">{#table_dlg.rtl}</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="column1"><label for="bordercolor">{#table_dlg.bordercolor}</label></td>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
@@ -131,7 +164,7 @@
</tr>
<tr>
- <td class="column1"><label for="bgcolor">{$lang_table_bgcolor}</label></td>
+ <td class="column1"><label for="bgcolor">{#table_dlg.bgcolor}</label></td>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
@@ -148,11 +181,11 @@
<div class="mceActionPanel">
<div style="float: left">
- <input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertTable();" />
+ <input type="submit" id="insert" name="insert" value="{#insert}" />
</div>
<div style="float: right">
- <input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
</div>
</form>