{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/draft-js/issues/463","repository_url":"https://api.github.com/repos/facebook/draft-js","labels_url":"https://api.github.com/repos/facebook/draft-js/issues/463/labels{/name}","comments_url":"https://api.github.com/repos/facebook/draft-js/issues/463/comments","events_url":"https://api.github.com/repos/facebook/draft-js/issues/463/events","html_url":"https://github.com/facebook/draft-js/issues/463","id":159855593,"number":463,"title":"Bug in example","user":{"login":"oeddyo","id":1943146,"avatar_url":"https://avatars.githubusercontent.com/u/1943146?v=3","gravatar_id":"","url":"https://api.github.com/users/oeddyo","html_url":"https://github.com/oeddyo","followers_url":"https://api.github.com/users/oeddyo/followers","following_url":"https://api.github.com/users/oeddyo/following{/other_user}","gists_url":"https://api.github.com/users/oeddyo/gists{/gist_id}","starred_url":"https://api.github.com/users/oeddyo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oeddyo/subscriptions","organizations_url":"https://api.github.com/users/oeddyo/orgs","repos_url":"https://api.github.com/users/oeddyo/repos","events_url":"https://api.github.com/users/oeddyo/events{/privacy}","received_events_url":"https://api.github.com/users/oeddyo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-06-13T00:07:05Z","updated_at":"2016-06-13T03:09:09Z","closed_at":null,"body":"Hi, \r\n\r\nI just found a bug in one example:\r\n\r\nhttps://github.com/facebook/draft-js/blob/master/examples/media/media.html\r\n\r\nIf you click the button \"add image\" and don't type anything, this.state.editorState will be set to null because the lines: \r\n\r\n _addMedia(type) {\r\n          const src = window.prompt('Enter a URL');\r\n          if (!src) {\r\n            return;\r\n          }\r\n\r\n          const entityKey = Entity.create(type, 'IMMUTABLE', {src});\r\n\r\n          return AtomicBlockUtils.insertAtomicBlock(\r\n            this.state.editorState,\r\n            entityKey,\r\n            ' '\r\n          );\r\n        }\r\n\r\nwill return null if src is not set (specifically if(!src) line). Then afterwards you can't upload any images since the whole thing is broken, because this.state.editorState is set to null already. \r\n\r\nI 'd change\r\n\r\nto:\r\n      if (!src) {\r\n            return this.state.editorState;\r\n        }\r\n\r\nI can submit a PR if this is not my illusion"},"comment":{"url":"https://api.github.com/repos/facebook/draft-js/issues/comments/225481062","html_url":"https://github.com/facebook/draft-js/issues/463#issuecomment-225481062","issue_url":"https://api.github.com/repos/facebook/draft-js/issues/463","id":225481062,"user":{"login":"hellendag","id":2823852,"avatar_url":"https://avatars.githubusercontent.com/u/2823852?v=3","gravatar_id":"","url":"https://api.github.com/users/hellendag","html_url":"https://github.com/hellendag","followers_url":"https://api.github.com/users/hellendag/followers","following_url":"https://api.github.com/users/hellendag/following{/other_user}","gists_url":"https://api.github.com/users/hellendag/gists{/gist_id}","starred_url":"https://api.github.com/users/hellendag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hellendag/subscriptions","organizations_url":"https://api.github.com/users/hellendag/orgs","repos_url":"https://api.github.com/users/hellendag/repos","events_url":"https://api.github.com/users/hellendag/events{/privacy}","received_events_url":"https://api.github.com/users/hellendag/received_events","type":"User","site_admin":false},"created_at":"2016-06-13T03:09:09Z","updated_at":"2016-06-13T03:09:09Z","body":"We shouldn't be using `window.prompt` in that example, since it causes problems with selection state.\r\n\r\nIt should be an input instead, like in the link example. Or just buttons."}}
{"actor":{"display_login":"hellendag"}}