Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

3.4.7 plone #10

Open
wants to merge 4 commits into from

1 participant

Joscha Krutzki
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
6 changelog_plone.txt
@@ -5,5 +5,11 @@ HISTORY
5 5 3.4.3-plone
6 6 -----------
7 7
  8 +- More stable more stable form_utils
  9 + [joka]
  10 +
  11 +- More stable table plugin; IE9 fixes
  12 + [joka]
  13 +
8 14 - Fix transparent line appearing in popups near the title
9 15 [iElectric]
44 jscripts/tiny_mce/plugins/table/js/cell.js
@@ -16,6 +16,8 @@ function init() {
16 16 var st = ed.dom.parseStyle(ed.dom.getAttrib(tdElm, "style"));
17 17
18 18 // Get table cell data
  19 + var celltype = tdElm.nodeName.toLowerCase();
  20 + var align = ed.dom.getAttrib(tdElm, 'align');
19 21 var valign = ed.dom.getAttrib(tdElm, 'valign');
20 22 var width = trimSize(getStyle(tdElm, 'width', 'width'));
21 23 var height = trimSize(getStyle(tdElm, 'height', 'height'));
@@ -29,6 +31,7 @@ function init() {
29 31 var scope = ed.dom.getAttrib(tdElm, 'scope');
30 32
31 33 // Setup form
  34 + addClassesToList('class', 'table_cell_styles');
32 35 TinyMCE_EditableSelects.init();
33 36
34 37 if (!ed.dom.hasClass(tdElm, 'mceSelected')) {
@@ -60,7 +63,7 @@ function init() {
60 63 function updateAction() {
61 64 var el, inst = ed, tdElm, trElm, tableElm, formObj = document.forms[0];
62 65
63   - if (!AutoValidator.validate(formObj)) {
  66 + if ( ((typeof AutoValidator)!=='undefined') && !AutoValidator.validate(formObj)) {
64 67 tinyMCEPopup.alert(AutoValidator.getErrorMessages(formObj).join('. ') + '.');
65 68 return false;
66 69 }
@@ -87,8 +90,29 @@ function updateAction() {
87 90
88 91 switch (getSelectValue(formObj, 'action')) {
89 92 case "cell":
  93 + var celltype = getSelectValue(formObj, 'celltype');
90 94 var scope = getSelectValue(formObj, 'scope');
91 95
  96 + function doUpdate(s) {
  97 + if (s) {
  98 + updateCell(tdElm);
  99 +
  100 + ed.addVisual();
  101 + ed.nodeChanged();
  102 + inst.execCommand('mceEndUndoLevel');
  103 + tinyMCEPopup.close();
  104 + }
  105 + };
  106 +
  107 + if (ed.getParam("accessibility_warnings", 1)) {
  108 + if (celltype == "th" && scope == "")
  109 + tinyMCEPopup.confirm(ed.getLang('table_dlg.missing_scope', '', true), doUpdate);
  110 + else
  111 + doUpdate(1);
  112 +
  113 + return;
  114 + }
  115 +
92 116 updateCell(tdElm);
93 117 break;
94 118
@@ -169,13 +193,15 @@ function nextCell(elm) {
169 193 function updateCell(td, skip_id) {
170 194 var inst = ed;
171 195 var formObj = document.forms[0];
  196 + var curCellType = td.nodeName.toLowerCase();
  197 + var celltype = String(getSelectValue(formObj, 'celltype'));
172 198 var doc = inst.getDoc();
173 199 var dom = ed.dom;
174 200
175 201 if (!skip_id)
176 202 dom.setAttrib(td, 'id', formObj.id.value);
177 203
178   - dom.setAttrib(td, 'align', formObj.align.value);
  204 +// dom.setAttrib(td, 'align', formObj.align.value);
179 205 dom.setAttrib(td, 'vAlign', formObj.valign.value);
180 206 dom.setAttrib(td, 'lang', formObj.lang.value);
181 207 dom.setAttrib(td, 'dir', getSelectValue(formObj, 'dir'));
@@ -207,6 +233,20 @@ function updateCell(td, skip_id) {
207 233 else
208 234 td.style.backgroundImage = '';
209 235
  236 + if (curCellType != celltype && celltype!="") {
  237 + // changing to a different node type
  238 + var newCell = doc.createElement(celltype);
  239 +
  240 + for (var c=0; c<td.childNodes.length; c++)
  241 + newCell.appendChild(td.childNodes[c].cloneNode(1));
  242 +
  243 + for (var a=0; a<td.attributes.length; a++)
  244 + ed.dom.setAttrib(newCell, td.attributes[a].name, ed.dom.getAttrib(td, td.attributes[a].name));
  245 +
  246 + td.parentNode.replaceChild(newCell, td);
  247 + td = newCell;
  248 + }
  249 +
210 250 dom.setAttrib(td, 'style', dom.serializeStyle(dom.parseStyle(td.style.cssText)));
211 251
212 252 return td;
4 jscripts/tiny_mce/plugins/table/js/row.js
@@ -14,8 +14,10 @@ function init() {
14 14
15 15 // Get table row data
16 16 var rowtype = trElm.parentNode.nodeName.toLowerCase();
  17 + var align = dom.getAttrib(trElm, 'align');
17 18 var valign = dom.getAttrib(trElm, 'valign');
18 19 var height = trimSize(getStyle(trElm, 'height', 'height'));
  20 + var className = dom.getAttrib(trElm, 'class');
19 21 var bgcolor = convertRGBToHex(getStyle(trElm, 'bgcolor', 'backgroundColor'));
20 22 var backgroundimage = getStyle(trElm, 'background', 'backgroundImage').replace(new RegExp("url\\(['\"]?([^'\"]*)['\"]?\\)", 'gi'), "$1");
21 23 var id = dom.getAttrib(trElm, 'id');
@@ -54,7 +56,7 @@ function updateAction() {
54 56 var inst = tinyMCEPopup.editor, dom = inst.dom, trElm, tableElm, formObj = document.forms[0];
55 57 var action = getSelectValue(formObj, 'action');
56 58
57   - if (!AutoValidator.validate(formObj)) {
  59 + if ( ((typeof AutoValidator)!=='undefined') && !AutoValidator.validate(formObj)) {
58 60 tinyMCEPopup.alert(AutoValidator.getErrorMessages(formObj).join('. ') + '.');
59 61 return false;
60 62 }
21 jscripts/tiny_mce/plugins/table/js/table.js
@@ -78,7 +78,7 @@ function insertTable() {
78 78 }
79 79
80 80 dom.setAttrib(elm, 'align', align);
81   - dom.setAttrib(elm, 'tframe', frame);
  81 + dom.setAttrib(elm, 'frame', frame);
82 82 dom.setAttrib(elm, 'rules', rules);
83 83 dom.setAttrib(elm, 'class', className);
84 84 dom.setAttrib(elm, 'style', style);
@@ -247,8 +247,12 @@ function insertTable() {
247 247 inst.execCommand('mceInsertContent', false, html);
248 248
249 249 tinymce.each(dom.select('table[data-mce-new]'), function(node) {
250   - var tdorth = dom.select('td,th', node);
  250 + // Fixes a bug in IE where the caret cannot be placed after the table if the table is at the end of the document
  251 + if (tinymce.isIE && node.nextSibling == null) {
  252 + dom.insertAfter(dom.create('p'), node);
  253 + }
251 254
  255 + var tdorth = dom.select('td,th', node);
252 256 try {
253 257 // IE9 might fail to do this selection
254 258 inst.selection.setCursorLocation(tdorth[0], 0);
@@ -303,6 +307,15 @@ function init() {
303 307 var formObj = document.forms[0];
304 308 var elm = dom.getParent(inst.selection.getNode(), "table");
305 309
  310 + /*
  311 + * hide class selection
  312 + */
  313 + var classElement = dom.select('#general_panel>div:first', formObj);
  314 + if (classElement!=null && classElement!=undefined && classElement.length>0) {
  315 + dom.hide(classElement);
  316 + }
  317 +
  318 +
306 319 action = tinyMCEPopup.getWindowArg('action');
307 320
308 321 if (!action)
@@ -350,7 +363,7 @@ function init() {
350 363
351 364 // Update form
352 365 selectByValue(formObj, 'align', align);
353   - selectByValue(formObj, 'frame', frame);
  366 + selectByValue(formObj, 'tframe', frame);
354 367 selectByValue(formObj, 'rules', rules);
355 368 selectByValue(formObj, 'class', className, true, true);
356 369 formObj.cols.value = cols;
@@ -438,6 +451,8 @@ function changedBorder() {
438 451 st['border-width'] = '';
439 452 }
440 453 }
  454 +
  455 + formObj.style.value = dom.serializeStyle(st);
441 456 }
442 457
443 458 function changedColor() {
33 jscripts/tiny_mce/utils/form_utils.js
@@ -115,34 +115,35 @@ function addSelectValue(form_obj, field_name, name, value) {
115 115 function addClassesToList(list_id, specific_option) {
116 116 // Setup class droplist
117 117 var styleSelectElm = document.getElementById(list_id);
118   - var styles = tinyMCEPopup.getParam('theme_advanced_styles', false);
119   - styles = tinyMCEPopup.getParam(specific_option, styles);
  118 + if (styleSelectElm!=null) {
  119 + var styles = tinyMCEPopup.getParam('theme_advanced_styles', false);
  120 + styles = tinyMCEPopup.getParam(specific_option, styles);
120 121
121   - if (styles) {
122   - var stylesAr = styles.split(';');
  122 + if (styles) {
  123 + var stylesAr = styles.split(';');
123 124
124   - for (var i=0; i<stylesAr.length; i++) {
125   - if (stylesAr != "") {
126   - var key, value;
  125 + for (var i=0; i<stylesAr.length; i++) {
  126 + if (stylesAr != "") {
  127 + var key, value;
127 128
128   - key = stylesAr[i].split('=')[0];
129   - value = stylesAr[i].split('=')[1];
  129 + key = stylesAr[i].split('=')[0];
  130 + value = stylesAr[i].split('=')[1];
130 131
131   - styleSelectElm.options[styleSelectElm.length] = new Option(key, value);
  132 + styleSelectElm.options[styleSelectElm.length] = new Option(key, value);
  133 + }
132 134 }
  135 + } else {
  136 + tinymce.each(tinyMCEPopup.editor.dom.getClasses(), function(o) {
  137 + styleSelectElm.options[styleSelectElm.length] = new Option(o.title || o['class'], o['class']);
  138 + });
133 139 }
134   - } else {
135   - tinymce.each(tinyMCEPopup.editor.dom.getClasses(), function(o) {
136   - styleSelectElm.options[styleSelectElm.length] = new Option(o.title || o['class'], o['class']);
137   - });
138 140 }
139 141 }
140 142
141 143 function isVisible(element_id) {
142 144 var elm = document.getElementById(element_id);
143 145
144   - // elm.style.display can be an empty string if the panel is hidden and has never been shown
145   - return elm && (elm.style.display == "block" || elm.style.display == "inline" || elm.style.display == "list-element");
  146 + return elm && elm.style.display != "none";
146 147 }
147 148
148 149 function convertRGBToHex(col) {

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.