| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
ve.ui.HistoryTool = function VeUiHistoryTool() { |
| 17 |
|
| 18 |
ve.ui.HistoryTool.super.apply( this, arguments ); |
| 19 |
|
| 20 |
|
| 21 |
this.toolbar.connect( this, { surfaceChange: 'onSurfaceChange' } ); |
| 22 |
}; |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
OO.inheritClass( ve.ui.HistoryTool, ve.ui.Tool ); |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
ve.ui.HistoryTool.prototype.onSurfaceChange = function ( oldSurface, newSurface ) { |
| 37 |
if ( oldSurface ) { |
| 38 |
oldSurface.getModel().disconnect( this ); |
| 39 |
} |
| 40 |
if ( newSurface ) { |
| 41 |
newSurface.getModel().connect( this, { history: 'onHistory' } ); |
| 42 |
this.onUpdateState( newSurface.getModel().getFragment() ); |
| 43 |
} |
| 44 |
}; |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
ve.ui.HistoryTool.prototype.onHistory = function () { |
| 50 |
this.onUpdateState( this.toolbar.getSurface().getModel().getFragment() ); |
| 51 |
}; |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
ve.ui.HistoryTool.prototype.destroy = function () { |
| 57 |
this.toolbar.getSurface().getModel().disconnect( this ); |
| 58 |
|
| 59 |
ve.ui.HistoryTool.super.prototype.destroy.call( this ); |
| 60 |
}; |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
ve.ui.UndoHistoryTool = function VeUiUndoHistoryTool() { |
| 72 |
|
| 73 |
ve.ui.UndoHistoryTool.super.apply( this, arguments ); |
| 74 |
}; |
| 75 |
OO.inheritClass( ve.ui.UndoHistoryTool, ve.ui.HistoryTool ); |
| 76 |
ve.ui.UndoHistoryTool.static.name = 'undo'; |
| 77 |
ve.ui.UndoHistoryTool.static.group = 'history'; |
| 78 |
ve.ui.UndoHistoryTool.static.icon = 'undo'; |
| 79 |
ve.ui.UndoHistoryTool.static.title = |
| 80 |
OO.ui.deferMsg( 'visualeditor-historybutton-undo-tooltip' ); |
| 81 |
ve.ui.UndoHistoryTool.static.commandName = 'undo'; |
| 82 |
ve.ui.toolFactory.register( ve.ui.UndoHistoryTool ); |
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
ve.ui.RedoHistoryTool = function VeUiRedoHistoryTool() { |
| 94 |
|
| 95 |
ve.ui.RedoHistoryTool.super.apply( this, arguments ); |
| 96 |
}; |
| 97 |
OO.inheritClass( ve.ui.RedoHistoryTool, ve.ui.HistoryTool ); |
| 98 |
ve.ui.RedoHistoryTool.static.name = 'redo'; |
| 99 |
ve.ui.RedoHistoryTool.static.group = 'history'; |
| 100 |
ve.ui.RedoHistoryTool.static.icon = 'redo'; |
| 101 |
ve.ui.RedoHistoryTool.static.title = |
| 102 |
OO.ui.deferMsg( 'visualeditor-historybutton-redo-tooltip' ); |
| 103 |
ve.ui.RedoHistoryTool.static.commandName = 'redo'; |
| 104 |
ve.ui.toolFactory.register( ve.ui.RedoHistoryTool ); |