includes/clientside/tinymce/plugins/table/js/table.js
changeset 778 57ce13805b6f
parent 588 20484deb89cd
child 1193 e3b94bd055dc
equal deleted inserted replaced
777:488665d49417 778:57ce13805b6f
    10 	var cellLimit, rowLimit, colLimit;
    10 	var cellLimit, rowLimit, colLimit;
    11 
    11 
    12 	tinyMCEPopup.restoreSelection();
    12 	tinyMCEPopup.restoreSelection();
    13 
    13 
    14 	if (!AutoValidator.validate(formObj)) {
    14 	if (!AutoValidator.validate(formObj)) {
    15 		alert(inst.getLang('invalid_data'));
    15 		tinyMCEPopup.alert(inst.getLang('invalid_data'));
    16 		return false;
    16 		return false;
    17 	}
    17 	}
    18 
    18 
    19 	elm = dom.getParent(inst.selection.getNode(), 'table');
    19 	elm = dom.getParent(inst.selection.getNode(), 'table');
    20 
    20 
    44 	rowLimit = tinyMCEPopup.getParam('table_row_limit', false);
    44 	rowLimit = tinyMCEPopup.getParam('table_row_limit', false);
    45 	colLimit = tinyMCEPopup.getParam('table_col_limit', false);
    45 	colLimit = tinyMCEPopup.getParam('table_col_limit', false);
    46 
    46 
    47 	// Validate table size
    47 	// Validate table size
    48 	if (colLimit && cols > colLimit) {
    48 	if (colLimit && cols > colLimit) {
    49 		inst.windowManager.alert(inst.getLang('table_dlg.col_limit').replace(/\{\$cols\}/g, colLimit));
    49 		tinyMCEPopup.alert(inst.getLang('table_dlg.col_limit').replace(/\{\$cols\}/g, colLimit));
    50 		return false;
    50 		return false;
    51 	} else if (rowLimit && rows > rowLimit) {
    51 	} else if (rowLimit && rows > rowLimit) {
    52 		inst.windowManager.alert(inst.getLang('table_dlg.row_limit').replace(/\{\$rows\}/g, rowLimit));
    52 		tinyMCEPopup.alert(inst.getLang('table_dlg.row_limit').replace(/\{\$rows\}/g, rowLimit));
    53 		return false;
    53 		return false;
    54 	} else if (cellLimit && cols * rows > cellLimit) {
    54 	} else if (cellLimit && cols * rows > cellLimit) {
    55 		inst.windowManager.alert(inst.getLang('table_dlg.cell_limit').replace(/\{\$cells\}/g, cellLimit));
    55 		tinyMCEPopup.alert(inst.getLang('table_dlg.cell_limit').replace(/\{\$cells\}/g, cellLimit));
    56 		return false;
    56 		return false;
    57 	}
    57 	}
    58 
    58 
    59 	// Update table
    59 	// Update table
    60 	if (action == "update") {
    60 	if (action == "update") {
    85 				capEl.innerHTML = '<br mce_bogus="1"/>';
    85 				capEl.innerHTML = '<br mce_bogus="1"/>';
    86 
    86 
    87 			elm.insertBefore(capEl, elm.firstChild);
    87 			elm.insertBefore(capEl, elm.firstChild);
    88 		}
    88 		}
    89 
    89 
    90 		if (width && /(pt|em|cm)$/.test(width)) {
    90 		if (width && inst.settings.inline_styles) {
    91 			dom.setStyle(elm, 'width', width);
    91 			dom.setStyle(elm, 'width', width);
    92 			dom.setAttrib(elm, 'width', '');
    92 			dom.setAttrib(elm, 'width', '');
    93 		} else {
    93 		} else {
    94 			dom.setAttrib(elm, 'width', width, true);
    94 			dom.setAttrib(elm, 'width', width, true);
    95 			dom.setStyle(elm, 'width', '');
    95 			dom.setStyle(elm, 'width', '');
    98 		// Remove these since they are not valid XHTML
    98 		// Remove these since they are not valid XHTML
    99 		dom.setAttrib(elm, 'borderColor', '');
    99 		dom.setAttrib(elm, 'borderColor', '');
   100 		dom.setAttrib(elm, 'bgColor', '');
   100 		dom.setAttrib(elm, 'bgColor', '');
   101 		dom.setAttrib(elm, 'background', '');
   101 		dom.setAttrib(elm, 'background', '');
   102 
   102 
   103 		if (height) {
   103 		if (height && inst.settings.inline_styles) {
   104 			dom.setStyle(elm, 'height', height);
   104 			dom.setStyle(elm, 'height', height);
   105 			dom.setAttrib(elm, 'height', '');
   105 			dom.setAttrib(elm, 'height', '');
   106 		}
   106 		} else {
       
   107 			dom.setAttrib(elm, 'height', height, true);
       
   108 			dom.setStyle(elm, 'height', '');
       
   109  		}
   107 
   110 
   108 		if (background != '')
   111 		if (background != '')
   109 			elm.style.backgroundImage = "url('" + background + "')";
   112 			elm.style.backgroundImage = "url('" + background + "')";
   110 		else
   113 		else
   111 			elm.style.backgroundImage = '';
   114 			elm.style.backgroundImage = '';
   147 	html += makeAttrib('id', id);
   150 	html += makeAttrib('id', id);
   148 	html += makeAttrib('border', border);
   151 	html += makeAttrib('border', border);
   149 	html += makeAttrib('cellpadding', cellpadding);
   152 	html += makeAttrib('cellpadding', cellpadding);
   150 	html += makeAttrib('cellspacing', cellspacing);
   153 	html += makeAttrib('cellspacing', cellspacing);
   151 
   154 
   152 	if (width && /(pt|em|cm)$/.test(width)) {
   155 	if (width && inst.settings.inline_styles) {
   153 		if (style)
   156 		if (style)
   154 			style += '; ';
   157 			style += '; ';
   155 
   158 
   156 		style += 'width: ' + width;
   159 		style += 'width: ' + width;
   157 	} else
   160 	} else