{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/draft-js/issues/390","repository_url":"https://api.github.com/repos/facebook/draft-js","labels_url":"https://api.github.com/repos/facebook/draft-js/issues/390/labels{/name}","comments_url":"https://api.github.com/repos/facebook/draft-js/issues/390/comments","events_url":"https://api.github.com/repos/facebook/draft-js/issues/390/events","html_url":"https://github.com/facebook/draft-js/issues/390","id":154687043,"number":390,"title":"How to create custom inline components without text","user":{"login":"inyono","id":1508477,"avatar_url":"https://avatars.githubusercontent.com/u/1508477?v=3","gravatar_id":"","url":"https://api.github.com/users/inyono","html_url":"https://github.com/inyono","followers_url":"https://api.github.com/users/inyono/followers","following_url":"https://api.github.com/users/inyono/following{/other_user}","gists_url":"https://api.github.com/users/inyono/gists{/gist_id}","starred_url":"https://api.github.com/users/inyono/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inyono/subscriptions","organizations_url":"https://api.github.com/users/inyono/orgs","repos_url":"https://api.github.com/users/inyono/repos","events_url":"https://api.github.com/users/inyono/events{/privacy}","received_events_url":"https://api.github.com/users/inyono/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":23,"created_at":"2016-05-13T11:02:57Z","updated_at":"2016-11-13T13:01:15Z","closed_at":null,"body":"I'm currently stuck at creating custom inline components. I want to have a component for inline LaTeX equations. I tried to follow [Creating and Retrieving Entities](https://facebook.github.io/draft-js/docs/advanced-topics-entities.html#creating-and-retrieving-entities) but I'm not sure what to pass `Modifier.applyEntity`. Something like this didn't work as intended:\n\n``` .js\naddInlineLatexEquation() {\n  const { editorState } = this.state\n\n  const entityKey = Entity.create(\n    'INLINE_LATEX_EQUATION',\n    'IMMUTABLE',\n     { src: '' }\n  )\n\n  const contentState = editorState.getCurrentContent()\n  const selectionState = editorState.getSelection()\n\n  const newContent = Modifier.applyEntity(\n    contentState,\n    selectionState,\n    entityKey\n  )\n\n  const newEditorState = EditorState.push(editorState, newContent, 'apply-entity')\n\n  this.setState({\n    editorState: newEditorState\n  })\n}\n```\n\nI now can create an inline LaTeX component by selecting text, but I rather want to have a behavior similar to the block components. I.e., I want to add an inline component at the current cursor position without any text (basically `AtomicBlockUtils.insertAtomicBlock` for inline components).\n"},"comment":{"url":"https://api.github.com/repos/facebook/draft-js/issues/comments/260184865","html_url":"https://github.com/facebook/draft-js/issues/390#issuecomment-260184865","issue_url":"https://api.github.com/repos/facebook/draft-js/issues/390","id":260184865,"user":{"login":"bryanph","id":3816712,"avatar_url":"https://avatars.githubusercontent.com/u/3816712?v=3","gravatar_id":"","url":"https://api.github.com/users/bryanph","html_url":"https://github.com/bryanph","followers_url":"https://api.github.com/users/bryanph/followers","following_url":"https://api.github.com/users/bryanph/following{/other_user}","gists_url":"https://api.github.com/users/bryanph/gists{/gist_id}","starred_url":"https://api.github.com/users/bryanph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bryanph/subscriptions","organizations_url":"https://api.github.com/users/bryanph/orgs","repos_url":"https://api.github.com/users/bryanph/repos","events_url":"https://api.github.com/users/bryanph/events{/privacy}","received_events_url":"https://api.github.com/users/bryanph/received_events","type":"User","site_admin":false},"created_at":"2016-11-13T13:01:15Z","updated_at":"2016-11-13T13:01:15Z","body":"@afraser, I'm now trying to get this to work for pastes between editor (so not internal). No idea how to approach this since the required data is stored in the entity store itself. Do you have any ideas maybe?"}}
{"actor":{"display_login":"bryanph"}}