mediawiki-extensions-Visual.../modules/es/tools/es.Tool.js

28 lines
700 B
JavaScript

es.Tool = function( toolbar ) {
this.$ = $( '<div>' ).addClass( 'es-toolbarTool' );
if ( !toolbar ) {
return;
}
var _this = this;
this.toolbar = toolbar;
this.toolbar.on( 'update', function( param ) {
var selection = _this.toolbar.surfaceView.currentSelection;
var annotations;
if( selection.from === selection.to ) {
annotations = _this.toolbar.surfaceView.documentView.model.getAnnotationsFromOffset(
selection.to
);
} else {
annotations = _this.toolbar.surfaceView.documentView.model.getAnnotationsFromRange(
selection
);
}
_this.updateState( selection, annotations );
} );
};
es.Tool.prototype.updateState = function () {
};