mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-26 07:15:32 +00:00
631323b9bd
* Added support for associating a selection with a state
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();
|
|
}
|
|
};
|