{"action":"created","issue":{"url":"https://api.github.com/repos/froala/wysiwyg-editor/issues/620","labels_url":"https://api.github.com/repos/froala/wysiwyg-editor/issues/620/labels{/name}","comments_url":"https://api.github.com/repos/froala/wysiwyg-editor/issues/620/comments","events_url":"https://api.github.com/repos/froala/wysiwyg-editor/issues/620/events","html_url":"https://github.com/froala/wysiwyg-editor/issues/620","id":96566959,"number":620,"title":"Element (div, a, other tags) duplicates when hitting return / enter within text that is not in a paragraph.","user":{"login":"Smashr","id":2221150,"avatar_url":"https://avatars.githubusercontent.com/u/2221150?v=3","gravatar_id":"","url":"https://api.github.com/users/Smashr","html_url":"https://github.com/Smashr","followers_url":"https://api.github.com/users/Smashr/followers","following_url":"https://api.github.com/users/Smashr/following{/other_user}","gists_url":"https://api.github.com/users/Smashr/gists{/gist_id}","starred_url":"https://api.github.com/users/Smashr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Smashr/subscriptions","organizations_url":"https://api.github.com/users/Smashr/orgs","repos_url":"https://api.github.com/users/Smashr/repos","events_url":"https://api.github.com/users/Smashr/events{/privacy}","received_events_url":"https://api.github.com/users/Smashr/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-07-22T13:23:36Z","updated_at":"2015-07-22T14:05:54Z","closed_at":"2015-07-22T13:27:56Z","body":"When the cursor is placed in a block of text and return/enter is pressed to divide the block into two blocks/paragraphs the containing element (div, a, p, etc) duplicates with all its classes and other attributes.\r\n\r\nAlthough this is expected behaviour when the text is wrapped in `<p>` tags. If I were to move my cursor anywhere in the text and hit return, it should altomatically create two `<p>` tags.\r\n\r\nSo this line:\r\n\r\n    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum consequat, orci ac laoreet cursus, dolor sem luctus lorem, eget consequat magna felis a magna.</p>\r\n\r\nchanges to :\r\n\r\n    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>\r\n    <p>Vestibulum consequat, orci ac laoreet cursus, dolor sem luctus lorem, eget consequat magna felis a magna.</p>\r\n\r\n\r\nbut if there is any other element like an anchor tag or a div, this duplication should not occur.\r\n\r\nCurretly this line:\r\n\r\n    <div class=\"some classes here etc\" contenteditable=\"true\" otherattributes=\"etc\">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum consequat, orci ac laoreet cursus, dolor sem luctus lorem, eget consequat magna felis a magna.</div>\r\n\r\nchanges to :\r\n\r\n    <div class=\"some classes here etc\" contenteditable=\"true\" otherattributes=\"etc\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>\r\n    <div class=\"some classes here etc\" contenteditable=\"true\" otherattributes=\"etc\">Vestibulum consequat, orci ac laoreet cursus, dolor sem luctus lorem, eget consequat magna felis a magna.</div>\r\n\r\nbut should change to :\r\n\r\n    <div class=\"some classes here etc\" contenteditable=\"true\" otherattributes=\"etc\">\r\n    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>\r\n    <p>Vestibulum consequat, orci ac laoreet cursus, dolor sem luctus lorem, eget consequat magna felis a magna.</p>\r\n    </div>\r\n\r\n\r\n\r\nSimilarly a link(anchor) tag:\r\n\r\n    <a class=\"button\" href=\"http://\">Learn More</a>\r\n\r\nChanges to:\r\n\r\n    <a class=\"button\" href=\"http://\">Learn</a>\r\n     <a class=\"button\" href=\"http://\">More</a>\r\n\r\nresulting in two buttons.\r\n\r\nI'm sure all tags behave in the same way. When only the paragraph tag should behave in this way. For all other tags, a paragraph tag should be wrapped around the text, and at the point where return/enter was pressed."},"comment":{"url":"https://api.github.com/repos/froala/wysiwyg-editor/issues/comments/123733844","html_url":"https://github.com/froala/wysiwyg-editor/issues/620#issuecomment-123733844","issue_url":"https://api.github.com/repos/froala/wysiwyg-editor/issues/620","id":123733844,"user":{"login":"Smashr","id":2221150,"avatar_url":"https://avatars.githubusercontent.com/u/2221150?v=3","gravatar_id":"","url":"https://api.github.com/users/Smashr","html_url":"https://github.com/Smashr","followers_url":"https://api.github.com/users/Smashr/followers","following_url":"https://api.github.com/users/Smashr/following{/other_user}","gists_url":"https://api.github.com/users/Smashr/gists{/gist_id}","starred_url":"https://api.github.com/users/Smashr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Smashr/subscriptions","organizations_url":"https://api.github.com/users/Smashr/orgs","repos_url":"https://api.github.com/users/Smashr/repos","events_url":"https://api.github.com/users/Smashr/events{/privacy}","received_events_url":"https://api.github.com/users/Smashr/received_events","type":"User","site_admin":false},"created_at":"2015-07-22T14:05:54Z","updated_at":"2015-07-22T14:05:54Z","body":"I personally think that this is great for list items and paragraphs. But for any other items, particularly divs and buttons (a tags) that are styled it does not work very well. Duplicates the buttons into two, duplicates content boxes etc.\r\n\r\nA user's intention is to split the text block only (add a paragraph / split the block into paragraphs) by hitting return. For now I'll just wrap 'p' tags around any text nodes not directly within 'p' tags before the editor is initialised on the content."}}