mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-25 11:16:51 +00:00
experimentation with table editing
This commit is contained in:
parent
92670e1aa3
commit
60e1f366a0
Notes:
Gabriel Wicke
2012-02-27 16:40:01 +00:00
|
@ -60,7 +60,72 @@ $(document).ready( function() {
|
|||
'content': { 'text': 'row 1 & cell 2' }
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
'type': 'tableCell',
|
||||
'attributes': { 'html/style': 'border: solid 1px;' },
|
||||
'children': [
|
||||
{
|
||||
'type': 'paragraph',
|
||||
'content': { 'text': 'row 1 & cell 3' }
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
'type': 'tableCell',
|
||||
'attributes': { 'html/style': 'border: solid 1px;' },
|
||||
'children': [
|
||||
{
|
||||
'type': 'paragraph',
|
||||
'content': { 'text': 'row 1 & cell 4' }
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
'type': 'tableRow',
|
||||
'children': [
|
||||
{
|
||||
'type': 'tableCell',
|
||||
'attributes': { 'html/style': 'border: solid 1px;' },
|
||||
'children': [
|
||||
{
|
||||
'type': 'paragraph',
|
||||
'content': { 'text': 'row 2 & cell 1' }
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
'type': 'tableCell',
|
||||
'attributes': { 'html/style': 'border: solid 1px;' },
|
||||
'children': [
|
||||
{
|
||||
'type': 'paragraph',
|
||||
'content': { 'text': 'row 2 & cell 2' }
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
'type': 'tableCell',
|
||||
'attributes': { 'html/style': 'border: solid 1px;' },
|
||||
'children': [
|
||||
{
|
||||
'type': 'paragraph',
|
||||
'content': { 'text': 'row 2 & cell 3' }
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
'type': 'tableCell',
|
||||
'attributes': { 'html/style': 'border: solid 1px;' },
|
||||
'children': [
|
||||
{
|
||||
'type': 'paragraph',
|
||||
'content': { 'text': 'row 2 & cell 4' }
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
|
@ -10,10 +10,23 @@ es.TableCellView = function( model ) {
|
|||
// Inheritance
|
||||
es.DocumentViewBranchNode.call( this, model, $( '<td>' ) );
|
||||
|
||||
var _this = this;
|
||||
|
||||
// DOM Changes
|
||||
this.$
|
||||
.attr( 'style', model.getElementAttribute( 'html/style' ) )
|
||||
.addClass( 'es-tableCellView' );
|
||||
|
||||
/* Table interaction experiment */
|
||||
/*
|
||||
this.$.mousedown( function( e ) {
|
||||
_this.mousedown( e );
|
||||
} );
|
||||
this.$.mouseup( function( e ) {
|
||||
_this.mouseup( e );
|
||||
} );
|
||||
*/
|
||||
|
||||
};
|
||||
|
||||
/* Registration */
|
||||
|
@ -26,3 +39,35 @@ es.DocumentView.splitRules.tableCell = {
|
|||
/* Inheritance */
|
||||
|
||||
es.extendClass( es.TableCellView, es.DocumentViewBranchNode );
|
||||
|
||||
|
||||
/* Table interaction experiment */
|
||||
/*
|
||||
es.TableCellView.prototype.mousedown = function( e ) {
|
||||
|
||||
if ( this.$.hasClass('selected') ) {
|
||||
$(document.body).css('-webkit-user-select', 'auto');
|
||||
this.giveCursor = true;
|
||||
} else {
|
||||
e.preventDefault();
|
||||
window.getSelection().removeAllRanges();
|
||||
this.giveCursor = false;
|
||||
$(document.body).css('-webkit-user-select', 'none');
|
||||
if ( e.metaKey ) {
|
||||
|
||||
} else if ( e.shiftKey ) {
|
||||
|
||||
} else {
|
||||
this.getParent().getParent().$.find('.es-tableCellView.selected').removeClass('selected');
|
||||
}
|
||||
}
|
||||
this.$.addClass('selected');
|
||||
}
|
||||
|
||||
es.TableCellView.prototype.mouseup = function( e ) {
|
||||
if ( this.giveCursor ) {
|
||||
this.getParent().getParent().$.find('.es-tableCellView.selected').removeClass('selected');
|
||||
} else {
|
||||
}
|
||||
}
|
||||
*/
|
Loading…
Reference in a new issue