aboutsummaryrefslogtreecommitdiffstats
path: root/library/tinymce/jscripts/tiny_mce/plugins/table/js/cell.js
diff options
context:
space:
mode:
Diffstat (limited to 'library/tinymce/jscripts/tiny_mce/plugins/table/js/cell.js')
-rw-r--r--[-rwxr-xr-x]library/tinymce/jscripts/tiny_mce/plugins/table/js/cell.js55
1 files changed, 44 insertions, 11 deletions
diff --git a/library/tinymce/jscripts/tiny_mce/plugins/table/js/cell.js b/library/tinymce/jscripts/tiny_mce/plugins/table/js/cell.js
index b5fc1fda3..d6f329059 100755..100644
--- a/library/tinymce/jscripts/tiny_mce/plugins/table/js/cell.js
+++ b/library/tinymce/jscripts/tiny_mce/plugins/table/js/cell.js
@@ -63,6 +63,11 @@ function init() {
function updateAction() {
var el, inst = ed, tdElm, trElm, tableElm, formObj = document.forms[0];
+ if (!AutoValidator.validate(formObj)) {
+ tinyMCEPopup.alert(AutoValidator.getErrorMessages(formObj).join('. ') + '.');
+ return false;
+ }
+
tinyMCEPopup.restoreSelection();
el = ed.selection.getStart();
tdElm = ed.dom.getParent(el, "td,th");
@@ -83,8 +88,6 @@ function updateAction() {
return;
}
- ed.execCommand('mceBeginUndoLevel');
-
switch (getSelectValue(formObj, 'action')) {
case "cell":
var celltype = getSelectValue(formObj, 'celltype');
@@ -125,6 +128,36 @@ function updateAction() {
break;
+ case "col":
+ var curr, col = 0, cell = trElm.firstChild, rows = tableElm.getElementsByTagName("tr");
+
+ if (cell.nodeName != "TD" && cell.nodeName != "TH")
+ cell = nextCell(cell);
+
+ do {
+ if (cell == tdElm)
+ break;
+ col += cell.getAttribute("colspan");
+ } while ((cell = nextCell(cell)) != null);
+
+ for (var i=0; i<rows.length; i++) {
+ cell = rows[i].firstChild;
+
+ if (cell.nodeName != "TD" && cell.nodeName != "TH")
+ cell = nextCell(cell);
+
+ curr = 0;
+ do {
+ if (curr == col) {
+ cell = updateCell(cell, true);
+ break;
+ }
+ curr += cell.getAttribute("colspan");
+ } while ((cell = nextCell(cell)) != null);
+ }
+
+ break;
+
case "all":
var rows = tableElm.getElementsByTagName("tr");
@@ -166,15 +199,15 @@ function updateCell(td, skip_id) {
var dom = ed.dom;
if (!skip_id)
- td.setAttribute('id', formObj.id.value);
-
- td.setAttribute('align', formObj.align.value);
- td.setAttribute('vAlign', formObj.valign.value);
- td.setAttribute('lang', formObj.lang.value);
- td.setAttribute('dir', getSelectValue(formObj, 'dir'));
- td.setAttribute('style', ed.dom.serializeStyle(ed.dom.parseStyle(formObj.style.value)));
- td.setAttribute('scope', formObj.scope.value);
- ed.dom.setAttrib(td, 'class', getSelectValue(formObj, 'class'));
+ dom.setAttrib(td, 'id', formObj.id.value);
+
+ dom.setAttrib(td, 'align', formObj.align.value);
+ dom.setAttrib(td, 'vAlign', formObj.valign.value);
+ dom.setAttrib(td, 'lang', formObj.lang.value);
+ dom.setAttrib(td, 'dir', getSelectValue(formObj, 'dir'));
+ dom.setAttrib(td, 'style', ed.dom.serializeStyle(ed.dom.parseStyle(formObj.style.value)));
+ dom.setAttrib(td, 'scope', formObj.scope.value);
+ dom.setAttrib(td, 'class', getSelectValue(formObj, 'class'));
// Clear deprecated attributes
ed.dom.setAttrib(td, 'width', '');