{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/draft-js/issues/594","repository_url":"https://api.github.com/repos/facebook/draft-js","labels_url":"https://api.github.com/repos/facebook/draft-js/issues/594/labels{/name}","comments_url":"https://api.github.com/repos/facebook/draft-js/issues/594/comments","events_url":"https://api.github.com/repos/facebook/draft-js/issues/594/events","html_url":"https://github.com/facebook/draft-js/issues/594","id":170793146,"number":594,"title":"There is no way to disable undo","user":{"login":"stevensacks","id":162252,"avatar_url":"https://avatars.githubusercontent.com/u/162252?v=3","gravatar_id":"","url":"https://api.github.com/users/stevensacks","html_url":"https://github.com/stevensacks","followers_url":"https://api.github.com/users/stevensacks/followers","following_url":"https://api.github.com/users/stevensacks/following{/other_user}","gists_url":"https://api.github.com/users/stevensacks/gists{/gist_id}","starred_url":"https://api.github.com/users/stevensacks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevensacks/subscriptions","organizations_url":"https://api.github.com/users/stevensacks/orgs","repos_url":"https://api.github.com/users/stevensacks/repos","events_url":"https://api.github.com/users/stevensacks/events{/privacy}","received_events_url":"https://api.github.com/users/stevensacks/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-08-12T03:36:56Z","updated_at":"2016-08-30T13:56:10Z","closed_at":null,"body":"**Do you want to request a *feature* or report a *bug*?**\r\nDocumentation error and missing function.\r\n\r\n**What is the current behavior?**\r\nThe documentation says you should not modify the allowUndo property directly, but instead use the provided static and instance functions. There is not an instance function which allows you to set allowUndo.\r\n\r\n**If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar.**\r\nThe source code says that the _immutable property of the editor state is private and should not be modified, but since there is no other way to do this, thankfully the editor state is just an instance property and can be modified and set.\r\n\r\n`editorState._immutable = editorState._immutable.set('allowUndo', false);`\r\n\r\nThis is currently the only way to set allowUndo and it's no bueno. Overwriting a private instance property from outside like this is an anti-pattern.\r\n\r\n**What is the expected behavior?**\r\nThere should be an instance function to change allowUndo.\r\n\r\n**Which versions of Draft.js, and which browser / OS are affected by this issue? Did this work in previous versions of Draft.js?**\r\nAll of them."},"comment":{"url":"https://api.github.com/repos/facebook/draft-js/issues/comments/243446560","html_url":"https://github.com/facebook/draft-js/issues/594#issuecomment-243446560","issue_url":"https://api.github.com/repos/facebook/draft-js/issues/594","id":243446560,"user":{"login":"Pelsin","id":5345892,"avatar_url":"https://avatars.githubusercontent.com/u/5345892?v=3","gravatar_id":"","url":"https://api.github.com/users/Pelsin","html_url":"https://github.com/Pelsin","followers_url":"https://api.github.com/users/Pelsin/followers","following_url":"https://api.github.com/users/Pelsin/following{/other_user}","gists_url":"https://api.github.com/users/Pelsin/gists{/gist_id}","starred_url":"https://api.github.com/users/Pelsin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pelsin/subscriptions","organizations_url":"https://api.github.com/users/Pelsin/orgs","repos_url":"https://api.github.com/users/Pelsin/repos","events_url":"https://api.github.com/users/Pelsin/events{/privacy}","received_events_url":"https://api.github.com/users/Pelsin/received_events","type":"User","site_admin":false},"created_at":"2016-08-30T13:56:10Z","updated_at":"2016-08-30T13:56:10Z","body":"You seem to mutate the already created \"editorState\". Instead, return a new \"editorState\" using the \"EditorState\" static setter with the new config. As the immutable pattern is intended ;P\r\n\r\nLike this\r\n```\r\nconst editorState = EditorState.set(oldEditorState, { allowUndo: false });\r\n```"}}
{"actor":{"display_login":"Pelsin"}}