replace default document in undo.js