Upgrade TinyMCE to 3.2.7. Fixes bug #10993.

This commit is contained in:
Colin Kuskie 2009-10-16 13:50:14 -07:00
parent dae7215922
commit a2a2bac440
140 changed files with 8023 additions and 3591 deletions

View file

@ -32,6 +32,8 @@ function init() {
// Setup form
addClassesToList('class', 'table_cell_styles');
TinyMCE_EditableSelects.init();
formObj.bordercolor.value = bordercolor;
formObj.bgcolor.value = bgcolor;
formObj.backgroundimage.value = backgroundimage;
@ -42,7 +44,7 @@ function init() {
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);
@ -56,12 +58,13 @@ function init() {
}
function updateAction() {
var el = ed.selection.getNode();
var inst = ed;
var tdElm = ed.dom.getParent(el, "td,th");
var trElm = ed.dom.getParent(el, "tr");
var tableElm = ed.dom.getParent(el, "table");
var formObj = document.forms[0];
var el, inst = ed, tdElm, trElm, tableElm, 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");
ed.execCommand('mceBeginUndoLevel');
@ -70,14 +73,24 @@ function updateAction() {
var celltype = getSelectValue(formObj, 'celltype');
var scope = getSelectValue(formObj, 'scope');
if (ed.getParam("accessibility_warnings")) {
if (celltype == "th" && scope == "")
var answer = confirm(ed.getLang('table_dlg.missing_scope', '', true));
else
var answer = true;
function doUpdate(s) {
if (s) {
updateCell(tdElm);
if (!answer)
return;
ed.addVisual();
ed.nodeChanged();
inst.execCommand('mceEndUndoLevel');
tinyMCEPopup.close();
}
};
if (ed.getParam("accessibility_warnings", 1)) {
if (celltype == "th" && scope == "")
tinyMCEPopup.confirm(ed.getLang('table_dlg.missing_scope', '', true), doUpdate);
else
doUpdate(1);
return;
}
updateCell(tdElm);

View file

@ -6,14 +6,16 @@ function init() {
tinyMCEPopup.resizeToInnerSize();
f.numcols.value = tinyMCEPopup.getWindowArg('numcols', 1);
f.numrows.value = tinyMCEPopup.getWindowArg('numcols', 1);
f.numrows.value = tinyMCEPopup.getWindowArg('numrows', 1);
}
function mergeCells() {
var args = [], f = document.forms[0];
tinyMCEPopup.restoreSelection();
if (!AutoValidator.validate(f)) {
alert(tinyMCEPopup.getLang('invalid_data'));
tinyMCEPopup.alert(tinyMCEPopup.getLang('invalid_data'));
return false;
}

View file

@ -26,6 +26,8 @@ function init() {
// Setup form
addClassesToList('class', 'table_row_styles');
TinyMCE_EditableSelects.init();
formObj.bgcolor.value = bgcolor;
formObj.backgroundimage.value = backgroundimage;
formObj.height.value = height;
@ -34,7 +36,7 @@ function init() {
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);
@ -46,13 +48,13 @@ function init() {
}
function updateAction() {
var inst = tinyMCEPopup.editor;
var dom = inst.dom;
var trElm = dom.getParent(inst.selection.getNode(), "tr");
var tableElm = dom.getParent(inst.selection.getNode(), "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) {

View file

@ -9,8 +9,10 @@ function insertTable() {
var html = '', capEl, elm;
var cellLimit, rowLimit, colLimit;
tinyMCEPopup.restoreSelection();
if (!AutoValidator.validate(formObj)) {
alert(inst.getLang('invalid_data'));
tinyMCEPopup.alert(inst.getLang('invalid_data'));
return false;
}
@ -22,14 +24,14 @@ function insertTable() {
border = formObj.elements['border'].value != "" ? formObj.elements['border'].value : 0;
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;
align = getSelectValue(formObj, "align");
frame = getSelectValue(formObj, "tframe");
rules = getSelectValue(formObj, "rules");
width = formObj.elements['width'].value;
height = formObj.elements['height'].value;
bordercolor = formObj.elements['bordercolor'].value;
bgcolor = formObj.elements['bgcolor'].value;
className = formObj.elements['class'].options[formObj.elements['class'].selectedIndex].value;
className = getSelectValue(formObj, "class");
id = formObj.elements['id'].value;
summary = formObj.elements['summary'].value;
style = formObj.elements['style'].value;
@ -44,13 +46,13 @@ function insertTable() {
// Validate table size
if (colLimit && cols > colLimit) {
alert(inst.getLang('table_col_limit', '', true, {cols : colLimit}));
tinyMCEPopup.alert(inst.getLang('table_dlg.col_limit').replace(/\{\$cols\}/g, colLimit));
return false;
} else if (rowLimit && rows > rowLimit) {
alert(inst.getLang('table_row_limit', '', true, {rows : rowLimit}));
tinyMCEPopup.alert(inst.getLang('table_dlg.row_limit').replace(/\{\$rows\}/g, rowLimit));
return false;
} else if (cellLimit && cols * rows > cellLimit) {
alert(inst.getLang('table_cell_limit', '', true, {cells : cellLimit}));
tinyMCEPopup.alert(inst.getLang('table_dlg.cell_limit').replace(/\{\$cells\}/g, cellLimit));
return false;
}
@ -85,7 +87,7 @@ function insertTable() {
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 {
@ -98,10 +100,13 @@ function insertTable() {
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 + "')";
@ -147,10 +152,14 @@ function insertTable() {
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
html += makeAttrib('width', width);
@ -198,7 +207,30 @@ function insertTable() {
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');
@ -286,12 +318,13 @@ function init() {
}
addClassesToList('class', "table_styles");
TinyMCE_EditableSelects.init();
// Update form
selectByValue(formObj, 'align', align);
selectByValue(formObj, 'frame', frame);
selectByValue(formObj, 'tframe', frame);
selectByValue(formObj, 'rules', rules);
selectByValue(formObj, 'class', className);
selectByValue(formObj, 'class', className, true, true);
formObj.cols.value = cols;
formObj.rows.value = rows;
formObj.border.value = border;