mediawiki-extensions-Visual.../contentEditable/views/es.TableCellView.js

73 lines
1.5 KiB
JavaScript
Raw Normal View History

2012-02-01 22:22:16 +00:00
/**
* Creates an es.TableCellView object.
*
* @class
* @constructor
* @extends {es.DocumentViewBranchNode}
* @param {es.TableCellModel} model Table cell model to view
*/
es.TableCellView = function( model ) {
// Inheritance
es.DocumentViewBranchNode.call( this, model, $( '<td>' ) );
2012-02-02 21:28:43 +00:00
var _this = this;
2012-02-01 22:22:16 +00:00
// DOM Changes
this.$
.attr( 'style', model.getElementAttribute( 'html/style' ) )
.addClass( 'es-tableCellView' );
2012-02-02 21:28:43 +00:00
/* Table interaction experiment */
/*
this.$.mousedown( function( e ) {
_this.mousedown( e );
} );
this.$.mouseup( function( e ) {
_this.mouseup( e );
} );
*/
2012-02-01 22:22:16 +00:00
};
/* Registration */
es.DocumentView.splitRules.tableCell = {
'self': false,
'children': true
};
/* Inheritance */
es.extendClass( es.TableCellView, es.DocumentViewBranchNode );
2012-02-02 21:28:43 +00:00
/* 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 {
}
}
*/