mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-26 15:21:51 +00:00
32 lines
673 B
JavaScript
32 lines
673 B
JavaScript
|
/**
|
||
|
* Creates an es.HistoryStateModel object.
|
||
|
*
|
||
|
* @class
|
||
|
* @constructor
|
||
|
*/
|
||
|
es.HistoryStateModel = function() {
|
||
|
this.transactions = [];
|
||
|
this.selection = null;
|
||
|
};
|
||
|
|
||
|
/* Methods */
|
||
|
|
||
|
es.HistoryStateModel.prototype.getSelection = function() {
|
||
|
return this.selection;
|
||
|
};
|
||
|
|
||
|
es.HistoryStateModel.prototype.getTransactions = function() {
|
||
|
return this.transactions;
|
||
|
};
|
||
|
|
||
|
es.HistoryStateModel.prototype.getTransactionCount = function() {
|
||
|
return this.transactions.length;
|
||
|
};
|
||
|
|
||
|
es.HistoryStateModel.prototype.pushTransaction = function( transaction, selection ) {
|
||
|
this.transactions.push( transaction );
|
||
|
if ( selection !== undefined ) {
|
||
|
this.selection = selection.clone();
|
||
|
}
|
||
|
};
|