{"action":"opened","issue":{"url":"https://api.github.com/repos/summernote/summernote/issues/1492","labels_url":"https://api.github.com/repos/summernote/summernote/issues/1492/labels{/name}","comments_url":"https://api.github.com/repos/summernote/summernote/issues/1492/comments","events_url":"https://api.github.com/repos/summernote/summernote/issues/1492/events","html_url":"https://github.com/summernote/summernote/issues/1492","id":121523609,"number":1492,"title":"Reset editor, feature","user":{"login":"kikosoft","id":4856162,"avatar_url":"https://avatars.githubusercontent.com/u/4856162?v=3","gravatar_id":"","url":"https://api.github.com/users/kikosoft","html_url":"https://github.com/kikosoft","followers_url":"https://api.github.com/users/kikosoft/followers","following_url":"https://api.github.com/users/kikosoft/following{/other_user}","gists_url":"https://api.github.com/users/kikosoft/gists{/gist_id}","starred_url":"https://api.github.com/users/kikosoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kikosoft/subscriptions","organizations_url":"https://api.github.com/users/kikosoft/orgs","repos_url":"https://api.github.com/users/kikosoft/repos","events_url":"https://api.github.com/users/kikosoft/events{/privacy}","received_events_url":"https://api.github.com/users/kikosoft/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-10T16:21:29Z","updated_at":"2015-12-10T16:21:29Z","closed_at":null,"body":"I'm using Summernote in a bootstrap modal. When you click on something on my html page, the modal opens, and the content of what you clicked is copied to the summernote tag. You can then edit it. when you close the modal, you can save your changes or forget them. The important thing here is that I am re-using the same summernote tag.\r\n\r\nInstead of that I could, of course, first copy the wanted content to the tag, initialize Summernote on the tag, and destroy it when the modal closes, but that's not what I have done. I have initialized Summernote once, and use `tag.summernote(\"code\",mycode);` to copy the content to Summernote. \r\n\r\nThis works great, unless an user switches to codeview. Once Summernote is in codeview I cannot overwrite the code with `tag.summernote(\"code\",mycode);`. *This could qualify as a bug, in my opinion.* However I also don't want Summernote to appear in codeview the next time the modal opens. So I did some digging in the source code and found a way to change it back to the wysiwyg view:\r\n\r\n    if (tag.summernote(\"codeview.isActivated\")) tag.summernote(\"codeview.deactivate\");\r\n\r\nAnd then I can overwrite the code again. This also solves my problem of not being able to overwrite the code. \r\n\r\nHowever, it would be nice if there was something as simple as:\r\n\r\n    tag.summernote(\"reset\");\r\n\r\nwhich would return the editor to the initial settings. So, to the original tag content, and the wysiwyg view. This would make re-using the same summernote tag simpler.\r\n\r\nI have not checked the whole source code to see if such a function exists, please forgive me if I missed it. It could also be that Summernote tags should, by definition, not be reused?"}}