Mercurial Hosting > sceditor
comparison src/plugins/undo.js @ 29:ea32a44b5a6e
remove more oo
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 11 Aug 2022 19:54:03 -0600 |
parents | b7725dab7482 |
children |
comparison
equal
deleted
inserted
replaced
28:f227fdfebded | 29:ea32a44b5a6e |
---|---|
1 (function (sceditor) { | 1 (function (sceditor) { |
2 'use strict'; | 2 'use strict'; |
3 | 3 |
4 sceditor.plugins.undo = function () { | 4 sceditor.plugins.undo = function () { |
5 var base = this; | 5 var base = {}; |
6 var sourceEditor; | 6 var sourceEditor; |
7 var editor; | 7 var editor; |
8 var body; | 8 var body; |
9 var lastInputType = ''; | 9 var lastInputType = ''; |
10 var charChangedCount = 0; | 10 var charChangedCount = 0; |
108 lastState.value = sourceMode ? | 108 lastState.value = sourceMode ? |
109 editor.getSourceEditorValue(false) : | 109 editor.getSourceEditorValue(false) : |
110 editor.getBody().innerHTML; | 110 editor.getBody().innerHTML; |
111 } | 111 } |
112 | 112 |
113 base.init = function () { | 113 base.init = function (ed) { |
114 // The this variable will be set to the instance of the editor | 114 editor = ed; |
115 // calling it, hence why the plugins "this" is saved to the base | |
116 // variable. | |
117 editor = this; | |
118 | 115 |
119 undoLimit = editor.undoLimit || undoLimit; | 116 undoLimit = editor.undoLimit || undoLimit; |
120 | 117 |
121 editor.addShortcut('ctrl+z', base.undo); | 118 editor.addShortcut('ctrl+z', base.undo); |
122 editor.addShortcut('ctrl+shift+z', base.redo); | 119 editor.addShortcut('ctrl+shift+z', base.redo); |
356 for (var i = positions.length - 1; node && i > 0; i--) { | 353 for (var i = positions.length - 1; node && i > 0; i--) { |
357 node = node.childNodes[positions[i]]; | 354 node = node.childNodes[positions[i]]; |
358 } | 355 } |
359 return node; | 356 return node; |
360 } | 357 } |
358 | |
359 return base; | |
361 }; | 360 }; |
362 }(sceditor)); | 361 }(sceditor)); |