{"action":"created","issue":{"url":"https://api.github.com/repos/quilljs/quill/issues/745","repository_url":"https://api.github.com/repos/quilljs/quill","labels_url":"https://api.github.com/repos/quilljs/quill/issues/745/labels{/name}","comments_url":"https://api.github.com/repos/quilljs/quill/issues/745/comments","events_url":"https://api.github.com/repos/quilljs/quill/issues/745/events","html_url":"https://github.com/quilljs/quill/issues/745","id":159349974,"number":745,"title":"Adding unwanted newlines when pasting","user":{"login":"Vonsild","id":1231930,"avatar_url":"https://avatars.githubusercontent.com/u/1231930?v=3","gravatar_id":"","url":"https://api.github.com/users/Vonsild","html_url":"https://github.com/Vonsild","followers_url":"https://api.github.com/users/Vonsild/followers","following_url":"https://api.github.com/users/Vonsild/following{/other_user}","gists_url":"https://api.github.com/users/Vonsild/gists{/gist_id}","starred_url":"https://api.github.com/users/Vonsild/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Vonsild/subscriptions","organizations_url":"https://api.github.com/users/Vonsild/orgs","repos_url":"https://api.github.com/users/Vonsild/repos","events_url":"https://api.github.com/users/Vonsild/events{/privacy}","received_events_url":"https://api.github.com/users/Vonsild/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-06-09T08:08:17Z","updated_at":"2016-07-04T21:10:14Z","closed_at":"2016-06-13T17:23:13Z","body":"Version 1 beta 4 (https://cdn.quilljs.com/1.0.0-beta.4/quill.js)\r\n\r\nWhen pasting HTML containing a header tag (e.g. &lt;h1&gt;) and a paragraph (&lt;p&gt;) an extra, unwanted, newline character is prepended in the delta object for the paragraph, resulting in an empty paragraph being inserted.\r\n\r\n**Steps for Reproduction**\r\nUsing jQuery.\r\nAssuming this DOM\r\n\r\n```html\r\n<div id=\"editor\"></div>\r\n<script type=\"text/javascript\">\r\nvar quill = null;\r\n$(function() {\r\n\tquill = new Quill('#editor', {theme: 'snow'\t});\r\n\tquill.pasteHTML('<h1>headline</h1><p>Content</p>');\r\n\r\n\tconsole.log(JSON.stringify(quill.getContents().ops));\r\n\t// [{\"insert\":\"headline\"},{\"attributes\":{\"header\":1},\"insert\":\"\\n\"},{\"insert\":\"\\nContent\\n\"}]\r\n\r\n\tconsole.log($('#editor .ql-editor').html());\r\n\t// <h1>headline</h1><p><br></p><p>Content</p>\r\n\r\n\tquill.pasteHTML($('#editor .ql-editor').html());\r\n\r\n\tconsole.log(JSON.stringify(quill.getContents().ops));\r\n\t// [{\"insert\":\"headline\"},{\"attributes\":{\"header\":1},\"insert\":\"\\n\"},{\"insert\":\"\\n\\nContent\\n\"}]\r\n\r\n\tconsole.log($('#editor .ql-editor').html());\r\n\t// <h1>headline</h1><p><br></p><p><br></p><p>Content</p>\r\n});\r\n```\r\n\r\n**Expected behavior**:\r\nI'd expect the output of `console.log($('#editor .ql-editor').html());` to match the input from `quill.pasteHTML('<h1>headline</h1><p>Content</p>');`\r\n\r\n**Actual behavior**:\r\nAn extra `<p>&nbps;</p>` tag is inserted. (Speculation:) Possibly because the header attribute is put on the newline character following the actual headline, instead of the headline itself.\r\n\r\n**Platforms**:\r\nLatest Chrome\r\n\r\n**Version**: [version]\r\n"},"comment":{"url":"https://api.github.com/repos/quilljs/quill/issues/comments/230354485","html_url":"https://github.com/quilljs/quill/issues/745#issuecomment-230354485","issue_url":"https://api.github.com/repos/quilljs/quill/issues/745","id":230354485,"user":{"login":"jhchen","id":192974,"avatar_url":"https://avatars.githubusercontent.com/u/192974?v=3","gravatar_id":"","url":"https://api.github.com/users/jhchen","html_url":"https://github.com/jhchen","followers_url":"https://api.github.com/users/jhchen/followers","following_url":"https://api.github.com/users/jhchen/following{/other_user}","gists_url":"https://api.github.com/users/jhchen/gists{/gist_id}","starred_url":"https://api.github.com/users/jhchen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhchen/subscriptions","organizations_url":"https://api.github.com/users/jhchen/orgs","repos_url":"https://api.github.com/users/jhchen/repos","events_url":"https://api.github.com/users/jhchen/events{/privacy}","received_events_url":"https://api.github.com/users/jhchen/received_events","type":"User","site_admin":false},"created_at":"2016-07-04T21:10:14Z","updated_at":"2016-07-04T21:10:14Z","body":"@lordenzo [It is](http://beta.quilljs.com/docs/modules/clipboard/)"}}
{"actor":{"display_login":"jhchen"}}