Update library.js

1. Only update the history data if callback function is not set.
2. Added `myEditor.updateHistory()` method to update the history data manually. Useful for handling history on every `keypress` event.