Index: trunk/extensions/VisualEditor/contentEditable/main.js |
— | — | @@ -60,8 +60,73 @@ |
61 | 61 | 'content': { 'text': 'row 1 & cell 2' } |
62 | 62 | } |
63 | 63 | ] |
64 | | - } |
| 64 | + }, |
| 65 | + { |
| 66 | + 'type': 'tableCell', |
| 67 | + 'attributes': { 'html/style': 'border: solid 1px;' }, |
| 68 | + 'children': [ |
| 69 | + { |
| 70 | + 'type': 'paragraph', |
| 71 | + 'content': { 'text': 'row 1 & cell 3' } |
| 72 | + } |
| 73 | + ] |
| 74 | + }, |
| 75 | + { |
| 76 | + 'type': 'tableCell', |
| 77 | + 'attributes': { 'html/style': 'border: solid 1px;' }, |
| 78 | + 'children': [ |
| 79 | + { |
| 80 | + 'type': 'paragraph', |
| 81 | + 'content': { 'text': 'row 1 & cell 4' } |
| 82 | + } |
| 83 | + ] |
| 84 | + } |
65 | 85 | ] |
| 86 | + }, |
| 87 | + { |
| 88 | + 'type': 'tableRow', |
| 89 | + 'children': [ |
| 90 | + { |
| 91 | + 'type': 'tableCell', |
| 92 | + 'attributes': { 'html/style': 'border: solid 1px;' }, |
| 93 | + 'children': [ |
| 94 | + { |
| 95 | + 'type': 'paragraph', |
| 96 | + 'content': { 'text': 'row 2 & cell 1' } |
| 97 | + } |
| 98 | + ] |
| 99 | + }, |
| 100 | + { |
| 101 | + 'type': 'tableCell', |
| 102 | + 'attributes': { 'html/style': 'border: solid 1px;' }, |
| 103 | + 'children': [ |
| 104 | + { |
| 105 | + 'type': 'paragraph', |
| 106 | + 'content': { 'text': 'row 2 & cell 2' } |
| 107 | + } |
| 108 | + ] |
| 109 | + }, |
| 110 | + { |
| 111 | + 'type': 'tableCell', |
| 112 | + 'attributes': { 'html/style': 'border: solid 1px;' }, |
| 113 | + 'children': [ |
| 114 | + { |
| 115 | + 'type': 'paragraph', |
| 116 | + 'content': { 'text': 'row 2 & cell 3' } |
| 117 | + } |
| 118 | + ] |
| 119 | + }, |
| 120 | + { |
| 121 | + 'type': 'tableCell', |
| 122 | + 'attributes': { 'html/style': 'border: solid 1px;' }, |
| 123 | + 'children': [ |
| 124 | + { |
| 125 | + 'type': 'paragraph', |
| 126 | + 'content': { 'text': 'row 2 & cell 4' } |
| 127 | + } |
| 128 | + ] |
| 129 | + } |
| 130 | + ] |
66 | 131 | } |
67 | 132 | ] |
68 | 133 | }, |
Index: trunk/extensions/VisualEditor/contentEditable/views/es.TableCellView.js |
— | — | @@ -10,10 +10,23 @@ |
11 | 11 | // Inheritance |
12 | 12 | es.DocumentViewBranchNode.call( this, model, $( '<td>' ) ); |
13 | 13 | |
| 14 | + var _this = this; |
| 15 | + |
14 | 16 | // DOM Changes |
15 | 17 | this.$ |
16 | 18 | .attr( 'style', model.getElementAttribute( 'html/style' ) ) |
17 | 19 | .addClass( 'es-tableCellView' ); |
| 20 | + |
| 21 | + /* Table interaction experiment */ |
| 22 | + /* |
| 23 | + this.$.mousedown( function( e ) { |
| 24 | + _this.mousedown( e ); |
| 25 | + } ); |
| 26 | + this.$.mouseup( function( e ) { |
| 27 | + _this.mouseup( e ); |
| 28 | + } ); |
| 29 | + */ |
| 30 | + |
18 | 31 | }; |
19 | 32 | |
20 | 33 | /* Registration */ |
— | — | @@ -26,3 +39,35 @@ |
27 | 40 | /* Inheritance */ |
28 | 41 | |
29 | 42 | es.extendClass( es.TableCellView, es.DocumentViewBranchNode ); |
| 43 | + |
| 44 | + |
| 45 | +/* Table interaction experiment */ |
| 46 | +/* |
| 47 | +es.TableCellView.prototype.mousedown = function( e ) { |
| 48 | + |
| 49 | + if ( this.$.hasClass('selected') ) { |
| 50 | + $(document.body).css('-webkit-user-select', 'auto'); |
| 51 | + this.giveCursor = true; |
| 52 | + } else { |
| 53 | + e.preventDefault(); |
| 54 | + window.getSelection().removeAllRanges(); |
| 55 | + this.giveCursor = false; |
| 56 | + $(document.body).css('-webkit-user-select', 'none'); |
| 57 | + if ( e.metaKey ) { |
| 58 | + |
| 59 | + } else if ( e.shiftKey ) { |
| 60 | + |
| 61 | + } else { |
| 62 | + this.getParent().getParent().$.find('.es-tableCellView.selected').removeClass('selected'); |
| 63 | + } |
| 64 | + } |
| 65 | + this.$.addClass('selected'); |
| 66 | +} |
| 67 | + |
| 68 | +es.TableCellView.prototype.mouseup = function( e ) { |
| 69 | + if ( this.giveCursor ) { |
| 70 | + this.getParent().getParent().$.find('.es-tableCellView.selected').removeClass('selected'); |
| 71 | + } else { |
| 72 | + } |
| 73 | +} |
| 74 | +*/ |
\ No newline at end of file |