Skip to content
Browse files

Make sure the Scratchpad 'redo/undo' stack is cleared when opening a …

…user script.
  • Loading branch information...
1 parent 5cd1d93 commit f1b9adf863c8a63320a8dc68807367bb49990130 @supahgreg supahgreg committed Sep 3, 2011
Showing with 14 additions and 1 deletion.
  1. +14 −1 extension/modules/utils/Scriptish_openInEditor.js
View
15 extension/modules/utils/Scriptish_openInEditor.js
@@ -22,7 +22,20 @@ function Scriptish_openInEditor(script, parentWindow) {
spWin.addEventListener("load", function spWinLoaded() {
spWin.removeEventListener("load", spWinLoaded, false);
spWin.document.title = spWin.Scratchpad.filename = file.path;
- spWin.Scratchpad.importFromFile(file);
+ spWin.Scratchpad.importFromFile(file, false, function() {
+ let spEditor = spWin.Scratchpad.editor;
+ if (spEditor._undoStack && spEditor._undoStack.reset) {
+ // Reset "undo/redo" for the Orion editor
+ spEditor._undoStack.reset();
+ } else if (spEditor._editor
+ && spEditor._editor.resetModificationCount
+ && spEditor._editor.transactionManager
+ && spEditor._editor.transactionManager.clear) {
+ // Reset "undo/redo" for the textarea editor
+ spEditor._editor.resetModificationCount();
+ spEditor._editor.transactionManager.clear();
+ }
+ });
}, false);
}
else {

0 comments on commit f1b9adf

Please sign in to comment.
Something went wrong with that request. Please try again.