comparison media/js/tiny_mce/plugins/table/editor_plugin_src.js @ 247:6ed2932901fa

Update tinymce to 3.3.9
author Brian Neal <bgneal@gmail.com>
date Sat, 18 Sep 2010 19:54:11 +0000
parents 237710206167
children
comparison
equal deleted inserted replaced
246:e4dc0b649fcb 247:6ed2932901fa
9 */ 9 */
10 10
11 (function(tinymce) { 11 (function(tinymce) {
12 var each = tinymce.each; 12 var each = tinymce.each;
13 13
14 // Checks if the selection/caret is at the start of the specified block element
15 function isAtStart(rng, par) {
16 var doc = par.ownerDocument, rng2 = doc.createRange(), elm;
17
18 rng2.setStartBefore(par);
19 rng2.setEnd(rng.endContainer, rng.endOffset);
20
21 elm = doc.createElement('body');
22 elm.appendChild(rng2.cloneContents());
23
24 // Check for text characters of other elements that should be treated as content
25 return elm.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi, '-').replace(/<[^>]+>/g, '').length == 0;
26 };
27
14 /** 28 /**
15 * Table Grid class. 29 * Table Grid class.
16 */ 30 */
17 function TableGrid(table, dom, selection) { 31 function TableGrid(table, dom, selection) {
18 var grid, startPos, endPos, selectedCell; 32 var grid, startPos, endPos, selectedCell;
36 var startY = 0; 50 var startY = 0;
37 51
38 grid = []; 52 grid = [];
39 53
40 each(['thead', 'tbody', 'tfoot'], function(part) { 54 each(['thead', 'tbody', 'tfoot'], function(part) {
41 var rows = dom.select(part + ' tr', table); 55 var rows = dom.select('> ' + part + ' tr', table);
42 56
43 each(rows, function(tr, y) { 57 each(rows, function(tr, y) {
44 y += startY; 58 y += startY;
45 59
46 each(dom.select('td,th', tr), function(td, x) { 60 each(dom.select('> td, > th', tr), function(td, x) {
47 var x2, y2, rowspan, colspan; 61 var x2, y2, rowspan, colspan;
48 62
49 // Skip over existing cells produced by rowspan 63 // Skip over existing cells produced by rowspan
50 if (grid[y]) { 64 if (grid[y]) {
51 while (grid[y][x]) 65 while (grid[y][x])