From 29da6414db77512106250b9832a0b4a0168bd7eb Mon Sep 17 00:00:00 2001 From: alecpl <alec@alec.pl> Date: Mon, 27 Apr 2009 03:36:26 -0400 Subject: [PATCH] - Updated TinyMCE to 3.2.3 version --- program/js/tiny_mce/plugins/table/js/table.js | 48 +++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 39 insertions(+), 9 deletions(-) diff --git a/program/js/tiny_mce/plugins/table/js/table.js b/program/js/tiny_mce/plugins/table/js/table.js index a8e112c..2b6fd1f 100644 --- a/program/js/tiny_mce/plugins/table/js/table.js +++ b/program/js/tiny_mce/plugins/table/js/table.js @@ -12,7 +12,7 @@ tinyMCEPopup.restoreSelection(); if (!AutoValidator.validate(formObj)) { - alert(inst.getLang('invalid_data')); + tinyMCEPopup.alert(inst.getLang('invalid_data')); return false; } @@ -46,13 +46,13 @@ // Validate table size if (colLimit && cols > colLimit) { - inst.windowManager.alert(inst.getLang('table_dlg.col_limit').replace(/\{\$cols\}/g, colLimit)); + tinyMCEPopup.alert(inst.getLang('table_dlg.col_limit').replace(/\{\$cols\}/g, colLimit)); return false; } else if (rowLimit && rows > rowLimit) { - inst.windowManager.alert(inst.getLang('table_dlg.row_limit').replace(/\{\$rows\}/g, rowLimit)); + tinyMCEPopup.alert(inst.getLang('table_dlg.row_limit').replace(/\{\$rows\}/g, rowLimit)); return false; } else if (cellLimit && cols * rows > cellLimit) { - inst.windowManager.alert(inst.getLang('table_dlg.cell_limit').replace(/\{\$cells\}/g, cellLimit)); + tinyMCEPopup.alert(inst.getLang('table_dlg.cell_limit').replace(/\{\$cells\}/g, cellLimit)); return false; } @@ -87,7 +87,7 @@ elm.insertBefore(capEl, elm.firstChild); } - if (width && /(pt|em|cm)$/.test(width)) { + if (width && inst.settings.inline_styles) { dom.setStyle(elm, 'width', width); dom.setAttrib(elm, 'width', ''); } else { @@ -100,10 +100,13 @@ dom.setAttrib(elm, 'bgColor', ''); dom.setAttrib(elm, 'background', ''); - if (height) { + if (height && inst.settings.inline_styles) { dom.setStyle(elm, 'height', height); dom.setAttrib(elm, 'height', ''); - } + } else { + dom.setAttrib(elm, 'height', height, true); + dom.setStyle(elm, 'height', ''); + } if (background != '') elm.style.backgroundImage = "url('" + background + "')"; @@ -149,9 +152,13 @@ html += makeAttrib('cellpadding', cellpadding); html += makeAttrib('cellspacing', cellspacing); - if (width && /(pt|em|cm)$/.test(width)) { + if (width && inst.settings.inline_styles) { if (style) style += '; '; + + // Force px + if (/[0-9\.]+/.test(width)) + width += 'px'; style += 'width: ' + width; } else @@ -200,7 +207,30 @@ html += "</table>"; inst.execCommand('mceBeginUndoLevel'); - inst.execCommand('mceInsertContent', false, html); + + // Move table + if (inst.settings.fix_table_elements) { + var bm = inst.selection.getBookmark(), patt = ''; + + inst.execCommand('mceInsertContent', false, '<br class="_mce_marker" />'); + + tinymce.each('h1,h2,h3,h4,h5,h6,p'.split(','), function(n) { + if (patt) + patt += ','; + + patt += n + ' ._mce_marker'; + }); + + tinymce.each(inst.dom.select(patt), function(n) { + inst.dom.split(inst.dom.getParent(n, 'h1,h2,h3,h4,h5,h6,p'), n); + }); + + dom.setOuterHTML(dom.select('._mce_marker')[0], html); + + inst.selection.moveToBookmark(bm); + } else + inst.execCommand('mceInsertContent', false, html); + inst.addVisual(); inst.execCommand('mceEndUndoLevel'); -- Gitblit v1.9.1